Search in sources :

Example 1 with MedicationOrderDetails

use of uk.gov.hscic.model.medication.MedicationOrderDetails in project gpconnect-demonstrator by nhsconnect.

the class MedicationOrderEntityToMedicationOrderDetailsTransformer method transform.

@Override
public MedicationOrderDetails transform(MedicationOrderEntity item) {
    MedicationOrderDetails medicationOrderDetails = new MedicationOrderDetails();
    medicationOrderDetails.setId(item.getId());
    medicationOrderDetails.setDateWritten(item.getDateWritten());
    medicationOrderDetails.setOrderStatus(item.getOrderStatus());
    medicationOrderDetails.setPatientId(item.getPatientId());
    medicationOrderDetails.setAutherId(item.getAutherId());
    medicationOrderDetails.setMedicationId(item.getMedicationId());
    medicationOrderDetails.setDosageText(item.getDosageText());
    medicationOrderDetails.setDispenseQuantityText(item.getDispenseQuantityText());
    medicationOrderDetails.setDispenseReviewDate(item.getDispenseReviewDate());
    medicationOrderDetails.setDispenseMedicationId(item.getDispenseMedicationId());
    medicationOrderDetails.setDispenseRepeatsAllowed(item.getDispenseRepeatsAllowed());
    medicationOrderDetails.setLastUpdated(item.getLastUpdated());
    return medicationOrderDetails;
}
Also used : MedicationOrderDetails(uk.gov.hscic.model.medication.MedicationOrderDetails)

Example 2 with MedicationOrderDetails

use of uk.gov.hscic.model.medication.MedicationOrderDetails in project gpconnect-demonstrator by nhsconnect.

the class MedicationOrderResourceProvider method getMedicationOrdersForPatientId.

@Search
public List<MedicationRequest> getMedicationOrdersForPatientId(@RequiredParam(name = "patient") String patientId) {
    ArrayList<MedicationRequest> medicationOrders = new ArrayList<>();
    List<MedicationOrderDetails> medicationOrderDetailsList = medicationOrderSearch.findMedicationOrdersForPatient(Long.parseLong(patientId));
    if (medicationOrderDetailsList != null && !medicationOrderDetailsList.isEmpty()) {
        for (MedicationOrderDetails medicationOrderDetails : medicationOrderDetailsList) {
            medicationOrders.add(medicationOrderDetailsToMedicationOrderResourceConverter(medicationOrderDetails));
        }
    }
    return medicationOrders;
}
Also used : MedicationOrderDetails(uk.gov.hscic.model.medication.MedicationOrderDetails) ArrayList(java.util.ArrayList) Search(ca.uhn.fhir.rest.annotation.Search) MedicationOrderSearch(uk.gov.hscic.medication.orders.MedicationOrderSearch)

Example 3 with MedicationOrderDetails

use of uk.gov.hscic.model.medication.MedicationOrderDetails in project gpconnect-demonstrator by nhsconnect.

the class MedicationOrderResourceProvider method getMedicationOrderById.

@Read()
public MedicationRequest getMedicationOrderById(@IdParam IdType medicationOrderId) {
    MedicationOrderDetails medicationOrderDetails = medicationOrderSearch.findMedicationOrderByID(medicationOrderId.getIdPartAsLong());
    if (medicationOrderDetails == null) {
        OperationOutcome operationalOutcome = new OperationOutcome();
        operationalOutcome.addIssue().setSeverity(IssueSeverity.ERROR).setDiagnostics("No medicationOrder details found for ID: " + medicationOrderId.getIdPart());
        throw new InternalErrorException("No medicationOrder details found for ID: " + medicationOrderId.getIdPart(), operationalOutcome);
    }
    return medicationOrderDetailsToMedicationOrderResourceConverter(medicationOrderDetails);
}
Also used : MedicationOrderDetails(uk.gov.hscic.model.medication.MedicationOrderDetails) InternalErrorException(ca.uhn.fhir.rest.server.exceptions.InternalErrorException) Read(ca.uhn.fhir.rest.annotation.Read)

Aggregations

MedicationOrderDetails (uk.gov.hscic.model.medication.MedicationOrderDetails)3 Read (ca.uhn.fhir.rest.annotation.Read)1 Search (ca.uhn.fhir.rest.annotation.Search)1 InternalErrorException (ca.uhn.fhir.rest.server.exceptions.InternalErrorException)1 ArrayList (java.util.ArrayList)1 MedicationOrderSearch (uk.gov.hscic.medication.orders.MedicationOrderSearch)1