public ims.emergency.vo.EDTransferVo saveEDTransfer(EDTransferVo record, EDPartialAdmissionVo partialadmis) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if(record == null) throw new CodingRuntimeException("Cannot save a null EDTransfer record."); DomainFactory factory = getDomainFactory(); EDTransfer doEDTransfer = EDTransferVoAssembler.extractEDTransfer(factory, record); factory.save(doEDTransfer); if( partialadmis != null ) { partialadmis.setAllocatedStatus(AllocationStatus.CANCELLED_ADMISSION); EDPartialAdmission doEDPartialAdmission = EDPartialAdmissionVoAssembler.extractEDPartialAdmission(factory, partialadmis); factory.save(doEDPartialAdmission); } return EDTransferVoAssembler.create(doEDTransfer); }
private void addTransferTimeRowToGrid(EDTransferVo edTransferVo) { if(edTransferVo == null) return; grdTransferRow newrow = form.ctnTimes().grdTransfer().getRows().newRow(); newrow.setColHospital(getTransfer(edTransferVo)); if (edTransferVo.getReferredBy() != null) { newrow.setColReferredBy(edTransferVo.getReferredBy().getIMosName()); } if(edTransferVo.getReferredDateTime() != null) { newrow.setColReferredDate(edTransferVo.getReferredDateTime().toString()); } if(edTransferVo.getAcceptedDateTime() != null) { newrow.setColAcceptedDate(edTransferVo.getAcceptedDateTime().toString()); } newrow.setValue(edTransferVo); }
private void populateInstanceControls(EDTransferVo edTrVo) { if(edTrVo == null) { clearScreen(); return; } form.dtimReferredDateTime().setValue(edTrVo.getReferredDateTime()); form.dtimAcceptedDateTime().setValue(edTrVo.getAcceptedDateTime()); form.cmbHospital().setValue(edTrVo.getToHospital()); form.cmbTransferEscort().setValue(edTrVo.getTransferEscort()); form.cmbTransferMode().setValue(edTrVo.getTransferMode()); form.txtComment().setValue(edTrVo.getComment()); form.txtOtherHospital().setValue(edTrVo.getOtherHospital()); form.ccRefferedBy().setValue(edTrVo.getReferredBy()); }
public EDTransferVo getUncompletedTransferByCareContext(Integer careContextID) { if (careContextID == null) { throw new CodingRuntimeException("Cannot get SeenByHCPVoCollection on null Id for CareContext "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select transfers from EDTransfer as transfers where transfers.attendance.id = :attID and transfers.acceptedDateTime is null and (transfers.notAccepted is null or transfers.notAccepted = 0) order by transfers.referredDateTime desc "); List<?> list = factory.find(hql.toString(), new String[] { "attID" }, new Object[] { careContextID }); if (list!=null && list.size()>0) return EDTransferVoAssembler.create((EDTransfer) list.get(0)); return null; }
private void populateScreenFromData( ims.emergency.vo.EDTransferVo edTrVo) { if( edTrVo == null ) return; form.dtimReferredDateTime().setValue(edTrVo.getReferredDateTime()); form.dtimAcceptedDateTime().setValue(edTrVo.getAcceptedDateTime()); form.cmbHospital().setValue(edTrVo.getToHospital()); form.cmbTransferEscort().setValue(edTrVo.getTransferEscort()); form.cmbTransferMode().setValue(edTrVo.getTransferMode()); form.txtComment().setValue(edTrVo.getComment()); form.txtOtherHospital().setValue(edTrVo.getOtherHospital()); }
private EDTransferVo assembleEDtransfer(EDTransfer item) { if(item != null) { //DomainFactory factory = getDomainFactory(); //return EDTransferVoAssembler.create((EDTransfer) factory.getDomainObject(EDTransfer.class, item.getId())); return EDTransferVoAssembler.create(item); } return null; }
public ims.emergency.vo.EDTransferVo getEDTransferVo(ims.emergency.vo.EDTransferRefVo edTransferRef) { if(edTransferRef == null || edTransferRef.getID_EDTransfer() == null) throw new CodingRuntimeException("Cannnot get EDTransferRefVo for a null Id."); return EDTransferVoAssembler.create((EDTransfer) getDomainFactory().getDomainObject(EDTransfer.class, edTransferRef.getID_EDTransfer())); }
private String getTransfer(EDTransferVo edTransferVo) { if(edTransferVo == null) return null; if(edTransferVo.getToHospital() != null && !TransferToHospital.OTHER.equals(edTransferVo.getToHospital())) return edTransferVo.getToHospital().getText(); if(edTransferVo.getOtherHospital() != null) return edTransferVo.getOtherHospital(); return null; }
private void populateScreenFromData(EDTransferVo edTransferVo) { clearScreen(); if(edTransferVo == null) return; form.txtHospital().setValue(getTransfer(edTransferVo)); form.txtReferredBy().setValue(edTransferVo.getReferredBy() != null ? edTransferVo.getReferredBy().getIMosName() : null); form.dtimReferred().setValue(edTransferVo.getReferredDateTime()); form.dtimAccepted().setValue(edTransferVo.getAcceptedDateTime()); }
private boolean save() { EDTransferVo record = populateDataFromScreen(form.getLocalContext().getCurrentRecord()); String[] errors = validateUIRules(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } errors = record.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { domain.save(record); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); engine.close(DialogResult.ABORT); return false; } return true; }
private EDTransferVo populateDataFromScreen(EDTransferVo currentRecord) { if(currentRecord == null) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); engine.close(DialogResult.ABORT); } currentRecord.setReferredDateTime(form.dtimReferred().getValue()); currentRecord.setAcceptedDateTime(form.dtimAccepted().getValue()); return currentRecord; }
private void populateRecordBrowser() { form.recbrTransfers().clear(); EDTransferVoCollection allTransfersForAttendanceCollection = domain.getAllTransfersForTheSelectedAttendance(form.getGlobalContext().Core.getCurrentCareContext().getID_CareContext()); if (allTransfersForAttendanceCollection == null || allTransfersForAttendanceCollection.size() == 0) { return; } for (int i = 0; i < allTransfersForAttendanceCollection.size(); i++) { EDTransferVo transfer = allTransfersForAttendanceCollection.get(i); if (transfer == null) return; String text = getTextDisplay(transfer); if (i==0) { form.recbrTransfers().newRow(i, transfer, text, Color.Green); } else { form.recbrTransfers().newRow(i, transfer, text); } form.recbrTransfers().setValue(transfer); } if (allTransfersForAttendanceCollection.size() > 0 && form.getLocalContext().getlcSelectedEDTransferRecord() == null) { form.getLocalContext().setlcSelectedEDTransferRecord(allTransfersForAttendanceCollection.get(0)); } form.recbrTransfers().setValue(form.getLocalContext().getlcSelectedEDTransferRecord()); }
private String getTextDisplay(EDTransferVo transfer) { if (transfer == null) return null; StringBuffer text = new StringBuffer(); if (transfer.getReferredDateTimeIsNotNull()) { text.append("Date/Time Referred: " + transfer.getReferredDateTime().toString()); } if (transfer.getReferredBy() != null && transfer.getReferredBy().getName()!=null) { text.append(" - "); text.append(transfer.getReferredBy().getName()); } if (transfer.getToHospitalIsNotNull() && !TransferToHospital.OTHER.equals(transfer.getToHospital())) { text.append(" - "); text.append(transfer.getToHospital().getText()); } else if ((transfer.getToHospitalIsNotNull() && TransferToHospital.OTHER.equals(transfer.getToHospital()))) { text.append(" - "); text.append(transfer.getOtherHospital()); } return text.length() > 0 ? text.toString() : null; }
private Boolean isNewTransfer(EDTransferVo currentTransferRecord) { if (currentTransferRecord == null) return true; else if (currentTransferRecord != null && (currentTransferRecord.getAcceptedDateTimeIsNotNull() || Boolean.TRUE.equals(currentTransferRecord.getNotAccepted()))) return true; return false; }
public ims.emergency.vo.EDTransferVo saveEDTransfer(EDTransferVo record, TrackingForTransferVo trackingRecord, EDTransferVo previousRecord, ReferralToSpecialtyTeamVo referralToSpecialty) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if(record == null && trackingRecord == null) throw new CodingRuntimeException("Cannot save a null EDTransfer / Tracking / Partial Admission record."); DomainFactory factory = getDomainFactory(); EDTransfer doEDTransfer = null; if (referralToSpecialty!=null) { ReferralToSpecTeam domainReferralToSpecialtyToBeSaved = ReferralToSpecialtyTeamVoAssembler.extractReferralToSpecTeam(factory, referralToSpecialty); factory.save(domainReferralToSpecialtyToBeSaved); trackingRecord.setCurrentReferral(null); Tracking doTracking = TrackingForTransferVoAssembler.extractTracking(factory, trackingRecord); factory.save(doTracking); trackingRecord = TrackingForTransferVoAssembler.create(doTracking); trackingRecord.validate(); } if (previousRecord != null) { EDTransfer prevRecord = EDTransferVoAssembler.extractEDTransfer(factory, previousRecord); prevRecord.setNotAccepted(true); factory.save(prevRecord); } if (trackingRecord != null ) { if (!trackingRecord.isValidated()) throw new DomainRuntimeException("TrackingForTransferVo Not Validated."); Tracking trackingForTransfer =TrackingForTransferVoAssembler.extractTracking(factory, trackingRecord); factory.save(trackingForTransfer); TrackingForTransferVo tracking = TrackingForTransferVoAssembler.create(trackingForTransfer); if(tracking != null) return tracking.getCurrentTransferRecord(); } if (record != null ) { if (!record.isValidated()) throw new DomainRuntimeException("EDTransferVo Not Validated."); doEDTransfer = EDTransferVoAssembler.extractEDTransfer(factory, record); factory.save(doEDTransfer); return EDTransferVoAssembler.create(doEDTransfer); } return null; }