Browse Source

优化中间断账和入院登记的相关问题。

lighter 3 years ago
parent
commit
03223e9d0a

+ 8 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiQueryDao.java

@@ -260,4 +260,12 @@ public interface SiQueryDao {
 
     @Select("select * from t_si_mz_matn_dise")
     List<SiMzMatnDise> selectAllMzMatnDises();
+
+    @Update("update t_si_pat_info set mdtrt_id=#{mdtrtId},insutype=#{insutype} where pat_no=#{patNo} " +
+            "and times=#{times} and ledger_sn=#{sn}")
+    void updateInhospInfo(@Param("patNo") String patNo,
+                          @Param("times") int times,
+                          @Param("sn") int sn,
+                          @Param("mdtrtId") String mdtrtId,
+                          @Param("insutype") String insutype);
 }

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiZyDao.java

@@ -199,7 +199,7 @@ public interface SiZyDao {
      * @param p 患者基本信息
      */
     @Update("update t_si_pat_info set insuplc_admdvs=#{insuplcAdmdvs},psn_type=#{psnType},emp_name=#{empName}," +
-            "mdtrt_id=#{mdtrtId},insutype=#{insutype},visit_datetime=#{admissDate},adm_reg_msgid=#{admRegMsgid} " +
+            "mdtrt_id=#{mdtrtId},insutype=#{insutype},visit_datetime=#{ybRegisterDate},adm_reg_msgid=#{admRegMsgid} " +
             "where pat_no=#{inpatientNo} and times=#{admissTimes} and ledger_sn=#{ledgerSn}")
     void afterAdmissRegister(ZyPatientInfo p);
 

+ 3 - 0
src/main/java/thyyxxk/webserver/dao/his/yibao/DismissDao.java

@@ -94,6 +94,9 @@ public interface DismissDao {
     @Delete("delete zy_tmp_settle_select_detail where inpatient_no=#{patNo} and admiss_times=#{times}")
     void deleteTemporaryTable(@Param("patNo") String patNo, @Param("times") Integer times);
 
+    @Select("select top 1 date_2 from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn>0 order by ledger_sn desc")
+    Date selectAccountDate(@Param("patNo") String patNo, @Param("times") int times);
+
     @Select("select admiss_date from ${table} where inpatient_no=#{patNo} and admiss_times=#{times}")
     Date selectAdmissDate(@Param("patNo") String patNo, @Param("times") Integer times, @Param("table") String table);
 

+ 1 - 1
src/main/java/thyyxxk/webserver/service/medicalinsurance/ExecService.java

@@ -116,7 +116,7 @@ public class ExecService {
         header.put("msgid", SiUtil.makeMsgId());
         header.put("mdtrtarea_admvs", SiUtil.getInstitutionArea(insureArea));
         header.put("insuplc_admdvs", insureArea);
-        header.put("recer_sys_code", SiUtil.INSTITUTION_AREA);
+        header.put("recer_sys_code", SiUtil.getInstitutionArea(insureArea));
         header.put("dev_no", "");
         header.put("dev_safe_info", "");
         header.put("cainfo", "");

+ 4 - 0
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -529,6 +529,10 @@ public class SiQueryService {
                 SiEnumReflectUtil.inHspPsnInfoReflect(inHspPsnInfo);
                 list.add(inHspPsnInfo);
             }
+            if (list.size() == 1) {
+                InHspPsnInfo info = list.get(0);
+                dao.updateInhospInfo(q.getPatNo(), q.getTimes(), q.getLedgerSn(), info.getMdtrtId(), info.getInsutype());
+            }
             return ResultVoUtil.success(list);
         }
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));

+ 9 - 22
src/main/java/thyyxxk/webserver/service/yibao/DismissService.java

@@ -190,26 +190,6 @@ public class DismissService {
             exception.setMessage("费用计算失败。执行zy_cngl_fyjs过程出错。");
             throw new BizException(exception);
         }
-//        String[] receipts = getReceiptFees(receiptFees);
-//        String adultFee = dao.selectAdultFee(patNo, times, ledgerSn);
-//        if (null == adultFee) {
-//            adultFee = "0";
-//        }
-//        log.info("总费用:{},发票计算费用:{}", adultFee, receipts[0]);
-//        if (DecimalUtil.compare(receipts[0], adultFee) != 0) {
-//            ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
-//            exception.setMessage("此患者明细费用与发票费用不一致。");
-//            throw new BizException(exception);
-//        }
-//        String infantFee = dao.selectInfantFee(patNo, times, ledgerSn);
-//        if (null == infantFee) {
-//            infantFee = "0";
-//        }
-//        if (DecimalUtil.compare(receipts[1], infantFee) != 0) {
-//            ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
-//            exception.setMessage("此患者婴儿明细费用与发票婴儿费用不一致。");
-//            throw new BizException(exception);
-//        }
         dao.deleteTemporaryTable(patNo, times);
         return ResultVoUtil.success();
     }
@@ -263,11 +243,10 @@ public class DismissService {
         }
         final int infantFlag = dao.selectInfantFlag(indata.getInpatientNo(), indata.getAdmissTimes(),
                 indata.getLedgerSn()); // =0 无婴儿,>0 有婴儿
+        final Date admissDate = getAdmissDate(indata.getInpatientNo(), indata.getAdmissTimes(), indata.getTable());
         final Date dismissDate = getDismissDate(indata.getFlag(), indata.getInpatientNo(), indata.getAdmissTimes(),
                 indata.getZjdzDatetime());
-
         final Integer transFlag = indata.getFlag() == 1 ? 0 : 2;
-        final Date admissDate = dao.selectAdmissDate(indata.getInpatientNo(), indata.getAdmissTimes(), indata.getTable());
         final List<ReceiptFee> fees = dao.calculateCost(indata.getInpatientNo(), indata.getAdmissTimes(),
                 indata.getLedgerSn(), indata.getStaffId(), admissDate, dismissDate, indata.getWardCode(),
                 indata.getDeptCode(), transFlag);
@@ -316,6 +295,14 @@ public class DismissService {
         return new String[]{adultCharge, infantCharge};
     }
 
+    private Date getAdmissDate(String patNo, int times, String table) {
+        Date admdate = dao.selectAccountDate(patNo, times);
+        if (null == admdate) {
+            admdate = dao.selectAdmissDate(patNo, times, table);
+        }
+        return admdate;
+    }
+
     private Date getDismissDate(Integer flag, String patNo, Integer times, Date zjdzDate) {
         if (flag == 2) {
             return zjdzDate;