Forráskód Böngészése

病案首页汇总添加出院统计

lighter 3 éve
szülő
commit
c459f462e2

+ 1 - 1
pom.xml

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

+ 5 - 0
src/main/java/thyyxxk/webserver/controller/casefrontsheet/CaseFrontSheetController.java

@@ -125,4 +125,9 @@ public class CaseFrontSheetController {
         return service.fetchSsfz(code, bah, times);
     }
 
+    @GetMapping("/analyzeDismissCount")
+    public ResultVo<List<DismissCount>> analyzeDismissCount(@RequestParam("month") String month) {
+        return service.analyzeDismissCount(month);
+    }
+
 }

+ 5 - 0
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/CaseFrontSheetDao.java

@@ -726,4 +726,9 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
 
     @Select("select * from t_si_operation_disefamily with(nolock) where disefamily_code=#{code}")
     List<OprnDisefamilyGrade> selectOperationDisefamilies(@Param("code") String code);
+
+    @Select("select rtrim(zk_ward) as deptCode,isnull(file_status,0) as fileStatus, count(1) as dismissCount " +
+            "from zy_inactpatient with(nolock) where dis_date>=#{start} and dis_date<=#{end} group by zk_ward, file_status")
+    List<TempDismissCount> selectDismissCount(@Param("start") String start,
+                                          @Param("end") String end);
 }

+ 3 - 0
src/main/java/thyyxxk/webserver/dao/his/redislike/RedisLikeDao.java

@@ -11,6 +11,9 @@ public interface RedisLikeDao {
     @Select("select rtrim(name) from a_employee_mi with(nolock) where code=#{code}")
     String selectEmployeeName(@Param("code") String code);
 
+    @Select("select rtrim(name) from zd_unit_code with(nolock) where code=#{code}")
+    String selectDeptName(@Param("code") String code);
+
     @Select("select code=(select b.name from t_region b where b.code=a.parent_code),a.name from t_region a where code=#{code}")
     PureCodeName selectAdmdvsNameAndParentName(@Param("code") String code);
 

+ 11 - 0
src/main/java/thyyxxk/webserver/entity/casefrontsheet/DismissCount.java

@@ -0,0 +1,11 @@
+package thyyxxk.webserver.entity.casefrontsheet;
+
+import lombok.Data;
+
+@Data
+public class DismissCount {
+    private String deptName;
+    private Integer dismissCount;
+    private Integer signedCount;
+    private Integer unsignCount;
+}

+ 10 - 0
src/main/java/thyyxxk/webserver/entity/casefrontsheet/TempDismissCount.java

@@ -0,0 +1,10 @@
+package thyyxxk.webserver.entity.casefrontsheet;
+
+import lombok.Data;
+
+@Data
+public class TempDismissCount {
+    private Integer fileStatus;
+    private String deptCode;
+    private Integer dismissCount;
+}

+ 39 - 1
src/main/java/thyyxxk/webserver/service/casefrontsheet/CaseFrontSheetService.java

@@ -15,6 +15,7 @@ import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.casefrontsheet.*;
 import thyyxxk.webserver.entity.dictionary.PureCodeName;
 import thyyxxk.webserver.service.externalhttp.PowersiSrvc;
+import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.utils.*;
 
 import java.lang.reflect.Field;
@@ -30,14 +31,16 @@ public class CaseFrontSheetService {
     private final BasSelectOverviewDao basDao;
     private final LoginDao userDao;
     private final PowersiSrvc srvc;
+    private final RedisLikeService redis;
 
     public CaseFrontSheetService(SheetCreatedDao createdDao, CaseFrontSheetDao dao,
-                                 BasSelectOverviewDao basDao, LoginDao userDao, PowersiSrvc srvc) {
+                                 BasSelectOverviewDao basDao, LoginDao userDao, PowersiSrvc srvc, RedisLikeService redis) {
         this.dao = dao;
         this.createdDao = createdDao;
         this.basDao = basDao;
         this.userDao = userDao;
         this.srvc = srvc;
+        this.redis = redis;
         if (allDictionary == null) {
             allDictionary = new ConcurrentHashMap<>();
         }
@@ -627,4 +630,39 @@ public class CaseFrontSheetService {
         return (int) days;
     }
 
+    public ResultVo<List<DismissCount>> analyzeDismissCount(String month) {
+        String begntime = month + "-01 00:00:00.000";
+        String endtime = DateUtil.getMonthEndtime(month);
+        List<TempDismissCount> templist = dao.selectDismissCount(begntime, endtime);
+        Map<String, DismissCount> map = new HashMap<>();
+        for (TempDismissCount item : templist) {
+            if (map.containsKey(item.getDeptCode())) {
+                DismissCount count = map.get(item.getDeptCode());
+                count.setDismissCount(count.getDismissCount() + item.getDismissCount());
+                if (item.getFileStatus() == 1) {
+                    count.setSignedCount(count.getSignedCount() + item.getDismissCount());
+                } else {
+                    count.setUnsignCount(count.getUnsignCount() + item.getDismissCount());
+                }
+            } else {
+                DismissCount dismissCount = new DismissCount();
+                dismissCount.setDeptName(redis.getDeptName(item.getDeptCode()));
+                dismissCount.setDismissCount(item.getDismissCount());
+                if (item.getFileStatus() == 1) {
+                    dismissCount.setSignedCount(item.getDismissCount());
+                    dismissCount.setUnsignCount(0);
+                } else {
+                    dismissCount.setUnsignCount(item.getDismissCount());
+                    dismissCount.setSignedCount(0);
+                }
+                map.put(item.getDeptCode(), dismissCount);
+            }
+        }
+        List<DismissCount> list = new ArrayList<>();
+        for (Map.Entry<String, DismissCount> entry : map.entrySet()) {
+            list.add(entry.getValue());
+        }
+        return ResultVoUtil.success(list);
+    }
+
 }

+ 13 - 0
src/main/java/thyyxxk/webserver/service/redislike/RedisLikeService.java

@@ -11,6 +11,7 @@ import java.util.Map;
 @Service
 public class RedisLikeService {
     private final static Map<String, String> employeeNameMap = new HashMap<>();
+    private final static Map<String, String> deptNameMap = new HashMap<>();
     private final static Map<String, String> regionMap = new HashMap<>();
     private final RedisLikeDao dao;
 
@@ -30,6 +31,18 @@ public class RedisLikeService {
         return username;
     }
 
+    public String getDeptName(String code) {
+        if (StringUtil.invalidValue(code)) {
+            return null;
+        }
+        String deptName = deptNameMap.get(code);
+        if (null == deptName) {
+            deptName = dao.selectDeptName(code);
+            deptNameMap.put(code, deptName);
+        }
+        return deptName;
+    }
+
     public String getRegionName(String code) {
         String regionName = regionMap.get(code);
         if (null == regionName) {

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

@@ -8,7 +8,7 @@ spring:
     cache: false
   datasource:
     dynamic:
-      primary: dev
+      primary: his
       strict: false
       datasource:
         his:
@@ -73,6 +73,6 @@ si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
 
 execute-scheduled: false
 
-logging:
-  level:
-    thyyxxk.webserver.dao: debug
+#logging:
+#  level:
+#    thyyxxk.webserver.dao: debug