lighter il y a 1 an
Parent
commit
c6320a2aeb

+ 12 - 12
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiMzDao.java

@@ -99,25 +99,25 @@ public interface SiMzDao {
     List<MzDepositFile> selectMzDepositFiles(@Param("patNo") String patNo, @Param("start") String start, @Param("end") String end);
 
     @Select("select rtrim(patient_id) as patient_id,times,receipt_no,order_no,item_no,charge_item_code, " +
-            "charge_bill_code,quantity,unit_price,serial,serial_no, " +
-            "frequency,drug_quan,drug_unit,supply_code,charge_date, " +
-            "doctorName=(select rtrim(name) from a_employee_mi where code=doctor_code)," +
+            "charge_bill_code,quantity,unit_price,serial,serial_no,frequency,drug_quan,charge_date, " +
+            "supplyCode=(select top 1 rtrim(d.supply_name) from mz_zd_supply_type d where d.supply_code=a.supply_code)," +
+            "doctorName=(select rtrim(d.name) from a_employee_mi d where d.code=a.doctor_code)," +
             "group_no,confirm_flag,instruction_text,drug_win,price_time,tc_no, " +
             "bill_item_code,doctor_code,tc_name," +
             "drugName=(case when group_no='00' then " +
-            "(select name from zd_charge_item a where a.code=charge_item_code) else " +
-            "(select top 1 name from yp_zd_dict a where a.code=charge_item_code) end)," +
+            "(select d.name from zd_charge_item d where d.code=a.charge_item_code) else " +
+            "(select top 1 d.name from yp_zd_dict d where d.code=a.charge_item_code) end)," +
             "drugUnit=(case when group_no='00' then " +
-            "(select rtrim(charge_unit) from zd_charge_item a where a.code=charge_item_code) else " +
-            "(select rtrim(name) from yp_zd_unit a where a.code=charge_item_code) end)," +
+            "(select rtrim(d.charge_unit) from zd_charge_item d where d.code=a.charge_item_code) else " +
+            "(select rtrim(d.name) from yp_zd_unit d where d.code=a.drug_unit) end)," +
             "specification=(case when group_no='00' then '' else " +
-            "(select rtrim(specification) from yp_zd_dict a where a.code=charge_item_code) end)," +
+            "(select rtrim(d.specification) from yp_zd_dict d where d.code=a.charge_item_code and d.serial=a.serial) end)," +
             "ybComment=(case when group_no='00' then null else " +
-            "(select max(yb_comment_new) from yp_zd_dict where code=charge_item_code) end)," +
+            "(select max(d.yb_comment_new) from yp_zd_dict d where d.code=a.charge_item_code) end)," +
             "nationalCode=(case when group_no='00' then " +
-            "(select national_code from zd_charge_item a where a.code=charge_item_code) else " +
-            "(select max(national_code) from yp_zd_dict a where a.code=charge_item_code) end) " +
-            "from mz_charge_detail where patient_id=#{patNo} and times=#{times} and " +
+            "(select d.national_code from zd_charge_item d where d.code=a.charge_item_code) else " +
+            "(select max(d.national_code) from yp_zd_dict d where d.code=a.charge_item_code) end) " +
+            "from mz_charge_detail a where patient_id=#{patNo} and times=#{times} and " +
             "receipt_no=#{receipt} and pay_mark=0 and confirm_flag!=4 and bill_item_code!='TC' " +
             "and charge_item_code!='BILL99' and isnull(cash_id,'')!='99998'")
     List<MzReceipt> selectMzCharge(@Param("patNo") String patNo, @Param("times") int times, @Param("receipt") int receipt);