private Patient getPatientForCareContext(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("CareContext is null or id not provided for getPatientForCareContext"); DomainFactory factory = getDomainFactory(); List pat = factory.find("select careSpell.patient rom CareSpell as careSpell left join careSpell.episodes as epis left join epis.careContexts as cc where cc.id = :idCareContext", new String[]{"idCareContext"}, new Object[]{careContext.getID_CareContext()}); PatientCollection patVo = PatientAssembler.createPatientCollectionFromPatient(pat); return patVo != null && patVo.size() > 0 ? patVo.get(0) : null; }
private ims.core.vo.Patient getLocalPatient(PatientShort patVo) { DomainFactory factory = getDomainFactory(); if (patVo.getIdentifiers() == null || patVo.getIdentifiers().size() == 0 || (patVo.getIdentifiers().get(0)) == null) { throw new DomainRuntimeException("Patient Get call must contain valid identifier"); } PatientIdCollection identifiers = patVo.getIdentifiers(); for (int i = 0; i < identifiers.size(); i++) { if (identifiers.get(i).getType().equals(PatIdType.PKEY)) { String idVal = identifiers.get(i).getIdValue().trim(); String hql = " from Patient p join p.identifiers as ids where ids.type = :idType and ids.value = :idValue "; java.util.List<?> patientList = factory.find(hql, new String[]{"idValue", "idType"}, new Object[]{idVal, getDomLookup(identifiers.get(i).getType())}); PatientCollection patients = PatientAssembler.createPatientCollectionFromPatient(patientList); if (patients!=null && patients.size()>0) { return patients.get(0); } } } return null; }
private Patient getPatientForCareContext(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("CareContext is null or id not provided for getPatientForCareContext"); DomainFactory factory = getDomainFactory(); List pat = factory.find("select careSpell.patient from CareSpell as careSpell left join careSpell.episodes as epis left join epis.careContexts as cc where cc.id = :idCareContext", new String[]{"idCareContext"}, new Object[]{careContext.getID_CareContext()}); PatientCollection patVo = PatientAssembler.createPatientCollectionFromPatient(pat); return patVo != null && patVo.size() > 0 ? patVo.get(0) : null; }