public MDTListAndDatesVo getLatestMDTListDetailsForPatient(PatientRefVo patient, CareContextRefVo careContext) { if (patient == null || patient.getID_Patient() == null) return null; if (careContext == null || careContext.getID_CareContext() == null) return null; String query = "SELECT mdtList FROM MDTListandDates AS mdtList WHERE mdtList.careContext.id = :CARE_CONTEXT "; return MDTListAndDatesVoAssembler.create((MDTListandDates) getDomainFactory().findFirst(query.toString(), "CARE_CONTEXT", careContext.getID_CareContext())); }
/** * A list of MDT appointments */ public ims.clinical.vo.MDTListAndDatesVoCollection listMDT(ims.clinical.vo.MDTListAndDatesVo voMDTList) { DomainFactory factory = getDomainFactory(); List MDTList = factory.find(" from MDTListandDates mdtlist where mdtlist.careContext.endDateTime is null " + "and mdtlist.careContext.context = :context " + "and mdtlist.listPatientisOn = :listPatient", new String[]{"context", "listPatient"}, new Object[]{getDomLookup(voMDTList.getCareContext().getContext()), getDomLookup(voMDTList.getListPatientisOn())}); MDTListAndDatesVoCollection voMDTNoContactColl = new MDTListAndDatesVoCollection(); for (int x = 0; x < MDTList.size(); x++) { MDTListandDates domMDTListAndDates = (MDTListandDates) MDTList.get(x); MDTListAndDatesVo voMDTListAndDates = MDTListAndDatesVoAssembler.create(domMDTListAndDates); voMDTListAndDates.setPatient(PatientShortAssembler.create(domMDTListAndDates.getPatient())); Demographics impl = (Demographics) getDomainImpl(DemographicsImpl.class); voMDTListAndDates.getPatient().setHasAlerts(impl.hasAlerts(domMDTListAndDates.getPatient().getId())); voMDTListAndDates.getPatient().setHasAllergies(impl.hasAllergy(domMDTListAndDates.getPatient().getId())); voMDTNoContactColl.add(voMDTListAndDates); } return voMDTNoContactColl.sort(); }
public MDTMeetingVo save(MDTMeetingVo mdtMeeting, MDTListAndDatesVo mdtList) throws StaleObjectException { if (!mdtMeeting.isValidated()) throw new DomainRuntimeException("MDT Meeting has not beed validated."); if (!mdtList.isValidated()) throw new DomainRuntimeException("MDT List has not been validate."); DomainFactory factory = getDomainFactory(); MDTMeeting domMDTMeeting = MDTMeetingVoAssembler.extractMDTMeeting(factory, mdtMeeting); // Check mdtMeeting to be the latest (if it was already saved) if (mdtMeeting.getID_MDTMeeting() != null) { MDTMeetingVo latest = getLatest(mdtMeeting); if (latest != null) { mdtList.setListPatientisOn(latest.getListPatientisOn()); mdtList.setKeyDates(new KeyDatesVoCollection()); for (KeyDatesVo keyDate : latest.getKeyDates()) { KeyDatesVo date = new KeyDatesVo(); date.setDate(keyDate.getDate()); date.setDateType(keyDate.getDateType()); mdtList.getKeyDates().add(date); } } } MDTListandDates domMDTList = MDTListAndDatesVoAssembler.extractMDTListandDates(factory, mdtList); factory.save(domMDTMeeting); factory.save(domMDTList); return MDTMeetingVoAssembler.create(domMDTMeeting); }