/** * saveSummary */ public EDischargeSTHKSummaryVo saveSummaryAndDischargeDetails(EDischargeSTHKSummaryVo summary, DischargeDetailsVo dischargeDetails) throws StaleObjectException, DomainInterfaceException { if (summary == null) throw new CodingRuntimeException("summary is null in method saveSummary"); if (!summary.isValidated()) throw new CodingRuntimeException("summary has not been validated in method saveSummary"); if (dischargeDetails != null) { IEDischargeHelper impl = (IEDischargeHelper)getDomainImpl(EDischargeHelper.class); summary.setDischargeDetails(impl.saveDischargeDetails(dischargeDetails)); } DomainFactory factory = getDomainFactory(); Summary doSummary = EDischargeSTHKSummaryVoAssembler.extractSummary(factory, summary); factory.save(doSummary); return EDischargeSTHKSummaryVoAssembler.create(doSummary); }
public EDischargeSTHKSummaryVo saveSummary(EDischargeSTHKSummaryVo summaryVo) throws StaleObjectException { if(summaryVo == null) throw new CodingRuntimeException("summaryVo is null"); if (!summaryVo.isValidated()) throw new DomainRuntimeException("summaryVo not validated"); DomainFactory factory = getDomainFactory(); Summary doSumm = EDischargeSTHKSummaryVoAssembler.extractSummary(factory, summaryVo); factory.save(doSumm); return EDischargeSTHKSummaryVoAssembler.create(doSumm); }
public EDischargeSTHKSummaryVoCollection getSTHKPatientDocuments() { DomainFactory factory = getDomainFactory(); String sql = "select summ from Summary as summ left join summ.careContext as cCtxt left join cCtxt.currentStatus as cStat where summ.dischargeLetterStatus.id = -1719 and ( summ.tTAStatus = -2084 or summ.tTAStatus = -2075) and cStat.status not in (:id1) "; List lst = factory.find(sql,new String[]{"id1"}, new Object[]{getDomLookup(CareContextStatus.CANCELLED)}); if(lst != null && !lst.isEmpty()) { System.out.println(new DateTime().toString() + ": No of results : " + lst.size()); return EDischargeSTHKSummaryVoAssembler.createEDischargeSTHKSummaryVoCollectionFromSummary(lst); } return null; }
public EDischargeSTHKSummaryVoCollection getSTHKSuppPatientDocuments() { DomainFactory factory = getDomainFactory(); String sql = "select summ from Summary as summ left join summ.careContext as cCtxt left join cCtxt.currentStatus as cStat where summ.dischargeLetterStatus.id = -1727 and summ.dischargeSupplementaryLetterStatus.id = -1821 and ( summ.tTAStatus = -2084 or summ.tTAStatus = -2075) and cStat.status not in (:id1)"; List lst = factory.find(sql,new String[]{"id1"}, new Object[]{getDomLookup(CareContextStatus.CANCELLED)}); if(lst != null && !lst.isEmpty()) { System.out.println(new DateTime().toString() + ": No of results : " + lst.size()); return EDischargeSTHKSummaryVoAssembler.createEDischargeSTHKSummaryVoCollectionFromSummary(lst); } return null; }
private void rollback(EDischargeSTHKSummaryVo summaryVo, PatientDocumentVo document, DocumentCategory category) throws ForeignKeyViolationException, StaleObjectException { DomainFactory factory = getDomainFactory(); Summary boSUMM = (Summary) factory.getDomainObject(Summary.class, summaryVo.getID_Summary()); summaryVo = EDischargeSTHKSummaryVoAssembler.create(boSUMM); PatientDocumentVoCollection documents = summaryVo.getDischargeDocuments(); documents.remove(document); summaryVo.setDischargeDocuments(documents); if (category.equals(DocumentCategory.DISCHARGE_SUMMARY)) summaryVo.setDischargeLetterStatus(DischargeLetterStatus.IN_PROGRESS); else if (category.equals(DocumentCategory.DISCHARGE_SUPPLEMENTARY)) summaryVo.setDischargeSupplementaryLetterStatus(DischargeSupplementaryLetterStatus.REQUIRED); String[] str = summaryVo.validate(); if (str != null && str.length > 0) { LOG.error("summaryVo is not validate"); return; } summaryVo = saveSummary(summaryVo); try { deletePatientDocument(document); } catch(Exception e) { throw new StaleObjectException(null); } getDomainFactory().getTransaction().commit(); getDomainFactory().setTransaction(null); }
public EDischargeSTHKSummaryVo getSummaryByCareContext(CareContextRefVo careContext) { if (careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("careContext is null or id not provided in method getNeonatalByCareContext"); DomainFactory factory = getDomainFactory(); List nnItems = factory.find("from Summary ds where ds.careContext.id = " + careContext.getID_CareContext()); if(nnItems != null && nnItems.size() > 0) return EDischargeSTHKSummaryVoAssembler.create((Summary) nnItems.get(0)); return null; }
public EDischargeSTHKSummaryVo getCurrentSummary(CareContextRefVo ccRefVo) { if(ccRefVo == null) throw new CodingRuntimeException("ccRefVo Filter not provided for list call. "); if(ccRefVo != null) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from Summary summ where "); String andStr = " "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); hql.append(andStr + " summ.careContext.id = :careContextId"); markers.add("careContextId"); values.add(ccRefVo.getID_CareContext()); andStr = " and "; List list = factory.find(hql.toString(), markers,values); if(list != null && list.size() > 0) { EDischargeSTHKSummaryVoCollection voColl = EDischargeSTHKSummaryVoAssembler.createEDischargeSTHKSummaryVoCollectionFromSummary(list); if(voColl != null && voColl.size() > 0) return voColl.get(0); } } return null; }
public ims.clinical.vo.EDischargeSTHKSummaryVo getSummaryByCareContext(ims.core.admin.vo.CareContextRefVo careContext) { if (careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("careContext is null or id not provided in method getNeonatalByCareContext"); DomainFactory factory = getDomainFactory(); List nnItems = factory.find("from Summary ds where ds.careContext.id = " + careContext.getID_CareContext()); if(nnItems != null && nnItems.size() > 0) return EDischargeSTHKSummaryVoAssembler.create((Summary) nnItems.get(0)); return null; }
public EDischargeSTHKSummaryVoCollection getSTHKPatientDocuments() { DomainFactory factory = getDomainFactory(); String sql = "from Summary as summ where summ.dischargeLetterStatus.id = -1719 and ( summ.tTAStatus = -2084 or summ.tTAStatus = -2075)"; List lst = factory.find(sql); if(lst != null && !lst.isEmpty()) { System.out.println(new DateTime().toString() + ": No of results : " + lst.size()); return EDischargeSTHKSummaryVoAssembler.createEDischargeSTHKSummaryVoCollectionFromSummary(lst); } return null; }
public EDischargeSTHKSummaryVoCollection getSTHKSuppPatientDocuments() { DomainFactory factory = getDomainFactory(); String sql = "from Summary as summ where summ.dischargeLetterStatus.id = -1727 and ( summ.tTAStatus = -2084 or summ.tTAStatus = -2075)"; List lst = factory.find(sql); if(lst != null && !lst.isEmpty()) { System.out.println(new DateTime().toString() + ": No of results : " + lst.size()); return EDischargeSTHKSummaryVoAssembler.createEDischargeSTHKSummaryVoCollectionFromSummary(lst); } return null; }
public DischargeSupplementaryNotesVo saveSupplementaryAndDDAndSummary(DischargeSupplementaryNotesVo voDischSupp, DischargeDetailsVo voDD, EDischargeSTHKSummaryVo voSumm) throws DomainInterfaceException, StaleObjectException { if(voDischSupp == null) throw new CodingRuntimeException("DischargeSupplementaryNotesVo is null"); if(!voDischSupp.isValidated()) throw new CodingRuntimeException("DischargeSupplementaryNotesVo Value Object has not been validated"); DomainFactory factory = getDomainFactory(); DischargeSupplementaryNotes doDSN = DischargeSupplementaryNotesVoAssembler.extractDischargeSupplementaryNotes(factory, voDischSupp); //WDEV-8813 // Workaround for the case when 2 users save in the same time a new DischargeSupplementaryNotesVO //In this case the domain.save call doesn't throw a StaleObjectExeption, even if it is the case if (!voDischSupp.getID_DischargeSupplementaryNotesIsNotNull()) { DischargeSupplementaryNotesVo voDischargeSupp = getSupplementary(voDischSupp.getCareContext()); if (voDischargeSupp!=null) { throw new StaleObjectException(doDSN,"A DischargeSupplementaryNotesVo was already saved by another user"); } } factory.save(doDSN); if (voDD != null) { DischargeDetails doDD = DischargeDetailsVoAssembler.extractDischargeDetails(factory, voDD); factory.save(doDD); } if (voSumm != null) { Summary doSumm = EDischargeSTHKSummaryVoAssembler.extractSummary(factory, voSumm); factory.save(doSumm); } return DischargeSupplementaryNotesVoAssembler.create(doDSN); }