public PatientRelevantPMHVoCollection getAllRelevantPMH(PatientRefVo patientRefVo) { DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); if (patientRefVo == null || patientRefVo.getID_Patient() == null) { throw new CodingRuntimeException("Cannot get patientRefVo on null Id "); } StringBuffer hql = new StringBuffer(); hql.append(" select pmh from PatientRelevantPMH as pmh left join pmh.patient as pat where pat.id = :patientID"); hql.append(" order by pmh.attendance.startDateTime desc"); markers.add("patientID"); values.add(patientRefVo.getID_Patient()); return PatientRelevantPMHVoAssembler.createPatientRelevantPMHVoCollectionFromPatientRelevantPMH(factory.find(hql.toString(), markers, values)); }
public PatientRelevantPMHVo getRelevantPMH(CareContextRefVo careContextRefVo) { DomainFactory factory = getDomainFactory(); if (careContextRefVo == null || careContextRefVo.getID_CareContext() == null) { throw new CodingRuntimeException("Cannot get careContextRefVo on null Id "); } StringBuffer hql = new StringBuffer(); hql.append(" select PMH from PatientRelevantPMH as PMH left join PMH.attendance as contextID where contextID.id = :contextID"); List<?> list = factory.find(hql.toString(), new String[] {"contextID"}, new Object[] {careContextRefVo.getID_CareContext()}); if (list!=null && list.size()>0) return PatientRelevantPMHVoAssembler.createPatientRelevantPMHVoCollectionFromPatientRelevantPMH(list).get(0); return null; }
public PatientRelevantPMHVo savePatientPMH(PatientRelevantPMHVo patientPMHToSave) throws StaleObjectException, UniqueKeyViolationException { if (patientPMHToSave == null) throw new CodingRuntimeException("Cannot save null PatientPMH"); if (!patientPMHToSave.isValidated()) throw new DomainRuntimeException("PatientPMHVo Not Validated."); DomainFactory factory = getDomainFactory(); PatientRelevantPMH domainPatientPMH = PatientRelevantPMHVoAssembler.extractPatientRelevantPMH(factory, patientPMHToSave); factory.save(domainPatientPMH); return PatientRelevantPMHVoAssembler.create(domainPatientPMH); }