Пример #1
0
  /** リストで選択された患者を受付に登録する。 */
  public void addAsPvt() {

    // 来院情報を生成する
    PatientVisitModel pvt = new PatientVisitModel();
    pvt.setId(0L);
    pvt.setNumber(number++);
    pvt.setPatientModel(getSelectedPatinet());

    // --------------------------------------------------------
    // 受け付けを通していないのでログイン情報及び設定ファイルを使用する
    // 診療科名、診療科コード、医師名、医師コード、JMARI
    // 2.0
    // ---------------------------------------------------------
    pvt.setDeptName(Project.getUserModel().getDepartmentModel().getDepartmentDesc());
    pvt.setDeptCode(Project.getUserModel().getDepartmentModel().getDepartment());
    pvt.setDoctorName(Project.getUserModel().getCommonName());
    if (Project.getUserModel().getOrcaId() != null) {
      pvt.setDoctorId(Project.getUserModel().getOrcaId());
    } else {
      pvt.setDoctorId(Project.getUserModel().getUserId());
    }
    pvt.setJmariNumber(Project.getString(Project.JMARI_CODE));

    // 来院日
    pvt.setPvtDate(ModelUtils.getDateTimeAsString(new Date()));

    final PatientVisitModel fPvt = pvt;

    SimpleWorker worker =
        new SimpleWorker<Void, Void>() {

          @Override
          protected Void doInBackground() throws Exception {
            PVTDelegater1 pdl = new PVTDelegater1();
            pdl.addPvt(fPvt);
            return null;
          }

          @Override
          protected void succeeded(Void result) {}

          @Override
          protected void failed(Throwable cause) {}

          @Override
          protected void startProgress() {
            doStartProgress();
          }

          @Override
          protected void stopProgress() {
            doStopProgress();
          }
        };

    worker.execute();
  }
Пример #2
0
  // minagawa^ 仮保存カルテ取得対応
  public void getTmpKarte() {

    SimpleWorker worker =
        new SimpleWorker<List, Void>() {

          @Override
          protected List doInBackground() throws Exception {
            PatientDelegater pdl = new PatientDelegater();
            // s.oh^ 2014/10/01 患者検索(傷病名)
            List result = pdl.getTmpKarte();
            // List result;
            // if(view.getKeywordFld().getText() != null &&
            // !view.getKeywordFld().getText().isEmpty()) {
            //    result = pdl.getCustom(view.getKeywordFld().getText());
            // }else{
            //    result = pdl.getTmpKarte();
            // }
            // s.oh$
            return result;
          }

          @Override
          protected void succeeded(List result) {
            if (result != null && result.size() > 0) {
              sortList(result);
              tableModel.setDataProvider(result);
            } else {
              tableModel.clear();
            }
            updateStatusLabel();
          }

          @Override
          protected void failed(Throwable cause) {}

          @Override
          protected void startProgress() {
            doStartProgress();
          }

          @Override
          protected void stopProgress() {
            doStopProgress();
          }
        };

    worker.execute();
  }
Пример #3
0
  /** 公開されているTreeのリストを取得しテーブルへ表示する。 */
  public void start() {

    final SimpleWorker worker =
        new SimpleWorker<List<PublishedTreeModel>, Void>() {

          @Override
          protected List<PublishedTreeModel> doInBackground() throws Exception {
            StampDelegater sdl = new StampDelegater();
            List<PublishedTreeModel> result = sdl.getPublishedTrees();
            return result;
          }

          @Override
          protected void succeeded(List<PublishedTreeModel> result) {
            // DBから取得が成功したらGUIコンポーネントを生成する
            initComponent();
            if (importedTreeList != null && importedTreeList.size() > 0) {
              for (PublishedTreeModel model : result) {
                for (Long id : importedTreeList) {
                  if (id.longValue() == model.getId()) {
                    model.setImported(true);
                    break;
                  }
                }
              }
            }
            tableModel.setDataProvider(result);
          }

          @Override
          protected void failed(java.lang.Throwable cause) {
            JOptionPane.showMessageDialog(
                frame,
                cause.getMessage(),
                ClientContext.getFrameTitle(title),
                JOptionPane.WARNING_MESSAGE);
            ClientContext.getBootLogger().warn(cause.getMessage());
          }

          @Override
          protected void startProgress() {
            delayCount = 0;
            taskTimer.start();
          }

          @Override
          protected void stopProgress() {
            taskTimer.stop();
            monitor.close();
            taskTimer = null;
            monitor = null;
          }
        };

    String message = "スタンプインポート";
    String note = "公開スタンプを取得しています...";
    Component c = frame;
    monitor = new ProgressMonitor(c, message, note, 0, maxEstimation / delay);

    taskTimer =
        new Timer(
            delay,
            new ActionListener() {

              @Override
              public void actionPerformed(ActionEvent e) {
                delayCount++;

                if (monitor.isCanceled() && (!worker.isCancelled())) {
                  // no cancel
                } else if (delayCount >= monitor.getMaximum() && (!worker.isCancelled())) {
                  worker.cancel(true);

                } else {
                  monitor.setProgress(delayCount);
                }
              }
            });

    worker.execute();
  }
Пример #4
0
  /** インポートしているスタンプを削除する。 */
  public void removeImportedTree() {

    // 削除するTreeを取得する
    int row = browseTable.getSelectedRow();
    final PublishedTreeModel removeTree = tableModel.getObject(row);

    if (removeTree == null) {
      return;
    }

    SubscribedTreeModel sm = new SubscribedTreeModel();
    sm.setTreeId(removeTree.getId());
    sm.setUserModel(Project.getUserModel());
    final List<SubscribedTreeModel> list = new ArrayList<SubscribedTreeModel>(1);
    list.add(sm);

    // Unsubscribeタスクを実行する

    final SimpleWorker worker =
        new SimpleWorker<Void, Void>() {

          @Override
          protected Void doInBackground() throws Exception {
            StampDelegater sdl = new StampDelegater();
            sdl.unsubscribeTrees(list);
            return null;
          }

          @Override
          protected void succeeded(Void result) {
            // スタンプボックスから削除する
            stampBox.removeImportedTree(removeTree.getId());
            // ブラウザ表示を変更する
            removeTree.setImported(false);
            tableModel.fireTableDataChanged();
          }

          @Override
          protected void cancelled() {
            ClientContext.getBootLogger().debug("Task cancelled");
          }

          @Override
          protected void failed(java.lang.Throwable cause) {
            JOptionPane.showMessageDialog(
                frame,
                cause.getMessage(),
                ClientContext.getFrameTitle(title),
                JOptionPane.WARNING_MESSAGE);
            ClientContext.getBootLogger().warn(cause.getMessage());
          }

          @Override
          protected void startProgress() {
            delayCount = 0;
            blockGlass.block();
            taskTimer.start();
          }

          @Override
          protected void stopProgress() {
            taskTimer.stop();
            monitor.close();
            blockGlass.unblock();
            taskTimer = null;
            monitor = null;
          }
        };

    String message = "スタンプインポート";
    String note = "インポート済みスタンプを削除しています...";
    Component c = frame;
    monitor = new ProgressMonitor(c, message, note, 0, maxEstimation / delay);

    taskTimer =
        new Timer(
            delay,
            new ActionListener() {

              @Override
              public void actionPerformed(ActionEvent e) {
                delayCount++;

                if (monitor.isCanceled() && (!worker.isCancelled())) {
                  // worker.cancel(true);
                  // No cancel

                } else if (delayCount >= monitor.getMaximum() && (!worker.isCancelled())) {
                  worker.cancel(true);

                } else {
                  monitor.setProgress(delayCount);
                }
              }
            });

    worker.execute();
  }
Пример #5
0
  /** ブラウザテーブルで選択した公開Treeをインポートする。 */
  public void importPublishedTree() {

    // テーブルはシングルセレクションである
    int row = browseTable.getSelectedRow();
    final PublishedTreeModel importTree = tableModel.getObject(row);

    if (importTree == null) {
      return;
    }

    // Import 済みの場合
    if (importTree.isImported()) {
      return;
    }

    try {
      importTree.setTreeXml(new String(importTree.getTreeBytes(), "UTF-8"));
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }

    // サブスクライブリストに追加する
    SubscribedTreeModel sm = new SubscribedTreeModel();
    sm.setUserModel(Project.getUserModel());
    sm.setTreeId(importTree.getId());
    final List<SubscribedTreeModel> subscribeList = new ArrayList<SubscribedTreeModel>(1);
    subscribeList.add(sm);

    final SimpleWorker worker =
        new SimpleWorker<Void, Void>() {

          @Override
          protected Void doInBackground() throws Exception {
            StampDelegater sdl = new StampDelegater();
            sdl.subscribeTrees(subscribeList);
            return null;
          }

          @Override
          protected void succeeded(Void result) {
            // スタンプボックスへインポートする
            stampBox.importPublishedTree(importTree);
            // Browser表示をインポート済みにする
            importTree.setImported(true);
            tableModel.fireTableDataChanged();
          }

          @Override
          protected void cancelled() {
            ClientContext.getBootLogger().debug("Task cancelled");
          }

          @Override
          protected void failed(java.lang.Throwable cause) {
            JOptionPane.showMessageDialog(
                frame,
                cause.getMessage(),
                ClientContext.getFrameTitle(title),
                JOptionPane.WARNING_MESSAGE);
            ClientContext.getBootLogger().warn(cause.getMessage());
          }

          @Override
          protected void startProgress() {
            delayCount = 0;
            blockGlass.block();
            taskTimer.start();
          }

          @Override
          protected void stopProgress() {
            taskTimer.stop();
            monitor.close();
            blockGlass.unblock();
            taskTimer = null;
            monitor = null;
          }
        };

    String message = "スタンプインポート";
    String note = "インポートしています...";
    Component c = frame;
    monitor = new ProgressMonitor(c, message, note, 0, maxEstimation / delay);

    taskTimer =
        new Timer(
            delay,
            new ActionListener() {

              @Override
              public void actionPerformed(ActionEvent e) {
                delayCount++;

                if (monitor.isCanceled() && (!worker.isCancelled())) {
                  // worker.cancel(true);
                  // No cancel

                } else if (delayCount >= monitor.getMaximum() && (!worker.isCancelled())) {
                  worker.cancel(true);

                } else {
                  monitor.setProgress(delayCount);
                }
              }
            });

    worker.execute();
  }
Пример #6
0
  // s.oh^ 2014/08/19 施設患者一括表示機能
  public void visitAll() {
    List<PatientModel> list = getTableModel().getDataProvider();
    if (list == null) return;
    for (PatientModel model : list) {
      // 来院情報を生成する
      PatientVisitModel pvt = new PatientVisitModel();
      pvt.setId(0L);
      pvt.setNumber(number++);
      pvt.setPatientModel(model);

      // --------------------------------------------------------
      // 受け付けを通していないのでログイン情報及び設定ファイルを使用する
      // 診療科名、診療科コード、医師名、医師コード、JMARI
      // 2.0
      // ---------------------------------------------------------
      pvt.setDeptName(Project.getUserModel().getDepartmentModel().getDepartmentDesc());
      pvt.setDeptCode(Project.getUserModel().getDepartmentModel().getDepartment());
      pvt.setDoctorName(Project.getUserModel().getCommonName());
      if (Project.getUserModel().getOrcaId() != null) {
        pvt.setDoctorId(Project.getUserModel().getOrcaId());
      } else {
        pvt.setDoctorId(Project.getUserModel().getUserId());
      }
      String jamri;
      if (Project.claimSenderIsServer()) {
        ServerInfoDelegater sid = new ServerInfoDelegater();
        try {
          jamri = sid.getJamri();
        } catch (Exception ex) {
          jamri = Project.getString(Project.JMARI_CODE);
          Log.outputFuncLog(Log.LOG_LEVEL_0, Log.FUNCTIONLOG_KIND_ERROR, ex.toString());
        }
      } else {
        jamri = Project.getString(Project.JMARI_CODE);
      }
      pvt.setJmariNumber(jamri);

      // 来院日
      pvt.setPvtDate(ModelUtils.getDateTimeAsString(new Date()));

      final PatientVisitModel fPvt = pvt;

      SimpleWorker worker =
          new SimpleWorker<Void, Void>() {

            @Override
            protected Void doInBackground() throws Exception {
              PVTDelegater1 pdl = new PVTDelegater1();
              pdl.addPvt(fPvt);
              return null;
            }

            @Override
            protected void succeeded(Void result) {}

            @Override
            protected void failed(Throwable cause) {}

            @Override
            protected void startProgress() {
              doStartProgress();
            }

            @Override
            protected void stopProgress() {
              doStopProgress();
            }
          };

      worker.execute();
    }
    Window parent = SwingUtilities.getWindowAncestor(getUI());
    JOptionPane.showMessageDialog(parent, "一括受付しました。", "一括受付", JOptionPane.WARNING_MESSAGE);
    Log.outputFuncLog(Log.LOG_LEVEL_0, Log.FUNCTIONLOG_KIND_INFORMATION, "一括受付しました。");
  }
Пример #7
0
  /**
   * 検索を実行する。
   *
   * @param text キーワード
   */
  private void find(String text) {

    Log.outputFuncLog(Log.LOG_LEVEL_0, Log.FUNCTIONLOG_KIND_INFORMATION, "患者検索", text);

    // 全角スペースをkill
    text = text.replaceAll(" ", " ");

    PatientSearchSpec spec = new PatientSearchSpec();

    if (isDate(text)) {
      spec.setCode(PatientSearchSpec.DATE_SEARCH);
      spec.setDigit(text);

    } else if (StringTool.startsWithKatakana(text)) {
      spec.setCode(PatientSearchSpec.KANA_SEARCH);
      spec.setName(text);

    } else if (StringTool.startsWithHiragana(text)) {
      text = StringTool.hiraganaToKatakana(text);
      spec.setCode(PatientSearchSpec.KANA_SEARCH);
      spec.setName(text);

    } else if (isNameAddress(text)) {
      spec.setCode(PatientSearchSpec.NAME_SEARCH);
      spec.setName(text);

    } else {

      if (Project.getBoolean("zero.paddings.id.search", false)) {
        int len = text.length();
        int paddings = Project.getInt("patient.id.length", 0) - len;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < paddings; i++) {
          sb.append("0");
        }
        sb.append(text);
        text = sb.toString();
      }

      spec.setCode(PatientSearchSpec.DIGIT_SEARCH);
      spec.setDigit(text);
    }

    final PatientSearchSpec searchSpec = spec;

    SimpleWorker worker =
        new SimpleWorker<Collection, Void>() {

          @Override
          protected Collection doInBackground() throws Exception {
            PatientDelegater pdl = new PatientDelegater();
            Collection result = pdl.getPatients(searchSpec);
            return result;
          }

          @Override
          protected void succeeded(Collection result) {

            List<PatientModel> list = (List<PatientModel>) result;

            if (list != null && list.size() > 0) {

              // minagawa^ 仮保存カルテ取得対応
              /*
              boolean sorted = true;
              for (int i=0; i < COLUMN_NAMES.length; i++) {
                  if (sorter.getSortingStatus(i)==0) {
                      sorted = false;
                      break;
                  }
              }

              if (!sorted) {

                  switch (sortItem) {
                      case 0:
                          Comparator c = new Comparator<PatientModel>() {

                              @Override
                              public int compare(PatientModel o1, PatientModel o2) {
                                  return o1.getPatientId().compareTo(o2.getPatientId());
                              }
                          };
                          Collections.sort(list, c);
                          break;
                      case 1:
                        Comparator c2 = new Comparator<PatientModel>() {

                          @Override
                           public int compare(PatientModel p1, PatientModel p2) {
                              String kana1 = p1.getKanaName();
                              String kana2 = p2.getKanaName();
                              if (kana1 != null && kana2 != null) {
                                  return p1.getKanaName().compareTo(p2.getKanaName());
                              } else if (kana1 != null && kana2 == null) {
                                  return -1;
                              } else if (kana1 == null && kana2 != null) {
                                  return 1;
                              } else {
                                  return 0;
                              }
                          }
                        };
                      Collections.sort(list, c2);
                      break;
                  }
              }
              */
              sortList(list);
              // minagawa$

              tableModel.setDataProvider(list);
              Log.outputFuncLog(
                  Log.LOG_LEVEL_0,
                  Log.FUNCTIONLOG_KIND_INFORMATION,
                  "患者数:",
                  String.valueOf(list.size()));
            } else {
              tableModel.clear();
              Log.outputFuncLog(Log.LOG_LEVEL_0, Log.FUNCTIONLOG_KIND_INFORMATION, "患者数:", "0");
            }
            updateStatusLabel();
          }

          @Override
          protected void failed(Throwable cause) {}

          @Override
          protected void startProgress() {
            doStartProgress();
          }

          @Override
          protected void stopProgress() {
            doStopProgress();
          }
        };

    worker.execute();
  }