use of io.adminshell.aas.v3.model.Reference in project gpconnect-demonstrator by nhsconnect.
the class MedicationAdministrationResourceProvider method getMedicationAdministrationsForPatientId.
@Search
public List<MedicationAdministration> getMedicationAdministrationsForPatientId(@RequiredParam(name = "patient") String patientId) {
ArrayList<MedicationAdministration> medicationAdministrations = new ArrayList<>();
List<MedicationAdministrationDetail> medicationAdministrationDetailList = medicationAdministrationSearch.findMedicationAdministrationForPatient(Long.parseLong(patientId));
if (medicationAdministrationDetailList != null && !medicationAdministrationDetailList.isEmpty()) {
for (MedicationAdministrationDetail medicationAdministrationDetail : medicationAdministrationDetailList) {
MedicationAdministration medicationAdministration = new MedicationAdministration();
String resourceId = String.valueOf(medicationAdministrationDetail.getId());
String versionId = String.valueOf(medicationAdministrationDetail.getLastUpdated().getTime());
String resourceType = medicationAdministration.getResourceType().toString();
IdType id = new IdType(resourceType, resourceId, versionId);
medicationAdministration.setId(id);
medicationAdministration.getMeta().setVersionId(versionId);
medicationAdministration.getMeta().setLastUpdated(medicationAdministrationDetail.getLastUpdated());
medicationAdministration.addDefinition(new Reference("Patient/" + medicationAdministrationDetail.getPatientId()));
medicationAdministration.addDefinition(new Reference("Practitioner/" + medicationAdministrationDetail.getPractitionerId()));
medicationAdministration.setPrescription(new Reference("MedicationOrder/" + medicationAdministrationDetail.getPrescriptionId()));
medicationAdministration.setEffective(new DateType(medicationAdministrationDetail.getAdministrationDate()));
medicationAdministration.setMedication(new Reference("Medication/" + medicationAdministrationDetail.getMedicationId()));
medicationAdministrations.add(medicationAdministration);
}
}
return medicationAdministrations;
}
use of io.adminshell.aas.v3.model.Reference in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method setStaticPatientData.
private Patient setStaticPatientData(Patient patient) {
patient.setLanguage(("en-GB"));
patient.addExtension(createCodingExtension("CG", "Greek Cypriot", SystemURL.CS_CC_ETHNIC_CATEGORY, SystemURL.SD_CC_EXT_ETHNIC_CATEGORY));
patient.addExtension(createCodingExtension("SomeSnomedCode", "Some Snomed Code", SystemURL.CS_CC_RELIGIOUS_AFFILI, SystemURL.SD_CC_EXT_RELIGIOUS_AFFILI));
patient.addExtension(new Extension(SystemURL.SD_PATIENT_CADAVERIC_DON, new BooleanType(false)));
patient.addExtension(createCodingExtension("H", "UK Resident", SystemURL.CS_CC_RESIDENTIAL_STATUS, SystemURL.SD_CC_EXT_RESIDENTIAL_STATUS));
patient.addExtension(createCodingExtension("3", "To pay hotel fees only", SystemURL.CS_CC_TREATMENT_CAT, SystemURL.SD_CC_EXT_TREATMENT_CAT));
Extension nhsCommExtension = new Extension();
nhsCommExtension.setUrl(SystemURL.SD_CC_EXT_NHS_COMMUNICATION);
nhsCommExtension.addExtension(createCodingExtension("en", "English", SystemURL.CS_CC_HUMAN_LANG, SystemURL.SD_CC_EXT_COMM_LANGUAGE));
nhsCommExtension.addExtension(new Extension(SystemURL.SD_CC_COMM_PREFERRED, new BooleanType(false)));
nhsCommExtension.addExtension(createCodingExtension("RWR", "Received written", SystemURL.CS_CC_LANG_ABILITY_MODE, SystemURL.SD_CC_MODE_OF_COMM));
nhsCommExtension.addExtension(createCodingExtension("E", "Excellent", SystemURL.CS_CC_LANG_ABILITY_PROFI, SystemURL.SD_CC_COMM_PROFICIENCY));
nhsCommExtension.addExtension(new Extension(SystemURL.SD_CC_INTERPRETER_REQUIRED, new BooleanType(false)));
patient.addExtension(nhsCommExtension);
Identifier localIdentifier = new Identifier();
localIdentifier.setUse(IdentifierUse.USUAL);
localIdentifier.setSystem(SystemURL.ID_LOCAL_PATIENT_IDENTIFIER);
localIdentifier.setValue("123456");
CodeableConcept liType = new CodeableConcept();
Coding liTypeCoding = new Coding();
liTypeCoding.setCode("EN");
liTypeCoding.setDisplay("Employer number");
liTypeCoding.setSystem(SystemURL.VS_IDENTIFIER_TYPE);
liType.addCoding(liTypeCoding);
localIdentifier.setType(liType);
localIdentifier.setAssigner(new Reference("Organization/1"));
patient.addIdentifier(localIdentifier);
Calendar calendar = Calendar.getInstance();
calendar.set(2017, 1, 1);
DateTimeDt endDate = new DateTimeDt(calendar.getTime());
calendar.set(2016, 1, 1);
DateTimeDt startDate = new DateTimeDt(calendar.getTime());
Period pastPeriod = new Period().setStart(calendar.getTime()).setEnd(calendar.getTime());
patient.addName().setFamily("AnotherOfficialFamilyName").addGiven("AnotherOfficialGivenName").setUse(NameUse.OFFICIAL).setPeriod(pastPeriod);
patient.addName().setFamily("AdditionalFamily").addGiven("AdditionalGiven").setUse(NameUse.TEMP);
patient.addTelecom(staticElHelper.getValidTelecom());
patient.addAddress(staticElHelper.getValidAddress());
return patient;
}
use of io.adminshell.aas.v3.model.Reference in project gpconnect-demonstrator by nhsconnect.
the class ScheduleResourceProvider method scheduleDetailToScheduleResourceConverter.
private Schedule scheduleDetailToScheduleResourceConverter(ScheduleDetail scheduleDetail) {
Schedule schedule = new Schedule();
String resourceId = String.valueOf(scheduleDetail.getId());
String versionId = String.valueOf(scheduleDetail.getLastUpdated().getTime());
String resourceType = schedule.getResourceType().toString();
IdType id = new IdType(resourceType, resourceId, versionId);
schedule.setId(id);
schedule.getMeta().setVersionId(versionId);
schedule.getMeta().setLastUpdated(scheduleDetail.getLastUpdated());
if (scheduleDetail.getPractitionerId() != null) {
schedule.addActor(new Reference("Practitioner/" + scheduleDetail.getPractitionerId()));
}
if (scheduleDetail.getPractitionerRoleCode() != null) {
Coding roleCoding = new Coding(SystemURL.VS_GPC_PRACTITIONER_ROLE, scheduleDetail.getPractitionerRoleCode(), scheduleDetail.getPractitionerRoleDisplay());
Extension practitionerRoleExtension = new Extension(SystemURL.SD_EXTENSION_GPC_PRACTITIONER_ROLE, new CodeableConcept().addCoding(roleCoding));
schedule.addExtension(practitionerRoleExtension);
}
// # 194
// Identifier identifier = new Identifier();
// identifier.setSystem(SystemURL.ID_GPC_SCHEDULE_IDENTIFIER);
// identifier.setValue(scheduleDetail.getIdentifier());
// schedule.addIdentifier(identifier);
Coding coding = new Coding().setSystem(SystemURL.HL7_VS_C80_PRACTICE_CODES).setCode(scheduleDetail.getTypeCode()).setDisplay(scheduleDetail.getTypeDescription());
CodeableConcept codableConcept = new CodeableConcept().addCoding(coding);
codableConcept.setText(scheduleDetail.getTypeDescription());
schedule.addActor(new Reference("Location/" + scheduleDetail.getLocationId()));
Period period = new Period();
period.setStart(scheduleDetail.getStartDateTime());
period.setEnd(scheduleDetail.getEndDateTime());
schedule.setPlanningHorizon(period);
// 1.2.7 remove comment
// schedule.setComment(scheduleDetail.getComment());
// 1.2.7 add schedule type description as service category
schedule.setServiceCategory(new CodeableConcept().setText(scheduleDetail.getTypeDescription()));
return schedule;
}
use of io.adminshell.aas.v3.model.Reference in project gpconnect-demonstrator by nhsconnect.
the class SlotResourceProvider method slotDetailToSlotResourceConverter.
private Slot slotDetailToSlotResourceConverter(SlotDetail slotDetail) {
Slot slot = new Slot();
Date lastUpdated = slotDetail.getLastUpdated() == null ? new Date() : slotDetail.getLastUpdated();
String resourceId = String.valueOf(slotDetail.getId());
String versionId = String.valueOf(lastUpdated.getTime());
IdType id = new IdType(resourceId);
slot.setId(id);
slot.getMeta().setVersionId(versionId);
slot.getMeta().addProfile(SystemURL.SD_GPC_SLOT);
slot.setSchedule(new Reference("Schedule/" + slotDetail.getScheduleReference()));
slot.setStart(slotDetail.getStartDateTime());
slot.setEnd(slotDetail.getEndDateTime());
// #218 Date time formats
slot.getStartElement().setPrecision(TemporalPrecisionEnum.SECOND);
slot.getEndElement().setPrecision(TemporalPrecisionEnum.SECOND);
switch(slotDetail.getFreeBusyType().toLowerCase(Locale.UK)) {
case "free":
slot.setStatus(SlotStatus.FREE);
break;
default:
slot.setStatus(SlotStatus.BUSY);
break;
}
String deliveryChannelCode = slotDetail.getDeliveryChannelCode();
ArrayList<Extension> al = new ArrayList<>();
if (deliveryChannelCode != null && !deliveryChannelCode.trim().isEmpty()) {
Extension deliveryChannelExtension = new Extension(SystemURL.SD_EXTENSION_GPC_DELIVERY_CHANNEL, new CodeType(deliveryChannelCode));
al.add(deliveryChannelExtension);
}
slot.setExtension(al);
// 1.2.7 add slot type description as service type
slot.addServiceType(new CodeableConcept().setText(slotDetail.getTypeDisply()));
return slot;
}
use of io.adminshell.aas.v3.model.Reference in project bunsen by cerner.
the class TestData method newCondition.
/**
* Returns a FHIR Condition for testing purposes.
*/
public static Condition newCondition() {
Condition condition = new Condition();
// Condition based on example from FHIR:
// https://www.hl7.org/fhir/condition-example.json.html
condition.setId("Condition/example");
condition.setLanguage("en_US");
// Narrative text
Narrative narrative = new Narrative();
narrative.setStatusAsString("generated");
narrative.setDivAsString("This data was generated for test purposes.");
XhtmlNode node = new XhtmlNode();
node.setNodeType(NodeType.Text);
node.setValue("Severe burn of left ear (Date: 24-May 2012)");
condition.setText(narrative);
condition.setSubject(new Reference("Patient/example").setDisplay("Here is a display for you."));
condition.setVerificationStatus(Condition.ConditionVerificationStatus.CONFIRMED);
// Condition code
CodeableConcept code = new CodeableConcept();
code.addCoding().setSystem("http://snomed.info/sct").setCode("39065001").setDisplay("Severe");
condition.setSeverity(code);
// Severity code
CodeableConcept severity = new CodeableConcept();
severity.addCoding().setSystem("http://snomed.info/sct").setCode("24484000").setDisplay("Burn of ear").setUserSelected(true);
condition.setSeverity(severity);
// Onset date time
DateTimeType onset = new DateTimeType();
onset.setValueAsString("2012-05-24");
condition.setOnset(onset);
return condition;
}
Aggregations