|
@@ -22,25 +22,81 @@ public interface YpZdDeptMapper {
|
|
|
int insertYpZdDept(YpZdDept ypZdDept);
|
|
|
|
|
|
/**
|
|
|
- * 查询科室所有药品停用信息
|
|
|
+ * 科室专用药品,其它科室全部停用
|
|
|
+ * @param ypZdDept
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Insert("insert into yp_zd_dept (dept_code,charge_code,use_flag)" +
|
|
|
+ " SELECT dept_code,#{chargeCode},'1' FROM zy_adtward where dept_code!=#{deptCode}")
|
|
|
+ int insertExclusiveYpZdDept(YpZdDept ypZdDept);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询科室药品停用信息
|
|
|
* @param deptCode
|
|
|
+ * @param groupNo
|
|
|
+ * @param searchText
|
|
|
+ * @param page
|
|
|
+ * @param rows
|
|
|
* @return
|
|
|
*/
|
|
|
- @Select("SELECT distinct use_flag=isnull(c.use_flag,'0')," +
|
|
|
+ @Select("<script>" +
|
|
|
+ " select top ${rows} *" +
|
|
|
+ " from (select ROW_NUMBER() over (order by isnull(c.use_flag,'0') desc) as RowNumber," +
|
|
|
+ " use_flag=isnull(c.use_flag,'0')," +
|
|
|
" a.code as charge_code," +
|
|
|
" a.name" +
|
|
|
" FROM yp_zd_dict a,yp_base_yf b,yp_zd_dept c" +
|
|
|
" where a.code=b.charge_code and" +
|
|
|
" a.code *=c.charge_code and" +
|
|
|
" b.group_no=#{groupNo} and" +
|
|
|
- " c.dept_code=#{deptCode} and (py_code like '%${searchText}%' or a.name like '%${searchText}%' or a.code like '%${searchText}%') order by use_flag desc ")
|
|
|
- List<YpZdDept> selectYpZdDept(@Param("deptCode") String deptCode,@Param("groupNo") Integer groupNo,@Param("searchText") String searchText);
|
|
|
+ " c.dept_code=#{deptCode} and (py_code like '%${searchText}%' or a.name like '%${searchText}%' or a.code like '%${searchText}%') " +
|
|
|
+ " group by a.code,name,use_flag)AS A WHERE RowNumber >${rows}*${page-1} order by RowNumber asc" +
|
|
|
+ "</script>")
|
|
|
+ List<YpZdDept> selectYpZdDeptPage(@Param("deptCode") String deptCode, @Param("groupNo") Integer groupNo, @Param("searchText") String searchText, @Param("page") Integer page, @Param("rows") Integer rows);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询药房所有药品总数
|
|
|
+ * @param groupNo
|
|
|
+ * @param searchText
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Select("select count(1) from (SELECT distinct" +
|
|
|
+ " a.code," +
|
|
|
+ " a.name" +
|
|
|
+ " FROM yp_zd_dict a,yp_base_yf b" +
|
|
|
+ " where a.code=b.charge_code and" +
|
|
|
+ " b.group_no=#{groupNo}" +
|
|
|
+ " and (py_code like '%${searchText}%' or a.name like '%${searchText}%' or a.code like '%${searchText}%')) count_tab")
|
|
|
+ int selectYpZdDeptCount(@Param("groupNo") Integer groupNo,@Param("searchText") String searchText);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询药品是否为科室专用
|
|
|
+ * @param deptCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Select("<script>" +
|
|
|
+ "select (case" +
|
|
|
+ " when sum(1)=(SELECT sum(1) as number FROM zy_adtward)-1" +
|
|
|
+ " then (select case when sum(1)<![CDATA[>]]>0 then 0 else 1 end from yp_zd_dept where charge_code=#{chargeCode} and dept_code=#{deptCode})" +
|
|
|
+ " else '0'" +
|
|
|
+ " end) as exclusive_use_flag" +
|
|
|
+ " from yp_zd_dept where charge_code = #{chargeCode}" +
|
|
|
+ "</script>")
|
|
|
+ int selectExclusiveYpZdDept(@Param("deptCode") String deptCode,@Param("chargeCode") String chargeCode);
|
|
|
|
|
|
/**
|
|
|
* 删除科室药品停用信息
|
|
|
* @param deptCode
|
|
|
* @return
|
|
|
*/
|
|
|
- @Delete("delete from yp_zd_dept where dept_code =#{deptCode} and charge_code =#{chargeCode} ")
|
|
|
+ @Delete("<script>" +
|
|
|
+ "delete from yp_zd_dept where 1=1 " +
|
|
|
+ "<when test='deptCode!=null'>"+
|
|
|
+ " and dept_code=#{deptCode,jdbcType=VARCHAR}"+
|
|
|
+ "</when>"+
|
|
|
+ "<when test='chargeCode!=null'>"+
|
|
|
+ " and charge_code=#{chargeCode,jdbcType=VARCHAR}"+
|
|
|
+ "</when>"+
|
|
|
+ "</script> ")
|
|
|
int deleteYpZdDept(@Param("deptCode") String deptCode, @Param("chargeCode") String chargeCode);
|
|
|
}
|