Sfoglia il codice sorgente

点击药品编码查看这个药品的使用患者明细

梁欢 1 settimana fa
parent
commit
6efc7e6db5

+ 18 - 9
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyiji/MedicineManagementDao.java

@@ -23,15 +23,24 @@ public interface MedicineManagementDao {
             "from zy_drug a with(nolock),yp_zd_dict b with(nolock) ${ew.customSqlSegment}")
     List<MedicinePage> selectMedicinePages(@Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
 
-    @Select("select b.code as chargeCode,rtrim(c.name) as patName,rtrim(c.inpatient_no) as patNo,sum(a.amount) as amount, " +
-            "sum(a.charge_fee) as chargeFee,max(b.pack_retprice) as price,max(a.exec_unit) as execUnit,a.charge_date, " +
-            "b.serial as serialNo,max(a.group_no) as groupNo,max(a.page_no) as pageNo,max(b.name) as drugName, " +
-            "max(b.specification) as spec,max(a.confirm_flag) as confirmFlag,max(b.drug_flag) as drugFlag " +
-            "from zy_drug a with(nolock),yp_zd_dict b with(nolock),zy_actpatient c with(nolock) " +
-            "where charge_date>=#{start} and charge_date<=#{end} and a.group_no='73' and a.exec_unit in (${dept}) " +
-            "and a.charge_code=b.code and a.inpatient_no=c.inpatient_no and isnull(a.serial,'01')=b.serial " +
-            "group by b.code,b.serial,c.inpatient_no,c.name,a.charge_date having sum(a.amount)!=0")
-    List<MedicinePage> selectUsedMedicines(FetchMedicines params);
+    @Select("<script>" +
+            "select b.code as chargeCode, rtrim(c.name) as patName, rtrim(c.inpatient_no) as patNo, sum(a.amount) as amount, " +
+            "sum(a.charge_fee) as chargeFee, max(b.pack_retprice) as price, max(a.exec_unit) as execUnit, a.charge_date, " +
+            "b.serial as serialNo, max(a.group_no) as groupNo, max(a.page_no) as pageNo, max(b.name) as drugName, " +
+            "max(b.specification) as spec, max(a.confirm_flag) as confirmFlag, max(b.drug_flag) as drugFlag " +
+            "from zy_drug a with(nolock), yp_zd_dict b with(nolock), zy_actpatient c with(nolock) " +
+            "where charge_date &gt;= #{start} and charge_date &lt;= #{end} " +
+            "and a.group_no = '73' and a.exec_unit in (${dept}) " +
+            "and a.charge_code = b.code and a.inpatient_no = c.inpatient_no and isnull(a.serial, '01') = b.serial " +
+            "<if test=\"chargeCodes != null and chargeCodes != ''\">" +
+            "and b.code = #{chargeCodes} " +
+            "</if>" +
+            "group by b.code, b.serial, c.inpatient_no, c.name, a.charge_date having sum(a.amount) != 0 " +
+            "</script>")
+    List<MedicinePage> selectUsedMedicines(@Param("start") String start,
+                                           @Param("end") String end,
+                                           @Param("dept") String dept,
+                                           @Param("chargeCodes") String chargeCodes);
 
     @Delete("delete yz_yp_page_no where page_no=#{pageNo}")
     void deleteExistTargetPageNo(int pageNo);

+ 1 - 1
src/main/java/thyyxxk/webserver/service/zhuyuanyiji/MedicineManagementService.java

@@ -46,7 +46,7 @@ public class MedicineManagementService {
     public ResultVo<List<MedicinePage>> fetchUsedMedicines(FetchMedicines params) {
 //        transformDateToDatetime(params);
         buildChildDepartments(params);
-        List<MedicinePage> list = dao.selectUsedMedicines(params);
+        List<MedicinePage> list = dao.selectUsedMedicines(params.getStart(),params.getEnd(),params.getDept(),params.getChargeCodes());
         if (list.isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
         }