Browse Source

修复写死的医嘱编码

lighter 5 months ago
parent
commit
15c48b17f5

+ 4 - 3
src/main/java/thyyxxk/webserver/dao/his/PublicDao.java

@@ -161,10 +161,12 @@ public interface PublicDao {
             "responce_type,  " + "rtrim(zk_ward) as dept,ward,ward_name = (select rtrim(name) name from zd_unit_code where code = ward), " +
             "ledger_sn = (select max(ledger_sn) from zy_ledger_file where a.inpatient_no = zy_ledger_file.inpatient_no and a.admiss_times = zy_ledger_file.admiss_times), " +
             "chu_yuan_yi_zhu = (case when (select count(1) from yz_act_order where inpatient_no= a.inpatient_no and admiss_times= a.admiss_times " +
-            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0 " +
+            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))) > 0 " +
             "then 1 " +
             "when (select count(1) from yz_inact_order where inpatient_no= a.inpatient_no and admiss_times= a.admiss_times " +
-            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0 " +
+            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))) > 0 " +
             "then 1 else 0 end  ), " + "bed_no,total_charge,balance,zy_serial_no " +
             " from zy_actpatient a " +
             "where inpatient_no = #{inpatientNo} ")
@@ -182,7 +184,6 @@ public interface PublicDao {
     @Select("select ori_detail_sn,sum(charge_fee) charge_fee,sum(charge_amount) charge_amount " + "from zy_detail_charge a " + "where inpatient_no=#{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn}  and order_no <> 6 and trans_flag_yb <> 2 " + "  and ori_detail_sn is not null and charge_amount<0 " + "group by ori_detail_sn having count(1) > 1")
     List<ZyDetailCharge> chongFuTuiFeiLiuShui(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes, @Param("ledgerSn") Integer ledgerSn);
 
-
     @Select("<script>" + "select detail_sn,charge_fee,charge_amount from zy_detail_charge where inpatient_no=#{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} " + "and detail_sn in " + "<foreach collection='oriSn' item='sn' open='(' close=')' separator=','>" + "#{sn}" + "</foreach>" + "</script>")
     List<ZyDetailCharge> getZhenShuLiuShui(@Param("inpatientNo") String inpatientNo, @Param("admissTimes") Integer admissTimes, @Param("ledgerSn") Integer ledgerSn, @Param("oriSn") Set<Integer> oriSn);
 

+ 2 - 1
src/main/java/thyyxxk/webserver/dao/his/inpatient/ChargeListDao.java

@@ -115,6 +115,7 @@ public interface ChargeListDao {
     List<Integer> selectAllLedgers(String patNo, int times);
 
     @Select("select convert(varchar(10),start_time,21) from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973')")
+            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))")
     String selectActOrderDisDate(@Param("patNo") String patNo, @Param("times") Integer times);
 }

+ 10 - 5
src/main/java/thyyxxk/webserver/dao/his/inpatient/DismissDao.java

@@ -123,15 +123,18 @@ public interface DismissDao {
                         @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
 
     @Select("select count(1) from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')")
+            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))")
     Integer countDisActOrders(@Param("patNo") String patNo, @Param("times") Integer times);
 
     @Select("select count(1) from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code='05973' ")
+            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name=N'死亡') ")
     Integer selectDeathOrderCount(@Param("patNo") String patNo, @Param("times") Integer times);
 
     @Select("select count(1) from yz_inact_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')")
+            "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))")
     Integer countDisActOrders2(@Param("patNo") String patNo, @Param("times") Integer times);
 
     @Select("select (select isnull(sum(charge_fee),0) from zy_detail_charge where inpatient_no=#{patNo} " +
@@ -216,11 +219,13 @@ public interface DismissDao {
                              @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
 
     @Select("select start_time from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973')")
+            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))")
     Date selectActOrderDisDate(@Param("patNo") String patNo, @Param("times") Integer times);
 
     @Select("select start_time from yz_inact_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973')")
+            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))")
     Date selectActOrderDisDate2(@Param("patNo") String patNo, @Param("times") Integer times);
 
     @Update("update ${table} SET dis_date=#{disDate},dis_ward=ward,dis_dept=dept,job_nurse=#{codeRs}," +

+ 11 - 7
src/main/java/thyyxxk/webserver/dao/his/inpatient/PatientDao.java

@@ -24,7 +24,7 @@ public interface PatientDao {
             "medType=a.med_type, " +
             "dismissOrder=(select count(1) from yz_act_order b where b.inpatient_no=a.inpatient_no " +
             "and b.admiss_times=a.admiss_times and status_flag > '1' and isnull(group_no,'00')='00' " +
-            "and order_code in ('06026','06053','05973'))," +
+            "and order_code in (select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')))," +
             "orderNoCount = (select count(1) " +
             "                    from yz_act_order c " +
             "                    where a.inpatient_no = c.inpatient_no " +
@@ -78,7 +78,7 @@ public interface PatientDao {
             "admissStatus=rtrim(a.admiss_status), " +
             "dismissOrder=(select count(1) from yz_act_order y where y.inpatient_no=b.inpatient_no  " +
             "and y.admiss_times=a.admiss_times and status_flag>'1' and isnull(group_no,'00')='00' " +
-            "and order_code in ('06026','06053','05973')),  " +
+            "and order_code in (select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))),  " +
             "disDiagStatus=(select RTRIM(dis_diag_status) from zy_dis_diag_yb where inpatient_no=a.inpatient_no " +
             "and admiss_times=a.admiss_times and dis_diag_no=1), " +
             "operation=rtrim(a.operation),a.zy_serial_no, " +
@@ -218,7 +218,8 @@ public interface PatientDao {
 
     @Select("select convert (varchar(12),dateadd (day,0,start_time),111) from yz_act_order where " +
             "inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} and status_flag > '1' " +
-            "and isnull(group_no,'00')='00' and order_code in ('06026','06053','05973') ")
+            "and isnull(group_no,'00')='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')) ")
     String getActOrderDisDate(@Param("inpatientNo") String inpatientNo,
                               @Param("admissTimes") Integer admissTimes);
 
@@ -233,9 +234,11 @@ public interface PatientDao {
             "enter_oper, start_time, end_time, infant_flag, drug_flag, performance_time, " +
             "physician, confirm_time, signer, status_flag, status_time,drug_specification,order_name,discription, " +
             "ward_code,dept_code,exec_unit) " +
-            "values (#{actOrderNo}, #{inpatientNo}, #{admissTimes}, '06026', #{dismissOrderDate}, 'ONCE', #{dismissOrderDate}, " +
-            "#{staffId}, #{dismissOrderDate}, #{dismissOrderDate}, 0, 0, #{dismissOrderDate}, #{staffId}, " +
-            "#{dismissOrderDate}, #{staffId}, 5, #{dismissOrderDate},'诊疗项目','今日结账出院','0.00 本项目不包含费用'," +
+            "values (#{actOrderNo}, #{inpatientNo}, #{admissTimes}, " +
+            "(select top 1 order_code from yz_zd_order_item_confirm where item_name=N'出院'), " +
+            "#{dismissOrderDate}, 'ONCE', #{dismissOrderDate},#{staffId}, #{dismissOrderDate}, #{dismissOrderDate}, " +
+            "0, 0, #{dismissOrderDate}, #{staffId},#{dismissOrderDate}, #{staffId}, 5, #{dismissOrderDate}," +
+            "'诊疗项目','今日结账出院','0.00 本项目不包含费用'," +
             "#{admissWard},#{admissWard},#{admissWard})")
     void insertNewDismissActOrder(@Param("actOrderNo") float actOrderNo,
                                   @Param("inpatientNo") String inpatientNo,
@@ -280,7 +283,8 @@ public interface PatientDao {
                                           @Param("newDate") Date newDate);
 
     @Select("select start_time from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973')")
+            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))")
     Date selectActOrderDisDate(@Param("patNo") String patNo, @Param("times") Integer times);
 
     @Update("update zy_detail_charge set charge_date=#{disdate} where inpatient_no=#{zyh} " +

+ 8 - 4
src/main/java/thyyxxk/webserver/dao/his/inpatient/casefrontsheet/CaseFrontSheetAnalyzeDao.java

@@ -53,11 +53,13 @@ public interface CaseFrontSheetAnalyzeDao {
             "from zy_inactpatient a, a_patient_mi b, batj_ba2 c, " +
             "(select inpatient_no,admiss_times,start_time from yz_act_order " +
             "where start_time>=#{begntime} and start_time<=#{endtime} " +
-            "and order_code='05973' and group_no='00' and exec_unit like #{dept} " +
+            "and order_code in (select order_code from yz_zd_order_item_confirm where item_name=N'死亡') " +
+            "and group_no='00' and exec_unit like #{dept} " +
             "union " +
             "select inpatient_no,admiss_times,start_time from yz_inact_order " +
             "where start_time>=#{begntime} and start_time<=#{endtime} " +
-            "and order_code='05973' and group_no='00' and exec_unit like #{dept}) d " +
+            "and order_code in (select order_code from yz_zd_order_item_confirm where item_name=N'死亡') " +
+            "and group_no='00' and exec_unit like #{dept}) d " +
             "where a.inpatient_no=b.inpatient_no and a.inpatient_no=c.zyh and " +
             "      a.inpatient_no=d.inpatient_no and a.admiss_times=c.zycs and " +
             "      a.admiss_times=d.admiss_times " +
@@ -74,10 +76,12 @@ public interface CaseFrontSheetAnalyzeDao {
             "from zy_actpatient a, a_patient_mi b, batj_ba2 c, " +
             "(select inpatient_no,admiss_times,start_time from yz_act_order " +
             "where start_time>=#{begntime} and start_time<=#{endtime} " +
-            "and order_code='05973' and group_no='00' and exec_unit like #{dept} union " +
+            "and order_code in (select order_code from yz_zd_order_item_confirm where item_name=N'死亡') " +
+            "and group_no='00' and exec_unit like #{dept} union " +
             "select inpatient_no,admiss_times,start_time from yz_inact_order " +
             "where start_time>=#{begntime} and start_time<=#{endtime} " +
-            "and order_code='05973' and group_no='00' and exec_unit like #{dept}) d " +
+            "and order_code in (select order_code from yz_zd_order_item_confirm where item_name=N'死亡') " +
+            "and group_no='00' and exec_unit like #{dept}) d " +
             "where a.inpatient_no=b.inpatient_no and a.inpatient_no=c.zyh and " +
             "      a.inpatient_no=d.inpatient_no and a.admiss_times=c.zycs and " +
             "      a.admiss_times=d.admiss_times ")

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

@@ -56,7 +56,8 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
 
     @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')")
+            "and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))")
     Date getDismissDateFromYzActOrder(String table, String bah, int times);
 
     @Select("select " +
@@ -71,7 +72,7 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "insutype=(select top 1 insutype from t_si_pat_info with(nolock) where pat_no=#{bah} and times=#{times} order by ledger_sn desc), " +
             "dismissDate=(select max(start_time) from ${yzTable} 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')), " +
+            "and order_code in (select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))), " +
             "rtrim(small_dept) as admissDeptCode, " +
             "admissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=small_dept), " +
             "rtrim(admiss_ward) as admissWardCode, " +

+ 6 - 2
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiSettleApplyDao.java

@@ -24,11 +24,15 @@ public interface SiSettleApplyDao {
     String selectYbGender(String patNo, int times, int ledger);
 
     @Select("select start_time from ${table} with(nolock) where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973') and status_flag <> '6'  ")
+            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')) " +
+            "and status_flag <> '6'  ")
     Date selectActOrderDisDate(String table, String patNo, Integer times);
 
     @Select("select start_time from ${table} with(nolock) where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973') and status_flag <> '6'  ")
+            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')) " +
+            "and status_flag <> '6'  ")
     List<Date> selectActOrderDisDate2(String table, String patNo, Integer times);
 
     @Select("select top 1 status,handle_comment,type,settle_datetime,acct_used_flag,death_flag,sort_no from t_si_settle_apply " +

+ 4 - 2
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiZyDao.java

@@ -133,7 +133,8 @@ public interface SiZyDao {
     PreSetlmt selectPreSetlmt(String patNo, int times, int ledgerSn, String endtime);
 
     @Select("select start_time from yz_act_order with(nolock) where inpatient_no=#{patNo} and admiss_times=#{times} " +
-            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973') and status_flag!='6'  ")
+            "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')) and status_flag!='6'  ")
     Date selectActOrderDisDate(String patNo, Integer times);
 
     @Select("select psn_no,certno as mdtrtCertNo,certno,mdtrtCertType='02', " +
@@ -150,7 +151,8 @@ public interface SiZyDao {
             "from t_si_pat_info a, yz_act_order b,zy_actpatient c " +
             "where a.pat_no=#{patNo} and a.times=#{times} and a.ledger_sn=#{ledgerSn} " +
             "and a.pat_no=b.inpatient_no and a.times=b.admiss_times and a.pat_no=c.inpatient_no " +
-            "and b.status_flag>'1' and isnull(b.group_no, '00')='00' and b.order_code in ('06026','06053','05973')")
+            "and b.status_flag>'1' and isnull(b.group_no, '00')='00' and b.order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡'))")
     Dscginfo selectDscginfo(String patNo, int times, int ledgerSn);
 
     @Select("select a.mdtrt_id,a.psn_no,a.insutype, " +

+ 10 - 5
src/main/java/thyyxxk/webserver/dao/his/scheduled/DailyPatientCountDao.java

@@ -12,16 +12,21 @@ public interface DailyPatientCountDao {
     @Select("select inHospCount=((select count(1) from zy_actpatient with(nolock) where inpatient_no not like 'JT%')- " +
             "(select count(1) from zy_actpatient a with(nolock),yz_act_order b where a.inpatient_no not like 'JT%' " +
             "and a.inpatient_no=b.inpatient_no and a.admiss_times=b.admiss_times and b.status_flag > '2' and " +
-            "isnull(b.group_no,'00' )='00' and b.order_code in ('06026','06053','05973'))), " +
+            "isnull(b.group_no,'00' )='00' and b.order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')))), " +
             "admissCount=(select count(1) from zy_actpatient with(nolock) where datediff(day,admiss_date,getdate())=1), " +
             "dismissCount=((select count(1) from yz_act_order with(nolock) where status_flag > '2' and " +
-            "datediff(day,start_time,getdate())=1 and isnull(group_no,'00' )='00' and order_code in ('06026','06053')) " +
+            "datediff(day,start_time,getdate())=1 and isnull(group_no,'00' )='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name=N'出院')) " +
             "+ (select count(1) from yz_inact_order with(nolock) where status_flag > '2' and " +
-            "datediff(day,start_time,getdate())=1 and isnull(group_no,'00' )='00' and order_code in ('06026','06053'))), " +
+            "datediff(day,start_time,getdate())=1 and isnull(group_no,'00' )='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name=N'出院'))), " +
             "deadCount=((select count(1) from yz_act_order with(nolock) where status_flag > '2' and " +
-            "datediff(day,start_time,getdate())=1 and isnull(group_no,'00' )='00' and order_code='05973') + " +
+            "datediff(day,start_time,getdate())=1 and isnull(group_no,'00' )='00' and " +
+            "order_code in (select order_code from yz_zd_order_item_confirm where item_name=N'死亡')) + " +
             "(select count(1) from yz_inact_order with(nolock) where status_flag > '2' and " +
-            "datediff(day,start_time,getdate())=1 and isnull(group_no,'00' )='00' and order_code='05973'))," + 
+            "datediff(day,start_time,getdate())=1 and isnull(group_no,'00' )='00' and order_code in " +
+            "(select order_code from yz_zd_order_item_confirm where item_name=N'死亡')))," +
             "heavyCount=(select count(1) from yz_act_order with(nolock) where status_flag!='5' " +
             "and isnull(group_no,'00' )='00' and order_code='05888'), " +
             "dangerCount=(select count(1) from yz_act_order with(nolock) where status_flag!='5' " +

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuLuRuDao.java

@@ -49,7 +49,7 @@ public interface YiZhuLuRuDao {
             "medType=a.med_type, " +
             "dismissOrder=(select count(1) from yz_act_order b where b.inpatient_no=a.inpatient_no " +
             "and b.admiss_times=a.admiss_times and status_flag > '1' and isnull(group_no,'00')='00' " +
-            "and order_code in ('06026','06053','05973'))," +
+            "and order_code in (select order_code from yz_zd_order_item_confirm where item_name in (N'出院',N'死亡')))," +
             "orderNoCount = (select count(1) " +
             "                    from yz_act_order c " +
             "                    where a.inpatient_no = c.inpatient_no " +