private void updateRequiredByDateField(SpecimenWorkListItemListVo previousWorkListItemVo, Date date) { OrderSpecimenListVo item = previousWorkListItemVo.getSpecimen(); for (int j = 0; item.getInvestigationsIsNotNull() && j < item.getInvestigations().size(); j++) { // cancelled investigations will not be modified if (item.getInvestigations().get(j).getInvestigationIsNotNull() && item.getInvestigations().get(j).getOrdInvCurrentStatusIsNotNull() && item.getInvestigations().get(j).getOrdInvCurrentStatus().getOrdInvStatusIsNotNull() && (!item.getInvestigations().get(j).getOrdInvCurrentStatus().getOrdInvStatus().equals(OrderInvStatus.CANCEL_REQUEST) && !item.getInvestigations().get(j).getOrdInvCurrentStatus().getOrdInvStatus().equals(OrderInvStatus.CANCELLED))) { item.getInvestigations().get(j).setRequiredByDate(new DateTime(date)); } } }
public SpecimenWorkListItemListVo saveWorkListItem(SpecimenWorkListItemListVo specimenWorkListItem, SpecimenWorkListItemListVo prevSpecimenWorkListItem) throws StaleObjectException { if(specimenWorkListItem == null || prevSpecimenWorkListItem == null) throw new CodingRuntimeException("Cannot save null SpecimenWorkListItemListVo"); if(specimenWorkListItem.isValidated() == false) { throw new RuntimeException("Current SpecimenWorkListItemListVo is not validated"); } if(prevSpecimenWorkListItem.isValidated() == false) { throw new RuntimeException("Parent SpecimenWorkListItemListVo is not validated"); } DomainFactory factory = getDomainFactory(); //Save previous specimen SpecimenWorkListItem doPrevSpecimen = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, prevSpecimenWorkListItem); factory.save(doPrevSpecimen); SpecimenWorkListItemListVo voPrevSpecimen = SpecimenWorkListItemListVoAssembler.create(doPrevSpecimen); //Avoid stale object Exception by setting again the specimen and setting the comment from the old vo OrderSpecimenListVo newSpecimen = voPrevSpecimen.getSpecimen(); specimenWorkListItem.getSpecimen().setCollectorComment(newSpecimen.getCollectorComment()); specimenWorkListItem.setSpecimen(newSpecimen); //Save the newly created specimen SpecimenWorkListItem doSpecimen = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, specimenWorkListItem); factory.save(doSpecimen); return voPrevSpecimen; }
private boolean saveWorkListItem(SpecimenWorkListItemListVo specimenWorkListItem) { specimenWorkListItem.setCollectionStatus(SpecimenCollectionStatus.FORCOLLECTION); specimenWorkListItem.setListType(SpecimenCollectionMethod.WARDCOLLECTION); specimenWorkListItem.setDateToCollect(form.dtimCollection().getValue() != null ? form.dtimCollection().getValue().getDate() : null); specimenWorkListItem.setTimeToCollect(form.dtimCollection().getValue() != null ? form.dtimCollection().getValue().getTime() : null); specimenWorkListItem.setRoundToCollect(null); OrderSpecimenListVo item = specimenWorkListItem.getSpecimen(); //WDEV-16898 for (int j = 0; item.getInvestigationsIsNotNull() && j < item.getInvestigations().size(); j++) { // cancelled investigations will not be modified if (item.getInvestigations().get(j).getInvestigationIsNotNull() && item.getInvestigations().get(j).getOrdInvCurrentStatusIsNotNull() && item.getInvestigations().get(j).getOrdInvCurrentStatus().getOrdInvStatusIsNotNull() && (!item.getInvestigations().get(j).getOrdInvCurrentStatus().getOrdInvStatus().equals(OrderInvStatus.CANCEL_REQUEST) && !item.getInvestigations().get(j).getOrdInvCurrentStatus().getOrdInvStatus().equals(OrderInvStatus.CANCELLED))) { item.getInvestigations().get(j).setRequiredByDate(form.dtimCollection().getValue()); } } String[] errors = specimenWorkListItem.validate(validateUIRules()); if (errors != null) { engine.showErrors(errors); return false; } try { domain.saveWorkListItem(specimenWorkListItem); } catch (StaleObjectException e) { if (domain.getSpecimenWorklistItem(form.getLocalContext().getSpecimenWorkListItem().getID_SpecimenWorkListItem()).getWard() != null) { form.getGlobalContext().OCRR.getMoveToWardDetails().setIsRoundClosed(Boolean.TRUE); engine.showMessage("Round was closed by another user. Screen will be refreshed."); } else engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return true; } return true; }
private void previewReport(DynamicGridRow row) { String result = ""; String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue(); String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue(); QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId()); if (row.getValue() instanceof OrderSpecimenListVo) { result = previewPathology(row, urlReportServer, client); } else if (row.getValue() instanceof DftOrderInvestigationVo) { result = previewDFTReport(row, urlReportServer, client); if (result != "") { engine.openUrl(result); String timeSeriesUrlS = ((DftOrderInvestigationVo) row.getValue()).getInvestigation().getInvestigationIndex().getTimeSeriesInstructionsURL(); if (timeSeriesUrlS != null && timeSeriesUrlS.length() > 0) { try { new URL(timeSeriesUrlS); } catch (MalformedURLException e) { engine.showErrors(new String[] { "Time Series Instructions URL for " + ((DftOrderInvestigationVo) row.getValue()).getInvestigation().getInvestigationIndex().getName() + " investigation is not set correctly." }); return; } engine.openUrl(timeSeriesUrlS); } } return; } if (result != "") { engine.openUrl(result); } }
private String previewPathology(DynamicGridRow row, String urlReportServer, QueryBuilderClient client) { String result = ""; String[] pathologyReport; boolean useModalityReportsConfig = ConfigFlag.UI.USE_MODALITY_REPORTS_CONFIGURATION.getValue(); OrderSpecimenListVo specimen = (OrderSpecimenListVo) row.getValue(); ServiceLiteVo modality = domain.getModality(specimen); if (useModalityReportsConfig) pathologyReport = domain.getSystemReportAndTemplateByReportMapping(Category.PATHOLOGY.getID(), modality, Boolean.FALSE); else pathologyReport = domain.getSystemReportAndTemplateByReportMapping(Category.PATHOLOGY.getID(), null, null); if (pathologyReport == null || pathologyReport.length < 2) { if (useModalityReportsConfig) engine.showMessage("I could not get the Pathology report and template! Please link a template against modality '" + modality.getServiceName() + "', dft = FALSE"); else engine.showMessage("I could not get the Pathology report and template! Please set the taxonomy mapping of type REPORT for Category.PATHOLOGY lookup instance with the relevant report Id."); return result; } if (pathologyReport[0] == null || pathologyReport[1] == null) { engine.showMessage("The Pathology report has not been deployed !"); return result; } client.addSeed(new SeedValue("OrderSpecimen_id", specimen.getID_OrderSpecimen(), Integer.class)); try { result = client.buildReportAsUrl(pathologyReport[0], pathologyReport[1], urlReportServer, "PDF", "", 1); client.getSeeds().clear(); } catch (QueryBuilderClientException e1) { engine.showMessage("Error building the report: " + e1.toString()); return result; } return result; }