public void addPersistentObject(PersistentObject o) {
    Konsultation actKons = (Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class);
    if (actKons != null) {
      if (o instanceof Prescription) {
        Prescription presc = (Prescription) o;
        o = presc.getArtikel();
      }
      if (o instanceof IVerrechenbar) {
        if (CoreHub.acl.request(AccessControlDefaults.LSTG_VERRECHNEN) == false) {
          SWTHelper.alert(
              Messages.VerrechnungsDisplay_missingRightsCaption, // $NON-NLS-1$
              Messages.VerrechnungsDisplay_missingRightsBody); // $NON-NLS-1$
        } else {
          Result<IVerrechenbar> result = actKons.addLeistung((IVerrechenbar) o);

          if (!result.isOK()) {
            SWTHelper.alert(
                Messages.VerrechnungsDisplay_imvalidBilling, result.toString()); // $NON-NLS-1$
          }
          setLeistungen(actKons);
        }
      } else if (o instanceof IDiagnose) {
        actKons.addDiagnose((IDiagnose) o);
      }
    }
  }
  @SuppressWarnings("unchecked")
  @Override
  public Result<Object> execute(
      File file,
      Map<String, Object> context,
      HL7Parser hl7Parser,
      IPersistenceHandler persistenceHandler)
      throws IOException {
    String myLab = (String) context.get(IMultiFileParser.CTX_LABNAME);

    Result<Object> result = null;

    if (testMode) {
      // we need to enable patient creation when testing otherwise test will fail
      result = (Result<Object>) hl7Parser.importFile(file.getAbsolutePath(), true);
    } else {
      result = (Result<Object>) hl7Parser.importFile(file.getAbsolutePath(), false);
    }

    Object resultObj = result.get();
    if (resultObj instanceof String) {
      List<ILabOrder> orders = persistenceHandler.getLabOrdersByOrderId((String) resultObj);
      if (orders != null && !orders.isEmpty()) {
        ILabOrder order = orders.get(0);
        context.put(IMultiFileParser.CTX_PATIENT, order.getPatientContact());
        context.put(IMultiFileParser.CTX_LABID, order.getLabResult().getOriginContact().getId());
        context.put(IMultiFileParser.CTX_GROUP, order.getLabItem().getGroup());
        context.put(IMultiFileParser.CTX_PRIO, order.getLabItem().getPriority());
        context.put(IMultiFileParser.CTX_TIME, getDate(order.getLabResult()));
      }
    }
    return result;
  }
Esempio n. 3
0
  public void testEncrypt() throws Exception {
    JCECrypter crypter = new JCECrypter(null, null, alicename, alicepwd.toCharArray());
    byte[] encrypted = crypter.encrypt(plain, bobname);

    crypter = new JCECrypter(null, null, bobname, bobpwd.toCharArray());
    Result<byte[]> check = crypter.decrypt(encrypted);
    assertTrue(check.isOK());
    assertTrue(Arrays.equals(check.get(), plain));
  }
Esempio n. 4
0
    public Rechnung getExistingRechnung(String rechnungNr) {
      Konsultation kons = createKons(faelle.get(0), mandanten.get(0));
      kons.addDiagnose(TICode.getFromCode("A1"));
      for (TarmedLeistung leistung : leistungen) {
        Result<IVerrechenbar> result = kons.addLeistung(leistung);
        if (!result.isOK()) {
          throw new IllegalStateException(result.toString());
        }
      }
      Result<Rechnung> result = Rechnung.build(Collections.singletonList(kons));
      Rechnung ret = result.get();

      ret.set(Rechnung.BILL_NUMBER, rechnungNr);

      return ret;
    }
Esempio n. 5
0
    TestSzenario() throws IOException {
      createMandanten();

      createPatientWithFall("Beatrice", "Spitzkiel", "14.04.1957", "w", false);
      createPatientWithFall("Karin", "Zirbelkiefer", "24.04.1951", "w", true);

      createLeistungen();

      for (int j = 0; j < faelle.size(); j++) {
        Konsultation kons = createKons(faelle.get(j), mandanten.get(0));
        konsultationen.add(kons);
        kons.addDiagnose(TICode.getFromCode("A1"));
        for (TarmedLeistung leistung : leistungen) {
          Result<IVerrechenbar> result = kons.addLeistung(leistung);
          if (!result.isOK()) {
            throw new IllegalStateException(result.toString());
          }
        }
      }

      for (Fall fall : faelle) {
        List<Konsultation> kons =
            new ArrayList<Konsultation>(Arrays.asList(fall.getBehandlungen(false)));
        Result<Rechnung> result = Rechnung.build(kons);
        if (result.isOK()) {
          rechnungen.add(result.get());
        } else {
          throw new IllegalStateException(result.toString());
        }
      }

      importExistingXml();
    }
  /** Print the bill(s) */
  public Result<Rechnung> doOutput(
      final TYPE type, final Collection<Rechnung> rnn, Properties props) {
    IWorkbenchPage rnPage;
    final Result<Rechnung> result = new Result<Rechnung>(); // =new
    // Result<Rechnung>(Log.ERRORS,99,"Not
    // yet implemented",null,true);
    rnPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
    final Result<Rechnung> res = new Result<Rechnung>();

    try {
      final RnPrintView rnp = (RnPrintView) rnPage.showView(RnPrintView.ID);
      progressService.runInUI(
          PlatformUI.getWorkbench().getProgressService(),
          new IRunnableWithProgress() {
            public void run(final IProgressMonitor monitor) {
              monitor.beginTask("Drucke Rechnungen", rnn.size() * 10);
              int errors = 0;
              for (Rechnung rn : rnn) {
                try {
                  result.add(rnp.doPrint(rn));
                  monitor.worked(10);
                  if (!result.isOK()) {
                    String errms = "Rechnung " + rn.getNr() + "konnte nicht gedruckt werden";
                    res.add(Result.SEVERITY.ERROR, 1, errms, rn, true);
                    errors++;
                    continue;
                  }
                  int status_vorher = rn.getStatus();
                  if ((status_vorher == RnStatus.OFFEN)
                      || (status_vorher == RnStatus.MAHNUNG_1)
                      || (status_vorher == RnStatus.MAHNUNG_2)
                      || (status_vorher == RnStatus.MAHNUNG_3)) {
                    rn.setStatus(status_vorher + 1);
                  }
                  rn.addTrace(
                      Rechnung.OUTPUT,
                      getDescription() + ": " + RnStatus.getStatusText(rn.getStatus()));
                } catch (Exception ex) {
                  SWTHelper.showError(
                      "Fehler beim Drucken der Rechnung " + rn.getRnId(), ex.getMessage());
                  errors++;
                }
              }
              monitor.done();
              if (errors == 0) {
                SWTHelper.showInfo("OK", "OK");
              } else {
                SWTHelper.showError("Fehler", "Fehler");
              }
            }
          },
          null);

      rnPage.hideView(rnp);

    } catch (Exception ex) {
      ExHandler.handle(ex);
      res.add(Result.SEVERITY.ERROR, 2, ex.getMessage(), null, true);
      ErrorDialog.openError(null, "Exception", "Exception", ResultAdapter.getResultAsStatus(res));
      return res;
    }
    if (!result.isOK()) {
      ResultAdapter.displayResult(result, "Fehler beim Rechnungsdruck");
    }
    return result;
  }