Selaa lähdekoodia

增加病案统计,增加诊断搜索权重

lighter 3 vuotta sitten
vanhempi
commit
ebd6d754ac

+ 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>

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

@@ -2,6 +2,7 @@ package thyyxxk.webserver.controller.casefrontsheet;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.casefrontsheet.*;
 import thyyxxk.webserver.entity.dictionary.PureCodeName;
@@ -126,8 +127,12 @@ public class CaseFrontSheetController {
     }
 
     @GetMapping("/analyzeDismissCount")
-    public ResultVo<List<DismissCount>> analyzeDismissCount(@RequestParam("month") String month) {
-        return service.analyzeDismissCount(month);
+    public ResultVo<List<DismissCount>> analyzeDismissCount(@RequestParam("type") Integer type, @RequestParam("month") String month) {
+        return service.analyzeDismissCount(type, month);
     }
 
+    @GetMapping("/increaseDiagWeight")
+    public void increaseDiagWeight(@RequestParam("code") String code) {
+        service.increaseDiagWeight(code);
+    }
 }

+ 21 - 8
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/CaseFrontSheetDao.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.dao.his.casefrontsheet;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.*;
 import thyyxxk.webserver.entity.casefrontsheet.*;
+import thyyxxk.webserver.entity.dictionary.PureCodeName;
 
 import java.util.Date;
 import java.util.List;
@@ -539,9 +540,6 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "from zy_dis_diag_yb with(nolock) where inpatient_no=#{bah} and admiss_times=#{times}")
     List<YiBaoDisdiag> getYbDiags(@Param("bah") String bah, @Param("times") int times);
 
-    @Update("update zy_actpatient set operation=#{operation} where inpatient_no=#{patNo}")
-    void updateOperation(@Param("patNo") String patNo, @Param("operation") String operation);
-
     @Delete("delete from zy_dis_diag_yb where inpatient_no=#{bah} and admiss_times=#{times}")
     void deleteOldYbDiag(@Param("bah") String bah, @Param("times") int times);
 
@@ -704,11 +702,6 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "d.ssbm like #{surgeryCode}")
     List<SheetOverview> advanceSearchWithSurgery(AdvanceSearchParam param);
 
-
-    @Select("select count(1) from t_case_frontsheet_main with(nolock) where bah=#{bah} and admiss_times=#{admissTimes}")
-    Integer bingAnQianShouZhuangTai(@Param("bah") String bah,
-                                    @Param("admissTimes") Integer admissTimes);
-
     @Select("select file_status from t_case_frontsheet_main with(nolock) where bah=#{bah} and admiss_times=#{admissTimes}")
     Integer selectFileStatus(@Param("bah") String bah,
                              @Param("admissTimes") Integer admissTimes);
@@ -731,4 +724,24 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "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);
+
+    @Select("select rtrim(a.inpatient_no) as patNo,a.admiss_times as times, " +
+            "rtrim(a.name) as name,gender=(case when a.sex='1' then '男' else '女' end), " +
+            "age=datediff(year,b.birth_date,getdate()),a.admiss_date,a.dis_date, " +
+            "inHospDays=datediff(day, a.admiss_date, a.dis_date),a.total_charge, " +
+            "rtrim(a.zk_ward) as disDept, " +
+            "disDiag=(select dis_diag_comment from ba_first_page1 t where t.inpatient_no=a.inpatient_no " +
+            "and t.admiss_times=a.admiss_times and t.dis_diag_no=1), " +
+            "blfx=isnull(c.blfx,''),rtrim(a.small_dept) as admissDept,rtrim(a.zk_ward) as zkWard, " +
+            "c.kzr,c.zzys,c.zyys,fdcrb=isnull(c.fdcrb,'')," +
+            "deadOrder=(select count(1) from yz_inact_order t where t.inpatient_no=a.inpatient_no and " +
+            "t.admiss_times=a.admiss_times and t.order_code='05973') " +
+            "from zy_inactpatient a, a_patient_mi b, batj_ba2 c " +
+            "where a.dis_date>=#{begntime} and a.dis_date<=#{endtime} and " +
+            "a.inpatient_no=b.inpatient_no and a.inpatient_no=c.zyh and a.admiss_times=c.zycs")
+    List<DismissCount> selectDismissDetailCount(@Param("begntime") String begntime,
+                                                @Param("endtime") String endtime);
+
+    @Update("update zd_icd_code set weight=(weight+1) where code=#{code}")
+    void increaseDiagWeight(@Param("code") String code);
 }

+ 14 - 105
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/SheetSearchDao.java

@@ -13,134 +13,43 @@ import java.util.List;
 public interface SheetSearchDao {
     @Select("select top 10 surgical_operation_code as code, operation_operation_name as name from " +
             "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from t_si_dl_oprtn with(nolock) where py_code like #{content}) a " +
+            "from t_si_dl_oprtn with(nolock) where ${method} like #{content}) a " +
             "where a.[Number]>10*(#{page}-1)")
-    List<PureCodeName> searchSurgeryByAlpha(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 surgical_operation_code as code, operation_operation_name as name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from t_si_dl_oprtn with(nolock) where surgical_operation_code like #{content}) a " +
-            "where a.[Number]>10*(#{page}-1)")
-    List<PureCodeName> searchSurgeryByCode(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 surgical_operation_code as code, operation_operation_name as name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from t_si_dl_oprtn with(nolock) where operation_operation_name like #{content}) a " +
-            "where a.[Number]>10*(#{page}-1)")
-    List<PureCodeName> searchSurgeryByName(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) as code, rtrim(name) as name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_icd_code with(nolock) where py_code like #{content}) a " +
-            "where a.[Number]>10*(#{page}-1)")
-    List<PureCodeName> searchClinicdiagByAlpha(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) as code, rtrim(name) as name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_icd_code with(nolock) where code like #{content}) a " +
-            "where a.[Number]>10*(#{page}-1)")
-    List<PureCodeName> searchClinicdiagByCode(@Param("content") String content, @Param("page") int page);
+    List<PureCodeName> searchSurgery(@Param("method") String method, @Param("content") String content, @Param("page") int page);
 
     @Select("select top 10 rtrim(code) as code, rtrim(name) as name from " +
             "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_icd_code with(nolock) where name like #{content}) a " +
-            "where a.[Number]>10*(#{page}-1)")
-    List<PureCodeName> searchClinicdiagByName(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(CODE) code, rtrim(NAME) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY CODE) AS 'Number',  * " +
-            "from zd_pathologic_diag_code with(nolock) where PY_CODE like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchPathologicDiagByAlpha(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(CODE) code, rtrim(NAME) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY CODE) AS 'Number',  * " +
-            "from zd_pathologic_diag_code with(nolock) where CODE like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchPathologicDiagByCode(@Param("content") String content, @Param("page") int page);
+            "from zd_icd_code with(nolock) where ${method} like #{content} ) a " +
+            "where a.[Number]>10*(#{page}-1) order by weight desc")
+    List<PureCodeName> searchClinicdiag(@Param("method") String method, @Param("content") String content, @Param("page") int page);
 
     @Select("select top 10 rtrim(CODE) code, rtrim(NAME) name from " +
             "(SELECT ROW_NUMBER() OVER(ORDER BY CODE) AS 'Number',  * " +
-            "from zd_pathologic_diag_code with(nolock) where NAME like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchPathologicDiagByName(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_district_code with(nolock) where py_code like #{content}) a " +
+            "from zd_pathologic_diag_code with(nolock) where ${method} like #{content}) a " +
             "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchBirthPlaceByAlpha(@Param("content") String content, @Param("page") int page);
+    List<PureCodeName> searchPathologicDiag(@Param("method") String method, @Param("content") String content, @Param("page") int page);
 
     @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
             "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_district_code with(nolock) where code like #{content}) a " +
+            "from zd_district_code with(nolock) where ${method} like #{content}) a " +
             "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchBirthPlaceByCode(@Param("content") String content, @Param("page") int page);
+    List<PureCodeName> searchBirthPlace(@Param("method") String method, @Param("content") String content, @Param("page") int page);
 
     @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
             "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_district_code with(nolock) where name like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchBirthPlaceByName(@Param("content") String content, @Param("page") int page);
+            "from zd_icd_code with(nolock) where PATINDEX('%[V-Y]%',code)=1 and ${method} like #{content}) a " +
+            "where a.[Number]>10*(#{page}) order by weight desc")
+    List<PureCodeName> searchHurtReason(@Param("method") String method, @Param("content") String content, @Param("page") int page);
 
     @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
             "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_icd_code with(nolock) where py_code like #{content}) a " +
+            "from a_employee_mi with(nolock) where isnull(del_flag,0)=0 and ${method} like #{content}) a " +
             "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchClinicDiagByAlpha(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_icd_code with(nolock) where code like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchClinicDiagByCode(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_icd_code with(nolock) where name like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchClinicDiagByName(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_icd_code with(nolock) where PATINDEX('%[V-Y]%',code)=1 and py_code like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchHurtReasonByAlpha(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_icd_code with(nolock) where PATINDEX('%[V-Y]%',code)=1 and code like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchHurtReasonByCode(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from zd_icd_code with(nolock) where PATINDEX('%[V-Y]%',code)=1 and name like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchHurtReasonByName(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from a_employee_mi with(nolock) where isnull(del_flag,0)=0 and py_code like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchEmployeeByAlpha(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from a_employee_mi with(nolock) where isnull(del_flag,0)=0 and code like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchEmployeeByCode(@Param("content") String content, @Param("page") int page);
-
-    @Select("select top 10 rtrim(code) code, rtrim(name) name from " +
-            "(SELECT ROW_NUMBER() OVER(ORDER BY code) AS 'Number',  * " +
-            "from a_employee_mi with(nolock) where isnull(del_flag,0)=0 and name like #{content}) a " +
-            "where a.[Number]>10*(#{page})")
-    List<PureCodeName> searchEmployeeByName(@Param("content") String content, @Param("page") int page);
+    List<PureCodeName> searchEmployee(@Param("method") String method, @Param("content") String content, @Param("page") int page);
 
     @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, " +

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/wxapi/WxApiDao.java

@@ -44,7 +44,7 @@ public interface WxApiDao {
     @Select("select * from t_wechat_pay_order where trade_no=#{tradeNo}")
     List<WxPayOrder> selectOrdersByTradeNo(@Param("tradeNo") String tradeNo);
 
-    @Update("update t_wechat_pay_order set refund_id=#{refundId}, refund_op_code=#{refundOpCode}, his_status=0 " +
+    @Update("update t_wechat_pay_order set refund_id=#{refundId}, refund_op_code=#{refundOpCode}, his_status=0, " +
             "refund_op_datetime=#{refundOpDatetime}, refund_reason=#{refundReason}, pay_status=4 where trade_no=#{tradeNo}")
     void updateRefundId(RefundParam param);
 

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

@@ -2,10 +2,36 @@ package thyyxxk.webserver.entity.casefrontsheet;
 
 import lombok.Data;
 
+import java.util.Date;
+
 @Data
 public class DismissCount {
     private String deptName;
     private Integer dismissCount;
     private Integer signedCount;
     private Integer unsignCount;
+
+    private String patNo;
+    private Integer times;
+    private String name;
+    private String gender;
+    private Integer age;
+    private Date admissDate;
+    private Date disDate;
+    private Integer inHospDays;
+    private String totalCharge;
+    private String disDept;
+    private String disDiag;
+    private String blfx;
+    private String admissDept;
+    private String zkWard;
+    private String kzr;
+    private String zzys;
+    private String zyys;
+    private String fdcrb;
+    private Integer deadOrder;
+
+    public Integer getDeadOrder() {
+        return null == deadOrder ? 0 :deadOrder;
+    }
 }

+ 166 - 110
src/main/java/thyyxxk/webserver/service/casefrontsheet/CaseFrontSheetService.java

@@ -292,103 +292,98 @@ public class CaseFrontSheetService {
     public synchronized ResultVo<List<PureCodeName>> savePatientInfo(OpCaseFrontsheet param) {
         CaseFrontsheetMain sheet = param.getSheet();
         final String bah = sheet.getBah();
-        final Integer times = sheet.getAdmissTimes();
+        final int times = sheet.getAdmissTimes();
         dao.writeBaOpLog(param.getOpType(), param.getStaffId(), bah, times);
-        log.info("写入病案操作日志, 操作员:{} >>> 住院号:{}, 住院次数:{}, 操作编码:{}",
-                param.getStaffId(), bah, times, param.getOpType());
-        if (param.getOpType() == 1) {
-            log.info("保存病案首页, 操作员:{} >>> 住院号:{}, 住院次数:{}", param.getStaffId(), bah, times);
-            dao.updateAPatientMi(sheet);
-            dao.updateZyActPatient(bah, times, sheet.getAutopsy(), sheet.getDiagConform1(),
-                    sheet.getDiagConform2(), sheet.getDiagConform3(), sheet.getDiagConform4(),
-                    sheet.getDiagConform5(), sheet.getHasSurgery(), sheet.getPathologicDiagStr(),
-                    sheet.getPathologicDiagCode(), sheet.getClinicDiagCode(), sheet.getClinicDiagStr());
-            dao.updateZyInActPatient(bah, times, sheet.getAutopsy(), sheet.getDiagConform1(), sheet.getDiagConform2(),
-                    sheet.getDiagConform3(), sheet.getDiagConform4(), sheet.getDiagConform5(), sheet.getHasSurgery(),
-                    sheet.getPathologicDiagStr(), sheet.getPathologicDiagCode(), sheet.getClinicDiagCode(), sheet.getClinicDiagStr());
-            dao.updateBatjBa1(sheet);
-            dao.updateBatjBa2(sheet);
-            dao.deleteOldDisdiag(bah, times);
-            if (!sheet.getDisdiagList().isEmpty()) {
-                List<CaseFrontsheetDisdiag> diags = sheet.getDisdiagList();
-                for (int i = 0; i < diags.size(); i++) {
-                    CaseFrontsheetDisdiag item = diags.get(i);
-                    if (StringUtil.isBlank(item.getCode())) {
-                        break;
-                    }
-                    item.setNo(i + 1);
-                    item.setBah(bah);
-                    item.setTimes(times);
-                    dao.writeNewDisdiag(item);
+        return param.getOpType() == 1 ? saveSheet(sheet, bah, times) : signSheet(sheet, bah, times);
+    }
+
+    private ResultVo<List<PureCodeName>> saveSheet(CaseFrontsheetMain sheet, String bah, int times) {
+        dao.updateAPatientMi(sheet);
+        dao.updateZyActPatient(bah, times, sheet.getAutopsy(), sheet.getDiagConform1(),
+                sheet.getDiagConform2(), sheet.getDiagConform3(), sheet.getDiagConform4(),
+                sheet.getDiagConform5(), sheet.getHasSurgery(), sheet.getPathologicDiagStr(),
+                sheet.getPathologicDiagCode(), sheet.getClinicDiagCode(), sheet.getClinicDiagStr());
+        dao.updateZyInActPatient(bah, times, sheet.getAutopsy(), sheet.getDiagConform1(), sheet.getDiagConform2(),
+                sheet.getDiagConform3(), sheet.getDiagConform4(), sheet.getDiagConform5(), sheet.getHasSurgery(),
+                sheet.getPathologicDiagStr(), sheet.getPathologicDiagCode(), sheet.getClinicDiagCode(), sheet.getClinicDiagStr());
+        dao.updateBatjBa1(sheet);
+        dao.updateBatjBa2(sheet);
+        dao.deleteOldDisdiag(bah, times);
+        if (!sheet.getDisdiagList().isEmpty()) {
+            List<CaseFrontsheetDisdiag> diags = sheet.getDisdiagList();
+            for (int i = 0; i < diags.size(); i++) {
+                CaseFrontsheetDisdiag item = diags.get(i);
+                if (StringUtil.isBlank(item.getCode())) {
+                    break;
                 }
+                item.setNo(i + 1);
+                item.setBah(bah);
+                item.setTimes(times);
+                dao.writeNewDisdiag(item);
             }
-            dao.deleteOldSurgeryRecord(bah, times);
-            if (!sheet.getSurgeryList().isEmpty()) {
-                List<CaseFrontsheetSurgery> surgeries = sheet.getSurgeryList();
-                for (int i = 0; i < surgeries.size(); i++) {
-                    CaseFrontsheetSurgery item = surgeries.get(i);
-                    if (StringUtil.isBlank(item.getCode())) {
-                        break;
-                    }
-                    if (null == item.getDate()) {
-                        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术日期不能为空!");
-                    }
-                    item.setNo(i + 1);
-                    item.setBah(bah);
-                    item.setTimes(times);
-                    dao.writeNewZySurgeryRecord(item);
+        }
+        dao.deleteOldSurgeryRecord(bah, times);
+        if (!sheet.getSurgeryList().isEmpty()) {
+            List<CaseFrontsheetSurgery> surgeries = sheet.getSurgeryList();
+            for (int i = 0; i < surgeries.size(); i++) {
+                CaseFrontsheetSurgery item = surgeries.get(i);
+                if (StringUtil.isBlank(item.getCode())) {
+                    break;
                 }
-            }
-            return ResultVoUtil.success();
-        } else {
-            log.info("签收病案首页, 操作员:{} >>> 住院号:{}, 住院次数:{}", param.getStaffId(), bah, times);
-            if (userDao.getUserRoles(TokenUtil.getTokenUserId()).contains(7)) {
-                if (isLateSubmit(sheet.getDismissDate()) > 8) {
-                    sheet.setLateFlag(1);
-                } else {
-                    sheet.setLateFlag(0);
+                if (null == item.getDate()) {
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "手术日期不能为空!");
                 }
-                dao.updateZyFileStatus(1, bah, times);
-                dao.updateZyInFileStatus(1, bah, times);
-                dao.updateLateSubmitFlag(sheet.getLateFlag(), bah, times);
-                //插入数据 SignDate 签收日期  在点击签收后 向数据库中插入
-                sheet.setSignDate(new Date());
-                sheet.setFileStatus(1);
-                //判断是否已经插入过了
-                Integer fileStatus = dao.selectFileStatus(sheet.getBah(), sheet.getAdmissTimes());
-                if (null == fileStatus) {
-                    //在t_case_frontsheet_main表中插入 主体的内容
-                    dao.insert(sheet);
-                    //循环插主要的诊断
-                    for (CaseFrontsheetDisdiag caseFrontsheetDisdiag : sheet.getDisdiagList()) {
-                        caseFrontsheetDisdiag.setBah(sheet.getBah());
-                        caseFrontsheetDisdiag.setTimes(sheet.getAdmissTimes());
-                        if (caseFrontsheetDisdiag.getNo() != null) {
-                            createdDao.insert(caseFrontsheetDisdiag);
-                        }
-                    }
-                    //循环插入做过的手术
-                    for (CaseFrontsheetSurgery caseFrontsheetSurgery : sheet.getSurgeryList()) {
-                        caseFrontsheetSurgery.setBah(sheet.getBah());
-                        caseFrontsheetSurgery.setTimes(sheet.getAdmissTimes());
-                        if (caseFrontsheetSurgery.getNo() != null) {
-                            basDao.insert(caseFrontsheetSurgery);
-                        }
-                    }
-                    return ResultVoUtil.success();
+                item.setNo(i + 1);
+                item.setBah(bah);
+                item.setTimes(times);
+                dao.writeNewZySurgeryRecord(item);
+            }
+        }
+        return ResultVoUtil.success();
+    }
+
+    private ResultVo<List<PureCodeName>> signSheet(CaseFrontsheetMain sheet, String bah, int times) {
+        if (userDao.getUserRoles(TokenUtil.getTokenUserId()).contains(7)) {
+            if (isLateSubmit(sheet.getDismissDate()) > 8) {
+                sheet.setLateFlag(1);
+            } else {
+                sheet.setLateFlag(0);
+            }
+            dao.updateZyFileStatus(1, bah, times);
+            dao.updateZyInFileStatus(1, bah, times);
+            dao.updateLateSubmitFlag(sheet.getLateFlag(), bah, times);
+            //插入数据 SignDate 签收日期  在点击签收后 向数据库中插入
+            sheet.setSignDate(new Date());
+            sheet.setFileStatus(1);
+            //判断是否已经插入过了
+            Integer fileStatus = dao.selectFileStatus(sheet.getBah(), sheet.getAdmissTimes());
+            if (null != fileStatus && fileStatus == 1) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请勿重复签收 ( ˉ ⌓ ˉ ๑)");
+            }
+            //在t_case_frontsheet_main表中插入 主体的内容
+            dao.insert(sheet);
+            //循环插主要的诊断
+            for (CaseFrontsheetDisdiag caseFrontsheetDisdiag : sheet.getDisdiagList()) {
+                caseFrontsheetDisdiag.setBah(sheet.getBah());
+                caseFrontsheetDisdiag.setTimes(sheet.getAdmissTimes());
+                if (caseFrontsheetDisdiag.getNo() != null) {
+                    createdDao.insert(caseFrontsheetDisdiag);
                 }
-                if (0 == fileStatus) {
-                    dao.updateFileStatus(sheet.getBah(), sheet.getAdmissTimes(), 1);
-                    return ResultVoUtil.success();
+            }
+            //循环插入做过的手术
+            for (CaseFrontsheetSurgery caseFrontsheetSurgery : sheet.getSurgeryList()) {
+                caseFrontsheetSurgery.setBah(sheet.getBah());
+                caseFrontsheetSurgery.setTimes(sheet.getAdmissTimes());
+                if (caseFrontsheetSurgery.getNo() != null) {
+                    basDao.insert(caseFrontsheetSurgery);
                 }
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请勿重复签收 ( ˉ ⌓ ˉ ๑)");
             }
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有签收首页的权限。");
+            return ResultVoUtil.success();
         }
+        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有签收首页的权限。");
     }
 
     @Transactional(rollbackFor = Exception.class)
-
     public synchronized ResultVo<String> unArchiveBa(OpCaseFrontsheet param) {
         CaseFrontsheetMain sheet = param.getSheet();
         if (sheet.getFileStatus() == 2) {
@@ -397,6 +392,14 @@ public class CaseFrontSheetService {
         if (sheet.getFileStatus() == 0) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未签收的病案首页无需解除签收!");
         }
+        Map<String, Object> map = new HashMap<>();
+        map.put("bah", sheet.getBah());
+        map.put("admiss_times", sheet.getAdmissTimes());
+        dao.deleteByMap(map);
+        map.put("times", map.remove("admiss_times"));
+        createdDao.deleteByMap(map);
+        basDao.deleteByMap(map);
+
         dao.updateZyFileStatus(0, sheet.getBah(), sheet.getAdmissTimes());
         dao.updateZyInFileStatus(0, sheet.getBah(), sheet.getAdmissTimes());
         dao.clearSignDate(sheet.getBah(), sheet.getAdmissTimes());
@@ -637,39 +640,92 @@ public class CaseFrontSheetService {
         return (int) days;
     }
 
-    public ResultVo<List<DismissCount>> analyzeDismissCount(String month) {
+    public ResultVo<List<DismissCount>> analyzeDismissCount(Integer type, 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());
+        List<DismissCount> list;
+        if (type == 1) {
+            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 {
-                    count.setUnsignCount(count.getUnsignCount() + item.getDismissCount());
+                    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);
                 }
-            } 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);
+            }
+            list = new ArrayList<>();
+            for (Map.Entry<String, DismissCount> entry : map.entrySet()) {
+                list.add(entry.getValue());
+            }
+        } else {
+            list = dao.selectDismissDetailCount(begntime, endtime);
+            if (type == 3) {
+                list.removeIf(item -> item.getDeadOrder() == 0);
+            }
+            for (DismissCount item : list) {
+                if (StringUtil.equalsIgnoreNull(item.getZkWard(), item.getAdmissDept())) {
+                    item.setZkWard(null);
                 }
-                map.put(item.getDeptCode(), dismissCount);
+                item.setDisDept(redis.getDeptName(item.getDisDept()));
+                item.setBlfx(filterBlfx(item.getBlfx()));
+                item.setAdmissDept(redis.getDeptName(item.getAdmissDept()));
+                item.setZkWard(redis.getDeptName(item.getZkWard()));
+                item.setKzr(redis.getEmployeeName(item.getKzr()));
+                item.setZzys(redis.getEmployeeName(item.getZzys()));
+                item.setZyys(redis.getEmployeeName(item.getZyys()));
+                item.setFdcrb(filterFdcrb(item.getFdcrb()));
             }
         }
-        List<DismissCount> list = new ArrayList<>();
-        for (Map.Entry<String, DismissCount> entry : map.entrySet()) {
-            list.add(entry.getValue());
-        }
         return ResultVoUtil.success(list);
     }
 
+    private String filterBlfx(String val) {
+        switch (val) {
+            case "1":
+                return "A";
+            case "2":
+                return "B";
+            case "3":
+                return "C";
+            case "4":
+                return "D";
+            default:
+                return "";
+        }
+    }
+
+    private String filterFdcrb(String val) {
+        switch (val) {
+            case "1":
+                return "甲类";
+            case "2":
+                return "乙类";
+            case "3":
+                return "丙类";
+            default:
+                return "";
+        }
+    }
+
+    public void increaseDiagWeight(String code) {
+        dao.increaseDiagWeight(code);
+    }
+
 }

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

@@ -8,9 +8,7 @@ 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;
@@ -44,109 +42,67 @@ public class SheetSearchService {
             case "place":
                 return ResultVoUtil.success(searchBirthPlace(param.getMethod(), content, param.getPage() - 1));
             case "normalDiag":
-                return ResultVoUtil.success(searchClinicDiag(param.getMethod(), content, param.getPage() - 1));
+            case "clinicdiag":
+                return ResultVoUtil.success(searchClinicdiag(param.getMethod(), content, param.getPage() - 1));
             case "hurtReason":
                 return ResultVoUtil.success(searchHurtReason(param.getMethod(), content, param.getPage() - 1));
             case "employee":
                 return ResultVoUtil.success(searchEmployee(param.getMethod(), content, param.getPage() - 1));
             case "diag":
                 return service.searchYbDiag(param);
-            case "clinicdiag":
-                return ResultVoUtil.success(searchClinicdiag(param.getMethod(), content, param.getPage() - 1));
             default:
                 return ResultVoUtil.success(new ArrayList<>());
         }
     }
 
     private List<PureCodeName> searchSurgery(String method, String content, int page) {
-        switch (method) {
-            case "alpha":
-                return dao.searchSurgeryByAlpha(content, page);
-            case "code":
-                return dao.searchSurgeryByCode(content, page);
-            case "name":
-                return dao.searchSurgeryByName(content, page);
-            default:
-                return null;
+        if (method.equals("alpha")) {
+            method = "py_code";
+        } else if (method.equals("code")) {
+            method = "surgical_operation_code";
+        } else {
+            method = "operation_operation_name";
         }
+        return dao.searchSurgery(method, content, page);
     }
 
     private List<PureCodeName> searchClinicdiag(String method, String content, int page) {
-        switch (method) {
-            case "alpha":
-                return dao.searchClinicdiagByAlpha(content, page);
-            case "code":
-                return dao.searchClinicdiagByCode(content, page);
-            case "name":
-                return dao.searchClinicdiagByName(content, page);
-            default:
-                return null;
+        if (method.equals("alpha")) {
+            method = "py_code";
         }
+        return dao.searchClinicdiag(method, content, page);
     }
 
     private List<PureCodeName> searchPathologicDiag(String method, String content, int page) {
-        switch (method) {
-            case "alpha":
-                return dao.searchPathologicDiagByAlpha(content, page);
-            case "code":
-                return dao.searchPathologicDiagByCode(content, page);
-            case "name":
-                return dao.searchPathologicDiagByName(content, page);
-            default:
-                return null;
+        if (method.equals("alpha")) {
+            method = "PY_CODE";
+        } else if (method.equals("code")) {
+            method = "CODE";
+        } else {
+            method = "NAME";
         }
+        return dao.searchPathologicDiag(method, content, page);
     }
 
     private List<PureCodeName> searchBirthPlace(String method, String content, int page) {
-        switch (method) {
-            case "alpha":
-                return dao.searchBirthPlaceByAlpha(content, page);
-            case "code":
-                return dao.searchBirthPlaceByCode(content, page);
-            case "name":
-                return dao.searchBirthPlaceByName(content, page);
-            default:
-                return null;
-        }
-    }
-
-    private List<PureCodeName> searchClinicDiag(String method, String content, int page) {
-        switch (method) {
-            case "alpha":
-                return dao.searchClinicDiagByAlpha(content, page);
-            case "code":
-                return dao.searchClinicDiagByCode(content, page);
-            case "name":
-                return dao.searchClinicDiagByName(content, page);
-            default:
-                return null;
+        if (method.equals("alpha")) {
+            method = "py_code";
         }
+        return dao.searchBirthPlace(method, content, page);
     }
 
     private List<PureCodeName> searchHurtReason(String method, String content, int page) {
-        switch (method) {
-            case "alpha":
-                return dao.searchHurtReasonByAlpha(content, page);
-            case "code":
-                return dao.searchHurtReasonByCode(content, page);
-            case "name":
-                return dao.searchHurtReasonByName(content, page);
-            default:
-                return null;
+        if (method.equals("alpha")) {
+            method = "py_code";
         }
+        return dao.searchHurtReason(method, content, page);
     }
 
     private List<PureCodeName> searchEmployee(String method, String content, int page) {
-        switch (method) {
-            case "alpha":
-                return dao.searchEmployeeByAlpha(content, page);
-            case "code":
-                return dao.searchEmployeeByCode(content, page);
-            case "name":
-                return dao.searchEmployeeByName(content, page);
-            default:
-                return null;
+        if (method.equals("alpha")) {
+            method = "py_code";
         }
+        return dao.searchEmployee(method, content, page);
     }
 
     /**

+ 6 - 2
src/main/java/thyyxxk/webserver/service/casefrontsheet/VerifyCaseFrontSheet.java

@@ -403,10 +403,14 @@ public class VerifyCaseFrontSheet {
     }
 
     private boolean needHurtReason(String diag) {
-        if (StringUtil.invalidValue(diag) || diag.startsWith("sy")) {
+        if (StringUtil.invalidValue(diag)) {
             return false;
         }
-        final char firstLetter = diag.toUpperCase().charAt(0);
+        diag = diag.toUpperCase();
+        if (diag.startsWith("SY")) {
+            return false;
+        }
+        final char firstLetter = diag.charAt(0);
         return firstLetter == 'S' || firstLetter == 'T';
     }
 

+ 15 - 7
src/main/java/thyyxxk/webserver/utils/PingYinUtils.java

@@ -155,18 +155,26 @@ public class PingYinUtils {
      * @param str 需要转化的中文字符串
      * @return 大写首字母缩写的字符串
      */
-    public static String getPinYinHeadChar(String str) {
+    public static String getPinYinHeadChar(String str, int maxLength) {
         StringBuilder convert = new StringBuilder();
-        for (int j = 0; j < str.length(); j++) {
+        int size = str.length();
+        if (maxLength != 0 && maxLength < size) {
+            size = maxLength;
+        }
+        for (int j = 0; j < size; j++) {
             char word = str.charAt(j);
-            String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
-            if (pinyinArray != null) {
-                convert.append(pinyinArray[0].charAt(0));
+            if (word == '膀') {
+                convert.append("P");
             } else {
-                convert.append(word);
+                String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
+                if (pinyinArray != null) {
+                    convert.append(pinyinArray[0].charAt(0));
+                } else {
+                    convert.append(word);
+                }
             }
         }
-        return convert.toString().toUpperCase().substring(0, 1);
+        return convert.toString().toUpperCase();
     }
 
     /**

+ 12 - 2
src/main/java/thyyxxk/webserver/utils/StringUtil.java

@@ -26,6 +26,16 @@ public class StringUtil {
         return notBlank(str) && !"-".equals(str.trim());
     }
 
+    public static boolean equalsIgnoreNull(String a, String b) {
+        if (null == a) {
+            a = "";
+        }
+        if (null == b) {
+            b = "";
+        }
+        return a.equals(b);
+    }
+
     public static boolean invalidValue(String str) {
         return isBlank(str) || "-".equals(str.trim());
     }
@@ -102,7 +112,7 @@ public class StringUtil {
      * 分割字符串,如果开始位置大于字符串长度,返回空
      *
      * @param str 原始字符串
-     * @param f   开始未知
+     * @param f   开始位置
      * @param t   结束位置
      * @return 。。
      */
@@ -111,7 +121,7 @@ public class StringUtil {
             return null;
         }
         if (t > str.length()) {
-            return str.substring(f, str.length());
+            return str;
         } else {
             return str.substring(f, t);
         }

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

@@ -73,7 +73,7 @@ si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
 
 execute-scheduled: false
 
-logging:
-  level:
-    thyyxxk.webserver.dao: debug
+#logging:
+#  level:
+#    thyyxxk.webserver.dao: debug