public OutpatientNotesOutcomeVo getOutpatientNotesForClinicalContact(ClinicalContactRefVo clinicalContact) { if(clinicalContact == null) throw new CodingRuntimeException("null clinical contact passed to getOutpatientNotesForClinicalContact() !"); DomainFactory factory = getDomainFactory(); List list = factory.find("from OutpatientNotesOutcome as o1_1 where o1_1.clinicalContact.id = :CCID order by o1_1.id asc ", new String[] {"CCID"}, new Object[] {clinicalContact.getID_ClinicalContact()}); return list.size() == 0 ? null : OutpatientNotesOutcomeVoAssembler.create((OutpatientNotesOutcome)list.get(0)); }
public OutpatientNotesOutcomeVo getOutpatientNotesOutcomeForClinicalNote(ClinicalNotesRefVo clinnoteRefVo) { DomainFactory factory = getDomainFactory(); if(clinnoteRefVo != null) { StringBuffer hql = new StringBuffer(" from OutpatientNotesOutcome opnote where "); String andStr = " "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); hql.append(andStr + " opnote.clinicalNote.clinicalNote.id = :refid"); markers.add("refid"); values.add(clinnoteRefVo.getID_ClinicalNotes()); andStr = " and "; List listNotes = factory.find(hql.toString(), markers,values); if(listNotes != null && listNotes.size() > 0) { OutpatientNotesOutcomeVoCollection voColl = OutpatientNotesOutcomeVoAssembler.createOutpatientNotesOutcomeVoCollectionFromOutpatientNotesOutcome(listNotes); if(voColl != null && voColl.size() > 0) return voColl.get(0); } } return null; }
public OutpatientNotesOutcomeVo getOutpatientNotesForCareContext(CareContextRefVo careContextRef) { if(careContextRef == null) throw new CodingRuntimeException("null clinical contact passed to getOutpatientNotesForClinicalContact() !"); DomainFactory factory = getDomainFactory(); List list = factory.find("from OutpatientNotesOutcome as o1_1 where o1_1.careContext.id = :CCID order by o1_1.id asc ", new String[] {"CCID"}, new Object[] {careContextRef.getID_CareContext()}); return list.size() == 0 ? null : OutpatientNotesOutcomeVoAssembler.create((OutpatientNotesOutcome)list.get(0)); }
public OutpatientNotesOutcomeVo getLastOutpatientNotesOutcome(CareContextRefVo careContext) { if(careContext == null) throw new CodingRuntimeException("null careContext passed to getLastOutpatientNotesOutcome() !"); DomainFactory factory = getDomainFactory(); List list = factory.find("from OutpatientNotesOutcome as o1_1 where o1_1.careContext.id = :CONTEXTID order by o1_1.id asc ", new String[] {"CONTEXTID"}, new Object[] {careContext.getID_CareContext()}); return list.size() == 0 ? null : OutpatientNotesOutcomeVoAssembler.create((OutpatientNotesOutcome)list.get(0)); }
public OutpatientNotesOutcomeVo saveOutpatientNotesOutcome(OutpatientNotesOutcomeVo record) throws StaleObjectException, UniqueKeyViolationException { if(record == null) throw new CodingRuntimeException("null record passed to saveClinicalCorrespondence() !"); if(!record.isValidated()) throw new CodingRuntimeException("OutpatientNotesOutcome not validated !"); DomainFactory factory = getDomainFactory(); OutpatientNotesOutcome boOutpatientNotesOutcome = OutpatientNotesOutcomeVoAssembler.extractOutpatientNotesOutcome(factory, record); factory.save(boOutpatientNotesOutcome); return OutpatientNotesOutcomeVoAssembler.create(boOutpatientNotesOutcome); }
public OutpatientNotesOutcomeVo saveOutpatientNotesOutcome(OutpatientNotesOutcomeVo record) throws StaleObjectException { if(record == null) throw new CodingRuntimeException("null record passed to saveClinicalCorrespondence() !"); if(!record.isValidated()) throw new CodingRuntimeException("OutpatientNotesOutcome not validated !"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1"); if(record.getClinicalNote().getClinicalNote().getID_ClinicalNotes()== null) { hql.append(" where (p.clinicalContact.id = " + record.getClinicalNote().getClinicalNote().getClinicalContact().getID_ClinicalContact() + "and l1_1.id <> -882 and l1_1 <> -883)"); // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } else { hql.append(" where (p.clinicalContact.id = " + record.getClinicalNote().getClinicalNote().getClinicalContact().getID_ClinicalContact() + "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " + record.getClinicalNote().getClinicalNote().getID_ClinicalNotes() +")"); //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } List list = (factory.find(hql.toString())); if(list.size() > 0) { ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list); if (doClinNotes.get(0).getSourceOfNote() != null && !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId()))) { return null; } else { throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed"); } } OutpatientNotesOutcome boOutpatientNotesOutcome = OutpatientNotesOutcomeVoAssembler.extractOutpatientNotesOutcome(factory, record); CareContext doCareContext = getCurrentCareContext(record.getCareContext());//WDEV-19027 boOutpatientNotesOutcome.setCareContext(doCareContext);//WDEV-19027 factory.save(boOutpatientNotesOutcome); return OutpatientNotesOutcomeVoAssembler.create(boOutpatientNotesOutcome); }
public OutpatientNotesOutcomeVo saveOutpatientNotesOutcomePerCareContext(OutpatientNotesOutcomeVo record) throws StaleObjectException { if(record == null) throw new CodingRuntimeException("null record passed to saveClinicalCorrespondence() !"); if(!record.isValidated()) throw new CodingRuntimeException("OutpatientNotesOutcome not validated !"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1"); if(record.getClinicalNote().getClinicalNote().getID_ClinicalNotes()== null) { hql.append(" where (p.careContext.id = " + record.getClinicalNote().getClinicalNote().getCareContext().getID_CareContext() + "and l1_1.id <> -882 and l1_1 <> -883)"); // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } else { hql.append(" where (p.careContext.id = " + record.getClinicalNote().getClinicalNote().getCareContext().getID_CareContext() + "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " + record.getClinicalNote().getClinicalNote().getID_ClinicalNotes() +")"); //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } List list = (factory.find(hql.toString())); if(list.size() > 0) { ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list); if (doClinNotes.get(0).getSourceOfNote() != null && !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId()))) { return null; } else { throw new DomainRuntimeException("A record exists for this Care context, the screen will be refreshed"); } } OutpatientNotesOutcome boOutpatientNotesOutcome = OutpatientNotesOutcomeVoAssembler.extractOutpatientNotesOutcome(factory, record); CareContext doCareContext = getCurrentCareContext(record.getCareContext());//WDEV-19027 boOutpatientNotesOutcome.setCareContext(doCareContext);//WDEV-19027 factory.save(boOutpatientNotesOutcome); return OutpatientNotesOutcomeVoAssembler.create(boOutpatientNotesOutcome); }