lighter 3 年之前
父节点
当前提交
bfa7ded665

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>1</version>
+    <version>2</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
     <properties>

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

@@ -1,15 +1,14 @@
 package thyyxxk.webserver.controller.casefrontsheet;
 
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.PureCodeName;
 import thyyxxk.webserver.entity.dictionary.SearchDataParam;
 import thyyxxk.webserver.service.casefrontsheet.SheetSearchService;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 @RestController
@@ -25,4 +24,10 @@ public class SheetSearchController {
     public ResultVo<List<PureCodeName>> sheetSearch(@Validated @RequestBody SearchDataParam param) {
         return service.sheetSearch(param);
     }
+
+    @PassToken
+    @GetMapping("/fetchStatisticsBySeason")
+    public void fetchStatisticsBySeason(HttpServletResponse response, @RequestParam("season") String season) {
+        service.fetchStatisticsBySeason(response, season);
+    }
 }

+ 26 - 0
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/SheetSearchDao.java

@@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
+import thyyxxk.webserver.entity.casefrontsheet.StatisticsBySeason;
 import thyyxxk.webserver.entity.dictionary.PureCodeName;
 
 import java.util.List;
@@ -138,4 +139,29 @@ public interface SheetSearchDao {
 
     @Select("select rtrim(code) code, rtrim(name) name from zd_cm3_new with(nolock)")
     List<PureCodeName> getAllItem();
+
+
+    @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' " +
+            "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 " +
+            "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 " +
+            "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) " +
+            "from zy_inactpatient a, a_patient_mi b, batj_ba1 c " +
+            "where responce_type in ('03','09','04','ad') and " +
+            "dis_date>=#{begntime} and " +
+            "dis_date<=#{endtime} and " +
+            "a.inpatient_no=b.inpatient_no and " +
+            "a.inpatient_no=c.zyh and " +
+            "a.admiss_times=c.zycs")
+    List<StatisticsBySeason> selectStatisticsBySeason(@Param("begntime") String begntime,
+                                                      @Param("endtime") String endtime);
 }

+ 11 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiSetlinfoDao.java

@@ -54,4 +54,15 @@ public interface SiSetlinfoDao extends BaseMapper<SiSetlinfo> {
                                      @Param("insutype") String insutype,
                                      @Param("begndate") String begndate,
                                      @Param("enddate") String enddate);
+
+    @Select("select a.*, " +
+            "hospPay=(select sum(b.fund_payamt) from t_si_setldetail b where b.pat_no=a.pat_no and b.times=a.times " +
+            "and b.ledger_sn=a.ledger_sn and (b.fund_pay_type='999996' or b.setl_proc_info='999996')) " +
+            "from t_si_setlinfo a where a.setl_type=21 and a.revoked=0 and a.insutype like #{insutype} " +
+            "and a.insuplc_admdvs like #{insuplcAdmdvs} and a.setl_time>=#{begntime} and a.setl_time<=#{endtime}")
+    List<SiSetlinfo> selectMyList(@Param("insutype") String insutype,
+                                  @Param("insuplcAdmdvs") String insuplcAdmdvs,
+                                  @Param("begntime") String begntime,
+                                  @Param("endtime") String endtime);
+
 }

+ 36 - 0
src/main/java/thyyxxk/webserver/entity/casefrontsheet/StatisticsBySeason.java

@@ -0,0 +1,36 @@
+package thyyxxk.webserver.entity.casefrontsheet;
+
+import lombok.Data;
+
+/**
+ * N041 出院病人调查表
+ * (注意事项:疾病编码、手术编码要按照医保编码2.0目录报送)
+ */
+@Data
+public class StatisticsBySeason {
+    private String AKC190;
+    private String AKB020;
+    private String USERNAME;
+    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;
+}

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/setlinfo/SiSetlinfo.java

@@ -285,4 +285,6 @@ public class SiSetlinfo implements Serializable {
 	private String clrOptinsName;
 	@TableField(exist = false)
 	private String insuplcAdmdvsName;
+	@TableField(exist = false)
+	private Double hospPay;
 }

+ 100 - 0
src/main/java/thyyxxk/webserver/service/casefrontsheet/SheetSearchService.java

@@ -5,11 +5,17 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.dao.his.casefrontsheet.SheetSearchDao;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.casefrontsheet.StatisticsBySeason;
 import thyyxxk.webserver.entity.dictionary.PureCodeName;
 import thyyxxk.webserver.entity.dictionary.SearchDataParam;
+import thyyxxk.webserver.entity.examinations.covidexam.CovidExamResult;
 import thyyxxk.webserver.service.yibao.DictionaryService;
+import thyyxxk.webserver.utils.DateUtil;
+import thyyxxk.webserver.utils.ExcelUtil;
 import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.StringUtil;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -143,4 +149,98 @@ public class SheetSearchService {
         }
     }
 
+    /**
+     * 1.	报送范围为出院日期在2019年1月1日—2021年12月31日,包括城镇职工、城乡居民基本医疗保险病人的住院数据(排除全自费、异地就医、工伤、生育保险类住院数据);
+     * 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"));
+        }
+
+        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();
+        }
+        ExcelUtil.exportExcel(response, title, content);
+    }
 }

+ 5 - 8
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -1589,15 +1589,12 @@ public class SiQueryService {
         if (StringUtil.isBlank(insutype)) {
             insutype = "%%";
         }
-        QueryWrapper<SiSetlinfo> wrapper = new QueryWrapper<>();
-        wrapper.eq("setl_type", condition.getSetlType());
-        wrapper.eq("revoked", YesOrNo.NO.getCode());
-        wrapper.like("insutype", insutype);
-        wrapper.like("insuplc_admdvs", insuplcAdmdvs);
-        wrapper.apply("setl_time>='" + begntime + "'");
-        wrapper.apply("setl_time<='" + endtime + "'");
-        List<SiSetlinfo> list = setlinfoDao.selectList(wrapper);
+        List<SiSetlinfo> list = setlinfoDao.selectMyList(insutype, insuplcAdmdvs, begntime, endtime);
         list.forEach(item -> {
+            if (null != item.getHospPay()) {
+                log.info("hosp: {}", item.getHospPay());
+                item.setFundPaySumamt(DecimalUtil.minusDouble(item.getFundPaySumamt(), item.getHospPay()));
+            }
             item.setInsuplcAdmdvsName(redis.getRegionName(item.getInsuplcAdmdvs()));
             FilterUtil.filterCodeToName(item);
         });

+ 12 - 0
src/main/java/thyyxxk/webserver/utils/DecimalUtil.java

@@ -48,6 +48,18 @@ public class DecimalUtil {
         return ad.subtract(bd).setScale(2, RoundingMode.HALF_UP).toString();
     }
 
+    public static Double minusDouble(Double a, Double b) {
+        if (null == a) {
+            a = 0d;
+        }
+        if (null == b) {
+            b = 0d;
+        }
+        BigDecimal ad = new BigDecimal(a);
+        BigDecimal bd = new BigDecimal(b);
+        return ad.subtract(bd).setScale(2, RoundingMode.HALF_UP).doubleValue();
+    }
+
     public static BigDecimal divide(BigDecimal a, BigDecimal b) {
         return a.divide(b, 0, RoundingMode.HALF_UP);
     }

+ 2 - 6
src/main/resources/application.yml

@@ -8,7 +8,7 @@ spring:
     cache: false
   datasource:
     dynamic:
-      primary: dev
+      primary: his
       strict: false
       datasource:
         his:
@@ -71,8 +71,4 @@ si-tj-url: http://jkglcsx.server.zhongmeihealth.com/openInter
 si-access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
 si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
 
-execute-scheduled: false
-
-logging:
-  level:
-    thyyxxk.webserver.dao: debug
+execute-scheduled: false