浏览代码

增加人数树状图数据导出

hsh 2 年之前
父节点
当前提交
b542542065

+ 7 - 0
src/main/java/thyyxxk/webserver/controller/ybkf/YbStatController.java

@@ -6,6 +6,7 @@ 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 thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
 import thyyxxk.webserver.entity.ybkf.TreeNodesResult;
@@ -70,4 +71,10 @@ public class YbStatController {
         return service.selectTreeData(dto);
     }
 
+    @PassToken
+    @PostMapping("/selectTreeAllData")
+    public void selectTreeAllData(HttpServletResponse response, @RequestBody @Validated YbStatDto dto){
+        service.selectTreeAllData(response, dto);
+    }
+
 }

+ 14 - 9
src/main/java/thyyxxk/webserver/dao/his/ybkf/YbStatDao.java

@@ -299,24 +299,29 @@ public interface YbStatDao {
     List<TreeNodesResult> selectTreeFourthData(@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("setlType") String setlType, @Param("insurType") String insurType);
 
     @Select("<script> " +
-            "select count(t.setl_id) as value, rtrim(t.pid) as pid, rtrim(t.id) as id, rtrim(isnull(t.medins_type, '其他')) as insurName, rtrim(isnull(e.name, '其他')) as doctorName, rtrim(d.name) as deptName  from " +
+            "select count(t.setl_id) as rs, rtrim(isnull(t.medins_type, '其他')) as insurName, rtrim(isnull(e.name, '其他')) as doctorName, rtrim(isnull(d.name, '其他')) as deptName  from " +
             "(select a.setl_id, a.medins_type, isnull(zy.small_dept, zya.small_dept) pid, isnull(isnull(zy.refer_physician, zya.refer_physician), 9999) id " +
             "from t_si_setlinfo a " +
             "left join zy_inactpatient zy on (zy.inpatient_no = a.pat_no and zy.admiss_times = a.times) " +
             "left join zy_actpatient zya on (zya.inpatient_no = a.pat_no and zya.admiss_times = a.times) " +
             "where a.revoked=0 and a.setl_type=#{setlType} and a.setl_time&gt;=#{beginTime} and a.setl_time&lt;=#{endTime} " +
-            "<if test=\"deptCode != null and deptCode != '' \">" +
-            " and (zy.small_dept=#{deptCode} or zya.small_dept=#{deptCode})  " +
+            "<if test=\"insurType != null and insurType != '' \"> " +
+            " and a.medins_type=#{insurType}  " +
             "</if> " +
-            "<if test=\"doctorId != null and doctorId != '' \">" +
-            " and (zy.refer_physician=#{doctorId} or zya.refer_physician=#{doctorId}) " +
-            "</if> ) t " +
+            ") t " +
             "left join zy_dept_code d on d.code = t.pid " +
             "left join a_employee_mi e on e.code = t.id " +
+            "where 1=1 " +
+            "<if test=\"dept != null and dept != '' \"> " +
+            " and rtrim(d.name)=#{dept} " +
+            "</if> " +
+            "<if test=\"doctor != null and doctor != '' \"> " +
+            " and rtrim(e.name)=#{doctor} " +
+            "</if> " +
             "group by t.pid, t.id, t.medins_type, d.name, e.name " +
-            "order by count(t.setl_id) desc " +
+            "order by d.name, e.name, count(t.setl_id) desc " +
             "</script>")
-    List<TreeNodesResult> selectTreeAllData(@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("setlType") String setlType,
-                                              @Param("deptCode") String deptCode, @Param("doctorId") String doctorId, @Param("insurType") String insurType);
+    List<Map<String, Object>> selectTreeAllData(@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("setlType") String setlType,
+                                              @Param("dept") String dept, @Param("doctor") String doctor, @Param("insurType") String insurType);
 
 }

+ 56 - 0
src/main/java/thyyxxk/webserver/service/ybkf/YbStatService.java

@@ -1441,4 +1441,60 @@ public class YbStatService {
         root.setChildren(secondTreeList);
         return ResultVoUtil.success(root);
     }
+
+    public void selectTreeAllData(HttpServletResponse response, YbStatDto dto) {
+        String beginTime = dto.getStartTime();
+        String endTime = DateUtil.getMonthEndtime(dto.getEndTime());
+        String setlType = dto.getSetlType();
+        String dept = dto.getDept();
+        String doctor = dto.getDoctor();
+        String insurType = dto.getInsurType();
+        List<Map<String, Object>> list = dao.selectTreeAllData(beginTime, endTime, setlType, dept, doctor, insurType);
+
+        if(null == list){
+            return;
+        }
+
+        // 导出标题
+        String exportName = dto.getExportName();
+
+        // 组装表头
+        List<HeadInfo> headInfoList = calTreeRsHeadList();
+
+        // 导出
+        ExcelUtil.exportExcelReport(response, list, headInfoList, exportName);
+    }
+
+    /**
+     * @description: 医生医保病人按参保身份分布人数导出
+     * @author: hsh
+     * @date: 2022/10/24 15:12
+     * @param: []
+     * @return: List<HeadInfo>
+     **/
+    private List<HeadInfo> calTreeRsHeadList() {
+        List<HeadInfo> headInfoList = new ArrayList<>();
+        HeadInfo headInfo = new HeadInfo();
+        headInfo.setDisplay("科室");
+        headInfo.setName("deptName");
+        headInfoList.add(headInfo);
+
+        headInfo = new HeadInfo();
+        headInfo.setDisplay("医生");
+        headInfo.setName("doctorName");
+        headInfoList.add(headInfo);
+
+        headInfo = new HeadInfo();
+        headInfo.setDisplay("险种");
+        headInfo.setName("insurName");
+        headInfoList.add(headInfo);
+
+        headInfo = new HeadInfo();
+        headInfo.setDisplay("人数");
+        headInfo.setName("rs");
+        headInfoList.add(headInfo);
+
+        return headInfoList;
+    }
+
 }