Skip to content

Commit

Permalink
Apply changes from review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jtquach1 committed Feb 8, 2024
1 parent 0c7d71c commit 84ff98e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 66 deletions.
69 changes: 5 additions & 64 deletions backend/src/ncpdpScriptBuilder/buildScript.v2017071.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function buildRxStatus(newRxMessageConvertedToJSON) {
export const buildRxFill = newRx => {
const { Message } = JSON.parse(newRx.serializedJSON);
const { Header, Body } = Message;
console.log('Message', Message);
const time = new Date();
const message = {
Message: {
Expand Down Expand Up @@ -91,29 +92,13 @@ export const buildRxFill = newRx => {
Note: PICKED_UP
}
},
Patient: {
HumanPatient: {
Name: {
LastName: Body.NewRx.Patient.HumanPatient.Name.LastName,
FirstName: Body.NewRx.Patient.HumanPatient.Name.FirstName
},
Gender: Body.NewRx.Patient.HumanPatient.Gender,
DateOfBirth: { Date: Body.NewRx.Patient.HumanPatient.DateOfBirth.Date },
Address: {
AddressLine1: Body.NewRx.Patient.HumanPatient.Address.AddressLine1,
City: Body.NewRx.Patient.HumanPatient.Address.City,
StateProvince: Body.NewRx.Patient.HumanPatient.Address.StateProvince,
PostalCode: Body.NewRx.Patient.HumanPatient.Address.PostalCode,
Country: Body.NewRx.Patient.HumanPatient.Address.Country
}
}
},
Patient: Body.NewRx.Patient,
Pharmacy: {
Identification: {
NCPDPID: MOCK_VALUE,
NPI: MOCK_VALUE
},
BusinessName: MOCK_VALUE,
BusinessName: Header.To._,
Address: {
AddressLine1: MOCK_VALUE,
City: MOCK_VALUE,
Expand All @@ -127,52 +112,8 @@ export const buildRxFill = newRx => {
}
}
},
Prescriber: {
NonVeterinarian: {
Identification: Body.NewRx.Prescriber.NonVeterinarian.Identification.NPI
},
Name: {
LastName: Body.NewRx.Prescriber.NonVeterinarian.Name.LastName,
FirstName: Body.NewRx.Prescriber.NonVeterinarian.Name.FirstName
},
Address: {
AddressLine1: Body.NewRx.Prescriber.NonVeterinarian.Address.AddressLine1,
City: Body.NewRx.Prescriber.NonVeterinarian.Address.City,
StateProvince: Body.NewRx.Prescriber.NonVeterinarian.Address.StateProvince,
PostalCode: Body.NewRx.Prescriber.NonVeterinarian.Address.PostalCode,
Country: Body.NewRx.Prescriber.NonVeterinarian.Address.Country
},
CommunicationNumbers: {
PrimaryTelephone: {
Number:
Body.NewRx.Prescriber.NonVeterinarian.CommunicationNumbers.PrimaryTelephone
.Number
},
ElectronicMail:
Body.NewRx.Prescriber.NonVeterinarian.CommunicationNumbers.ElectronicMail
}
},
MedicationPrescribed: {
DrugDescription: Body.NewRx.MedicationPrescribed.DrugDescription,
DrugCoded: {
ProductCode: {
Code: Body.NewRx.MedicationPrescribed.DrugCoded.ProductCode.Code,
Qualifier: Body.NewRx.MedicationPrescribed.DrugCoded.ProductCode.Qualifier
}
},
Quantity: {
Value: Body.NewRx.MedicationPrescribed.Quantity.Value,
CodeListQuantifier: Body.NewRx.MedicationPrescribed.Quantity.CodeListQuantifier,
QuantityUnitOfMeasure: {
Code: Body.NewRx.MedicationPrescribed.Quantity.QuantityUnitOfMeasure.Code
},
WrittenDate: { Date: Body.NewRx.MedicationPrescribed.WrittenDate.Date },
Substitutions: Body.NewRx.MedicationPrescribed.Substitutions,
NumberOfRefills: Body.NewRx.MedicationPrescribed.NumberOfRefills,
Sig: { SigText: Body.NewRx.MedicationPrescribed.Sig.SigText },
PrescriberCheckedREMS: Body.NewRx.MedicationPrescribed.PrescriberCheckedREMS
}
}
Prescriber: Body.NewRx.Prescriber,
MedicationPrescribed: Body.NewRx.MedicationPrescribed
}
}
]
Expand Down
3 changes: 1 addition & 2 deletions backend/src/routes/doctorOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,13 @@ router.patch('/api/updateRx/:id/pickedUp', async (req, res) => {
prescriberOrderNumber: prescriberOrderNumber
});
const rxFill = buildRxFill(newRx);
console.log('RxFill', rxFill);
const status = await axios.post(env.EHR_RXFILL_URL, rxFill, {
headers: {
Accept: 'application/xml', // Expect that the Status that the EHR returns back is in XML
'Content-Type': 'application/xml' // Tell the EHR that the RxFill is in XML
}
});
console.log('Sent RxFill to EHR and received status from EHR', status);
console.log('Sent RxFill to EHR and received status from EHR', status.data);
} catch (error) {
console.log('Could not send RxFill to EHR', error);
return error;
Expand Down

0 comments on commit 84ff98e

Please sign in to comment.