浏览代码

优化病案首页

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

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

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

@@ -98,12 +98,6 @@ public class CaseFrontSheetController {
         return service.signApply(sheet);
     }
 
-    @PostMapping("/confirmCopyPrint")
-    public ResultVo<String> confirmCopyPrint(@RequestBody OpCaseFrontsheet param) {
-        param.setStaffId(TokenUtil.getTokenUserId());
-        return service.confirmCopyPrint(param);
-    }
-
     @PostMapping("/lendOut")
     public ResultVo<String> lendOut(@RequestBody OpCaseFrontsheet param) {
         param.setStaffId(TokenUtil.getTokenUserId());

+ 13 - 15
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/BasSelectOverviewDao.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 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.CaseFrontsheetSurgery;
 import thyyxxk.webserver.entity.casefrontsheet.GetOutSheet;
 import thyyxxk.webserver.entity.casefrontsheet.SheetOverview;
@@ -12,8 +13,9 @@ import java.util.List;
 
 @Mapper
 public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery> {
+
     @Select("select " +
-            "b.sign_date,fileStatus=0, " +
+            "fileStatus=0, " +
             "bedNo=rtrim(a.bed_no), " +
             "bah=rtrim(a.inpatient_no), " +
             "times=rtrim(a.admiss_times), " +
@@ -21,9 +23,6 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
             "a.sex,a.admiss_date, " +
             "deptName=(select rtrim(name) from zd_unit_code with(nolock) where code=a.zk_ward), " +
             "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=b.zyys), " +
-            "b.late_flag, " +
-            "lateCount=(select count(*) from batj_ba2 with(nolock) where late_flag=1 and zyys=b.zyys), " +
-            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
             "a.dis_date " +
             "from zy_inactpatient a with(nolock), batj_ba2 b with(nolock) " +
             "where " +
@@ -32,7 +31,7 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
             "a.admiss_times=b.zycs and " +
             "a.dis_date>=#{start} and " +
             "a.dis_date<=#{end} and " +
-            "isnull(a.file_status, 0)=0 order by a.zk_ward,b.zyys")
+            "isnull(a.file_status, 0)!=1 order by a.zk_ward,b.zyys")
     List<SheetOverview> selectPatientsForBasByBah(GetOutSheet param);
 
     @Select("select sign_date,file_status,bah,name, " +
@@ -51,7 +50,7 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
     List<SheetOverview> selectSignApply(@Param("bah") String bah, @Param("status") int status);
 
     @Select("select " +
-            "b.sign_date,fileStatus=0, " +
+            "fileStatus=0, " +
             "bedNo=rtrim(a.bed_no), " +
             "bah=rtrim(a.inpatient_no), " +
             "times=rtrim(a.admiss_times), " +
@@ -59,9 +58,7 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
             "a.sex,a.admiss_date, " +
             "deptName=(select rtrim(name) from zd_unit_code with(nolock) where code=a.zk_ward), " +
             "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=b.zyys), " +
-            "b.late_flag, " +
-            "lateCount=(select count(*) from batj_ba2 with(nolock) where late_flag=1 and zyys=b.zyys), " +
-            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
+            "lateCount=(select count(1) from t_case_frontsheet_main with(nolock) where late_flag=1 and admiss_doctor=b.zyys), " +
             "a.dis_date " +
             "from zy_inactpatient a with(nolock), batj_ba2 b with(nolock) " +
             "where " +
@@ -72,7 +69,7 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
             "a.dis_date>=#{start} and " +
             "a.dis_date<=#{end} and " +
             "a.zk_ward = #{ward} and " +
-            "isnull(a.file_status, 0)=0 and " +
+            "isnull(a.file_status, 0)!=1 and " +
             "charindex('$',a.inpatient_no)=0 order by a.zk_ward,b.zyys")
     List<SheetOverview> selectPatientsForBasByWard(GetOutSheet param);
 
@@ -85,7 +82,7 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
     List<SheetOverview> selectPatientsForBasByWard2(GetOutSheet param);
 
     @Select("select " +
-            "b.sign_date,fileStatus=0, " +
+            "fileStatus=0, " +
             "bedNo=rtrim(a.bed_no), " +
             "bah=rtrim(a.inpatient_no), " +
             "times=rtrim(a.admiss_times), " +
@@ -93,9 +90,6 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
             "a.sex,a.admiss_date, " +
             "deptName=(select rtrim(name) from zd_unit_code with(nolock) where code=a.zk_ward), " +
             "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=b.zyys), " +
-            "b.late_flag, " +
-            "lateCount=(select count(*) from batj_ba2 with(nolock) where late_flag=1 and zyys=b.zyys), " +
-            "lateDays=datediff(day, a.dis_date, b.sign_date), " +
             "a.dis_date " +
             "from zy_inactpatient a with(nolock), batj_ba2 b with(nolock) " +
             "where " +
@@ -105,7 +99,7 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
             "a.admiss_times=b.zycs and " +
             "a.dis_date>=#{start} and " +
             "a.dis_date<=#{end} and " +
-            "isnull(a.file_status, 0)=0 and " +
+            "isnull(a.file_status, 0)!=1 and " +
             "charindex('$',a.inpatient_no)=0 order by a.zk_ward,b.zyys")
     List<SheetOverview> selectPatientsForBasByFileStatus(GetOutSheet param);
 
@@ -116,4 +110,8 @@ public interface BasSelectOverviewDao extends BaseMapper<CaseFrontsheetSurgery>
             "where dismiss_date>=#{start} and dismiss_date<=#{end} " +
             "order by trans_dept,admiss_doctor")
     List<SheetOverview> selectPatientsForBasByFileStatus2(GetOutSheet param);
+
+    @Update("update zy_actpatient set file_status=#{status} where inpatient_no=#{bah} and admiss_times=#{times};" +
+            "update zy_inactpatient set file_status=#{status} where inpatient_no=#{bah} and admiss_times=#{times};")
+    void updateActFileStatus(@Param("bah") String bah, @Param("times") int times, @Param("status") int status);
 }

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

@@ -12,6 +12,9 @@ import java.util.List;
  */
 @Mapper
 public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
+    @Select("select count(1) from zy_actpatient where inpatient_no=#{bah} and admiss_times=#{times}")
+    int selectActCount(@Param("bah") String bah, @Param("times") int times);
+
     @Select("select " +
             "bedNo=rtrim(bed_no)," +
             "bah=rtrim(inpatient_no)," +
@@ -203,8 +206,9 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
     CaseFrontsheetMain getBatjBa2ForInPatient(@Param("bah") String bah, @Param("times") int times);
 
     @Select("select " +
-            "late_flag lateFlag, " +
-            "sign_date, " +
+            "lateFlag=(select late_flag from t_case_frontsheet_main t where t.bah=#{bah} and t.admiss_times=#{times}), " +
+            "fileStatus=(select file_status from t_case_frontsheet_main t where t.bah=#{bah} and t.admiss_times=#{times}), " +
+            "signDate=(select sign_date from t_case_frontsheet_main t where t.bah=#{bah} and t.admiss_times=#{times}), " +
             "blh=rtrim(a.blzd_qph)," +
             "allergy=rtrim(a.gm_flag)," +
             "allergicMedicine=rtrim(a.gmwy)," +
@@ -492,20 +496,6 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "where bah=#{bah} and times=#{times}")
     void updateSignApply(@Param("bah") String bah, @Param("times") int times, @Param("staff") String staff);
 
-    @Update("update zy_actpatient set file_status=#{status} where inpatient_no=#{bah} and " +
-            "admiss_times=#{times}")
-    void updateZyFileStatus(@Param("status") int status, @Param("bah") String bah, @Param("times") int times);
-
-    @Update("update zy_inactpatient set file_status=#{status} where inpatient_no=#{bah} and " +
-            "admiss_times=#{times}")
-    void updateZyInFileStatus(@Param("status") int status, @Param("bah") String bah, @Param("times") int times);
-
-    @Update("update batj_ba2 set late_flag=#{flag}, sign_date=getdate() where zyh=#{bah} and zycs=#{times}")
-    void updateLateSubmitFlag(@Param("flag") int flag, @Param("bah") String bah, @Param("times") int times);
-
-    @Update("update batj_ba2 set sign_date=null where zyh=#{bah} and zycs=#{times}")
-    void clearSignDate(@Param("bah") String bah, @Param("times") int times);
-
     @Insert("insert into ba_op_log (op_type, op_id, op_time, inpatient_no, admiss_times) values " +
             "(#{opType}, #{staffId}, getDate(), #{bah}, #{admissTimes})")
     void writeBaOpLog(@Param("opType") int opType,
@@ -626,11 +616,6 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
     Integer selectFileStatus(@Param("bah") String bah,
                              @Param("admissTimes") Integer admissTimes);
 
-    @Update("update t_case_frontsheet_main set file_status=#{status} where bah=#{bah} and admiss_times=#{admissTimes}")
-    void updateFileStatus(@Param("bah") String bah,
-                          @Param("admissTimes") Integer admissTimes,
-                          @Param("status") int status);
-
     @Select("select top 1 * from t_si_disefamily_diagnose with(nolock) where dise_code=#{code} or disefamily_code=#{code}")
     DisefamilyGrade selectDisefamilyGrade(@Param("code") String code);
 

+ 6 - 27
src/main/java/thyyxxk/webserver/service/casefrontsheet/CaseFrontSheetService.java

@@ -202,7 +202,10 @@ public class CaseFrontSheetService {
                 return ResultVoUtil.success(sheet);
             }
         }
-        Integer flag = overview.getInOutFlag();
+        int flag = overview.getInOutFlag();
+        if (flag == 2) {
+            flag = dao.selectActCount(bah, times) > 0 ? 1 : 2;
+        }
         sheet = dao.getAPatientMi(bah);
         sheet.setAge(DateUtil.calculateAge(sheet.getBirthDate()));
         CaseFrontsheetMain sheet1 = dao.getZyLedgerFile(bah, times);
@@ -384,9 +387,6 @@ public class CaseFrontSheetService {
             } 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);
@@ -413,6 +413,7 @@ public class CaseFrontSheetService {
                     basDao.insert(caseFrontsheetSurgery);
                 }
             }
+            basDao.updateActFileStatus(bah, times, 1);
             dao.updateSignApply(bah, times, staff);
             return ResultVoUtil.success();
         }
@@ -422,9 +423,6 @@ public class CaseFrontSheetService {
     @Transactional(rollbackFor = Exception.class)
     public synchronized ResultVo<String> unArchiveSheet(OpCaseFrontsheet param) {
         CaseFrontsheetMain sheet = param.getSheet();
-        if (sheet.getFileStatus() == 2) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "已打印的病案首页无法解除签收!");
-        }
         if (sheet.getFileStatus() == 0) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未签收的病案首页无需解除签收!");
         }
@@ -435,13 +433,9 @@ public class CaseFrontSheetService {
         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());
-        dao.updateFileStatus(sheet.getBah(), sheet.getAdmissTimes(), 0);
         log.info("解除签收状态, 操作员:{} >>> 住院号:{}, 住院次数:{}",
                 param.getStaffId(), sheet.getBah(), sheet.getAdmissTimes());
+        basDao.updateActFileStatus(sheet.getBah(), sheet.getAdmissTimes(), 0);
         dao.writeBaOpLog(param.getOpType(), param.getStaffId(), sheet.getBah(), sheet.getAdmissTimes());
         log.info("写入病案操作日志, 操作员:{} >>> 住院号:{}, 住院次数:{}, 操作编码:{}",
                 param.getStaffId(), sheet.getBah(), sheet.getAdmissTimes(), param.getOpType());
@@ -556,21 +550,6 @@ public class CaseFrontSheetService {
         }
     }
 
-    @Transactional(rollbackFor = Exception.class)
-    public synchronized ResultVo<String> confirmCopyPrint(OpCaseFrontsheet param) {
-        CaseFrontsheetMain sheet = param.getSheet();
-        if (sheet.getFileStatus() == 0) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未签收的病案无法确认打印!请先签收该病案!");
-        }
-        param.setOpType(4);
-        dao.updateZyFileStatus(2, sheet.getBah(), sheet.getAdmissTimes());
-        dao.updateZyInFileStatus(2, sheet.getBah(), sheet.getAdmissTimes());
-        dao.writeBaOpLog(param.getOpType(), param.getStaffId(), sheet.getBah(), sheet.getAdmissTimes());
-        log.info("写入病案操作日志, 操作员:{} >>> 住院号:{}, 住院次数:{}, 操作编码:{}", param.getStaffId(),
-                sheet.getBah(), sheet.getAdmissTimes(), param.getOpType());
-        return ResultVoUtil.success();
-    }
-
     public ResultVo<List<YiBaoDisdiag>> getYbDiags(String bah, int times) {
         List<YiBaoDisdiag> diags = dao.getYbDiags(bah, times);
         return ResultVoUtil.success(diags);