private void loadOrderInvestigations(boolean defaultToFirst)// WDEV-15894 { form.cmbInvestigation().clear(); OcsPathRadResultVoCollection collResults = domain.refreshOcsPathRadResultVo(form.getGlobalContext().OCRR.getSelectedInvs());//WDEV-15894 OcsPathRadResultVo item = null; if(collResults != null && collResults.size() > 0) { for(int i=0;i<collResults.size();i++) { item = collResults.get(i); form.cmbInvestigation().newRow(item, item.getDescription()); } } else throw new CodingRuntimeException("No Results passed to dialog"); //default selection to the first one if(defaultToFirst)// WDEV-15894 { form.cmbInvestigation().setValue(collResults.get(0)); cmbInvestigationChanged(); } }
private String getStatusText(OrderInvStatus ordInvStatus) { if(ordInvStatus == null || form.cmbInvestigation().getValue() == null) return null; OcsPathRadResultVo item = form.cmbInvestigation().getValue(); if(ConfigFlag.UI.ORDER_ENTRY_UI_TYPE.getValue().equals("CARE_UK") || ConfigFlag.UI.ORDER_ENTRY_UI_TYPE.getValue().equals("UKSH")) //WDEV-11881 { if(item.getCategoryIsNotNull()) { if(item.getCategory().equals(Category.CLINICALIMAGING)) { if(ordInvStatus.equals(ordInvStatus.ORDERED)) { return "Ready"; } } else ordInvStatus.getText(); } } return ordInvStatus.getText(); }
private void loadOrderInvestigations() { form.cmbInvestigation().clear(); OcsPathRadResultVoCollection collResults = form.getGlobalContext().OCRR.getSelectedInvsWithResults(); OcsPathRadResultVo item = null; if(collResults != null && collResults.size() > 0) { for(int i=0;i<collResults.size();i++) { item = collResults.get(i); form.cmbInvestigation().newRow(item.getOrderInvestigation(), item.getDescription()); } } else throw new CodingRuntimeException("No Results passed to dialog"); //default selection to the first one form.cmbInvestigation().setValue(collResults.get(0).getOrderInvestigation()); cmbInvestigationChanged(); }
private void viewResult() { OcsPathRadResultVo value = form.grdResults().getValue(); if (value == null) throw new CodingRuntimeException("grid selection is null"); // WDEV-17106 if(OrderInvStatus.COMPLETE.equals(value.getCurrentInvestigationStatus())) { form.getGlobalContext().OCRR.PathologyResults.setOrder(value.getOrderSummarySession()); // When populating the grid, patient in row value is PatientRef - so now we have to retrieve the PatientShort value.setPatient(domain.getPatient(value.getPatient())); form.getGlobalContext().Core.setPatientShort(value.getPatient()); engine.open(form.getForms().OCRR.OrderSummaryDialog); return; } form.getGlobalContext().OCRR.setCurrentPathRadResult(value); form.getGlobalContext().OCRR.setSelectedPathRadResults(getOrderInvestigationFromGrid());// WDEV-17106 engine.open(form.getForms().OCRR.ResultDialog, false); }
private OcsPathRadResultVo getCurrentInv() { //WDEV-11547 change this to return only invs that are resulted whther the child or parent is clicked on PathologyResultListShortVo resParent = (PathologyResultListShortVo) form.lyrMain().tabSearch().grdResults().getSelectedRow().getValue().getOrderInvestigation(); if (isResultedStatus(resParent.getOrdInvCurrentStatus().getOrdInvStatus())) return form.lyrMain().tabSearch().grdResults().getSelectedRow().getValue(); GenForm.lyrMainLayer.tabSearchContainer.grdResultsRowCollection rowColl = form.lyrMain().tabSearch().grdResults().getSelectedRow().getRows(); for (int i = 0; i < rowColl.size(); i++) { GenForm.lyrMainLayer.tabSearchContainer.grdResultsRow row = rowColl.get(i); PathologyResultListShortVo res = (PathologyResultListShortVo) row.getValue().getOrderInvestigation(); if (isResultedStatus(res.getOrdInvCurrentStatus().getOrdInvStatus())) return row.getValue(); } return null; //return form.lyrMain().tabSearch().grdResults().getValue(); }
public void removeComment(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException, ForeignKeyViolationException { if (result == null) throw new DomainRuntimeException("Can not remove comment from null parent."); if (Category.PATHOLOGY.equals(result.getCategory())) { removeComentFromOrderSpecimen(result, comment); return; } if (Category.CLINICALIMAGING.equals(result.getCategory())) { removeCommentFromOrderInvestigation(result, comment); return; } return; }
private void removeCommentFromOrderInvestigation(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException, ForeignKeyViolationException { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) throw new DomainRuntimeException("Can not remove comment from null parent."); if (comment == null || !comment.getID_ResultConclusionAndActionCommentIsNotNull()) throw new DomainRuntimeException("Can not remove unsaved comment."); DomainFactory factory = getDomainFactory(); // Extract comment domain object ResultConclusionAndActionComment domComment = (ResultConclusionAndActionComment) factory.getDomainObject(ResultConclusionAndActionComment.class, comment.getID_ResultConclusionAndActionComment()); // Check for stale comment (deleted or edited) if (domComment == null || domComment.getVersion() > comment.getVersion_ResultConclusionAndActionComment()) throw new StaleObjectException(domComment); OrderInvestigation domOrderInv = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, result.getOrderInvestigation().getID_OrderInvestigation()); // Remove comment from order investigation comments domOrderInv.getResultConclusionComments().remove(domComment); factory.delete(domComment); factory.save(domOrderInv); return; }
private boolean hasCheckedInvestigation() { ArrayList<OcsPathRadResultVo> values = form.cmbInvestigation().getValues(); if (values == null || values.size() == 0) return false; for (OcsPathRadResultVo item : values) { if (OrderInvStatus.CHECKED.equals(item.getCurrentInvestigationStatus())) return true; } return false; }
private void cmbInvestigationChanged() { if(form.cmbInvestigation().getValue() != null) { OcsPathRadResultVo item = form.cmbInvestigation().getValue(); OrderedInvestigationStatusVoCollection collStatus = domain.listStatusHistory(item.getOrderInvestigation()); collStatus.sort(SortOrder.DESCENDING); populateGridFromData(collStatus); } else form.grdHistory().getRows().clear(); }
private void resetResultStatusToNew(OcsPathRadResultVo selectedInv) { ArrayList<OcsPathRadResultVo> values = form.cmbInvestigation().getValues(); if (values == null || values.size() == 0) return; OrderInvestigationRefVoCollection investigations = new OrderInvestigationRefVoCollection(); for (OcsPathRadResultVo item : values) { if (item.getOrderInvestigation() != null && OrderInvStatus.CHECKED.equals(item.getCurrentInvestigationStatus())) investigations.add(item.getOrderInvestigation()); } try { domain.resetResultStatusToNew(investigations); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); } loadOrderInvestigations(false); form.cmbInvestigation().setValue(selectedInv); cmbInvestigationChanged(); updateControlsState(); }
private void viewResult() { OcsPathRadResultVo value = form.grdResults().getValue(); if (value == null) throw new CodingRuntimeException("grid selection is null"); form.getGlobalContext().OCRR.setCurrentPathRadResult(value); form.getGlobalContext().OCRR.setSelectedPathRadResults(form.grdResults().getValues()); engine.open(form.getForms().OCRR.ResultDialog, false); }
private void displayCumulateResults() { OcsPathRadResultVo currRep = form.getGlobalContext().OCRR.getCurrentPathRadResult(); if(currRep == null) return; if(currRep.getCategoryIsNotNull()) { if (currRep.getCategory().equals(Category.PATHOLOGY)) { PathologySpecimenVo specimen = domain.getSpecimen(form.getGlobalContext().OCRR.getCurrentPathRadResult().getOrderInvestigation()); if(specimen != null && specimen.getOrderIsNotNull())//WDEV-16463 { form.getGlobalContext().Core.setSecondPatientShort(specimen.getOrder().getPatient()); } } else if (currRep.getCategory().equals(Category.CLINICALIMAGING)) { ClinicalImagingResultVo radRes = domain.getClinicalImagingResult(form.getGlobalContext().OCRR.getCurrentPathRadResult().getOrderInvestigation()); if(radRes != null && radRes.getOrderDetailsIsNotNull())//WDEV-16463 { form.getGlobalContext().Core.setSecondPatientShort(radRes.getOrderDetails().getPatient()); } } } form.getGlobalContext().OCRR.setCumulateAnalytes(form.getLocalContext().getAnalytes()); if(form.getGlobalContext().OCRR.getCurrentPathRadResult() != null) { form.getGlobalContext().OCRR.setOrderInvestigationReference(form.getGlobalContext().OCRR.getCurrentPathRadResult().getOrderInvestigation()); } engine.open(form.getForms().OCRR.CumulateResults); }
public ResultCommentsVoCollection listComments(OcsPathRadResultVo result) { if (result == null) return null; if (Category.PATHOLOGY.equals(result.getCategory())) return listCommentsFromOrderSpeciment(result); if (Category.CLINICALIMAGING.equals(result.getCategory()) || Category.CLINICAL.equals(result.getCategory())) //WDEV-16643 return listCommentsFromOrderInvestigation(result); return null; }
private ResultCommentsVoCollection listCommentsFromOrderInvestigation(OcsPathRadResultVo result) { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) return null; StringBuilder query = new StringBuilder(); query.append("SELECT comm FROM OrderInvestigation AS inv LEFT JOIN inv.resultConclusionComments AS comm "); query.append("WHERE inv.id = :INV_ID"); query.append(" order by comm.authoringInformation.authoringDateTime desc"); //WDEV-14077 return ResultCommentsVoAssembler.createResultCommentsVoCollectionFromResultConclusionAndActionComment(getDomainFactory().find(query.toString(), "INV_ID", result.getOrderInvestigation().getID_OrderInvestigation())); }
private ResultCommentsVoCollection listCommentsFromOrderSpeciment(OcsPathRadResultVo result) { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) return null; StringBuilder query = new StringBuilder(); query.append("SELECT comm FROM OrderInvestigation AS inv LEFT JOIN inv.specimen AS spec LEFT JOIN spec.resultConclusionComments AS comm "); query.append("WHERE inv.id = :INV_ID"); query.append(" order by comm.authoringInformation.authoringDateTime desc"); //WDEV-14077 return ResultCommentsVoAssembler.createResultCommentsVoCollectionFromResultConclusionAndActionComment(getDomainFactory().find(query.toString(), "INV_ID", result.getOrderInvestigation().getID_OrderInvestigation())); }
@SuppressWarnings("unchecked") private ResultCommentsVo saveNewCommentToOrderInvestigation(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) throw new DomainRuntimeException("Can not add comment to null parent."); if (comment == null) throw new DomainRuntimeException("Can not save null comment record."); if (!comment.isValidated()) throw new DomainRuntimeException("Comment record is not validated."); DomainFactory factory = getDomainFactory(); // Extract comment domain object ResultConclusionAndActionComment domainComment = ResultCommentsVoAssembler.extractResultConclusionAndActionComment(factory, comment); // Commit comment to data base factory.save(domainComment); // Get order investigation from data base OrderInvestigation domOrderInvestigation = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, result.getOrderInvestigation().getID_OrderInvestigation()); domOrderInvestigation.getResultConclusionComments().add(domainComment); factory.save(domOrderInvestigation); // Return saved comment return ResultCommentsVoAssembler.create(domainComment); }
@SuppressWarnings("unchecked") private ResultCommentsVo saveNewCommentToOrderSpecimen(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) throw new DomainRuntimeException("Can not add comment to null parent"); if (comment == null) throw new DomainRuntimeException("Can not save null comment record."); if (!comment.isValidated()) throw new DomainRuntimeException("Comment record is not validated"); DomainFactory factory = getDomainFactory(); // Extract comment domain object ResultConclusionAndActionComment domComment = ResultCommentsVoAssembler.extractResultConclusionAndActionComment(factory, comment); // Commit comment to data base factory.save(domComment); // Get order investigation from data base OrderInvestigation domOrderInvestigation = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, result.getOrderInvestigation().getID_OrderInvestigation()); // Get specimen domain object OrderSpecimen domSpecimen = (OrderSpecimen) domOrderInvestigation.getSpecimen().get(0); domSpecimen.getResultConclusionComments().add(domComment); factory.save(domSpecimen); // Return saved comment return ResultCommentsVoAssembler.create(domComment); }
private void removeComentFromOrderSpecimen(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException, ForeignKeyViolationException { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) throw new DomainRuntimeException("Can not remove comment from null parent."); if (comment == null || !comment.getID_ResultConclusionAndActionCommentIsNotNull()) throw new DomainRuntimeException("Can not remove unsaved comment."); DomainFactory factory = getDomainFactory(); // Extract comment domain object ResultConclusionAndActionComment domComment = (ResultConclusionAndActionComment) factory.getDomainObject(ResultConclusionAndActionComment.class, comment.getID_ResultConclusionAndActionComment()); // Check for stale comment (deleted or edited) if (domComment == null || domComment.getVersion() > comment.getVersion_ResultConclusionAndActionComment()) throw new StaleObjectException(domComment); OrderInvestigation domOrderInv = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, result.getOrderInvestigation().getID_OrderInvestigation()); OrderSpecimen domSpecimen = (OrderSpecimen) domOrderInv.getSpecimen().get(0); // Remove comment from order investigation comments domSpecimen.getResultConclusionComments().remove(domComment); factory.delete(domComment); factory.save(domOrderInv); return; }