Ver código fonte

优化费用上传

lighter 2 semanas atrás
pai
commit
4db3bbd5fc

+ 9 - 9
src/main/java/thyyxxk/sizyfeeoprnsystm/dao/SiZyDao.java

@@ -98,8 +98,8 @@ public interface SiZyDao {
             "medType=(select med_type from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
             "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=charge_code_mx),(select max(national_code) from zd_charge_item where code=charge_code_mx)), " +
             "medListCodgType=case when (select max(national_code) from yp_zd_dict where code=charge_code_mx) is not null then 1 else 2 end, " +
-            "bilgDeptCodg=(select t.si_caty from zd_unit_code t where t.code=ward_code), " +
-            "bilgDeptName=(select t.si_caty_name from zd_unit_code t where t.code=ward_code), " +
+            "bilgDeptCodg=(select t.si_caty from zd_unit_code t where t.code=isnull(ward_code,exec_unit)), " +
+            "bilgDeptName=(select t.si_caty_name from zd_unit_code t where t.code=isnull(ward_code,exec_unit)), " +
             "bilgDrCodg=isnull(" +
             "(select rtrim(nullif(yb_code,'')) from a_employee_mi where code=isnull(isnull(nullif(doctor_code,''),refer_physician),op_id_code)), " +
             "(select rtrim(yb_code) from a_employee_mi where code=isnull(nullif(refer_physician,''),op_id_code))), " +
@@ -139,9 +139,9 @@ public interface SiZyDao {
             "medType=(select med_type from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
             "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=charge_code_mx),(select max(national_code) from zd_charge_item where code=charge_code_mx)), " +
             "medListCodgType=case when (select max(national_code) from yp_zd_dict where code=charge_code_mx) is not null then 1 else 2 end, " +
-            "bilgDeptCodg=(select t.si_caty from zd_unit_code t where t.code=ward_code), " +
+            "bilgDeptCodg=(select t.si_caty from zd_unit_code t where t.code=isnull(ward_code,exec_unit)), " +
             "bilgDeptName=(select z.name from t_yb_dept z where z.code=" +
-            "(select t.si_caty from zd_unit_code t where t.code=ward_code)), " +
+            "(select t.si_caty from zd_unit_code t where t.code=isnull(ward_code,exec_unit))), " +
             "bilgDrCodg=isnull(" +
             "(select rtrim(nullif(yb_code,'')) from a_employee_mi where code=isnull(isnull(nullif(doctor_code,''),refer_physician),op_id_code)), " +
             "(select rtrim(yb_code) from a_employee_mi where code=isnull(nullif(refer_physician,''),op_id_code))), " +
@@ -308,9 +308,9 @@ public interface SiZyDao {
             "medType=(select med_type from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
             "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=charge_code_mx),(select max(national_code) from zd_charge_item where code=charge_code_mx)), " +
             "medListCodgType=case when (select max(national_code) from yp_zd_dict where code=charge_code_mx) is not null then 1 else 2 end, " +
-            "bilgDeptCodg=(select t.si_caty from zd_unit_code t where t.code=ward_code), " +
+            "bilgDeptCodg=(select t.si_caty from zd_unit_code t where t.code=isnull(ward_code,exec_unit)), " +
             "bilgDeptName=(select z.name from t_yb_dept z where z.code=" +
-            "(select t.si_caty from zd_unit_code t where t.code=ward_code)), " +
+            "(select t.si_caty from zd_unit_code t where t.code=isnull(ward_code,exec_unit))), " +
             "bilgDrCodg=isnull(" +
             "(select rtrim(nullif(yb_code,'')) from a_employee_mi where code=isnull(isnull(nullif(doctor_code,''),refer_physician),op_id_code)), " +
             "(select rtrim(yb_code) from a_employee_mi where code=isnull(nullif(refer_physician,''),op_id_code))), " +
@@ -350,9 +350,9 @@ public interface SiZyDao {
             "medType=(select med_type from t_si_pat_info b where b.pat_no=inpatient_no and b.times=admiss_times and b.ledger_sn=a.ledger_sn), " +
             "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=charge_code_mx),(select max(national_code) from zd_charge_item where code=charge_code_mx)), " +
             "medListCodgType=case when (select max(national_code) from yp_zd_dict where code=charge_code_mx) is not null then 1 else 2 end, " +
-            "bilgDeptCodg=(select t.si_caty from zd_unit_code t where t.code=ward_code), " +
+            "bilgDeptCodg=(select t.si_caty from zd_unit_code t where t.code=isnull(ward_code,exec_unit)), " +
             "bilgDeptName=(select z.name from t_yb_dept z where z.code=" +
-            "(select t.si_caty from zd_unit_code t where t.code=ward_code)), " +
+            "(select t.si_caty from zd_unit_code t where t.code=isnull(ward_code,exec_unit))), " +
             "bilgDrCodg=isnull(" +
             "(select rtrim(nullif(yb_code,'')) from a_employee_mi where code=isnull(isnull(nullif(doctor_code,''),refer_physician),op_id_code)), " +
             "(select rtrim(yb_code) from a_employee_mi where code=isnull(nullif(refer_physician,''),op_id_code))), " +
@@ -421,7 +421,7 @@ public interface SiZyDao {
      * @return 科室编码
      */
     @Select("select top 1 t.si_caty from zd_unit_code t " +
-            "inner join zy_detail_charge a on t.code = a.ward_code " +
+            "inner join zy_detail_charge a on t.code = a.isnull(ward_code,exec_unit) " +
             "where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and a.ledger_sn=#{ledgerSn} " +
             "and t.si_caty is not null and t.si_caty != ''")
     String selectAdmDeptCodg(@Param("patNo") String patNo,