private PatientDocumentLiteVo getReferralLetter(CatsReferralListVo referral) { StringBuilder query = new StringBuilder(); query.append("SELECT doc FROM CatsReferral as referral left join referral.referralDocuments as doc left join doc.category as cat "); query.append(" WHERE referral.id = :REF_ID and cat.id = :CAT_ID "); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("REF_ID"); paramValues.add(referral.getID_CatsReferral()); paramNames.add("CAT_ID"); paramValues.add(DocumentCategory.GPLETTER.getID()); return PatientDocumentLiteVoAssembler.create((PatientDocument) getDomainFactory().findFirst(query.toString(), paramNames, paramValues)); }
public PatientDocumentLiteVo getPatientDocumentLiteVo(PatientDocumentRefVo patDocRef) { if( patDocRef == null ) return null; PatientDocument doPatientDocument = (PatientDocument)getDomainFactory().getDomainObject(PatientDocument.class, patDocRef.getID_PatientDocument()); return PatientDocumentLiteVoAssembler.create(doPatientDocument); }
public ims.core.vo.PatientDocumentLiteVo getCatsReport(ims.RefMan.vo.CatsReferralRefVo referral) { if(referral == null || referral.getID_CatsReferral() == null) throw new CodingRuntimeException("Cannot get Cats Referral on null Referral Id."); String query = "select pd from CatsReferral as c left join c.referralDocuments as pd where c.id = :ReferralId and pd.category.id = :CatsReport order by pd.recordingDateTime desc"; PatientDocumentLiteVoCollection coll = PatientDocumentLiteVoAssembler.createPatientDocumentLiteVoCollectionFromPatientDocument(getDomainFactory().find(query, new String[] {"ReferralId", "CatsReport"}, new Object[] {referral.getID_CatsReferral(), DocumentCategory.CATS_FINAL_REPORT.getID()})); if(coll != null && coll.size() > 0) return coll.get(0); return null; }
public PatientDocumentLiteVoCollection listReferralLetters(CatsReferralRefVo referral) { if(referral == null || referral.getID_CatsReferral() == null) throw new CodingRuntimeException("Cannot get Referral Letters on null Referral Id."); String hql = "select pd from CatsReferral as c left join c.referralDocuments as pd where c.id = :ReferralId and pd.category.id = :ReferralLetterId order by pd.recordingDateTime desc"; return PatientDocumentLiteVoAssembler.createPatientDocumentLiteVoCollectionFromPatientDocument(getDomainFactory().find(hql, new String[] {"ReferralId", "ReferralLetterId"}, new Object[] {referral.getID_CatsReferral(), DocumentCategory.GPLETTER.getID()} )); }
public PatientDocumentLiteVoCollection listPatientDocuments(PatientRefVo patient, CareContextRefVo context,DocumentCategory documentCategory, CatsReferralRefVo refVo, UploadDocumentStoreLevel level) { if(patient == null || (patient != null && patient.getID_Patient() == null)) throw new DomainRuntimeException("Cannot get PatientDocumentVoCollection for null PatientRefVo"); if (level == null) throw new DomainRuntimeException("Document Store Level cannot be null"); DomainFactory factory = getDomainFactory(); String mainHql = ""; String hql = ""; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " where "; if (level.equals(UploadDocumentStoreLevel.REFERRAL)) { if (refVo != null) { mainHql = "select pd from CatsReferral catsref "; mainHql +=(" left join catsref.referralDocuments as pd "); andStr = " where "; hql += (andStr + " catsref.id = :idCatsRef "); markers.add("idCatsRef"); values.add(refVo.getID_CatsReferral()); andStr = " and "; mainHql +=(" left join pd.patient as p"); hql += andStr + " p.id = :idPatient "; markers.add("idPatient"); values.add(patient.getID_Patient()); } else { return null; } } else if (level.equals(UploadDocumentStoreLevel.CARECONTEXT)) { mainHql = "select pd from PatientDocument pd "; mainHql +=(" left join pd.patient as p"); hql += andStr + " p.id = :idPatient "; markers.add("idPatient"); values.add(patient.getID_Patient()); if (context != null) { andStr = " and "; hql += andStr + " pd.careContext.id = :idCareContext"; markers.add("idCareContext"); values.add(context.getID_CareContext()); } } else if (level.equals(UploadDocumentStoreLevel.PATIENT)) { mainHql = "select pd from PatientDocument pd "; mainHql +=(" left join pd.patient as p"); hql += andStr + " p.id = :idPatient "; markers.add("idPatient"); values.add(patient.getID_Patient()); } mainHql += hql; List documents = factory.find(mainHql,markers,values); return PatientDocumentLiteVoAssembler.createPatientDocumentLiteVoCollectionFromPatientDocument(documents); }