protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException { initialiseGrid(); //WDEV-3121 printing automatically Radiology Orders that have a default printer and are not printed locally if(form.getGlobalContext().OCRR.PrintOrder.getExecuteAutomaticPrintIsNotNull() && form.getGlobalContext().OCRR.PrintOrder.getExecuteAutomaticPrint().booleanValue()) { if(printAutomatically()) { engine.close(DialogResult.OK); return; } else form.getGlobalContext().OCRR.PrintOrder.setExecuteAutomaticPrint(Boolean.FALSE); } //standard print processing form.lblNoPrinter1().setVisible(false); OcsOrderSummaryVo voOrderSummary = domain.getOrderSummary(form.getGlobalContext().OCRR.PathologyResults.getOrder()); populateSpecimens(voOrderSummary.getSpecimens()); populateDFTInvestigations(voOrderSummary.getInvestigations()); populateInvestigations(voOrderSummary.getInvestigations()); }
/** * WDEV-13999 * Function used to determine if the order can be amended * This works of analysing the local context value */ private boolean canOrderBeAmmended() { if (form.getLocalContext().getOrderSummary() == null) return false; OcsOrderSummaryVo orderSummary = form.getLocalContext().getOrderSummary(); if (orderSummary.getInvestigations() == null) return false; for (OrderInvestigationListVo investigation : orderSummary.getInvestigations()) { if (investigation.getOrdInvCurrentStatusIsNotNull() && OrderInvStatus.REJECTED.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus())) return true; } return false; }
private void populateOrderSummary(OcsOrderSummaryVo voOrderSummary) { form.getGlobalContext().OCRR.setSelectedInvs(null); form.getLocalContext().setOrderSummary(voOrderSummary); if(voOrderSummary == null) return; if (voOrderSummary.getSpecimens() == null || voOrderSummary.getSpecimens().size() == 0) { populateOrderDetails(domain.getOrderDetails(form.getGlobalContext().OCRR.PathologyResults.getOrder())); } else { PathologySpecimenVo voPathologySpecimen = voOrderSummary.getSpecimens().get(0); populateOrderDetails(voPathologySpecimen.getOrder()); populateSpecimens(voOrderSummary.getSpecimens()); cleanUpInvsGrid(); } populateInvestigations(voOrderSummary.getInvestigations()); }
private boolean isCancelled(OcsOrderSummaryVo orderSummary) { if (orderSummary == null || orderSummary.getInvestigations() == null) return false; for (OrderInvestigationListVo investigation : orderSummary.getInvestigations()) { if (!OrderInvStatus.CANCEL_REQUEST.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus()) && !OrderInvStatus.CANCELLED.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus())) return false; } return true; }
/** * Function used to determine if the oder can be authorised * This works of analysing the local context value for the order */ private boolean canOrderBeAuthorized() { OcsOrderSummaryVo orderSummary = form.getLocalContext().getOrderSummary(); if (orderSummary == null || orderSummary.getInvestigations() == null) return false; // Check order status - not to be cancelled int ordersAwaitingAuthorization = 0; for (OrderInvestigationListVo investigation : orderSummary.getInvestigations()) { if (investigation.getOrdInvCurrentStatus() != null && OrderInvStatus.AWAITING_AUTHORISATION.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus())) ordersAwaitingAuthorization++; if (Category.PATHOLOGY.equals(investigation.getInvestigation().getInvestigationIndex().getCategory()) && !engine.hasRight(AppRight.CAN_AUTHORIZE_PATHOLOGY_ORDERS) && investigation.getOrdInvCurrentStatus() != null && OrderInvStatus.AWAITING_AUTHORISATION.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus())) return false; if (Category.CLINICALIMAGING.equals(investigation.getInvestigation().getInvestigationIndex().getCategory()) && !engine.hasRight(AppRight.CAN_AUTHORIZE_CLINICAL_IMAGING_ORDERS) && investigation.getOrdInvCurrentStatus() != null && OrderInvStatus.AWAITING_AUTHORISATION.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus())) return false; } if (ordersAwaitingAuthorization == 0) return false; if (engine.hasRight(AppRight.CAN_AUTHORIZE_CLINICAL_IMAGING_ORDERS) && engine.hasRight(AppRight.CAN_AUTHORIZE_PATHOLOGY_ORDERS)) return true; return false; }
private boolean doesOrderedInvestigationExist() { if(form.getLocalContext().getOrderSummaryIsNotNull()) { OcsOrderSummaryVo voOrderSummary = form.getLocalContext().getOrderSummary(); if(voOrderSummary.getInvestigationsIsNotNull()) { for(OrderInvestigationListVo investigation : voOrderSummary.getInvestigations()) { if(investigation.getOrdInvCurrentStatusIsNotNull() && investigation.getOrdInvCurrentStatus().getOrdInvStatusIsNotNull()) { boolean invSentRadiologyFromSchedulingService = (Category.CLINICALIMAGING.equals(investigation.getInvestigation().getInvestigationIndex().getCategory()) && !isInvestigationCompletedOrResulted(investigation)) && !isCancelledOrCancelRequested(investigation) && canBeScheduled(investigation); if(investigation.getOrdInvCurrentStatus().getOrdInvStatus().equals(OrderInvStatus.AWAITING_AUTHORISATION) || investigation.getOrdInvCurrentStatus().getOrdInvStatus().equals(OrderInvStatus.ORDERED) || investigation.getOrdInvCurrentStatus().getOrdInvStatus().equals(OrderInvStatus.ORDERED_AWAITING_APPT) || invSentRadiologyFromSchedulingService) { if(investigation.getPassesSecurity() == null || (investigation.getPassesSecurityIsNotNull() && investigation.getPassesSecurity())) return true; } } } } } return false; }
private void open() { clearAllControls(); populateDemographics(); OcsOrderSummaryVo orderSummary = domain.getOrderSummary(form.getGlobalContext().OCRR.PathologyResults.getOrder()); //WDEV-11080 orderSummary = enforceSecurity(orderSummary); populateOrderSummary(orderSummary); form.getGlobalContext().OCRR.setQuestionsNotes(orderSummary); updateControlsState(); }
public OcsOrderSummaryVo getOrderSummary(OcsOrderSessionRefVo voOcsOrderRef) //WDEV-16232 { if(voOcsOrderRef == null || voOcsOrderRef.getID_OcsOrderSession() == null)//WDEV-16232 throw new DomainRuntimeException("Order ref is null"); OcsOrderSession doOcsOrder = (OcsOrderSession) getDomainFactory().getDomainObject(voOcsOrderRef);//WDEV-16232 OcsOrderSummaryVo voOcsOrder = OcsOrderSummaryVoAssembler.create(doOcsOrder); //WDEV-12054 HashMap map = new HashMap(); List results = new ArrayList(doOcsOrder.getInvestigations()); //convert set to list ClinicalImagingResults impl = (ClinicalImagingResults) getDomainImpl(ClinicalImagingResultsImpl.class); map = impl.getListXoHistory(map, results); OrderInvestigationListVoCollection voCollInvs = OrderInvestigationListVoAssembler.createOrderInvestigationListVoCollectionFromOrderInvestigation(results); if(voCollInvs != null) { for(OrderInvestigationListVo voResult : voCollInvs) { if(map.containsKey(voResult.getID_OrderInvestigation())) { voResult.setOrdInvXOStatusHistory((OrdInvXOStatusHistoryLiteVoCollection) map.get(voResult.getID_OrderInvestigation())); } } } voOcsOrder.setInvestigations(voCollInvs); return voOcsOrder; }
/** * If there are items to be printed automatically print them and then close the dialog * otherwise continue on and allow printing of the rest of the investigations * @return bRecordsPrinted */ private boolean printAutomatically() { int iRecordsProcessed = 0; String[] radiologyReport = domain.getSystemReportAndTemplateByReporMapping(Category.CLINICALIMAGING.getID(), null, null); if(radiologyReport == null || radiologyReport.length < 2) { engine.showMessage("I could not get the Radiology report and template! Please set the taxonomy mapping of type REPORT for Category.CLINICALIMAGING lookup instance with the relevant report Id."); return false; } if(radiologyReport[0] == null || radiologyReport[1] == null) { engine.showMessage("The Radiology report has not been deployed !"); return false; } //To facilitate grouping OrderInvestigations by Provider Service ArrayList<ProviderServiceInvestigations> provServiceInvs = new ArrayList<ProviderServiceInvestigations>(); OcsOrderSummaryVo voOrderSummary = domain.getOrderSummary(form.getGlobalContext().OCRR.PathologyResults.getOrder()); if(voOrderSummary.getInvestigationsIsNotNull()) { for (OrderInvestigationListVo voOrderInv : voOrderSummary.getInvestigations()) { if(form.getGlobalContext().OCRR.PrintOrder.getNotLocalInvestigationsIsNotNull()) { for(InvestigationIndexRefVo voInvIndex : form.getGlobalContext().OCRR.PrintOrder.getNotLocalInvestigations()) { if(voOrderInv.getInvestigationIsNotNull() && voOrderInv.getInvestigation().getInvestigationIndexIsNotNull() && voOrderInv.getInvestigation().getInvestigationIndex().getCategoryIsNotNull()) { if(voOrderInv.getInvestigation().getInvestigationIndex().getCategory().equals(Category.CLINICALIMAGING)) { if(voInvIndex.getID_InvestigationIndexIsNotNull() && voOrderInv.getInvestigation().getInvestigationIndex().getID_InvestigationIndexIsNotNull()) { if(voInvIndex.getID_InvestigationIndex().equals(voOrderInv.getInvestigation().getInvestigationIndex().getID_InvestigationIndex())) { if(voOrderInv.getInvestigation().getProviderServiceIsNotNull() && voOrderInv.getInvestigation().getProviderService().getLocationServiceIsNotNull()) { String defaultPrinter = domain.getDefaultPrinterByLocationAndService(voOrderInv.getRequestedLocation(), voOrderInv.getInvestigation().getProviderService().getLocationService().getService()); if(defaultPrinter != null) { provServiceInvs = getPrintRecords(iRecordsProcessed, provServiceInvs, voOrderInv, voOrderInv.getInvestigation().getProviderService(),defaultPrinter); iRecordsProcessed++; } } } } } } } } } } if(iRecordsProcessed > 0) { try { printRadiologyOrClinicalOrderInv(radiologyReport[0], radiologyReport[1], null, null, ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), ConfigFlag.GEN.REPORT_SERVER_URL.getValue(), provServiceInvs); } catch (QueryBuilderClientException e1) { engine.showMessage("Error creating report: " + e1.getMessage()); return false; } } return iRecordsProcessed > 0; }
private OcsOrderSummaryVo enforceSecurity(OcsOrderSummaryVo voOrderSummary) { if(voOrderSummary == null) return null; //investigations collection if(voOrderSummary.getInvestigationsIsNotNull()) { for(OrderInvestigationListVo voOrderInv : voOrderSummary.getInvestigations()) { // WDEV-11080 voOrderInv.setPassesSecurity(true); if (form.getGlobalContext().OCRR.getRoleDisciplineSecurityLevelsIsNotNull()) { ServiceRefVo voInvService = voOrderInv.getInvestigationIsNotNull() && voOrderInv.getInvestigation().getProviderServiceIsNotNull() && voOrderInv.getInvestigation().getProviderService().getLocationServiceIsNotNull() && voOrderInv.getInvestigation().getProviderService().getLocationService().getServiceIsNotNull() ? voOrderInv.getInvestigation().getProviderService().getLocationService().getService() : null; SecurityLevelConfigVo voInvSecurityLevel = voOrderInv.getInvestigationIsNotNull() && voOrderInv.getInvestigation().getInvestigationIndexIsNotNull() ? voOrderInv.getInvestigation().getInvestigationIndex().getSecurityLevel() : null; //set a boolean in the for security check if(!form.getGlobalContext().OCRR.getRoleDisciplineSecurityLevels().doesInvPassSecurityCheck(voInvService, voInvSecurityLevel,false)) //WDEV-11622 voOrderInv.setPassesSecurity(false); } //we have done all the investigations above so just need to copy security check result into each record within the specimen's investigation collection if(voOrderSummary.getSpecimensIsNotNull()) { for(PathologySpecimenVo voSpec : voOrderSummary.getSpecimens()) { if(voSpec.getInvestigationsIsNotNull()) { for(PathologySpecimenOrderInvestigationVo voSpecOrdInv : voSpec.getInvestigations()) { if(voOrderInv.getBoId().equals(voSpecOrdInv.getBoId())) { voSpecOrdInv.setPassesSecurity(voOrderInv.getPassesSecurity()); break; } } } } } } } form.getLocalContext().setOrderSummary(voOrderSummary); return voOrderSummary; }
/** * Function used to determine if the oder can be authorised * This works of analysing the local context value for the order */ private boolean canOrderBeAuthorized() { OcsOrderSummaryVo orderSummary = form.getLocalContext().getOrderSummary(); if (orderSummary == null || orderSummary.getInvestigations() == null) return false; // Check order status - not to be cancelled int ordersAwaitingAuthorization = 0; //WDEV-16808 boolean hasPathologyInvestigations= false; boolean hasClinicalImagingInvestigations = false; //----------- for (OrderInvestigationListVo investigation : orderSummary.getInvestigations()) { if (investigation.getOrdInvCurrentStatus() != null && OrderInvStatus.AWAITING_AUTHORISATION.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus())) ordersAwaitingAuthorization++; //WDEV-16808 if (Category.PATHOLOGY.equals(investigation.getInvestigation().getInvestigationIndex().getCategory()) //&& engine.hasRight(AppRight.CAN_AUTHORIZE_PATHOLOGY_ORDERS) //WDEV-16808 && investigation.getOrdInvCurrentStatus() != null && OrderInvStatus.AWAITING_AUTHORISATION.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus())) hasPathologyInvestigations = true; //WDEV-16808 if (Category.CLINICALIMAGING.equals(investigation.getInvestigation().getInvestigationIndex().getCategory()) // && engine.hasRight(AppRight.CAN_AUTHORIZE_CLINICAL_IMAGING_ORDERS) && investigation.getOrdInvCurrentStatus() != null && OrderInvStatus.AWAITING_AUTHORISATION.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus())) hasClinicalImagingInvestigations = true; } if (ordersAwaitingAuthorization == 0) return false; //WDEV-16808 if ((hasClinicalImagingInvestigations && !hasPathologyInvestigations && engine.hasRight(AppRight.CAN_AUTHORIZE_CLINICAL_IMAGING_ORDERS)) || (!hasClinicalImagingInvestigations && hasPathologyInvestigations && engine.hasRight(AppRight.CAN_AUTHORIZE_PATHOLOGY_ORDERS)) || (hasClinicalImagingInvestigations && hasPathologyInvestigations && engine.hasRight(AppRight.CAN_AUTHORIZE_PATHOLOGY_ORDERS) && engine.hasRight(AppRight.CAN_AUTHORIZE_CLINICAL_IMAGING_ORDERS))) return true; return false; }