public GpShortVo getGpPatient(PatientRefVo patient) { if(patient == null) throw new CodingRuntimeException("Patient not provided"); DomainFactory factory = getDomainFactory(); String hsql = "select g1_1 from Patient as p1_1 left join p1_1.gp as g1_1 where (p1_1.id = :id)"; List gps = factory.find(hsql, new String[] {"id"}, new Object[] {patient.getID_Patient()}); if(gps != null && gps.size() > 0) { GpShortVoCollection gpColl = GpShortVoAssembler.createGpShortVoCollectionFromGp(gps); if(gpColl != null && gpColl.size() > 0) return gpColl.get(0); } return null; }
public ims.core.vo.GpShortVoCollection listGPsBySurname(String surname) { if(surname == null) throw new DomainRuntimeException("Invalid GP surname"); ArrayList<String> names = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); surname = surname.toUpperCase(); if(!surname.endsWith("%")) surname += "%"; String hql = "from Gp gp where gp.name.upperSurname like :surname order by gp.name.upperSurname"; names.add("surname"); values.add(surname); return GpShortVoAssembler.createGpShortVoCollectionFromGp(getDomainFactory().find(hql, names, values)); }
public GpShortVoCollection listGPsBySurname(String text) { if(text == null) throw new CodingRuntimeException("text is mandatory in method listGPsBySurname"); text = text.replaceAll("%", ""); String hql = "from Gp gp where gp.name.upperSurname like :surname and gp.status = :activeStatus order by gp.name.upperSurname"; return GpShortVoAssembler.createGpShortVoCollectionFromGp(getDomainFactory().find(hql, new String[] {"surname", "activeStatus"}, new Object[] {text.toUpperCase() + "%", getDomLookup(GPStatus.ACTIVE)})); }
public GpShortVo getPatientsGp(Integer idPatient) { // DomainFactory factory = getDomainFactory(); ims.core.patient.domain.objects.Patient pat=null; // IMSCriteria imsc=new IMSCriteria(Patient.class,factory); // imsc.equal("this.id", idPatient); // List patients=imsc.find(); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from Patient where "); String andStr = " "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); hql.append(andStr + "id = :patient"); markers.add("patient"); values.add(idPatient); List patients = factory.find(hql.toString(), markers,values); if (patients!=null && patients.size()>0) { pat=(ims.core.patient.domain.objects.Patient) patients.get(0); if (pat.getGp()!=null) return GpShortVoAssembler.create(pat.getGp()); else return null; } return null; }
public GpShortVoCollection listReferralGps(GP voGpFilter) { DomainFactory factory = getDomainFactory(); String andStr = " "; StringBuffer clause = new StringBuffer(); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); if (voGpFilter.getNameIsNotNull()) { if (voGpFilter.getName().getForenameIsNotNull()) { clause.append(" gp.name.upperForename like :forename"); names.add("forename"); values.add("%" + voGpFilter.getName().getForename().toUpperCase() + "%"); andStr = " and "; } if (voGpFilter.getName().getSurnameIsNotNull()) { clause.append(andStr + " gp.name.upperSurname like :surname"); names.add("surname"); values.add("%" + voGpFilter.getName().getSurname().toUpperCase() + "%"); andStr = " and "; } } if (voGpFilter.getPracticesIsNotNull()) { if (voGpFilter.getPractices() != null) { if (voGpFilter.getPractices().get(0).getPractice().getAddress().getLine1() != null && voGpFilter.getPractices().get(0).getPractice().getAddress().getLine1().length() > 0) { clause.append(andStr + " gp.id = Pract.gp.id and (upper(Pract.practice.address.line1) like :partialAddress "); clause.append(" or upper(Pract.practice.address.line2) like :partialAddress"); clause.append(" or upper(Pract.practice.address.line3) like :partialAddress"); clause.append(" or upper(Pract.practice.address.line4) like :partialAddress"); clause.append(" or upper(Pract.practice.address.line5) like :partialAddress )"); //clause.append(" gp.id = Pract.gp.id and Pract.practice.address.line1 like :partialAddress "); names.add("partialAddress"); values.add("%" + voGpFilter.getPractices().get(0).getPractice().getAddress().getLine1().toUpperCase() + "%"); andStr = " and "; } } } String hql = "select distinct gp from Gp gp, GpToPractice Pract where "; hql += clause.toString(); List gps = factory.find(hql,names,values); return GpShortVoAssembler.createGpShortVoCollectionFromGp(gps).sort(); }
@Override public GpShortVo getGp(GpRefVo refVo) { if(refVo == null || refVo.getID_Gp() == null) throw new CodingRuntimeException("GpRefVo is null or id not provided for method getGp"); return GpShortVoAssembler.create((Gp) getDomainFactory().getDomainObject(refVo)); }
@Override public GpShortVo getGP(GpRefVo ref) { if (ref != null) { Gp gp = (Gp) getDomainFactory().getDomainObject(Gp.class,ref.getID_Gp()); GpShortVo voGp = GpShortVoAssembler.create(gp); return voGp; } return null; }
public GpShortVo getRegisteredGp(PatientRefVo client) throws DomainInterfaceException { if (client == null) throw new DomainInterfaceException("A client must be selected to search for a registred GP"); DomainFactory factory = getDomainFactory(); String query = "select gp from Patient as pt left join pt.communityCare as cc left join cc.registeredGp as gp where (pt.id = :ID)"; ArrayList<String> markers = new ArrayList<String>(); markers.add("ID"); ArrayList<Object> values = new ArrayList<Object>(); values.add(client.getID_Patient()); return GpShortVoAssembler.create((Gp) factory.find(query, markers, values).get(0)); }