use of org.hl7.fhir.r4.model.Type in project gpconnect-demonstrator by nhsconnect.
the class SlotResourceProvider method getSlotsForScheduleIdNoOrganizationTypeOrODS.
/**
* returns any slots not having org type or org id assigned
*
* @param scheduleId
* @param startDateTime
* @param endDateTime
* @return
*/
public List<Slot> getSlotsForScheduleIdNoOrganizationTypeOrODS(String scheduleId, Date startDateTime, Date endDateTime) {
ArrayList<Slot> slots = new ArrayList<>();
List<SlotDetail> slotDetails = slotSearch.findSlotsForScheduleIdNoOrganizationTypeOrODS(Long.valueOf(scheduleId), startDateTime, endDateTime);
if (slotDetails != null && !slotDetails.isEmpty()) {
for (SlotDetail slotDetail : slotDetails) {
slots.add(slotDetailToSlotResourceConverter(slotDetail));
}
}
return slots;
}
use of org.hl7.fhir.r4.model.Type 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 org.hl7.fhir.r4.model.Type in project gpconnect-demonstrator by nhsconnect.
the class AppointmentValidation method validateParticipantType.
/**
* This method is effectively disabled since we dont check against value sets
* This was experimental code that never worked correctly.
* @param participantType
* @return
*/
public Boolean validateParticipantType(CodeableConcept participantType) {
Boolean hasCode = !participantType.isEmpty();
Coding code = participantType.getCodingFirstRep();
Boolean isValid = !hasCode;
if (hasCode) {
// isValid = valueSetValidator.validateCode(code);
isValid = true;
if (!isValid) {
throwUnprocessableEntity422_InvalidResourceException(MessageFormat.format("Invalid Participant Type Code. Code: {0} [Display: {1}, System:{2}]", code.getCode(), code.getDisplay(), code.getSystem()));
}
}
return isValid;
}
use of org.hl7.fhir.r4.model.Type in project uPMT by coco35700.
the class Main method createBasicSchema.
/**
* Creates a basic scheme as a default
* should be improved if desired
*/
private void createBasicSchema() {
Type s = new Schema((_langBundle.getString("default_scheme")));
Type general = new Folder(_langBundle.getString("general"));
Type autre = new Folder(_langBundle.getString("other"));
Type visuel = new Category(_langBundle.getString("visual"));
Type image = new Property(_langBundle.getString("picture"));
Type sensoriel = new Category(_langBundle.getString("sensory"));
Type emotionnel = new Category(_langBundle.getString("emotional"));
Type sonore = new Category(_langBundle.getString("acoustic"));
visuel.addType(image);
general.addType(visuel);
general.addType(sensoriel);
general.addType(emotionnel);
general.addType(sonore);
s.addType(general);
s.addType(autre);
this.BasicSchema = (Schema) s;
}
use of org.hl7.fhir.r4.model.Type in project uPMT by coco35700.
the class Main method writeMoment.
/**
* Recursive method used to recursively transform a Moment and its sub Moments into CSV compatible DATAZ
*/
private void writeMoment(DescriptionInterview ent, MomentExperience m, PrintWriter writer, String hierarchy) {
LinkedList<String> classes = new LinkedList<String>();
for (Type t : m.getTypes()) {
for (Type prop : t.getTypes()) {
Property p = (Property) prop;
classes.add(format(t.getName()) + "," + format(p.getName()) + "," + format(p.getValue()));
}
}
if (!classes.isEmpty()) {
for (String s : classes) {
writer.println(format(ent.getName()) + ",\"" + hierarchy + "\"" + "," + format(m.getName()) + "," + format(m.getDescripteme()) + "," + format(m.getColor()) + "," + format(m.getDuration()) + "," + s);
}
} else {
writer.println(format(ent.getName()) + ",\"" + hierarchy + "\"" + "," + format(m.getName()) + "," + format(m.getDescripteme()) + "," + format(m.getColor()) + "," + format(m.getDuration()) + ",\"\",\"\",\"\"");
}
for (int i = 0; i < m.getSubMoments().size(); i++) {
MomentExperience sub = m.getSubMoments().get(i);
writeMoment(ent, sub, writer, hierarchy + "." + (i + 1));
}
}
Aggregations