+
Available Medications
+ {resources.length > 0 ? (
+ resources.map(resource => (
+
+ ))
+ ) : (
+
{message}
+ )}
+
+ );
+};
+
+const MedicationElement = props => {
+ const { initialMedicationDispense, client } = props;
+ const [lastCheckedMedicationTime, setMedicationTime] = useState(null);
+ const [medicationDispense, setMedicationDispense] = useState(initialMedicationDispense);
+ const ehrUrl = client.state.serverUrl;
+ const patientId = client.patient.id;
+ const medicationRequest = medicationDispense?.authorizingPrescription?.[0];
+
+ const getMedicationStatus = () => {
+ setMedicationTime(Date.now());
+
+ if (client?.patient && patientId) {
+ client.request(`MedicationDispense/${medicationDispense.id}`, {
+ pageLimit: 0,
+ onPage: bundle => {
+ setMedicationDispense(bundle.entry[0].resource);
+ },
+ resolveReferences: 'authorizingPrescription'
+ });
+ }
+ };
+
+ return (
+