private void addAttendanceStatusRowToGrid(TrackingAttendanceStatusForEventHistoryVo trackingAttendanceStatusForEventHistoryVo) { grdPatientStatusTimesRow newrow = form.grdPatientStatusTimes().getRows().newRow(); if (trackingAttendanceStatusForEventHistoryVo.getStatusIsNotNull()) { newrow.setColStatus(trackingAttendanceStatusForEventHistoryVo.getStatus().getText()); } if (trackingAttendanceStatusForEventHistoryVo.getStatusDatetimeIsNotNull()) { newrow.setColTime(trackingAttendanceStatusForEventHistoryVo.getStatusDatetime().toString()); } if (trackingAttendanceStatusForEventHistoryVo.getTrackingAreaIsNotNull()) { newrow.setColTrackingArea(trackingAttendanceStatusForEventHistoryVo.getTrackingArea().getAreaDisplayName()); } }
public void saveTrackingAndRIECurrentStatus(TrackingRefVo tracking, TrackingAttendanceStatusForEventHistoryVo status, FormName formName, PatientRefVo patient, CareContextRefVo careContext, String rieComment) throws StaleObjectException { if(tracking == null || tracking.getID_Tracking() == null) return; DomainFactory factory = getDomainFactory(); String query = "select attendanceStatus from TrackingAttendanceStatus as attendanceStatus left join attendanceStatus.attendance as contextID where contextID.id = :ContextID and attendanceStatus.id <> :CurrentStatus and (attendanceStatus.isRIE is null or attendanceStatus.isRIE = 0) order by attendanceStatus.systemInformation.creationDateTime desc"; TrackingAttendanceStatus prevStatus = (TrackingAttendanceStatus) factory.findFirst(query, new String[] {"ContextID", "CurrentStatus"}, new Object[] {careContext.getID_CareContext(), status.getID_TrackingAttendanceStatus()}); if(prevStatus != null) { Tracking doTracking = (Tracking) factory.getDomainObject(Tracking.class, tracking.getID_Tracking()); doTracking.setCurrentStatus(prevStatus); factory.save(doTracking); markAsRie(status, formName, (patient != null ? patient.getID_Patient() : null), null , (careContext != null ? careContext.getID_CareContext() : null), rieComment); } }
private void addAttendanceStatusRowToGrid(TrackingAttendanceStatusForEventHistoryVo trackingAttendanceStatusForEventHistoryVo) { if(trackingAttendanceStatusForEventHistoryVo == null) return; grdPatientStatusRow newrow = form.ctnTimes().grdPatientStatus().getRows().newRow(); if(isCurrentStatus(trackingAttendanceStatusForEventHistoryVo)) { newrow.setBackColor(Color.Beige); } if (trackingAttendanceStatusForEventHistoryVo.getStatusIsNotNull()) { newrow.setColStatus(trackingAttendanceStatusForEventHistoryVo.getStatus().getText()); } if (trackingAttendanceStatusForEventHistoryVo.getStatusDatetimeIsNotNull()) { newrow.setColTime(trackingAttendanceStatusForEventHistoryVo.getStatusDatetime().toString()); } if (trackingAttendanceStatusForEventHistoryVo.getTrackingAreaIsNotNull()) { newrow.setColTrackingArea(trackingAttendanceStatusForEventHistoryVo.getTrackingArea().getAreaDisplayName()); } newrow.setValue(trackingAttendanceStatusForEventHistoryVo); }
private boolean isCurrentStatus(TrackingAttendanceStatusForEventHistoryVo trackingAttendanceStatusForEventHistoryVo) { if(trackingAttendanceStatusForEventHistoryVo == null) return false; return form.getLocalContext().getTracking() != null && form.getLocalContext().getTracking().getCurrentStatus() != null && form.getLocalContext().getTracking().getCurrentStatus().getID_TrackingAttendanceStatus().equals(trackingAttendanceStatusForEventHistoryVo.getID_TrackingAttendanceStatus()); }
private void populateScreenFromData(TrackingAttendanceStatusForEventHistoryVo currentRecord) { clearScreen(); if(currentRecord == null) return; form.txtTrackingArea().setValue(currentRecord.getTrackingArea().getAreaDisplayName()); form.txtPatientStatus().setValue(currentRecord.getStatus().getText()); form.dtimStatus().setValue(currentRecord.getStatusDatetime()); }
private boolean save() { TrackingAttendanceStatusForEventHistoryVo 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 TrackingAttendanceStatusForEventHistoryVo populateDataFromScreen(TrackingAttendanceStatusForEventHistoryVo currentRecord) { if(currentRecord == null) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); engine.close(DialogResult.ABORT); } currentRecord.setStatusDatetime(form.dtimStatus().getValue()); return currentRecord; }