|
|
@@ -23,16 +23,7 @@ public interface YfDrugApplyMapper {
|
|
|
* @return
|
|
|
*/
|
|
|
@Select("<script>" +
|
|
|
- "SELECT top ${pageBean.pageSize} * from " +
|
|
|
- "(SELECT row_number() over (order by (case when b.mini_stock_amount>=max(isnull(b.stock_amount,0)) then 0 else 1 end) asc," +
|
|
|
- "(case when max(isnull(b.stock_amount,0))=0 " +
|
|
|
- " or isnull(sum(case when datediff(day,confirm_time,getdate()) <![CDATA[>]]> 3 then 0 else quantity end),0)=0" +
|
|
|
- " then 0 " +
|
|
|
- " else round(max(isnull(b.stock_amount,0))/(isnull(round(sum(case when datediff(day,confirm_time,getdate()) <![CDATA[>]]> 3 then 0 else quantity end),2),0)/3),2) end) asc," +
|
|
|
- "max(isnull(b.stock_amount,0)) asc," +
|
|
|
- "isnull(round(sum(case" +
|
|
|
- " when datediff(day,confirm_time,getdate()) > 3 then 0" +
|
|
|
- " else quantity end),2),0) desc) RowNumber," +
|
|
|
+ "SELECT " +
|
|
|
" b.charge_code," +
|
|
|
" isnull(dd.stock_amount,0) as stock_amount_yk," +
|
|
|
" a.name," +
|
|
|
@@ -114,77 +105,15 @@ public interface YfDrugApplyMapper {
|
|
|
" a.pack_retprice ," +
|
|
|
" dd.stock_amount ," +
|
|
|
" b.location" +
|
|
|
- ") as A WHERE RowNumber >#{pageBean.pageSize}*#{pageBean.pageIndex} order by RowNumber asc" +
|
|
|
+ " order by\n" +
|
|
|
+ " (case when b.mini_stock_amount>=max(isnull(b.stock_amount,0)) then 0 else 1 end) asc,\n" +
|
|
|
+ " (case when max(isnull(b.stock_amount, 0))=0 or isnull(sum(case when datediff(day, confirm_time, getdate()) > 3 then 0 else quantity end), 0)=0\n" +
|
|
|
+ " then 0 else round(max(isnull(b.stock_amount, 0))/(isnull(round(sum(case when datediff(day, confirm_time, getdate()) > 3 then 0 else quantity end), 2),0)/3),2) end) asc,\n" +
|
|
|
+ " max(isnull(b.stock_amount,0)) asc,\n" +
|
|
|
+ " isnull(round(sum(case when datediff(day,confirm_time,getdate()) > 3 then 0 else quantity end), 2), 0) desc" +
|
|
|
"</script>")
|
|
|
- List<YpBaseBoundVo> selectYpBaseYfBoundPage(@Param("searchText")String searchText, @Param("groupNo") String groupNo, @Param("pageBean")PageBean pageBean);
|
|
|
+ List<YpBaseBoundVo> selectYpBaseYfBound(@Param("searchText")String searchText, @Param("groupNo") String groupNo);
|
|
|
|
|
|
- /**
|
|
|
- * 查询药房药品总条数
|
|
|
- * @param searchText
|
|
|
- * @param groupNo
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Select("<script>" +
|
|
|
- "select count(1) " +
|
|
|
- "from (SELECT b.charge_code" +
|
|
|
- " FROM yp_zd_dict a WITH(NOLOCK) ,yp_base_yf b WITH(NOLOCK)," +
|
|
|
- " (select c.name,a.charge_item_code code,c.serial,a.confirm_time," +
|
|
|
- " round(sum(case when a.serial <![CDATA[<]]> c.serial then quantity*cy_fy/pack_size else quantity*cy_fy end),2) quantity" +
|
|
|
- " from yp_mz_fytj a WITH(NOLOCK)," +
|
|
|
- " (select a.name,a.code,a.serial,a.specification,a.pack_size" +
|
|
|
- " from yp_zd_dict a WITH(NOLOCK),(select code,max(serial) serial" +
|
|
|
- " from yp_zd_dict WITH(NOLOCK) group by code) b" +
|
|
|
- " where a.code=b.code and a.serial=b.serial) c" +
|
|
|
- " where a.charge_item_code=c.code and datediff(day,confirm_time,getdate()) <![CDATA[<]]> 61 and group_no =#{groupNo}" +
|
|
|
- " group by c.name,a.charge_item_code,c.serial,a.confirm_time" +
|
|
|
- " union all" +
|
|
|
- " select" +
|
|
|
- " c.name,a.charge_code code,c.serial,a.confirm_time," +
|
|
|
- " round(sum(case when a.serial <![CDATA[<]]> c.serial then amount/pack_size else amount end),2) quantity" +
|
|
|
- " from yp_zy_patient a WITH(NOLOCK)," +
|
|
|
- " (select a.name,a.code,a.serial,a.specification,a.pack_size" +
|
|
|
- " from yp_zd_dict a WITH(NOLOCK),(select code,max(serial) serial" +
|
|
|
- " from yp_zd_dict WITH(NOLOCK) group by code) b" +
|
|
|
- " where a.code=b.code and a.serial=b.serial) c" +
|
|
|
- " where a.charge_code=c.code and datediff(day,confirm_time,getdate()) <![CDATA[<]]> 61 and acct_sign=2 and group_no =#{groupNo}" +
|
|
|
- " group by c.name,a.charge_code,c.serial,a.confirm_time) aa," +
|
|
|
- " (select c.name,a.charge_code,c.serial," +
|
|
|
- " case when a.group_no='81' then '22' else '11' end group_no," +
|
|
|
- " round(sum(case when a.serial <![CDATA[<]]> c.serial then stock_amount/pack_size else stock_amount end),2) stock_amount" +
|
|
|
- " from yp_base_yf a WITH(NOLOCK)," +
|
|
|
- " (select a.name,a.code,a.serial,a.specification,a.pack_size" +
|
|
|
- " from yp_zd_dict a WITH(NOLOCK),(select code,max(serial) serial" +
|
|
|
- " from yp_zd_dict WITH(NOLOCK) group by code) b" +
|
|
|
- " where a.code=b.code and a.serial=b.serial) c" +
|
|
|
- " where a.charge_code=c.code and a.group_no <![CDATA[<>]]> '91' and a.group_no =#{groupNo}" +
|
|
|
- " group by c.name,a.charge_code,c.serial,(case when a.group_no='81' then '22' else'11' end)) bb" +
|
|
|
- " where a.code=b.charge_code and" +
|
|
|
- " a.serial=b.serial and" +
|
|
|
- " b.group_no=#{groupNo} and" +
|
|
|
- " a.code*=aa.code and" +
|
|
|
- " a.serial*=aa.serial and" +
|
|
|
- " a.code*=bb.charge_code and" +
|
|
|
- " a.serial*=bb.serial and" +
|
|
|
- " (a.py_code like '${searchText}%' or" +
|
|
|
- " a.d_code like '${searchText}%' or" +
|
|
|
- " a.code like '${searchText}%' or" +
|
|
|
- " a.name like '${searchText}%') and" +
|
|
|
- " isnull(a.visible_flag,'0') <![CDATA[<>]]> '1' and" +
|
|
|
- " isnull(a.del_flag,'0') <![CDATA[<>]]> '1'" +
|
|
|
- " group by b.charge_code," +
|
|
|
- " a.name," +
|
|
|
- " b.serial," +
|
|
|
- " b.group_no," +
|
|
|
- " a.specification," +
|
|
|
- " a.drug_flag," +
|
|
|
- " a.visible_flag," +
|
|
|
- " a.manu_code," +
|
|
|
- " max_stock_amount," +
|
|
|
- " mini_stock_amount," +
|
|
|
- " a.pack_retprice ," +
|
|
|
- " b.location) as gg" +
|
|
|
- "</script>")
|
|
|
- int countYpBaseYfBound(@Param("searchText")String searchText, @Param("groupNo") String groupNo);
|
|
|
|
|
|
/**
|
|
|
* 查询药库药品上下限信息
|