|
|
@@ -0,0 +1,91 @@
|
|
|
+package thyyxxk.webserver.dao.his.yp;
|
|
|
+
|
|
|
+import org.apache.ibatis.annotations.Select;
|
|
|
+import thyyxxk.webserver.entity.yp.YpInventoryVo;
|
|
|
+import thyyxxk.webserver.entity.yp.YpZdDictVo;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+public interface YpInventoryDao {
|
|
|
+
|
|
|
+ @Select("<script> " +
|
|
|
+ " select t.charge_code as code, t.serial, t.name, t.pack_retprice as packRetprice, t.pack_size as packSize, t.specification, sum(t.sl) as amount " +
|
|
|
+ " from (select yp.charge_code, yp.serial, zd.name, zd.pack_retprice, zd.pack_size, zd.specification, sum(yp.amount) as sl " +
|
|
|
+ " from yp_zy_patient yp with(nolock), yp_zd_dict zd with(nolock) " +
|
|
|
+ " where yp.charge_code = zd.code and yp.serial = zd.serial " +
|
|
|
+ "<if test=\"startTime != null and startTime != '' \">" +
|
|
|
+ " and yp.order_date >= #{startTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"endTime != null and endTime != '' \">" +
|
|
|
+ " and yp.order_date <= #{endTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"keyCode != null and keyCode != '' \">" +
|
|
|
+ " and (zd.code like '%${keyCode}%' or zd.name like '%${keyCode}%' " +
|
|
|
+ " or zd.py_code like ('%' + upper(#{keyCode}) + '%') or zd.d_code like ('%' + upper(#{keyCode}) + '%')) " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"groupNo != null and groupNo != '' \">" +
|
|
|
+ " and yp.group_no = #{groupNo} " +
|
|
|
+ "</if>" +
|
|
|
+ " group by yp.charge_code, yp.serial, zd.name, zd.pack_retprice, zd.pack_size, zd.specification " +
|
|
|
+ " union all " +
|
|
|
+ " select yp.charge_item_code as charge_code, yp.serial, zd.name, zd.pack_retprice, zd.pack_size, zd.specification, sum(yp.quantity) as sl " +
|
|
|
+ " from yp_mz_fytj yp with(nolock), yp_zd_dict zd with(nolock) " +
|
|
|
+ " where yp.charge_item_code = zd.code and yp.serial = zd.serial " +
|
|
|
+ "<if test=\"startTime != null and startTime != '' \">" +
|
|
|
+ " and yp.charge_date >= #{startTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"endTime != null and endTime != '' \">" +
|
|
|
+ " and yp.charge_date <= #{endTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"keyCode != null and keyCode != '' \">" +
|
|
|
+ " and (zd.code like '%${keyCode}%' or zd.name like '%${keyCode}%' " +
|
|
|
+ " or zd.py_code like ('%' + upper(#{keyCode}) + '%') or zd.d_code like ('%' + upper(#{keyCode}) + '%')) " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"groupNo != null and groupNo != '' \">" +
|
|
|
+ " and yp.group_no = #{groupNo} " +
|
|
|
+ "</if>" +
|
|
|
+ " group by yp.charge_item_code, yp.serial, zd.name, zd.pack_retprice, zd.pack_size, zd.specification) t " +
|
|
|
+ " group by t.charge_code, t.serial, t.name, t.pack_retprice, t.pack_size, t.specification " +
|
|
|
+ " order by sum(t.sl) desc " +
|
|
|
+ "</script> ")
|
|
|
+ List<YpZdDictVo> selectYpUsedQuantity(YpInventoryVo vo);
|
|
|
+
|
|
|
+ @Select("<script> " +
|
|
|
+ " select t.* from " +
|
|
|
+ " (select yp.charge_code as code, yp.serial, zd.name, zd.pack_retprice as packRetprice, zd.specification, " +
|
|
|
+ " yp.order_date as sj, yp.inpatient_no as zyh, yp.admiss_times as cs, " +
|
|
|
+ " yp.name as xm, yp.amount, yp.page_no as pageNo, yp.act_order_no as orderNo, " +
|
|
|
+ " yp.group_no as groupNo, ks.group_name as groupName, '' as receiptNo " +
|
|
|
+ " from yp_zy_patient yp with(nolock) left join yp_zd_group_name ks on yp.group_no = ks.group_no, yp_zd_dict zd with(nolock) " +
|
|
|
+ " where yp.charge_code = zd.code and yp.serial = zd.serial and yp.charge_code = #{code} " +
|
|
|
+ "<if test=\"startTime != null and startTime != '' \">" +
|
|
|
+ " and yp.order_date >= #{startTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"endTime != null and endTime != '' \">" +
|
|
|
+ " and yp.order_date <= #{endTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"groupNo != null and groupNo != '' \">" +
|
|
|
+ " and yp.group_no = #{groupNo} " +
|
|
|
+ "</if>" +
|
|
|
+ " union all " +
|
|
|
+ " select yp.charge_item_code as code, yp.serial, zd.name, zd.pack_retprice as packRetprice, zd.specification, " +
|
|
|
+ " yp.charge_date as sj, yp.patient_id as zyh, yp.times as cs, " +
|
|
|
+ " yp.name as xm, yp.quantity as amount, yp.real_no as pageNo, yp.order_no as orderNo, " +
|
|
|
+ " yp.group_no as groupNo, ks.group_name as groupName, yp.receipt_no as receiptNo " +
|
|
|
+ " from yp_mz_fytj yp with(nolock) left join yp_zd_group_name ks on yp.group_no = ks.group_no, yp_zd_dict zd with(nolock) " +
|
|
|
+ " where yp.charge_item_code = zd.code and yp.serial = zd.serial and yp.charge_item_code = #{code} " +
|
|
|
+ "<if test=\"startTime != null and startTime != '' \">" +
|
|
|
+ " and yp.charge_date >= #{startTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"endTime != null and endTime != '' \">" +
|
|
|
+ " and yp.charge_date <= #{endTime} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test=\"groupNo != null and groupNo != '' \">" +
|
|
|
+ " and yp.group_no = #{groupNo} " +
|
|
|
+ "</if>" +
|
|
|
+ " ) t order by t.sj " +
|
|
|
+ "</script> ")
|
|
|
+ List<Map<String, Object>> selectYpUsedMx(YpInventoryVo vo);
|
|
|
+
|
|
|
+}
|