private boolean unallocateCubicle() { TrackingForAllocateCubicleVo tracking = null; form.getLocalContext().setCurrentTracking(domain.getTracking(form.getGlobalContext().Emergency.getTracking())); if(form.getLocalContext().getCurrentTracking()!= null && form.getLocalContext().getCurrentTracking().getCurrentCubicleIsNotNull()) { tracking = form.getLocalContext().getCurrentTracking(); tracking.setCurrentCubicle(null); } try { form.getLocalContext().setCurrentCubicleAllocation(domain.saveCubicleAllocation(null, tracking)); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getLocalContext().setCurrentCubicleAllocation(null); open(); return false; } return true; }
public TrackingForAllocateCubicleVo getTracking(TrackingRefVo trackingRef) { if( trackingRef == null) throw new CodingRuntimeException("Tracking not provided"); DomainFactory factory = getDomainFactory(); ims.emergency.domain.objects.Tracking doTracking = (ims.emergency.domain.objects.Tracking) factory.getDomainObject(ims.emergency.domain.objects.Tracking.class, trackingRef.getID_Tracking()); return TrackingForAllocateCubicleVoAssembler.create(doTracking); }
private boolean markAsRIE() { if (form.recbrAllocateCubicle().getValue() == null) return false; if (domain.isStale(form.recbrAllocateCubicle().getValue())) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getLocalContext().setCurrentCubicleAllocation(null); open(); return false; } TrackingForAllocateCubicleVo tracking = null; form.getLocalContext().setCurrentTracking(domain.getTracking(form.getGlobalContext().Emergency.getTracking())); if(form.getLocalContext().getCurrentTracking() != null && form.recbrAllocateCubicle().getValue().equals(form.getLocalContext().getCurrentTracking().getCurrentCubicle())) { tracking = form.getLocalContext().getCurrentTracking(); tracking.setCurrentCubicle(null); } try { domain.markCubicleAsRIEAndSaveTracking(form.recbrAllocateCubicle().getValue(), tracking, engine.getFormName(), form.getGlobalContext().Core.getPatientShort() != null ? form.getGlobalContext().Core.getPatientShort().getID_Patient() : null, form.getGlobalContext().Core.getCurrentCareContext() != null ? form.getGlobalContext().Core.getCurrentCareContext().getID_CareContext() : null, form.getGlobalContext().Core.getRieMessage()); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getLocalContext().setCurrentCubicleAllocation(null); open(); return false; } return true; }
public void markCubicleAsRIEAndSaveTracking(CubicleAllocationShortVo cubicle, TrackingForAllocateCubicleVo tracking, FormName formName, Integer patientId, Integer careContextId, String rieMessage) throws StaleObjectException { if(cubicle == null) throw new CodingRuntimeException("Cannot RIE a null CubicleAllocationShortVo."); markAsRie(cubicle, formName, patientId, null, careContextId, rieMessage); if(tracking != null) { DomainFactory factory = getDomainFactory(); factory.save(TrackingForAllocateCubicleVoAssembler.extractTracking(factory, tracking)); } }
private boolean save() { TrackingForAllocateCubicleVo trackinrecord = null; String[] uiErrors = getUiErrors(); if (uiErrors != null) { engine.showErrors(uiErrors); return false; } CubicleAllocationVo record = populateDataFromScreen(form.getLocalContext().getCurrentCubicleAllocation()); String[] errors = record.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } //verify if is new record and the patient is in ED if( record.getID_CubicleAllocation() == null && form.getLocalContext().getCurrentTrackingIsNotNull() && !Boolean.TRUE.equals(form.getLocalContext().getCurrentTracking().getIsDischarged())) { trackinrecord = form.getLocalContext().getCurrentTracking(); trackinrecord.setCurrentCubicle(record); errors = trackinrecord.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } } //WDEV-17469 -> verify if Cubicle was removed from configuration by another user TrackingAreaCubiclesVo cubicles = domain.getTrackingAreaCubicles(form.getLocalContext().getCurrentTracking().getCurrentArea()); if (cubicles != null && cubicles.getCubiclesRoomsBeds() != null && (! cubicles.getCubiclesRoomsBeds().contains(form.cmbCubicle().getValue()))) { engine.showMessage("Selected Cubicle/Room/Bed was removed from Configuration. Please select another."); return false; } try { if( trackinrecord != null) record = domain.saveCubicleAllocation(null,trackinrecord); else record = domain.saveCubicleAllocation(record,null); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); if( form.getGlobalContext().Emergency.getTracking() != null) form.getLocalContext().setCurrentTracking(domain.getTracking(form.getGlobalContext().Emergency.getTracking())); } form.getLocalContext().setCurrentCubicleAllocation(record); return true; }
public ims.emergency.vo.CubicleAllocationVo saveCubicleAllocation(CubicleAllocationVo record, TrackingForAllocateCubicleVo tracking) throws ims.domain.exceptions.StaleObjectException { if( record == null && tracking == null) throw new CodingRuntimeException("CubicleAllocation not provided and TrackingForAllocateCubicleVo not provided"); DomainFactory factory = getDomainFactory(); if( record != null) { CubicleAllocation doCubicleAllocation = CubicleAllocationVoAssembler.extractCubicleAllocation(factory, record); factory.save(doCubicleAllocation); return CubicleAllocationVoAssembler.create(doCubicleAllocation); } else if( tracking != null) { ims.emergency.domain.objects.Tracking doTracking = TrackingForAllocateCubicleVoAssembler.extractTracking(factory, tracking); factory.save(doTracking); TrackingForAllocateCubicleVo track = TrackingForAllocateCubicleVoAssembler.create(doTracking); if( track != null) return track.getCurrentCubicle(); } return null; }