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();
    }
  @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;
  }
Beispiel #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));
  }
    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;
    }