Skip to content

Commit

Permalink
Use SubmitToREMS function instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jtquach1 committed Oct 11, 2023
1 parent 6ac0d45 commit 51016c3
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions src/views/Patient/MedReqDropDown/MedReqDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,27 +172,6 @@ function MedReqDropDown(props: MedReqDropDownProps) {
const [medicationName, setMedicationName] = useState<string>('');
const [tabIndex, setTabIndex] = useState<number>(1);

const sendOrderSelect = () => {
if (patient && patient.id && user && selectedMedicationCardBundle) {
const resourceId = `${selectedMedicationCardBundle.resource?.resourceType}/${selectedMedicationCardBundle.resource?.id}`;
const hook = new OrderSelect(
patient.id,
user,
{
resourceType: 'Bundle',
type: 'batch',
entry: [selectedMedicationCardBundle]
},
[resourceId]
);
const tempHook = hook.generate();

hydrate(getFhirResource, example.prefetch, tempHook).then(() => {
setCDSHook(tempHook);
});
}
};

useEffect(() => {
if (selectedOption != '') {
setSelectedMedicationCard(
Expand All @@ -212,7 +191,26 @@ function MedReqDropDown(props: MedReqDropDownProps) {
}
}, [selectedMedicationCard]);

useEffect(sendOrderSelect, [selectedMedicationCardBundle]);
useEffect(() => {
if (patient && patient.id && user && selectedMedicationCardBundle) {
const resourceId = `${selectedMedicationCardBundle.resource?.resourceType}/${selectedMedicationCardBundle.resource?.id}`;
const hook = new OrderSelect(
patient.id,
user,
{
resourceType: 'Bundle',
type: 'batch',
entry: [selectedMedicationCardBundle]
},
[resourceId]
);
const tempHook = hook.generate();

hydrate(getFhirResource, example.prefetch, tempHook).then(() => {
setCDSHook(tempHook);
});
}
}, [selectedMedicationCardBundle]);

useEffect(() => {
if (
Expand Down Expand Up @@ -322,7 +320,7 @@ function MedReqDropDown(props: MedReqDropDownProps) {
</Grid>
)}
<Grid item>
<Button variant="contained" onClick={sendOrderSelect}>
<Button variant="contained" onClick={SubmitToREMS}>
Resend order-select hook
</Button>
</Grid>
Expand Down

0 comments on commit 51016c3

Please sign in to comment.