예제 #1
0
  public void intercept(IEntityForm aForm, Object aEntity, InterceptorContext aContext) {
    DepartmentMedCaseForm form = (DepartmentMedCaseForm) aForm;
    if (CAN_DEBUG) LOG.debug("Проверка правильности введенных данных");
    EntityManager manager = aContext.getEntityManager();
    DepartmentMedCase medCase = (DepartmentMedCase) aEntity;
    String dateFinish = "null";
    if (medCase.getDateFinish() != null) {
      dateFinish =
          new StringBuilder()
              .append("to_date('")
              .append(DateFormat.formatToDate(medCase.getDateFinish()))
              .append("','dd.mm.yyyy')")
              .toString();
    }
    String timeFinish = "null";
    if (medCase.getDischargeTime() != null) {
      timeFinish =
          new StringBuilder()
              .append("'")
              .append(DateFormat.formatToTime(medCase.getDischargeTime()))
              .append("'")
              .toString();
    }
    StringBuilder sqlupdate = new StringBuilder();

    if (!isDiagnosisAllowed(
        form.getClinicalMkb(),
        form.getDepartment(),
        form.getPatient(),
        form.getServiceStream(),
        null,
        null,
        manager)) {
      throw new IllegalStateException("Данный диагноз запрещен в отделении!");
    }
    sqlupdate.append(
        "update MedCase set dateFinish="
            + dateFinish
            + ", dischargeTime="
            + timeFinish
            + " where parent_id=:parent and DTYPE='DepartmentMedCase' and (dateFinish is not null or (transferDate is null and dateFinish is null))");

    manager
        .createNativeQuery(sqlupdate.toString())
        .setParameter("parent", form.getId())
        .executeUpdate();
  }
예제 #2
0
  private boolean setDiagnosisByType(
      boolean aNewIs,
      Diagnosis aDiag,
      VocDiagnosisRegistrationType aType,
      String aName,
      String aDate,
      Long aCode,
      HospitalMedCase aMedCase,
      EntityManager aManager,
      VocPriorityDiagnosis aPriorityType,
      Long aActuity,
      String aMkbAdc) {
    boolean resault = false;
    if (!aNewIs) {
      aNewIs =
          aDiag.getRegistrationType() != null
              && aDiag.getRegistrationType().equals(aType)
              && aDiag.getPriority() != null
              && aDiag.getPriority().equals(aPriorityType)
      // && aDiag.getPriority()!=null && aDiag.getPrimary().equals(aPriorityType)
      ;
    }
    if (aNewIs) {
      aDiag.setMkbAdc(aMkbAdc);
      aDiag.setName(aName);
      if (aCode != null) {
        VocIdc10 mkb = aManager.find(VocIdc10.class, aCode);
        aDiag.setIdc10(mkb);
      }
      aDiag.setMedCase(aMedCase);
      try {
        aDiag.setEstablishDate(DateFormat.parseSqlDate(aDate));
      } catch (Exception e) {

      }
      if (aDiag.getRegistrationType() == null) aDiag.setRegistrationType(aType);
      if (aDiag.getPriority() == null) aDiag.setPriority(aPriorityType);

      if (!isEmpty(aActuity)) {
        VocIllnesPrimary illnes = aManager.find(VocIllnesPrimary.class, aActuity);
        VocAcuityDiagnosis actuity = illnes.getIllnesType();
        VocPrimaryDiagnosis primary = illnes.getPrimary();
        // System.out.println("      actuity ="+actuity+"");
        aDiag.setAcuity(actuity);
        aDiag.setPrimary(primary);
        aDiag.setIllnesPrimary(illnes);
        // VocAcuityDiagnosis actuity = aManager.find(VocAcuityDiagnosis.class, aActuity) ;
        // System.out.println("      actuity ="+actuity+"");
        // aDiag.setAcuity(actuity) ;
      }
      resault = true;
    }
    aManager.persist(aDiag);
    return resault;
  }
예제 #3
0
  @Override
  public ActionForward myExecute(
      ActionMapping aMapping,
      ActionForm aForm,
      HttpServletRequest aRequest,
      HttpServletResponse aResponse)
      throws Exception {
    String typeDate = ActionUtil.updateParameter("DocumentExport", "typeDate", "2", aRequest);
    String typeDocument =
        ActionUtil.updateParameter("DocumentExport", "typeDocument", "3", aRequest);
    String orderBy = ActionUtil.updateParameter("DocumentExport", "orderBy", "1", aRequest);
    DisabilitySearchForm form = (DisabilitySearchForm) aForm;
    if (form.validate(aMapping, aRequest).size() == 0) {
      if (form.getBeginDate() != null && !form.getBeginDate().equals("")) {
        String beginDate = DateFormat.formatToJDBC(form.getBeginDate());
        aRequest.setAttribute("beginDate", beginDate);
        String endDate = beginDate;
        if (form.getEndDate() != null && !form.getEndDate().equals("")) {
          endDate = DateFormat.formatToJDBC(form.getEndDate());
        }
        aRequest.setAttribute("endDate", endDate);
      }
      aRequest.setAttribute("valid", "1");
    } else {
      aRequest.setAttribute("valid", "0");
    }

    String dGroup = "";
    if (typeDate != null && typeDate.equals("1")) {
      dGroup =
          "(select min(dr2.dateFrom) from disabilityrecord as dr2 where dr2.disabilitydocument_id=dd.id)";
      aRequest.setAttribute("dateGroup", dGroup);
      aRequest.setAttribute("dateSearch", "max");
      aRequest.setAttribute("infoSearch", " Поиск по дате закрытия");
    } else if (typeDate != null && typeDate.equals("2")) {
      dGroup = "dd.issuedate";
      aRequest.setAttribute("dateGroup", dGroup);
      aRequest.setAttribute("dateSearch", "min");
      aRequest.setAttribute("infoSearch", " Поиск по дате выдачи");
    }
    if (orderBy != null && orderBy.equals("1")) {
      aRequest.setAttribute("orderByInfo", "по номерам больничных");
      aRequest.setAttribute("orderBystatus", " dd.number ");
    } else if (orderBy != null && orderBy.equals("2")) {
      aRequest.setAttribute("orderByInfo", "по дате выдачи");
      aRequest.setAttribute("orderBystatus", " dd.issueDate, dd.number ");
    } else {
      aRequest.setAttribute("orderByInfo", "по ФИО");
      aRequest.setAttribute("orderBystatus", "p.lastname,p.firstname,p.middlename,dd.number");
    }
    if (typeDocument != null && typeDocument.equals("1")) {
      aRequest.setAttribute("typeDocumentInfo", "всем экспортированным");
      aRequest.setAttribute("status", "(dd.exportdate is not null) and ");
    } else if (typeDocument != null && typeDocument.equals("2")) {
      aRequest.setAttribute("typeDocumentInfo", "успешно экспортированным");
      aRequest.setAttribute("status", "(dd.exportdate is not null and dd.exportdefect='') and ");
    } else {
      aRequest.setAttribute("typeDocumentInfo", "дефекты");
      aRequest.setAttribute(
          "status",
          "(dd.exportdate is not null and (dd.exportdefect is not null and dd.exportdefect!='')) and ");
    }

    return aMapping.findForward("success");
  }