public DischargeReportDetailVo getDischargeReportDetailsForCareContext( CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("CareContext is null or id not provided for getDischargeDetailsForCareContext"); DomainFactory factory = getDomainFactory(); List domainObjectList = factory.find("select drd from DischargeReportDetail as drd left join drd.careContext as cc where cc.id = :idCareContext", new String[]{"idCareContext"}, new Object[]{careContext.getID_CareContext()}); DischargeReportDetailVoCollection reportDetail = DischargeReportDetailVoAssembler.createDischargeReportDetailVoCollectionFromDischargeReportDetail(domainObjectList); return reportDetail != null && reportDetail.size() > 0 ? (reportDetail.get(0) != null ? reportDetail.get(0) : null) : null; }
public DischargeReportDetailVo saveDischargeReportDetails(DischargeReportDetailVo dischargeReportDetail) throws StaleObjectException { if (!dischargeReportDetail.isValidated()) throw new DomainRuntimeException("DischargeReportDetailVo not validated"); DomainFactory factory = getDomainFactory(); DischargeReportDetail dom = DischargeReportDetailVoAssembler.extractDischargeReportDetail(factory, dischargeReportDetail); factory.save(dom); return DischargeReportDetailVoAssembler.create(dom); }
public DischargeReportDetailVo getDischargeReportDetailsForCareContext(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("CareContext is null or id not provided for getDischargeDetailsForCareContext"); DomainFactory factory = getDomainFactory(); List<?> domainObjectList = factory.find("select drd from DischargeReportDetail as drd left join drd.careContext as cc where cc.id = :idCareContext", new String[]{"idCareContext"}, new Object[]{careContext.getID_CareContext()}); DischargeReportDetailVoCollection reportDetail = DischargeReportDetailVoAssembler.createDischargeReportDetailVoCollectionFromDischargeReportDetail(domainObjectList); return reportDetail != null && reportDetail.size() > 0 ? (reportDetail.get(0) != null ? reportDetail.get(0) : null) : null; }
public DischargeReportDetailVo getDischargeReportDetailsForCareContext(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("CareContext is null or id not provided for getDischargeDetailsForCareContext"); DomainFactory factory = getDomainFactory(); List domainObjectList = factory.find("select drd from DischargeReportDetail as drd left join drd.careContext as cc where cc.id = :idCareContext", new String[]{"idCareContext"}, new Object[]{careContext.getID_CareContext()}); DischargeReportDetailVoCollection reportDetail = DischargeReportDetailVoAssembler.createDischargeReportDetailVoCollectionFromDischargeReportDetail(domainObjectList); return reportDetail != null && reportDetail.size() > 0 ? (reportDetail.get(0) != null ? reportDetail.get(0) : null) : null; }
public DischargeReportDetailVo saveDischargeReportDetail(DischargeReportDetailVo record, DischargeReadyToLeaveVo voReady) throws StaleObjectException { if (record != null) { if (!record.isValidated()) throw new DomainRuntimeException("PatientDocumentVo not validated"); } DomainFactory factory = getDomainFactory(); if (!record.getID_DischargeReportDetailIsNotNull()) { List<?> dischargeDetails = factory.find("select dd from DischargeReportDetail as dd left join dd.careContext as cc where cc.id = :idCareContext and dd.isRIE is null ", new String[]{"idCareContext"}, new Object[]{record.getCareContext().getID_CareContext()}); if (dischargeDetails != null && dischargeDetails.size()>0) { throw new StaleObjectException(null); } } DischargeReportDetail dom = DischargeReportDetailVoAssembler.extractDischargeReportDetail(factory, record); factory.save(dom); if (voReady != null) { ReadyToLeave domReady = DischargeReadyToLeaveVoAssembler.extractReadyToLeave(factory, voReady); factory.save(domReady); } return DischargeReportDetailVoAssembler.create(dom); }
public DischargeReportDetailVo saveDischargeReportDetail(DischargeReportDetailVo report) throws StaleObjectException { if(report == null) { throw new CodingRuntimeException("DischargeReportDetailVo is null"); } if (!report.isValidated()) { throw new DomainRuntimeException("DischargeReportDetailVo not validated"); } DomainFactory factory = getDomainFactory(); DischargeReportDetail doDischargeReportDetail = DischargeReportDetailVoAssembler.extractDischargeReportDetail(factory, report); factory.save(doDischargeReportDetail); return DischargeReportDetailVoAssembler.create(doDischargeReportDetail); }
public DischargeReportDetailVoCollection listDischargesInBatches(DomainFactory factory, String careContextIDs) { if (careContextIDs.length() > 0) { List domainObjectList = null; System.out.println("CareContext list ids : " + careContextIDs); domainObjectList = factory.find("select drd from DischargeReportDetail as drd left join drd.careContext as cc where cc.id in ( " + careContextIDs + " )",1100); System.out.println("Size of DischargeReportDetail list is " + domainObjectList.size()); return DischargeReportDetailVoAssembler.createDischargeReportDetailVoCollectionFromDischargeReportDetail(domainObjectList); } return null; }
public DischargeReportDetailVo saveDischargeReportDetail(DischargeReportDetailVo record, DischargeReadyToLeaveVo voReady, RTLSummaryVo rTLSummaryVo, PatientNoDiagInfoForCCVo patientNoDiagInfo) throws StaleObjectException { if (record != null) { if (!record.isValidated()) throw new DomainRuntimeException("PatientDocumentVo not validated"); } DomainFactory factory = getDomainFactory(); if (!record.getID_DischargeReportDetailIsNotNull()) { List<?> dischargeDetails = factory.find("select dd from DischargeReportDetail as dd left join dd.careContext as cc where cc.id = :idCareContext and dd.isRIE is null ", new String[]{"idCareContext"}, new Object[]{record.getCareContext().getID_CareContext()}); if (dischargeDetails != null && dischargeDetails.size()>0) { throw new StaleObjectException(null); } } DischargeReportDetail dom = DischargeReportDetailVoAssembler.extractDischargeReportDetail(factory, record); RTLSummary doRTLSummary = RTLSummaryVoAssembler.extractRTLSummary(factory, rTLSummaryVo); //WDEV-18622 factory.save(dom); factory.save(doRTLSummary); //WDEV-18622 //WDEV-18627 if (patientNoDiagInfo != null) { PatientNoDiagInfoForCC patientNoDiagInfoDo = PatientNoDiagInfoForCCVoAssembler.extractPatientNoDiagInfoForCC(factory, patientNoDiagInfo); factory.save(patientNoDiagInfoDo); } if (voReady != null) { ReadyToLeave domReady = DischargeReadyToLeaveVoAssembler.extractReadyToLeave(factory, voReady); factory.save(domReady); } return DischargeReportDetailVoAssembler.create(dom); }
public DischargeReportDetailVoCollection getSuppPatientDocuments() { List<CareContext> careContexts = new ArrayList<CareContext>(); String careContextIDs = ""; List domainObjectList = null; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" select dd.careContext from DischargeDetails dd where "); String andStr = " "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); hql.append(andStr + " dd.dischargeSupplementaryLetterStatus = :stat"); markers.add("stat"); values.add(getDomLookup(DischargeSupplementaryLetterStatus.REQUIRED)); andStr = " and "; List list = factory.find(hql.toString(), markers,values); if(list != null && !list.isEmpty()) { for (Iterator iter = list.iterator(); iter.hasNext();) { CareContext careContext = (CareContext) iter.next(); if (careContext != null) { if (careContextIDs != "") careContextIDs += " , "; careContexts.add(careContext); careContextIDs += careContext.getId(); } } } else return null; if (careContexts.size() > 0) { domainObjectList = factory.find("select drd from DischargeReportDetail as drd left join drd.careContext as cc where cc.id in ( " + careContextIDs + " )"); return DischargeReportDetailVoAssembler.createDischargeReportDetailVoCollectionFromDischargeReportDetail(domainObjectList); } return null; }
private void rollback(DischargeDetailsVo dischargeDetails, DischargeReportDetailVo report, PatientDocumentVo document, DocumentCategory category) throws ForeignKeyViolationException, StaleObjectException { DomainFactory factory = getDomainFactory(); DischargeDetails boDischarge = (DischargeDetails) factory.getDomainObject(DischargeDetails.class, dischargeDetails.getID_DischargeDetails()); dischargeDetails = DischargeDetailsVoAssembler.create(boDischarge); DischargeReportDetail boDischargeReport = (DischargeReportDetail) factory.getDomainObject(DischargeReportDetail.class, report.getID_DischargeReportDetail()); report = DischargeReportDetailVoAssembler.create(boDischargeReport); PatientDocumentVoCollection documents = report.getDischargeDocuments(); documents.remove(document); report.setDischargeDocuments(documents); if (category.equals(DocumentCategory.DISCHARGE_SUMMARY)) { dischargeDetails.setDischargeLetterStatus(DischargeLetterStatus.IN_PROGRESS); } else if (category.equals(DocumentCategory.DISCHARGE_SUPPLEMENTARY)) { dischargeDetails.setDischargeSupplementaryLetterStatus(DischargeSupplementaryLetterStatus.REQUIRED); } String[] str = dischargeDetails.validate(); if (str != null && str.length > 0) { LOG.error("DischargeDetailsVo is not validate"); return; } str = report.validate(); if (str != null && str.length > 0) { LOG.error("DischargeReportDetailsVo is not validate"); return; } dischargeDetails = saveDischargeDetails(dischargeDetails); report = saveDischargeReportDetail(report); try { deletePatientDocument(document); } catch(Exception e) { throw new StaleObjectException(null); } getDomainFactory().getTransaction().commit(); getDomainFactory().setTransaction(null); }