فهرست منبع

解决院内统计的时候解决 报错。

xiaochan 4 سال پیش
والد
کامیت
556f6bdee4

+ 3 - 3
src/main/java/thyyxxk/webserver/dao/his/querydata/QueryDrugsAndProjectsDao.java

@@ -92,7 +92,7 @@ public interface QueryDrugsAndProjectsDao {
      */
     @Select("select * from (" +
             "SELECT " +
-            "    a.inpatient_no patient,a.admiss_times times,rtrim(b.name) name,b.social_no social_no,b.employer_tel phone,c.admiss_date,c.dis_date,a.charge_date charge_date, " +
+            "    rtrim(a.inpatient_no) patient,a.admiss_times times,rtrim(b.name) name,b.social_no social_no,b.employer_tel phone,c.admiss_date,c.dis_date,a.charge_date charge_date, " +
             "    (select name from zd_unit_code where code=c.small_dept) dept, " +
             "    (select name from zy_zd_responce_type where code=c.responce_type) yb_type, " +
             "    sum(a.charge_amount) number,sum(a.charge_fee) amount_of_money,charge_code_mx charge_code,source='住院' " +
@@ -105,7 +105,7 @@ public interface QueryDrugsAndProjectsDao {
             "group by charge_code_mx,a.inpatient_no,a.admiss_times,b.name,b.social_no,b.employer_tel,c.admiss_date,c.dis_date,c.small_dept,c.responce_type,a.charge_date " +
             "union all " +
             "SELECT " +
-            "    a.inpatient_no patient,a.admiss_times times,rtrim(b.name) name ,b.social_no social_no,b.employer_tel phone,c.admiss_date,c.dis_date,a.charge_date, " +
+            "   rtrim(a.inpatient_no) patient,a.admiss_times times,rtrim(b.name) name ,b.social_no social_no,b.employer_tel phone,c.admiss_date,c.dis_date,a.charge_date, " +
             "    (select name from zd_unit_code where code=c.small_dept) dept, " +
             "    (select name from zy_zd_responce_type where code=c.responce_type) yb_type, " +
             "    sum(a.charge_amount) number,sum(a.charge_fee) amount_of_money,charge_code_mx charge_code,source = '住院' " +
@@ -117,7 +117,7 @@ public interface QueryDrugsAndProjectsDao {
             "  and charge_date >= #{startTime} and charge_date <= #{endTime} " +
             "group by charge_code_mx,a.inpatient_no,a.admiss_times,b.name,b.social_no,b.employer_tel,c.admiss_date,c.dis_date,c.small_dept,c.responce_type,a.charge_date " +
             "union all " +
-            "    select a.patient_id patient,a.times times,rtrim(b.name) name ,b.social_no social_no,b.phone_no phone,a.charge_date admiss_date,dis_date = null,a.charge_date charge_date, " +
+            "    select rtrim(a.patient_id) patient,a.times times,rtrim(b.name) name ,b.social_no social_no,b.phone_no phone,a.charge_date admiss_date,dis_date = null,a.charge_date charge_date, " +
             "    (select name from zd_unit_code where code = a.exec_dept) dept, " +
             "           yb_type = '自费',sum(a.quantity*a.drug_win) number,sum(a.quantity*drug_win*unit_price) amount_of_money,a.charge_item_code,source = '门诊' " +
             "           from mz_charge_detail_b a,mz_patient_mi b " +

+ 3 - 2
src/main/java/thyyxxk/webserver/service/querydata/QueryDrugsAndProjectsService.java

@@ -88,6 +88,7 @@ public class QueryDrugsAndProjectsService {
         // 获取诊断的详细情况
         List<QueryDrugsAndProjects> zhenDuanList = new ArrayList<>();
 
+        // 因为在 sql 中的 in 最长只能是有 2100 个 所以我需要 拆分来查询
         for (QueryDrugsAndProjects projects : xiangMuList) {
             if (xiangMuList.size() > 2100) {
                 if (patientList.size() < 2000) {
@@ -96,7 +97,7 @@ public class QueryDrugsAndProjectsService {
                     }
                 } else {
                     zhenDuanList.addAll(dao.queryZhenDuan(patientList));
-                    patientList = new ArrayList<>();
+                    patientList.clear();
                 }
             } else {
                 patientList.add(projects.getPatient());
@@ -106,7 +107,7 @@ public class QueryDrugsAndProjectsService {
         if (patientList.size() < 2100) {
             zhenDuanList.addAll(dao.queryZhenDuan(patientList));
         }
-        
+
         for (QueryDrugsAndProjects xiangMu : xiangMuList) {
             StringBuilder pjZhenDuan = new StringBuilder();
             for (QueryDrugsAndProjects zhenDuan : zhenDuanList) {

+ 6 - 2
src/main/java/thyyxxk/webserver/service/yibao/XiangMuLuRuService.java

@@ -222,10 +222,11 @@ public class XiangMuLuRuService {
     }
 
     public ResultVo<String> yiZhuTuiFeiPiPei(String inpatientNo, Integer admissTimes) {
-        log.info("医嘱退费匹配:住院号:{},住院次数:{}", inpatientNo, admissTimes);
+        // 获取正的费用
         List<ZyDetailCharge> getYiZhuFeiYongZhenShu = dao.getYiZhuFeiYong(inpatientNo, admissTimes, ">");
+        // 获取负的费用
         List<ZyDetailCharge> getYiZhuFeiYongFuShu = dao.getYiZhuFeiYong(inpatientNo, admissTimes, "<");
-
+        // 需要匹配的一些流水
         List<ZyDetailCharge> piPei = new ArrayList<>();
         for (ZyDetailCharge fuShu : getYiZhuFeiYongFuShu) {
             for (ZyDetailCharge zhenShu : getYiZhuFeiYongZhenShu) {
@@ -234,12 +235,15 @@ public class XiangMuLuRuService {
                         && DateUtil.formatDatetime(fuShu.getChargeDate()).equals(DateUtil.formatDatetime(zhenShu.getChargeDate()))
                         && fuShu.getChargeCodeMx().equals(zhenShu.getChargeCodeMx())
                         && fuShu.getChargeAmount().negate().equals(zhenShu.getChargeAmount())) {
+                    // 把匹配到的 流水号 添加进来
                     fuShu.setOriDetailSn(zhenShu.getDetailSn());
+                    // 在保存到list中
                     piPei.add(fuShu);
                 }
             }
         }
         if (piPei.size() > 0) {
+            log.info("医嘱退费匹配 ==》 操作人:{} :住院号:{},住院次数:{}", TokenUtil.getTokenUserId(), inpatientNo, admissTimes);
             dao.yiZhuTuiFeiPiPei(inpatientNo, admissTimes, piPei);
             return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, String.format("医嘱退费匹配成功共匹配%d条", piPei.size()));
         } else {

+ 4 - 3
src/main/resources/application.yml

@@ -8,7 +8,7 @@ spring:
     cache: false
   datasource:
     dynamic:
-      primary: dev
+      primary: his
       strict: false
       datasource:
         his:
@@ -86,6 +86,7 @@ hrg-api-url: http://172.16.30.33:8089/thmz/api/v1
 powersi-api-url: http://172.16.32.183:8916/mmg-gateway
 triage-notify-url: http://localhost:8083/triage/roomScreen/pushMsg
 si-tj-url: http://jkglcsx.server.zhongmeihealth.com/openInter
-
-
+#logging:
+#  level:
+#    thyyxxk.webserver.dao: debug