Browse Source

病案首页添加新的填写内容

lighter 9 months ago
parent
commit
dbdc40a999

+ 3 - 3
src/main/java/thyyxxk/webserver/dao/his/inpatient/adverseevent/AdverseEventDao.java

@@ -92,9 +92,9 @@ public interface AdverseEventDao {
             "dept_deal_time=#{datetime},event_level=#{eventLevel} where p_id=#{pid}")
     void updateDeptHandled(HandlerInfo handlerInfo);
 
-    @Update("update adverse_event set final_dealing=#{dealing}, " +
-            "final_dealer_id=#{userId}, final_dealer_name=#{userName}, " +
-            "final_deal_time=#{datetime} where p_id=#{pid}")
+    @Update("update adverse_event set final_dealing=#{dealing},final_dealer_id=#{userId}, " +
+            "final_dealer_name=#{userName},final_deal_time=#{datetime}, " +
+            "event_level=#{eventLevel} where p_id=#{pid}")
     void updateFinalHandled(HandlerInfo handlerInfo);
 
     @Select("select dept_id code, dept_name name from adverse_dept " +

+ 79 - 94
src/main/java/thyyxxk/webserver/dao/his/inpatient/casefrontsheet/CaseFrontSheetDao.java

@@ -19,7 +19,7 @@ import java.util.Map;
 @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);
+    int selectActCount(String bah, int times);
 
     @Select("select bedNo=rtrim(bed_no),bah=rtrim(inpatient_no),times=rtrim(admiss_times),name=rtrim(name),sex," +
             "file_status,doctorCode=rtrim(refer_physician)," +
@@ -27,7 +27,7 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "admiss_date from zy_actpatient with(nolock) where charindex('$',inpatient_no)=0 and " +
             "(small_dept=#{ward} or ward=#{ward} or zk_ward=#{ward} or zk_dept=#{ward}) " +
             "ORDER BY cast(bed_no AS int)")
-    List<SheetOverview> getPatientOverview(@Param("ward") String ward);
+    List<SheetOverview> getPatientOverview(String ward);
 
     @Select("select bedNo=rtrim(bed_no),bah=rtrim(inpatient_no),times=rtrim(admiss_times),name=rtrim(name),sex," +
             "file_status,doctorCode=rtrim(refer_physician)," +
@@ -45,19 +45,18 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "unitName=rtrim(employer_name),unitPlace=rtrim(employer_street),unitPhone=rtrim(employer_tel), " +
             "unitZipCode=rtrim(employer_zipcode),contactName=rtrim(relation_name),contactRelation=rtrim(relation_code), " +
             "contactPhone=(rtrim(relation_tel)) from a_patient_mi with(nolock) where inpatient_no=#{bah}")
-    CaseFrontsheetMain getAPatientMi(@Param("bah") String bah);
+    CaseFrontsheetMain getAPatientMi(String bah);
 
     @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);
+    String selectInjurySerialNo(String patNo, int times);
 
     @Select("select [dbo].[judge_infant](#{bah}, #{times})")
-    int getInfant(@Param("bah") String bah, @Param("times") int times);
+    int getInfant(String bah, int times);
 
     @Select("select max(start_time) from ${table} 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')")
-    Date getDismissDateFromYzActOrder(@Param("table") String table, @Param("bah") String bah, @Param("times") int times);
+    Date getDismissDateFromYzActOrder(String table, String bah, int times);
 
     @Select("select " +
             "admissTimes=#{times}, " +
@@ -94,8 +93,7 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "lendFlag=isnull(lend_flag, 0), " +
             "fileStatus=isnull(file_status, 0) " +
             "from ${table} with(nolock) where inpatient_no=#{bah} and admiss_times=#{times}")
-    CaseFrontsheetMain getZyActPatient(@Param("table") String table, @Param("yzTable") String yzTable,
-                                       @Param("bah") String bah, @Param("times") int times);
+    CaseFrontsheetMain getZyActPatient(String table, String yzTable, String bah, int times);
 
 
     @Select("select payMethod=rtrim(pay_method),ageDays=rtrim(age_days),newBornWeight=rtrim(new_born_weight)," +
@@ -103,7 +101,7 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "nativePlaceName=(select rtrim(name) from zd_district_code with(nolock) where code=jg)," +
             "hkPlace=rtrim(hkdz),hkPlaceName=rtrim(hkdz2),contactAddr=rtrim(lxdz),contactAddrName=rtrim(lxdz2)," +
             "hkZipCode=rtrim(hkyb) from batj_ba1 with(nolock) where bah=#{bah} and zycs=#{times}")
-    CaseFrontsheetMain getBatjBa1(@Param("bah") String bah, @Param("times") int times);
+    CaseFrontsheetMain getBatjBa1(String bah, int times);
 
     @Select("select " +
             "blh=rtrim(a.blzd_qph)," +
@@ -169,7 +167,7 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "from batj_ba2 a with(nolock), zy_actpatient b with(nolock) where " +
             "b.inpatient_no=a.bah and " +
             "a.bah=#{bah} and a.zycs=#{times}")
-    CaseFrontsheetMain getBatjBa2ForInPatient(@Param("bah") String bah, @Param("times") int times);
+    CaseFrontsheetMain getBatjBa2ForInPatient(String bah, int times);
 
     @Select("select " +
             "lateFlag=(select late_flag from t_case_frontsheet_main t where t.bah=#{bah} and t.admiss_times=#{times}), " +
@@ -238,7 +236,7 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "from batj_ba2 a with(nolock), zy_inactpatient b with(nolock) where " +
             "b.inpatient_no=a.bah and b.admiss_times=a.zycs and " +
             "a.bah=#{bah} and a.zycs=#{times}")
-    CaseFrontsheetMain getBatjBa2ForOutPatient(@Param("bah") String bah, @Param("times") int times);
+    CaseFrontsheetMain getBatjBa2ForOutPatient(String bah, int times);
 
     @Select("select c.sheet_column as code,sum(a.charge_fee) as name " +
             "from zy_detail_charge a,zd_charge_item b,zd_charge_ba_class c " +
@@ -259,10 +257,10 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "code=rtrim(dis_diag), admissStatus=rtrim(admiss_status), " +
             "dismissStatus=rtrim(dis_diag_status) from ba_first_page1 with(nolock) " +
             "where inpatient_no=#{bah} and admiss_times=#{times}")
-    List<CaseFrontsheetDisdiag> getDisdiags(@Param("bah") String bah, @Param("times") int times);
+    List<CaseFrontsheetDisdiag> getDisdiags(String bah, int times);
 
     @Select("select rtrim(code) as code,rtrim(name) as name from zd_icd_code_new where code=#{code}")
-    CaseFrontsheetDisdiag selectDiagInfoByCode(@Param("code") String code);
+    CaseFrontsheetDisdiag selectDiagInfoByCode(String code);
 
     @Select("select no=rtrim(ssxh),name=rtrim(ssmc),date=ssrq, " +
             "op_end_date,anst_start_date,anst_end_date,anaesthesiaor=rtrim(mzys), " +
@@ -274,10 +272,10 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "cut=rtrim(qkjb),heal=rtrim(yhqk),anaesthesia=rtrim(mzff)," +
             "anaesthesiaorName=(select rtrim(name) from a_employee_mi with(nolock) where code=mzys) " +
             "from batj_ba4 with(nolock) where bah=#{bah} and zycs=#{times}")
-    List<CaseFrontsheetSurgery> getSurgeries(@Param("bah") String bah, @Param("times") int times);
+    List<CaseFrontsheetSurgery> getSurgeries(String bah, int times);
 
     @Select("select top 1 rtrim(yb_code) as code,rtrim(yb_name) as name from zd_icd9_cm3 where code=#{code}")
-    CaseFrontsheetSurgery selectSurgeryByCode(@Param("code") String code);
+    CaseFrontsheetSurgery selectSurgeryByCode(String code);
 
     @Update("update a_patient_mi set name=#{name}, " +
             "sex=#{sex}, " +
@@ -307,57 +305,45 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
 
     @Update("update a_patient_mi set province_code=#{province},city_code=#{city},district_code=#{district} " +
             "where inpatient_no=#{bah}")
-    void updateAddressCascader(@Param("bah") String bah,
-                               @Param("province") Integer province,
-                               @Param("city") Integer city,
-                               @Param("district") Integer district);
+    void updateAddressCascader(String bah, Integer province, Integer city, Integer district);
 
     @Update("update zy_actpatient set autopsy_mark=#{autopsy},clinic_diag_str=#{clinicDiagStr}, " +
             "diagnose_conform1=#{dc1},diagnose_conform2=#{dc2},diagnose_conform3=#{dc3}," +
             "diagnose_conform4=#{dc4}, diagnose_conform5=#{dc5}, operation=#{hasSurgery}," +
             "pathology_diag_comment=#{pathologicDiagStr},pathology_diag=#{pathologicDiagCode}, " +
             "clinic_diag=#{clinicDiagCode} where inpatient_no=#{bah} and admiss_times=#{times}")
-    void updateZyActPatient(@Param("bah") String bah, @Param("times") int times,
-                            @Param("autopsy") String autopsy,
-                            @Param("dc1") String dc1, @Param("dc2") String dc2,
-                            @Param("dc3") String dc3, @Param("dc4") String dc4,
-                            @Param("dc5") String dc5, @Param("hasSurgery") String hasSurgery,
-                            @Param("pathologicDiagStr") String pathologicDiagStr,
-                            @Param("pathologicDiagCode") String pathologicDiagCode,
-                            @Param("clinicDiagCode") String clinicDiagCode,
-                            @Param("clinicDiagStr") String clinicDiagStr);
+    void updateZyActPatient(String bah, int times, String autopsy, String dc1, String dc2,
+                            String dc3, String dc4, String dc5, String hasSurgery,
+                            String pathologicDiagStr, String pathologicDiagCode,
+                            String clinicDiagCode, String clinicDiagStr);
 
     @Update("update zy_inactpatient set autopsy_mark=#{autopsy},clinic_diag_str=#{clinicDiagStr}, " +
             "diagnose_conform1=#{dc1},diagnose_conform2=#{dc2},diagnose_conform3=#{dc3}," +
             "diagnose_conform4=#{dc4}, diagnose_conform5=#{dc5}, operation=#{hasSurgery}," +
             "pathology_diag_comment=#{pathologicDiagStr},pathology_diag=#{pathologicDiagCode}, " +
             "clinic_diag=#{clinicDiagCode} where inpatient_no=#{bah} and admiss_times=#{times}")
-    void updateZyInActPatient(@Param("bah") String bah, @Param("times") int times,
-                              @Param("autopsy") String autopsy,
-                              @Param("dc1") String dc1, @Param("dc2") String dc2,
-                              @Param("dc3") String dc3, @Param("dc4") String dc4,
-                              @Param("dc5") String dc5, @Param("hasSurgery") String hasSurgery,
-                              @Param("pathologicDiagStr") String pathologicDiagStr,
-                              @Param("pathologicDiagCode") String pathologicDiagCode,
-                              @Param("clinicDiagCode") String clinicDiagCode,
-                              @Param("clinicDiagStr") String clinicDiagStr);
+    void updateZyInActPatient(String bah, int times, String autopsy, String dc1, String dc2,
+                              String dc3, String dc4, String dc5, String hasSurgery,
+                              String pathologicDiagStr, String pathologicDiagCode,
+                              String clinicDiagCode, String clinicDiagStr);
 
     @Select("select count(1) from batj_ba1 with(nolock) where bah=#{bah} and zycs=#{times}")
-    int isBatjBa1Exist(@Param("bah") String bah, @Param("times") int times);
+    int isBatjBa1Exist(String bah, int times);
 
     @Select("select count(1) from batj_ba2 with(nolock) where bah=#{bah} and zycs=#{times}")
-    int isBatjBa2Exist(@Param("bah") String bah, @Param("times") int times);
+    int isBatjBa2Exist(String bah, int times);
 
     @Insert("insert into batj_ba1 (bah, zyh, zycs, xm, ryrq, ryks, rybf) values " +
             "(#{bah}, #{bah}, #{times}, #{name}, #{ryrq}, " +
             "(select code from zd_unit_code with(nolock) where name=#{dept} and isnull(del_flag,'')!='1'), " +
             "(select code from zd_unit_code with(nolock) where name=#{ward} and isnull(del_flag,'')!='1'))")
-    void createBatjBa1(@Param("bah") String bah, @Param("times") int times,
-                       @Param("name") String name, @Param("ryrq") Date ryrq,
-                       @Param("dept") String dept, @Param("ward") String ward);
+    void createBatjBa1(String bah, int times, String name, Date ryrq, String dept, String ward);
 
     @Insert("insert into batj_ba2 (bah, zyh, zycs) values (#{bah}, #{bah}, #{times})")
-    void createBatjBa2(@Param("bah") String bah, @Param("times") int times);
+    void createBatjBa2(String bah, int times);
+
+    @Insert("insert into t_frontsheet_supplement (bah, times) values (#{bah}, #{times})")
+    void createSheetSupplement(String bah, int times);
 
     @Update("update batj_ba1 set " +
             "pay_method=#{payMethod}," +
@@ -442,10 +428,10 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
     void updateBatjBa2(CaseFrontsheetMain info);
 
     @Delete("delete from ba_first_page1 where inpatient_no=#{bah} and admiss_times=#{times}")
-    void deleteOldDisdiag(@Param("bah") String bah, @Param("times") int times);
+    void deleteOldDisdiag(String bah, int times);
 
     @Delete("delete from batj_ba4 where bah=#{bah} and zycs=#{times}")
-    void deleteOldSurgeryRecord(@Param("bah") String bah, @Param("times") int times);
+    void deleteOldSurgeryRecord(String bah, int times);
 
     @Insert("insert into ba_first_page1 (inpatient_no, admiss_times, dis_diag_no," +
             "dis_diag_comment, dis_diag, admiss_status, dis_diag_status, op_id_code) " +
@@ -461,40 +447,27 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
 
     @Update("update t_case_frontsheet_main set file_status=0,unsign_date=getdate() " +
             "where bah=#{bah} and admiss_times=#{times}")
-    void updateSignStateToUnsigned(@Param("bah") String bah, @Param("times") int times);
+    void updateSignStateToUnsigned(String bah, 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,
-                      @Param("staffId") String staffId,
-                      @Param("bah") String bah,
-                      @Param("admissTimes") int admissTimes);
+            "(#{opType}, #{staffId}, getDate(), #{bah}, #{times})")
+    void writeBaOpLog(int opType, String staffId, String bah, int times);
 
     @Select("select rtrim(dis_diag_no) no, rtrim(dis_diag) code, " +
             "rtrim(dis_diag_comment) name, rtrim(dis_diag_status) cyzg, " +
             "rtrim(op_id_code) operId, convert(varchar(19), op_diag_date, 21) opDate, " +
             "diagType='13',si_diag_type,bzfx='普通', admiss_cond " +
             "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);
+    List<YiBaoDisdiag> getYbDiags(String bah, int times);
 
     @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);
+    void deleteOldYbDiag(String bah, int times);
 
     @Insert("insert into zy_dis_diag_yb (inpatient_no, admiss_times, dis_diag_no, dis_diag_type, dis_diag, " +
             "dis_diag_comment, op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, si_diag_type, admiss_cond) " +
             "values (#{bah},#{times},#{no},13,#{code},#{name},#{operId},#{opDate},'普通',#{cyzg},#{siDiagType},#{admissCond})    ")
     void insertNewYbDiag(YiBaoDisdiag diag);
 
-    @Select("select count(1) from zy_inactpatient a with(nolock), batj_ba2 b with(nolock) " +
-            "where (dis_dept=#{ward} or dis_ward=#{ward}) and " +
-            "b.bah=a.inpatient_no and " +
-            "b.zycs=a.admiss_times and " +
-            "b.blfx>2")
-    Integer getCDBlfxCount(@Param("ward") String ward);
-
-    @Select("select count(1) from zy_inactpatient with(nolock) where dis_dept=#{ward} or dis_ward=#{ward}")
-    Integer getAllDisPatientCount(@Param("ward") String ward);
-
     @Select("<script>" +
             "select distinct " +
             "a.bah,a.admiss_times as times, " +
@@ -541,87 +514,81 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
     List<SheetOverview> advanceSearch(AdvanceSearch param);
 
     @Select("select file_status from t_case_frontsheet_main with(nolock) where bah=#{bah} and admiss_times=#{times}")
-    Integer selectFileStatus(@Param("bah") String bah,
-                             @Param("times") Integer times);
+    Integer selectFileStatus(String bah, int times);
 
     @Select("select late_flag from t_case_frontsheet_main with(nolock) where bah=#{bah} and admiss_times=#{times}")
-    Integer selectLateFlag(@Param("bah") String bah,
-                             @Param("times") Integer times);
+    Integer selectLateFlag(String bah, int times);
 
     @Select("select sign_staff from t_case_frontsheet_main with(nolock) where bah=#{bah} and admiss_times=#{times}")
-    String selectSignStaff(@Param("bah") String bah,
-                                        @Param("times") Integer times);
+    String selectSignStaff(String bah, int times);
 
     @Select("select role_id from dj_user_role where user_code=#{code}")
-    List<Integer> getUserRoles(@Param("code") String code);
+    List<Integer> getUserRoles(String code);
 
     @Select("select count(1) from t_yb_setl_modify_req where pat_no=#{bah} and times=#{times}")
-    Integer selectModified(@Param("bah") String bah, @Param("times") Integer times);
+    Integer selectModified(String bah, int times);
 
     @Select("select top 1 * from t_si_disefamily_diagnose with(nolock) where dise_code=#{code} ")
-    DisefamilyGrade selectDisefamilyGrade(@Param("code") String code);
+    DisefamilyGrade selectDisefamilyGrade(String code);
 
     @Select("select yb_code from zd_icd9_cm3 where code in " +
             "(select ssbm from ${table} with(nolock) where zyh=#{bah} and zycs=#{times} and isnull(ssbm,'')!='') " +
             "union select ssbm from ${table} with(nolock) where zyh=#{bah} and zycs=#{times} and isnull(ssbm,'')!=''")
-    List<String> selectPatientSurgeryCodes(@Param("bah") String bah, @Param("times") Integer times, @Param("table") String table);
+    List<String> selectPatientSurgeryCodes(String bah, int times, String table);
 
     @Select("select * from t_si_operation_disefamily with(nolock) where disefamily_code=#{code}")
-    List<OprnDisefamilyGrade> selectOperationDisefamilies(@Param("code") String code);
+    List<OprnDisefamilyGrade> selectOperationDisefamilies(String code);
 
     @Update("update zd_icd_code set weight=(weight+1) where code=#{code}")
-    void increaseDiagWeight(@Param("code") String code);
+    void increaseDiagWeight(String code);
 
     @Select("select *, " +
             "duplicated=(select count(1) from t_case_frontsheet_duplicate where bah=#{bah} and times=#{times})," +
             "lendout=(select count(1) from t_case_frontsheet_lendout where bah=#{bah} and times=#{times} and state='LEND_OUT')," +
             "closedown=(select count(1) from t_case_frontsheet_closedown where bah=#{bah} and times=#{times}) " +
             "from t_case_frontsheet_main where bah=#{bah} and admiss_times=#{times} and file_status=1")
-    CaseFrontsheetMain selectStoredSheetMain(@Param("bah") String bah, @Param("times") Integer times);
+    CaseFrontsheetMain selectStoredSheetMain(String bah, int times);
 
     @Select("select * from t_case_frontsheet_disdiag where bah=#{bah} and times=#{times} ")
-    List<CaseFrontsheetDisdiag> selectSignedSheetDiags(@Param("bah") String bah, @Param("times") Integer times);
+    List<CaseFrontsheetDisdiag> selectSignedSheetDiags(String bah, int times);
 
     @Select("select * from t_case_frontsheet_surgery where bah=#{bah} and times=#{times} ")
-    List<CaseFrontsheetSurgery> selectSignedSheetSurgeries(@Param("bah") String bah, @Param("times") Integer times);
+    List<CaseFrontsheetSurgery> selectSignedSheetSurgeries(String bah, int times);
 
     @Update("update t_case_frontsheet_main set age_days=#{agedays} where bah=#{bah} and admiss_times=#{times}")
-    void updateNewBornAge(@Param("bah") String bah, @Param("times") Integer times, @Param("agedays") Integer agedays);
+    void updateNewBornAge(String bah, int times, Integer agedays);
 
     @Select("select rtrim(yb_code) as code, rtrim(yb_name) as name from zd_icd_code_new where code=#{code} and del_flag=0")
-    CodeName selectSiDiagByBaDiag(@Param("code") String code);
+    CodeName selectSiDiagByBaDiag(String code);
 
     @Select("select province_code,city_code,district_code," +
             "provinceName=(select name from t_region where code=province_code), " +
             "cityName=(select name from t_region where code=city_code), " +
             "districtName=(select name from t_region where code=district_code) " +
             "from a_patient_mi where inpatient_no=#{bah}")
-    StandardAddressMember selectStandardAddressMember(@Param("bah") String bah);
+    StandardAddressMember selectStandardAddressMember(String bah);
 
     @Select("select rtrim(social_no) from a_patient_mi where inpatient_no=#{bah}")
-    String selectSocialNo(@Param("bah") String bah);
+    String selectSocialNo(String bah);
 
     @Select("select parent_code as code, name=(select t.name from t_region t where t.code=a.parent_code) " +
             "from t_region a where code=#{region}")
-    Region selectParentRegion(@Param("region") Integer region);
+    Region selectParentRegion(Integer region);
 
     @Select("select name from t_region where code=#{region}")
-    String selectRegionName(@Param("region") Integer region);
+    String selectRegionName(Integer region);
 
     @Select("select top 1 med_type from t_si_pat_info where pat_no=#{patNo} and times=#{times} order by " +
             "ledger_sn desc")
-    String selectMedType(@Param("patNo") String patNo,
-                         @Param("times") int times);
+    String selectMedType(String patNo, int times);
 
     @Select("select provinceName=(select name from t_region where code=#{province}), " +
             "cityName=(select name from t_region where code=#{city}), " +
             "districtName=(select name from t_region where code=#{district}) ")
-    StandardAddressMember selectStandardAddressMember2(@Param("province") int province,
-                                                       @Param("city") int city,
-                                                       @Param("district") int district);
+    StandardAddressMember selectStandardAddressMember2(int province, int city, int district);
 
     @Select("select audit_flag from t_yb_setl_modify_req where pat_no=#{patNo} and times=#{times} ")
-    Integer qualityPass(@Param("patNo") String patNo, @Param("times") Integer times);
+    Integer qualityPass(String patNo, int times);
 
     @Select("<script>" +
             "select rtrim(yb_code) as code,rtrim(yb_name) as name,charge_code as wjwCode," +
@@ -639,7 +606,7 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "#{code}" +
             "</foreach>" +
             "</script>")
-    Integer selectChargeSumamt(@Param("patNo") String patNo, @Param("times") int times, @Param("list") String[] list);
+    Integer selectChargeSumamt(String patNo, int times, String[] list);
 
     @Select("select code,yb_name as name,yb_code from zd_anaesthesia where yb_code is not null")
     List<CodeName> selectZdAnstWays();
@@ -651,10 +618,10 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
     List<CodeName> selectZdNations();
 
     @Select("select top 1 insuplc_admdvs from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=0")
-    String selectSetlInsuplcAdmdvs(@Param("patNo") String patNo, @Param("times") int times);
+    String selectSetlInsuplcAdmdvs(String patNo, int times);
 
     @Select("select top 1 isnull(op_type,9) from zd_icd9_cm3 where yb_code=#{code}")
-    Integer selectOperationType(@Param("code") String code);
+    Integer selectOperationType(String code);
 
     // 病历分型
     @Select("select data_element from emr_data_element where pat_no=#{patNo} and times=#{times}")
@@ -747,4 +714,22 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "from t_case_frontsheet_lendout where bah=#{bah} and times=#{times} and state='LEND_OUT' " +
             "order by lend_time desc")
     LendOutRequest selectExistLendOut(String bah, int times);
+
+    @Select("select * from t_frontsheet_supplement where bah=#{bah} and times=#{times}")
+    FrontSheetSupplement getSheetSupplement(String bah, int times);
+    
+    @Update("update t_frontsheet_supplement set " +
+            "adm_diag_code=#{admDiagCode},adm_diag_name=#{admDiagName},adm_status=#{admStatus}, " +
+            "diagnosis_confirm_date=#{diagnosisConfirmDate,jdbcType=DATE}, " +
+            "ventilator_use_time=#{ventilatorUseTime}, " +
+            "had_icu=#{hadIcu},icu_name=#{icuName},start_icu_time=#{startIcuTime,jdbcType=TIMESTAMP}, " +
+            "end_icu_time=#{endIcuTime,jdbcType=TIMESTAMP},had_ecmo=#{hadEcmo},ecmo_mode=#{ecmoMode}, " +
+            "start_ecmo_time=#{startEcmoTime,jdbcType=TIMESTAMP},end_ecmo_time=#{endEcmoTime,jdbcType=TIMESTAMP}, " +
+            "memlung_change_times=#{memlungChangeTimes},erythrocyte=#{erythrocyte,jdbcType=REAL}, " +
+            "platelet=#{platelet,jdbcType=REAL},plasma=#{plasma,jdbcType=REAL}, " +
+            "whole_blood=#{wholeBlood,jdbcType=REAL}, " +
+            "autotransfusion=#{autotransfusion,jdbcType=REAL},infusion=#{infusion}, " +
+            "infusion_reaction=#{infusionReaction},transfusion=#{transfusion}, " +
+            "transfusion_reaction=#{transfusionReaction} where bah=#{bah} and times=#{times}")
+    void updateSheetSupplement(FrontSheetSupplement sheetSupplement);
 }

+ 3 - 0
src/main/java/thyyxxk/webserver/entity/casefrontsheet/CaseFrontsheetMain.java

@@ -848,6 +848,9 @@ public class CaseFrontsheetMain implements Serializable {
     @TableField(exist = false)
     private AuditState auditState;
 
+    @TableField(exist = false)
+    private FrontSheetSupplement supplement;
+
     public List<CaseFrontsheetDisdiag> getDisdiagList() {
         return null == disdiagList ? new ArrayList<>() : disdiagList;
     }

+ 157 - 0
src/main/java/thyyxxk/webserver/entity/casefrontsheet/FrontSheetSupplement.java

@@ -0,0 +1,157 @@
+package thyyxxk.webserver.entity.casefrontsheet;
+
+import lombok.Data;
+import java.util.Date;
+
+@Data
+public class FrontSheetSupplement {
+    /**
+     * 病案号
+     */
+    private String bah;
+
+    /**
+     * 住院次数
+     */
+    private Integer times;
+
+    /**
+     * 入院诊断编码
+     */
+    private String admDiagCode;
+
+    /**
+     * 入院诊断名称
+     */
+    private String admDiagName;
+
+    /**
+     * 入院时情况
+     */
+    private Integer admStatus;
+
+    /**
+     * 入院后确认日期
+     */
+    private Date diagnosisConfirmDate;
+    private Integer diagnosisConfirmYear;
+    private Integer diagnosisConfirmMonth;
+    private Integer diagnosisConfirmDay;
+
+    /**
+     * 有创呼吸机使用时间(小时)
+     */
+    private Integer ventilatorUseTime;
+
+    /**
+     * 有无进入重症监护室(1-有,2-无)
+     */
+    private Integer hadIcu;
+
+    /**
+     * 重症监护室名称
+     */
+    private String icuName;
+
+    /**
+     * 进入重症监护室时间
+     */
+    private Date startIcuTime;
+    private Integer startIcuYear;
+    private Integer startIcuMonth;
+    private Integer startIcuDay;
+    private Integer startIcuHour;
+    private Integer startIcuMinute;
+
+    /**
+     * 转出重症监护室时间
+     */
+    private Date endIcuTime;
+    private Integer endIcuYear;
+    private Integer endIcuMonth;
+    private Integer endIcuDay;
+    private Integer endIcuHour;
+    private Integer endIcuMinute;
+
+    /**
+     * 住院过程中是否使用ECMO(1-是,2-否)
+     */
+    private Integer hadEcmo;
+
+    /**
+     * ECMO模式
+     */
+    private String ecmoMode;
+
+    /**
+     * ECMO上机时间
+     */
+    private Date startEcmoTime;
+    private Integer startEcmoYear;
+    private Integer startEcmoMonth;
+    private Integer startEcmoDay;
+    private Integer startEcmoHour;
+    private Integer startEcmoMinute;
+
+    /**
+     * ECMO撤机时间
+     */
+    private Date endEcmoTime;
+    private Integer endEcmoYear;
+    private Integer endEcmoMonth;
+    private Integer endEcmoDay;
+    private Integer endEcmoHour;
+    private Integer endEcmoMinute;
+
+    /**
+     * 膜肺更换次数
+     */
+    private Integer memlungChangeTimes;
+
+    /**
+     * 输血品种-红细胞单位数量
+     */
+    private Double erythrocyte;
+
+    /**
+     * 输血品种-血小板单位数量
+     */
+    private Double platelet;
+
+    /**
+     * 输血品种-血浆单位数量
+     */
+    private Double plasma;
+
+    /**
+     * 输血品种-全血单位数量
+     */
+    private Double wholeBlood;
+
+    /**
+     * 输血品种-自体血回输单位数量
+     */
+    private Double autotransfusion;
+
+    /**
+     * 输液情况(1-有,2-无)
+     */
+    private Integer infusion;
+
+    /**
+     * 输液反应(1-有,2-无)
+     */
+    private Integer infusionReaction;
+
+    /**
+     * 输血情况(1-有,2-无)
+     */
+    private Integer transfusion;
+
+    /**
+     * 输血反应(1-有,2-无)
+     */
+    private Integer transfusionReaction;
+}
+
+

+ 143 - 2
src/main/java/thyyxxk/webserver/service/inpatient/casefrontsheet/CaseFrontSheetMainService.java

@@ -243,6 +243,7 @@ public class CaseFrontSheetMainService {
         if (null != sheet) {
             sheet.setDisdiagList(getSheetDisDiags(bah, times, State.FileStatus.SIGNED));
             sheet.setSurgeryList(getSheetSurgeries(bah, times, State.FileStatus.SIGNED));
+            sheet.setSupplement(getSheetSupplement(bah, times));
             if (null != standardAddressMember) {
                 sheet.setStandardAddress(standardAddressMember.makeStandardAddress());
                 sheet.setLivePlaceCombo(standardAddressMember.makeAddressCombo() + sheet.getLivePlace());
@@ -333,8 +334,9 @@ public class CaseFrontSheetMainService {
         if (null == sheet.getQualityControlDate()) {
             sheet.setQualityControlDate(new Date());
         }
-        sheet.setDisdiagList(getSheetDisDiags(bah, times, 0));
-        sheet.setSurgeryList(getSheetSurgeries(bah, times, 0));
+        sheet.setDisdiagList(getSheetDisDiags(bah, times, State.FileStatus.UNSIGNED));
+        sheet.setSurgeryList(getSheetSurgeries(bah, times, State.FileStatus.UNSIGNED));
+        sheet.setSupplement(getSheetSupplement(bah, times));
         if (null == standardAddressMember) {
             sheet.setLivePlaceCombo(sheet.getLivePlace());
         } else {
@@ -448,6 +450,142 @@ public class CaseFrontSheetMainService {
         return member;
     }
 
+    private FrontSheetSupplement getSheetSupplement(String bah, int times) {
+        FrontSheetSupplement result = dao.getSheetSupplement(bah, times);
+        if (null == result) {
+            dao.createSheetSupplement(bah, times);
+            result = new FrontSheetSupplement();
+            result.setBah(bah);
+            result.setTimes(times);
+        }
+        fillSeparatedTime(result);
+        if (StringUtil.notBlank(result.getAdmDiagCode()) && StringUtil.notBlank(result.getAdmDiagName())) {
+            return result;
+        }
+        JSONArray diagList;
+        JSONObject emrPatientData = emrService.getEmrPatientData(bah, times);
+        try {
+            diagList = emrPatientData.getJSONArray("入院诊断");
+        } catch (Exception e) {
+            diagList = null;
+        }
+        if (null == diagList || diagList.isEmpty()) {
+            return result;
+        }
+        JSONObject diagItem = diagList.getJSONObject(0);
+        result.setAdmDiagCode(diagItem.getString("code"));
+        result.setAdmDiagName(diagItem.getString("name"));
+        return result;
+    }
+
+    private void fillSeparatedTime(FrontSheetSupplement supplement) {
+        if (null != supplement.getDiagnosisConfirmDate()) {
+            Integer[] datetimeArr = getSplitDatetime(supplement.getDiagnosisConfirmDate());
+            supplement.setDiagnosisConfirmYear(datetimeArr[0]);
+            supplement.setDiagnosisConfirmMonth(datetimeArr[1]);
+            supplement.setDiagnosisConfirmDay(datetimeArr[2]);
+        }
+        if (null != supplement.getStartIcuTime()) {
+            Integer[] datetimeArr = getSplitDatetime(supplement.getStartIcuTime());
+            supplement.setStartIcuYear(datetimeArr[0]);
+            supplement.setStartIcuMonth(datetimeArr[1]);
+            supplement.setStartIcuDay(datetimeArr[2]);
+            supplement.setStartIcuHour(datetimeArr[3]);
+            supplement.setStartIcuMinute(datetimeArr[4]);
+        }
+        if (null != supplement.getEndIcuTime()) {
+            Integer[] datetimeArr = getSplitDatetime(supplement.getEndIcuTime());
+            supplement.setEndIcuYear(datetimeArr[0]);
+            supplement.setEndIcuMonth(datetimeArr[1]);
+            supplement.setEndIcuDay(datetimeArr[2]);
+            supplement.setEndIcuHour(datetimeArr[3]);
+            supplement.setEndIcuMinute(datetimeArr[4]);
+        }
+        if (null != supplement.getStartEcmoTime()) {
+            Integer[] datetimeArr = getSplitDatetime(supplement.getStartEcmoTime());
+            supplement.setStartEcmoYear(datetimeArr[0]);
+            supplement.setStartEcmoMonth(datetimeArr[1]);
+            supplement.setStartEcmoDay(datetimeArr[2]);
+            supplement.setStartEcmoHour(datetimeArr[3]);
+            supplement.setStartEcmoMinute(datetimeArr[4]);
+        }
+        if (null != supplement.getEndEcmoTime()) {
+            Integer[] datetimeArr = getSplitDatetime(supplement.getEndEcmoTime());
+            supplement.setEndEcmoYear(datetimeArr[0]);
+            supplement.setEndEcmoMonth(datetimeArr[1]);
+            supplement.setEndEcmoDay(datetimeArr[2]);
+            supplement.setEndEcmoHour(datetimeArr[3]);
+            supplement.setEndEcmoMinute(datetimeArr[4]);
+        }
+    }
+
+    private Integer[] getSplitDatetime(Date date) {
+        String formatted = DateUtil.formatDatetime(date);
+        String[] dateTime = formatted.split(" ");
+        String[] dateArr = dateTime[0].split("-");
+        String[] timeArr = dateTime[1].split(":");
+        return new Integer[]{
+                Integer.parseInt(dateArr[0]),
+                Integer.parseInt(dateArr[1]),
+                Integer.parseInt(dateArr[2]),
+                Integer.parseInt(timeArr[0]),
+                Integer.parseInt(timeArr[1])
+        };
+    }
+
+    private void combineSeparatedTime(FrontSheetSupplement s) {
+        Date diagConfirmDate = makeDateBySplitTime(s.getDiagnosisConfirmYear(),
+                s.getDiagnosisConfirmMonth(), s.getDiagnosisConfirmDay(),
+                null, null, "入院后确认日期。");
+        if (null != diagConfirmDate) {
+            s.setDiagnosisConfirmDate(diagConfirmDate);
+        }
+
+        Date startIcuTime = makeDateBySplitTime(s.getStartIcuYear(), s.getStartIcuMonth(),
+                s.getStartIcuDay(), s.getStartIcuHour(), s.getStartIcuMinute(), "进入重症监护室时间。");
+        if (null != startIcuTime) {
+            s.setStartIcuTime(startIcuTime);
+        }
+
+        Date endIcuTime = makeDateBySplitTime(s.getEndIcuYear(), s.getEndIcuMonth(),
+                s.getEndIcuDay(), s.getEndIcuHour(), s.getEndIcuMinute(), "转出重症监护室时间。");
+        if (null != endIcuTime) {
+            s.setEndIcuTime(endIcuTime);
+        }
+
+        Date startEcmoTime = makeDateBySplitTime(s.getStartEcmoYear(), s.getStartEcmoMonth(),
+                s.getStartEcmoDay(), s.getStartEcmoHour(), s.getStartEcmoMinute(), "ECMO上机时间。");
+        if (null != startEcmoTime) {
+            s.setStartEcmoTime(startEcmoTime);
+        }
+
+        Date endEcmoTime = makeDateBySplitTime(s.getEndEcmoYear(), s.getEndEcmoMonth(),
+                s.getEndEcmoDay(), s.getEndEcmoHour(), s.getEndEcmoMinute(), "ECMO撤机时间。");
+        if (null != endEcmoTime) {
+            s.setEndEcmoTime(endEcmoTime);
+        }
+    }
+
+    private Date makeDateBySplitTime(Integer year, Integer month, Integer day,
+                                     Integer hour, Integer minute, String tip) {
+        if (null == year || null == month || null == day) {
+            return null;
+        }
+        if (year > 9999 || year < 1 || month > 12 || month < 1 || day > 31 || day < 1) {
+            throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, "请填写正确的 " + tip);
+        }
+        Calendar calendar = Calendar.getInstance();
+        if (null == hour || null == minute) {
+            calendar.set(year, month - 1, day);
+            return calendar.getTime();
+        }
+        if (hour > 23 || hour < 0 || minute > 59 || minute < 0) {
+            throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, "请填写正确的 " + tip);
+        }
+        calendar.set(year, month - 1, day, hour, minute);
+        return calendar.getTime();
+    }
+
     private List<CaseFrontsheetDisdiag> getSheetDisDiags(String bah, int times, int status) {
         List<CaseFrontsheetDisdiag> disdiags = status == State.FileStatus.SIGNED ?
                 dao.selectSignedSheetDiags(bah, times) : dao.getDisdiags(bah, times);
@@ -572,6 +710,7 @@ public class CaseFrontSheetMainService {
         if (StringUtil.notBlank(sheet.getSocialNo())) {
             sheet.setSocialNo(sheet.getSocialNo().toUpperCase());
         }
+        combineSeparatedTime(sheet.getSupplement());
         dao.updateAPatientMi(sheet);
         Integer[] addrs = sheet.getStandardAddress();
         if (null != addrs && addrs.length > 0) {
@@ -590,6 +729,8 @@ public class CaseFrontSheetMainService {
                 sheet.getPathologicDiagStr(), sheet.getPathologicDiagCode(), sheet.getClinicDiagCode(), sheet.getClinicDiagStr());
         dao.updateBatjBa1(sheet);
         dao.updateBatjBa2(sheet);
+        log.info("{}", sheet.getSupplement());
+        dao.updateSheetSupplement(sheet.getSupplement());
         dao.deleteOldDisdiag(bah, times);
         if (!sheet.getDisdiagList().isEmpty()) {
             List<CaseFrontsheetDisdiag> diags = sheet.getDisdiagList();