public SoapNoteVo saveSoapNoteVo(SoapNoteVo soapNoteVo) throws StaleObjectException { if(soapNoteVo == null) throw new RuntimeException("Cannot save null value for SoapNoteVo"); if (!soapNoteVo.isValidated()) throw new CodingRuntimeException("SoapNoteVo value object has not been validated"); //if a new SoapNoteVo record must be save check if already exist a SoapNoteVo record for selected clinical contact if(soapNoteVo != null && !soapNoteVo.getID_SoapNoteIsNotNull()) { if(soapNoteVo.getClinicalContactIsNotNull()) { SoapNoteVo tempVo = getSoapNoteVo(soapNoteVo.getClinicalContact()); if(tempVo != null) throw new DomainRuntimeException("A Therapy Contact record already exists for this clinical contact"); } } DomainFactory factory = getDomainFactory(); SoapNote doSoapNote = SoapNoteVoAssembler.extractSoapNote(factory, soapNoteVo); factory.save(doSoapNote); return SoapNoteVoAssembler.create(doSoapNote); }
public SoapNoteVoCollection listSoapNotesVo(CareContextRefVo careContextRefVo) { if (careContextRefVo == null) throw new DomainRuntimeException("CareContextRefVo is null"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); String query = "from SoapNote sn "; ArrayList markers= new ArrayList(); ArrayList values = new ArrayList(); hql.append(" sn.careContext.id = :rcc"); markers.add("rcc"); values.add(careContextRefVo.getID_CareContext()); if (markers.size() > 0) query += " where "; query += hql.toString(); List listSoapNote = factory.find(query,markers,values); SoapNoteVoCollection voSoapNoteColl = SoapNoteVoAssembler.createSoapNoteVoCollectionFromSoapNote(listSoapNote); //if(voSoapNoteColl.size() > 0) return voSoapNoteColl; ////else //return null; }
public SoapNoteVo getSoapNoteVo(ClinicalContactShortVo clinicalContactShortVo) { if (clinicalContactShortVo == null) throw new CodingRuntimeException("Cannot get SoapNoteVo for null Clinical Contact"); DomainFactory factory = getDomainFactory(); String hql = " from SoapNote sn "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if (clinicalContactShortVo != null) { condStr.append(andStr + " sn.clinicalContact.id = :id_ClinicalContact"); markers.add("id_ClinicalContact"); values.add(clinicalContactShortVo.getID_ClinicalContact()); andStr = " and "; } if (andStr.equals(" and ")) hql += " where "; hql += condStr.toString(); hql += " order by sn.systemInformation.creationDateTime desc"; SoapNoteVoCollection collSoapNoteVo = SoapNoteVoAssembler.createSoapNoteVoCollectionFromSoapNote(factory.find(hql, markers, values)); if (collSoapNoteVo != null) { if (collSoapNoteVo.size() >= 1) return collSoapNoteVo.get(0); } return null; }