/** * get Respiratory Treatment */ public ims.core.vo.RespiratoryTreatmentVo getRespiratoryTreatment(ims.core.vo.ClinicalContactShortVo voClinicalContact) { if (voClinicalContact == null) throw new RuntimeException("Cannot get RespiratoryTreatmentVo for null ClinicalContactShortVo"); StringBuffer hql = new StringBuffer("from RespiratoryTreatment as r1_1 where r1_1.sOAPClinicalContact.id = :CCID and r1_1.isRIE is null order by r1_1.systemInformation.creationDateTime desc"); List list = getDomainFactory().find(hql.toString(), "CCID", voClinicalContact.getID_ClinicalContact()); if (list == null || list.size() == 0) return null; RespiratoryTreatmentVoCollection voList = RespiratoryTreatmentVoAssembler.createRespiratoryTreatmentVoCollectionFromRespiratoryTreatment(list);; if (voList.size() > 0) return voList.get(0); return null; }
/** * save Respiratory Treatment */ public RespiratoryTreatmentVo saveRespiratoryTreatment(ims.core.vo.RespiratoryTreatmentVo voRespiratoryTreatment) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if(!voRespiratoryTreatment.isValidated()) throw new DomainRuntimeException("This Respiratory Treatment has not been validated"); //if a new RespiratoryTreatmentVo record must be save check if already exist a RespiratoryTreatmentVo record for selected clinical contact if(voRespiratoryTreatment != null && voRespiratoryTreatment.getID_RespiratoryTreatment() == null) { if(voRespiratoryTreatment.getSOAPClinicalContactIsNotNull()) { RespiratoryTreatmentVo tempVo = getRespiratoryTreatment(voRespiratoryTreatment.getSOAPClinicalContact()); if(tempVo != null) throw new DomainRuntimeException("A Respiratory Treatment record already exists for this SOAP clinical contact"); } } DomainFactory factory = getDomainFactory(); RespiratoryTreatment doRespiratoryTreatment = RespiratoryTreatmentVoAssembler.extractRespiratoryTreatment(factory, voRespiratoryTreatment); factory.save(doRespiratoryTreatment); return RespiratoryTreatmentVoAssembler.create(doRespiratoryTreatment); }
public ClinicalContactShortVoCollection listRespTreatContacts(Integer idCareContext) { if (idCareContext != null) { DomainFactory factory = getDomainFactory(); List RespTrList = factory.find(" from RespiratoryTreatment rt where rt.sOAPClinicalContact.careContext.id = :ccId and rt.isRIE is null order by rt.authoringDateTime", new String[]{"ccId"}, new Object[]{idCareContext}); ClinicalContactShortVoCollection voCareContactList = new ClinicalContactShortVoCollection(); for (int x = 0; x < RespTrList.size(); x++) { RespiratoryTreatment domRespTr = (RespiratoryTreatment) RespTrList.get(x); RespiratoryTreatmentVo voRespTreat = RespiratoryTreatmentVoAssembler.create(domRespTr); //TODO: check that SOAP clinical contact is the correct vo to handle here. voCareContactList.add(voRespTreat.getSOAPClinicalContact()); } return voCareContactList; } return null; }
public RespiratoryTreatmentVoCollection getRespiratoryTreatmentCollection(ClinicalContactShortVo voClinicalContact) { if (voClinicalContact == null) throw new RuntimeException("Cannot get RespiratoryTreatmentVo for null ClinicalContactShortVo"); StringBuffer hql = new StringBuffer("from RespiratoryTreatment as r1_1 where r1_1.sOAPClinicalContact.id = :CCID order by r1_1.systemInformation.creationDateTime desc"); List list = getDomainFactory().find(hql.toString(), "CCID", voClinicalContact.getID_ClinicalContact()); if (list == null || list.size() == 0) return null; RespiratoryTreatmentVoCollection voList = RespiratoryTreatmentVoAssembler.createRespiratoryTreatmentVoCollectionFromRespiratoryTreatment(list);; return voList; }