public ReferralLiteVo getReferralFromSelectedCatsReferral(Integer catsReferralID) { if (catsReferralID == null) return null; DomainFactory factory = getDomainFactory(); ArrayList<String> marques = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); marques.add("id"); values.add(catsReferralID); String query = " select referral from CatsReferral as catsReferral left join catsReferral.journey as referralJourney left join referralJourney.referral as referral where catsReferral.id = :id "; List<?> referral = factory.find(query, marques, values); if(referral != null && referral.size() > 0 && referral.get(0) instanceof Referral) return ReferralLiteVoAssembler.create((Referral) referral.get(0)); return null; }
/** * Lists all referrals for a patient */ public ims.core.vo.ReferralLiteVoCollection listReferrals(ims.core.patient.vo.PatientRefVo patient) { if(patient == null) throw new DomainRuntimeException("Invalid patient"); DomainFactory factory = getDomainFactory(); return ReferralLiteVoAssembler.createReferralLiteVoCollectionFromReferral(factory.find("from Referral rf where rf.patient.id = " + patient.getID_Patient())); }
public ReferralLiteVo getReferralByJourney(PatientPathwayJourneyRefVo journey) { DomainFactory factory = getDomainFactory(); String hql = "select pj.referral from PatientPathwayJourney as pj left join pj.referral as referral " + "where (pj.id = " + journey.getID_PatientPathwayJourney() + " )"; List referralList = factory.find(hql); if(referralList != null && referralList.size() == 1) return ReferralLiteVoAssembler.create((Referral) referralList.get(0)); return null; }
public ReferralLiteVoCollection listReferralWithPathways(PatientRefVo patient) { if(patient == null) throw new DomainRuntimeException("Invalid patient"); ReferralLiteVoCollection referralColl = new ReferralLiteVoCollection(); DomainFactory factory = getDomainFactory(); ArrayList<String> marques = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String query = " select catsRef, p1_1.referral from CatsReferral as catsRef, PatientPathwayJourney as p1_1 join p1_1.referral as r1_1 where p1_1.patient.id =:id and catsRef.journey.id = p1_1.id "; marques.add("id"); values.add(patient.getID_Patient()); List<?> list = factory.find(query, marques, values); for (int i = 0; list != null && i < list.size(); i++) { if (list.get(i) instanceof Object[]) { Object[] result = (Object[]) list.get(i); CatsReferralForJourneyVo catsReferral = null; ReferralLiteVo referral = null; if (result[0] instanceof CatsReferral) { catsReferral = CatsReferralForJourneyVoAssembler.create((CatsReferral) result[0]); } if (result[1] instanceof Referral) { referral = ReferralLiteVoAssembler.create((Referral) result[1]); } if (catsReferral != null && referral != null) { referral.setCatsReferralDetails(catsReferral); } referralColl.add(referral); } } return referralColl; }
public ReferralLiteVoCollection listReferralsByPatient(PatientRefVo patient) { DomainFactory factory = getDomainFactory(); String hql = "from Referral r where r.isActive = true and r.patient.id = " + patient.getID_Patient(); return ReferralLiteVoAssembler.createReferralLiteVoCollectionFromReferral(factory.find(hql)).sort(SortOrder.DESCENDING); }
public ReferralLiteVoCollection listReferralWithPathways(PatientRefVo patient) { if(patient == null) throw new DomainRuntimeException("Invalid patient"); DomainFactory factory = getDomainFactory(); return ReferralLiteVoAssembler.createReferralLiteVoCollectionFromReferral(factory.find("select p1_1.referral from PatientPathwayJourney as p1_1 join p1_1.referral as r1_1 where p1_1.patient.id = " + patient.getID_Patient())); }