private void processPhlebotomyReport(QueryBuilderClient client,String urlReportServer, String repXml, String templXml, PhlebotomyRoundVo round) { client.getSeeds().clear(); client.addSeed(new SeedValue("PhlebotomyRound_id", round.getID_PhlebotomyRound(), Integer.class)); client.addSeed(new SeedValue("Patient_id", null, Integer.class)); try { client.printReport(repXml, templXml, urlReportServer,form.qmbPrinter().getValue(), 1); } catch (QueryBuilderClientException e1) { engine.showMessage("Error building the report: " + e1.toString()); return; } }
public PhlebotomyRoundVo savePhlebotomyRound(PhlebotomyRoundVo phlebotomyRoundItem, SpecimenWorkListitemCustomVoCollection collectionItems) throws StaleObjectException { //long t1 = System.currentTimeMillis(); DomainFactory factory = getDomainFactory(); PhlebotomyRound phlebotomyRoundItemBo = PhlebotomyRoundVoAssembler.extractPhlebotomyRound(factory, phlebotomyRoundItem); for (int i = 0; collectionItems!=null && i < collectionItems.size(); i++)//WDEV-12893 { SpecimenWorkListItem workListItemBo = (SpecimenWorkListItem) factory.getDomainObject(SpecimenWorkListItem.class, collectionItems.get(i).getWorkListitemId()); if(workListItemBo.getSpecimen() != null && workListItemBo.getSpecimen().getOrder() != null && workListItemBo.getSpecimen().getOrder().getPatient() != null) { //workListItemBo.setWard(workListItemBo.getSpecimen().getOrder().getPatient().getWard()); workListItemBo.setWard((Location) factory.getDomainObject(Location.class, collectionItems.get(i).getWardId())); factory.save(workListItemBo); } else if (workListItemBo.getDFTOrderInvestigation() != null) { workListItemBo.setWard((Location) factory.getDomainObject(Location.class, collectionItems.get(i).getWardId())); workListItemBo.setCollectionStatus(factory.getLookupInstance(SpecimenCollectionStatus.COLLECTIONCOMPLETE.getId())); } phlebotomyRoundItemBo.getCollectionItems().add(workListItemBo); } factory.save(phlebotomyRoundItemBo); //long t2 = System.currentTimeMillis(); //System.out.println((t2-t1) + " ms"); return PhlebotomyRoundVoAssembler.create(phlebotomyRoundItemBo); }
private void printRound(PhlebotomyRoundVo round)throws Exception { String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue(); String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue(); java.util.Date date = new java.util.Date(); SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); String timestamp = df.format(date); String fileName = "PhlebotomyRoundandLabels"+engine.getSessionId()+timestamp+".pdf"; QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId()); if(checkConfigFlags(urlQueryServer, urlReportServer) == false) return; String[] obj = domain.getSystemReportAndTemplate(new Integer(PHLEBOTOMY_ROUND)); if(obj == null || obj.length < 2) { engine.showMessage("I could not get the report and template !"); return; } if(obj[0] == null || obj[1] == null) { engine.showMessage("The report has not been deployed !"); return; } String repXml = (String) obj[0]; String templXml = (String) obj[1]; if(templXml != null && repXml != null) { processPhlebotomyReport(client, urlReportServer, repXml, templXml, round); } //WDEV-17760 processPrintLabelsReport(urlReportServer, client); /*String folderName = getOutputFolder(); String path= folderName +fileName; byte[] report=readBytes(path); try { client.printReport(report, urlReportServer, form.qmbPrinterLabels().getValue(), 1); } catch (QueryBuilderClientException e1) { engine.showMessage("Error creating report: " + e1.getMessage()); return; } File finalFile = new File(path); if(finalFile.exists()) { deleteFile(finalFile); }*/ }