lighter 3 years ago
parent
commit
a8cd826641

+ 2 - 2
src/main/java/thyyxxk/webserver/controller/casefrontsheet/SheetSearchController.java

@@ -34,8 +34,8 @@ public class SheetSearchController {
 
     @PassToken
     @GetMapping("/fetchStatisticsBySeason")
-    public void fetchStatisticsBySeason(HttpServletResponse response, @RequestParam("season") String season) {
-        service.fetchStatisticsBySeason(response, season);
+    public void fetchStatisticsBySeason(HttpServletResponse response) {
+        service.fetchStatisticsBySeason(response);
     }
 
 

+ 17 - 10
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/SheetSearchDao.java

@@ -60,19 +60,19 @@ public interface SheetSearchDao {
     List<PureCodeName> selectOperationDisefamilies(@Param("code") String code);
 
     @Select("select " +
-            "rtrim(a.inpatient_no) as AKC190,AKB020='H43010500370',USERNAME='长沙泰和医院',ZFY=a.total_charge, " +
-            "a.admiss_times as ZYCS,rtrim(a.inpatient_no) as BAH,rtrim(a.name) as XM,a.sex AS XB, " +
-            "CSRQ=convert(varchar(8),b.birth_date,112),NL=(datediff(year,b.birth_date,getdate())),GJ='CNH', " +
-            "XSECSTZ=c.new_born_weight,XSERYTZ=c.new_born_admiss_weight,SFZH=b.social_no,rtrim(b.occupation_code) as ZY, " +
-            "HY=case when b.marry_code='1' then '10' when b.marry_code='2' then '20' when b.marry_code='3' then '40' " +
+            "rtrim(a.inpatient_no) as patNo,hospId='H43010500370',hospName='长沙泰和医院',a.total_charge, " +
+            "a.admiss_times as times,rtrim(a.inpatient_no) as bah,rtrim(a.name) as name,a.sex AS gender, " +
+            "birthdate=convert(varchar(8),b.birth_date,112),age=(datediff(year,b.birth_date,getdate())),nation='CNH', " +
+            "b.social_no,rtrim(b.occupation_code) as occupation, " +
+            "marriage=case when b.marry_code='1' then '10' when b.marry_code='2' then '20' when b.marry_code='3' then '40' " +
             "when b.marry_code='4' then '30' when b.marry_code='9' then '90' end, " +
-            "RYSJ=convert(varchar(8),a.admiss_date,112),CYSJ=convert(varchar(8),a.dis_date,112), " +
-            "SJZYTS=datediff(day,a.admiss_date,a.dis_date), " +
-            "ZYZD=(select rtrim(dis_diag_comment) from zy_dis_diag_yb tmp where tmp.inpatient_no=a.inpatient_no and " +
+            "admissDate=convert(varchar(8),a.admiss_date,112),disDate=convert(varchar(8),a.dis_date,112), " +
+            "inHospDays=datediff(day,a.admiss_date,a.dis_date), " +
+            "disdiagName=(select rtrim(dis_diag_comment) from zy_dis_diag_yb tmp where tmp.inpatient_no=a.inpatient_no and " +
             "tmp.admiss_times=a.admiss_times and tmp.dis_diag_no=1), " +
-            "JBDM=(select rtrim(dis_diag) from zy_dis_diag_yb tmp where tmp.inpatient_no=a.inpatient_no and " +
+            "disdiagCode=(select rtrim(dis_diag) from zy_dis_diag_yb tmp where tmp.inpatient_no=a.inpatient_no and " +
             "tmp.admiss_times=a.admiss_times and tmp.dis_diag_no=1), " +
-            "LYFS=(select rtrim(lyfs) from batj_ba2 tmp where tmp.zyh=a.inpatient_no and tmp.zycs=a.admiss_times) " +
+            "dismissWay=(select rtrim(lyfs) from batj_ba2 tmp where tmp.zyh=a.inpatient_no and tmp.zycs=a.admiss_times) " +
             "from zy_inactpatient a, a_patient_mi b, batj_ba1 c " +
             "where responce_type in ('03','09','04','ad') and " +
             "dis_date>=#{begntime} and " +
@@ -82,4 +82,11 @@ public interface SheetSearchDao {
             "a.admiss_times=c.zycs")
     List<StatisticsBySeason> selectStatisticsBySeason(@Param("begntime") String begntime,
                                                       @Param("endtime") String endtime);
+
+    @Select("select rtrim(dis_diag) code, rtrim(dis_diag_comment) name from zy_dis_diag_yb where " +
+            "inpatient_no=#{patNo} and admiss_times=#{times} and dis_diag_no=1")
+    PureCodeName selectMainDisDiag(@Param("patNo") String patNo, @Param("times") String times);
+
+    @Select("select top 1 diagnosis_code from t_si_dl_dss_dns where diagnosis_name=#{name} order by data_update_time desc")
+    String selectMedinsDiagByName(@Param("name") String name);
 }

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

@@ -48,7 +48,7 @@ public interface DismissDao {
                             @Param("times") Integer times,
                             @Param("ledgerSn") int ledgerSn);
 
-    @Select("select isnull(sum ( depo_amount ),0) from zy_deposit_file where depo_type='Y' " +
+    @Select("select isnull(sum(depo_amount),0) from zy_deposit_file where depo_type='Y' " +
             "and inpatient_no=#{patNo} and admiss_times=#{times}")
     int hasUnsettledStepTwo(@Param("patNo") String patNo, @Param("times") Integer times);
 
@@ -139,7 +139,7 @@ public interface DismissDao {
                                       @Param("timeLimit") Date timeLimit);
 
     @Update("update zy_ledger_file set deposit=(select isnull(sum(depo_amount),0) from zy_deposit_file f with(nolock) " +
-            "where f.inpatient_no=#{zyh} and f.admiss_times=#{times} and f.ledger_sn=#{ledger} and f.status in ('1','2')) " +
+            "where f.inpatient_no=#{zyh} and f.admiss_times=#{times} and f.ledger_sn=#{ledger} and f.status in (1,2)) " +
             "where inpatient_no=#{zyh} and admiss_times=#{times} and ledger_sn=#{ledger}")
     void recountDeposit(@Param("zyh") String zyh,
                         @Param("times") int times,
@@ -377,7 +377,7 @@ public interface DismissDao {
                               @Param("ledgerSn") int ledgerSn);
 
     @Select("select cast(isnull(sum(depo_amount),0) as varchar(16)) from zy_deposit_file where " +
-            "inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} and status in ('1','2') ")
+            "inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} and status in (1,2) ")
     String selectDepositSumamt(@Param("patNo") String patNo,
                                @Param("times") int times,
                                @Param("ledgerSn") int ledgerSn);

+ 20 - 23
src/main/java/thyyxxk/webserver/entity/casefrontsheet/StatisticsBySeason.java

@@ -8,29 +8,26 @@ import lombok.Data;
  */
 @Data
 public class StatisticsBySeason {
-    private String AKC190;
-    private String AKB020;
-    private String USERNAME;
+    private String patNo;
+    private String hospId;
+    private String hospName;
     private String YLFKFS;
     private String JKKH;
-    private String ZYCS;
-    private String BAH;
-    private String XM;
-    private String XB;
-    private String CSRQ;
-    private String NL;
-    private String GJ;
-    private String BZYZSNL;
-    private String XSECSTZ;
-    private String XSERYTZ;
-    private String SFZH;
-    private String ZY;
-    private String HY;
-    private String RYSJ;
-    private String CYSJ;
-    private String SJZYTS;
-    private String ZYZD;
-    private String JBDM;
-    private String LYFS;
-    private String ZFY;
+    private String times;
+    private String bah;
+    private String name;
+    private String gender;
+    private String birthdate;
+    private String age;
+    private String nation;
+    private String socialNo;
+    private String occupation;
+    private String marriage;
+    private String admissDate;
+    private String disDate;
+    private String inHospDays;
+    private String disdiagName;
+    private String disdiagCode;
+    private String dismissWay;
+    private String totalCharge;
 }

+ 28 - 85
src/main/java/thyyxxk/webserver/service/casefrontsheet/SheetSearchService.java

@@ -12,11 +12,13 @@ import thyyxxk.webserver.entity.dictionary.SearchDataParam;
 import thyyxxk.webserver.service.yibao.DictionaryService;
 import thyyxxk.webserver.utils.ExcelUtil;
 import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.SiUtil;
 import thyyxxk.webserver.utils.StringUtil;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Queue;
 
 /**
  * @author dj
@@ -126,93 +128,34 @@ public class SheetSearchService {
      * 2.	NO41表以CSV文件格式提取,并按季度上传数据。单个上传文件上限为5万条病例数,如果数据量过大,也可按月度上传数据。(文件命名格式:“医疗机构名称_201901.csv”);
      * 3.	报送规范以《长株潭数据报送标准-附件1、2》为准,相关编码要按照贯标后报送,疾病编码、手术编码要按照医保编码2.0目录报送,AKC190、AKB020作为唯一联合主键。
      * */
-    public void fetchStatisticsBySeason(HttpServletResponse response, String season) {
-        String begntime, endtime;
-        switch (season) {
-            case "2019S1":
-                begntime = "2019-01-01 00:00:00";
-                endtime = "2019-03-31 23:59:59";
-                break;
-            case "2019S2":
-                begntime = "2019-04-01 00:00:00";
-                endtime = "2019-06-30 23:59:59";
-                break;
-            case "2019S3":
-                begntime = "2019-07-01 00:00:00";
-                endtime = "2019-09-30 23:59:59";
-                break;
-            case "2019S4":
-                begntime = "2019-10-01 00:00:00";
-                endtime = "2019-12-31 23:59:59";
-                break;
-            case "2020S1":
-                begntime = "2020-01-01 00:00:00";
-                endtime = "2020-03-31 23:59:59";
-                break;
-            case "2020S2":
-                begntime = "2020-04-01 00:00:00";
-                endtime = "2020-06-30 23:59:59";
-                break;
-            case "2020S3":
-                begntime = "2020-07-01 00:00:00";
-                endtime = "2020-09-30 23:59:59";
-                break;
-            case "2020S4":
-                begntime = "2020-10-01 00:00:00";
-                endtime = "2020-12-31 23:59:59";
-                break;
-            case "2021S1":
-                begntime = "2021-01-01 00:00:00";
-                endtime = "2021-03-31 23:59:59";
-                break;
-            case "2021S2":
-                begntime = "2021-04-01 00:00:00";
-                endtime = "2021-06-30 23:59:59";
-                break;
-            case "2021S3":
-                begntime = "2021-07-01 00:00:00";
-                endtime = "2021-09-30 23:59:59";
-                break;
-            default:
-                begntime = "2021-10-01 00:00:00";
-                endtime = "2021-12-31 23:59:59";
-                break;
-        }
-        List<StatisticsBySeason> list = dao.selectStatisticsBySeason(begntime, endtime);
-        list.removeIf(itm -> StringUtil.isBlank(itm.getJBDM()));
-        if (season.equals("2021S4")) {
-            list.removeIf(itm -> !itm.getSFZH().startsWith("4301"));
+    public void fetchStatisticsBySeason(HttpServletResponse response) {
+        Queue<String> queue = SiUtil.readTxtFile("D:\\disdiagwrong.txt");
+        if (null == queue) {
+            log.info("读取文本为空!");
+            return;
         }
-
-        String[] title = {"AKC190", "AKB020", "USERNAME", "ZYCS", "BAH", "XM", "XB", "CSRQ", "NL", "GJ", "XSECSTZ",
-                "XSERYTZ", "SFZH", "ZY", "HY", "RYSJ", "CYSJ", "SJZYTS", "ZYZD", "JBDM", "LYFS", "ZFY" };
-        String[][] content = new String[list.size()][];
-        for (int i = 0; i < list.size(); i++) {
-            content[i] = new String[title.length];
-            StatisticsBySeason result = list.get(i);
-            content[i][0] = result.getAKC190();
-            content[i][1] = result.getAKB020();
-            content[i][2] = result.getUSERNAME();
-            content[i][3] = result.getZYCS();
-            content[i][4] = result.getBAH();
-            content[i][5] = result.getXM();
-            content[i][6] = result.getXB();
-            content[i][7] = result.getCSRQ();
-            content[i][8] = result.getNL();
-            content[i][9] = result.getGJ();
-            content[i][10] = result.getXSECSTZ();
-            content[i][11] = result.getXSERYTZ();
-            content[i][12] = result.getSFZH();
-            content[i][13] = result.getZY();
-            content[i][14] = result.getHY();
-            content[i][15] = result.getRYSJ();
-            content[i][16] = result.getCYSJ();
-            content[i][17] = result.getSJZYTS();
-            content[i][18] = result.getZYZD();
-            content[i][19] = result.getJBDM();
-            content[i][20] = result.getLYFS();
-            content[i][21] = result.getZFY();
+        log.info("读取文本共 {} 行", queue.size());
+        String[][] content = new String[queue.size()][];
+        String[] title = {"patNo", "times", "diag" };
+        int column = 0;
+        int count = 0;
+        while (!queue.isEmpty()) {
+            String info = queue.poll();
+            String[] ifs = info.split("\t");
+            PureCodeName codeName = dao.selectMainDisDiag(ifs[1], ifs[2]);
+            String medinsDiag = dao.selectMedinsDiagByName(codeName.getName());
+            log.info("解析:{}, {}, {}, {}, {}", ifs[1], ifs[2], codeName.getCode(), codeName.getName(), medinsDiag);
+            if (StringUtil.notBlank(medinsDiag)) {
+                count += 1;
+                ifs[3] = medinsDiag;
+            }
+            content[column] = new String[title.length];
+            content[column][0] = ifs[1];
+            content[column][1] = ifs[2];
+            content[column][2] = ifs[3];
+            column += 1;
         }
+        log.info("处理共 {} 条", count);
         ExcelUtil.exportExcel(response, title, content);
     }
 }

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

@@ -183,7 +183,7 @@ public class DismissService {
             exception.setMessage("此患者有未结账的费用。");
             throw new BizException(exception);
         }
-        dao.recountDeposit(patNo, times, ledgerSn);
+//        dao.recountDeposit(patNo, times, ledgerSn);
         Date begntime = getBegntime(patNo, times, "zy_actpatient");
         dismissFeeAnalyse(patNo, times, ledgerSn, begntime, tmpendtime);