Ver Fonte

优化sql

lighter há 3 anos atrás
pai
commit
0c0dc040a6

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

+ 2 - 36
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/CaseFrontSheetDao.java

@@ -73,40 +73,6 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "zy_ledger_file with(nolock) where inpatient_no=#{bah} and admiss_times=#{times}")
     CaseFrontsheetMain getZyLedgerFile(@Param("bah") String bah, @Param("times") int times);
 
-    @Select("select " +
-            "admissTimes=#{times}, " +
-            "transDept=(select rtrim(name) from zd_unit_code with(nolock) where code=zk_ward)," +
-            "dismissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=isnull(isnull(zk_dept,zk_ward),small_dept))," +
-            "dismissWard=(select rtrim(name) from zd_unit_code with(nolock) where code=isnull(zk_ward,ward))," +
-            "admiss_date, med_type=(select top 1 med_type from t_si_pat_info with(nolock) where pat_no=#{bah} and times=#{times} order by ledger_sn desc)," +
-            "dismissDate=(select start_time from yz_act_order with(nolock) where inpatient_no=#{bah} " +
-            "and admiss_times=#{times} and status_flag > '1' and isnull (group_no,'00')='00' " +
-            "and order_code in ('06025','06026','06027','06053','05973')), " +
-            "admissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=small_dept), " +
-            "zk_ward zkWardCode, " +
-            "admissWard=(select rtrim(name) from zd_unit_code with(nolock) where code=admiss_ward), " +
-            "clinicDiagStr=rtrim(clinic_diag_str), " +
-            "clinicDiagCode=rtrim(clinic_diag), " +
-            "totalCost=total_charge, " +
-            "selfPay=(select sum(total_charge) - sum(isnull(charge_yb,0)) from " +
-            "zy_ledger_file with(nolock) where inpatient_no=#{bah} and admiss_times=#{times})," +
-            "autopsy=rtrim(autopsy_mark)," +
-            "hasSurgery=rtrim(operation)," +
-            "diagConform1=rtrim(diagnose_conform1)," +
-            "diagConform2=rtrim(diagnose_conform2)," +
-            "diagConform3=rtrim(diagnose_conform3)," +
-            "diagConform4=rtrim(diagnose_conform4)," +
-            "diagConform5=rtrim(diagnose_conform5)," +
-            "pathologicDiagStr=rtrim(pathology_diag_comment)," +
-            "pathologicDiagCode=rtrim(pathology_diag)," +
-            "fileStatus=isnull(file_status, 0), " +
-            "lendFlag=isnull(lend_flag, 0), " +
-            "balance=(select balance+charge_yb from zy_ledger_file with(nolock) where inpatient_no=#{bah} " +
-            "and admiss_times=#{times} and ledger_sn=(select max(ledger_sn) from zy_ledger_file with(nolock) " +
-            "where inpatient_no=#{bah} and admiss_times=#{times})) " +
-            "from zy_actpatient with(nolock) where inpatient_no=#{bah}")
-    CaseFrontsheetMain getZyActPatient(@Param("bah") String bah, @Param("times") int times);
-
     @Select("select top 1 serial_no from t_injury_si_pat_info with(nolock) where pat_no=#{patNo} and times=#{times} order by ledger_sn desc")
     String selectInjurySerialNo(@Param("patNo") String patNo,
                                 @Param("times") Integer times);
@@ -145,8 +111,8 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "pathologicDiagCode=rtrim(pathology_diag)," +
             "lendFlag=isnull(lend_flag, 0), " +
             "fileStatus=isnull(file_status, 0) " +
-            "from zy_inactpatient with(nolock) where inpatient_no=#{bah} and admiss_times=#{times}")
-    CaseFrontsheetMain getZyInActPatient(@Param("bah") String bah, @Param("times") int times);
+            "from ${table} with(nolock) where inpatient_no=#{bah} and admiss_times=#{times}")
+    CaseFrontsheetMain getZyActPatient(@Param("table") String table, @Param("bah") String bah, @Param("times") int times);
 
     @Select("select start_time from yz_act_order with(nolock) where inpatient_no=#{bah} " +
             "and admiss_times=#{times} and status_flag > '1' and isnull (group_no,'00')='00' " +

+ 4 - 15
src/main/java/thyyxxk/webserver/service/casefrontsheet/CaseFrontSheetService.java

@@ -112,13 +112,11 @@ public class CaseFrontSheetService {
     }
 
     public ResultVo<List<SheetOverview>> getPatientOverview(String ward) {
-        log.info("病案首页获取在院病人>>> {}", ward);
         return ResultVoUtil.success(dao.getPatientOverview(ward));
     }
 
     public ResultVo<List<SheetOverview>> getOutPatient(GetOutSheet param) {
         param.setEnd(param.getEnd() + " 23:59:59");
-        log.info("获取出院病人>>> {}", param);
         if (StringUtil.isBlank(param.getWard())) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请选择科室!");
         }
@@ -141,7 +139,6 @@ public class CaseFrontSheetService {
             } else {
                 ret.setCdPercentage(DecimalUtil.getPercent(cd, all));
             }
-            log.info("科室【{}】CD型病例比例:{}", param.getWard(), ret.getCdPercentage());
         }
         if (StringUtil.notBlank(param.getStart())) {
             param.setStart(param.getStart() + " 00:00:00");
@@ -149,7 +146,6 @@ public class CaseFrontSheetService {
         if (StringUtil.notBlank(param.getEnd())) {
             param.setEnd(param.getEnd() + " 23:59:59");
         }
-        log.info("病案室获取病人列表>>> {}", param);
         List<SheetOverview> list;
         if (StringUtil.notBlank(param.getBah())) {
             if (param.getFileStatus() == 0) {
@@ -195,13 +191,14 @@ public class CaseFrontSheetService {
     }
 
     public ResultVo<CaseFrontsheetMain> getPatientInfo(String bah, Integer times, Integer flag) {
-        log.info("病案首页获取病人信息>>> 住院号:{},住院次数:{},在院状态:{}", bah, times, flag);
         CaseFrontsheetMain sheet = dao.getAPatientMi(bah);
         sheet.setAge(DateUtil.calculateAge(sheet.getBirthDate()));
         CaseFrontsheetMain sheet1 = dao.getZyLedgerFile(bah, times);
-        CaseFrontsheetMain sheet2 = flag == 1 ? dao.getZyActPatient(bah, times) : dao.getZyInActPatient(bah, times);
+        CaseFrontsheetMain sheet2 = flag == 1 ? dao.getZyActPatient("zy_actpatient", bah, times) :
+                dao.getZyActPatient("zy_inactpatient", bah, times);
         if (null == sheet2) {
-            sheet2 = flag == 1 ? dao.getZyInActPatient(bah, times) : dao.getZyActPatient(bah, times);
+            sheet2 = flag == 1 ? dao.getZyActPatient("zy_inactpatient", bah, times) :
+                    dao.getZyActPatient("zy_actpatient", bah, times);
         }
         if (StringUtil.isBlank(sheet2.getMedType())) {
             String injurySerialNo = dao.selectInjurySerialNo(bah, times);
@@ -209,7 +206,6 @@ public class CaseFrontSheetService {
                 sheet2.setMedType("42");
             }
         }
-
         final int hasInfant = dao.getInfant(bah, times);
         sheet2.setHasInfant(String.valueOf(hasInfant));
         if (null == sheet2.getDismissDate()) {
@@ -218,7 +214,6 @@ public class CaseFrontSheetService {
                     : dao.getDismissDateFromYzActOrder(bah, times);
             sheet2.setDismissDate(dismissDate);
         }
-
         CaseFrontsheetMain sheet3 = dao.getBatjBa1(bah, times);
         if (sheet3 == null) {
             if (dao.isBatjBa1Exist(bah, times) == 0) {
@@ -510,7 +505,6 @@ public class CaseFrontSheetService {
                 }
             }
         }
-        log.info("打印前病案逻辑校验, 操作员:{} >>> {}", param.getStaffId(), force);
         if (force.isEmpty() && advice.isEmpty()) {
             return ResultVoUtil.success();
         }
@@ -550,8 +544,6 @@ public class CaseFrontSheetService {
         param.setOpType(4);
         dao.updateZyFileStatus(2, sheet.getBah(), sheet.getAdmissTimes());
         dao.updateZyInFileStatus(2, sheet.getBah(), sheet.getAdmissTimes());
-        log.info("打印病案首页,操作员:{} >>> 住院号:{},住院次数:{}",
-                param.getStaffId(), sheet.getBah(), sheet.getAdmissTimes());
         dao.writeBaOpLog(param.getOpType(), param.getStaffId(), sheet.getBah(), sheet.getAdmissTimes());
         log.info("写入病案操作日志, 操作员:{} >>> 住院号:{}, 住院次数:{}, 操作编码:{}", param.getStaffId(),
                 sheet.getBah(), sheet.getAdmissTimes(), param.getOpType());
@@ -560,7 +552,6 @@ public class CaseFrontSheetService {
 
     public ResultVo<List<YiBaoDisdiag>> getYbDiags(String bah, int times) {
         List<YiBaoDisdiag> diags = dao.getYbDiags(bah, times);
-        log.info("获取医保诊断>>> 住院号:{},住院次数:{}:结果:{}", bah, times, diags);
         return ResultVoUtil.success(diags);
     }
 
@@ -590,7 +581,6 @@ public class CaseFrontSheetService {
             diag.setBah(param.getBah());
             diag.setTimes(param.getTimes());
             dao.insertNewYbDiag(diag);
-            log.info("保存医保诊断>>> {}", diag);
         }
         return ResultVoUtil.success();
     }
@@ -633,7 +623,6 @@ public class CaseFrontSheetService {
     }
 
     public ResultVo<List<SheetOverview>> advanceSearch(AdvanceSearchParam param) {
-        log.info("高级条件检索:{}", param);
         param.setDoctorCode(param.getDoctorCode() + "%");
         param.setSex(param.getSex() + "%");
         if ("".equals(param.getIcdCode()) && "".equals(param.getSurgeryCode())) {