123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- package cn.hnthyy.thmz.mapper.his.yp;
- import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
- import org.apache.ibatis.annotations.Insert;
- import org.apache.ibatis.annotations.Param;
- import org.apache.ibatis.annotations.Select;
- import org.apache.ibatis.annotations.Update;
- import java.util.List;
- public interface YpZdDictMapper {
- /**
- * 根据药品编码和规格查询药品信息
- *
- * @param code
- * @return
- */
- @Select("select code, serial, name, class_code, dosage, concentration, weight, weigh_unit, volum, vol_unit, mini_unit," +
- " pack_size, pack_unit, ltrim(specification)specification, ltrim(specification2)specification2, pack_retprice, retprice, percent_group_mz, percent_group_zy," +
- " self_flag, separate_flag, suprice_flag, drug_flag, py_code, d_code as wb_code, infusion_flag, visible_flag, del_flag," +
- " country_flag, fix_price, new_flag, manu_code, yb_flag, sort_code, gmp_flag, cold_flag, chem_remark, drug_kind," +
- " zb_flag, zb_supplyer, n_code as yn_code, bill_item_mz, bill_item_zy, supply_type, rtrim(frequency)frequency, ps_flag, ex_code, kss_flag," +
- " zj_flag, spec_b, yb_code, yb_type, yb_code_zf, init_flag, yp_level, drug_id, serial_old, spec_pack, xnh_flag," +
- " buy_price, self_flag_yb, order_dosage, dosage_unit, yb_comment, isnull(rtrim(jb_flag),0) jb_flag, location, zs_flag, rtrim(audit_code)audit_code, comment," +
- " categories_flag, father_flag, ybxj_price, ym_flag, dpym_flag, yb_comment2, yb_code2, rtrim(kjyw_flag)kjyw_flag, ygyyjc_type," +
- " ddd_value, kj_limit_flag, yp_id, xtpp_name, sp_name, qj_flag, js_flag, rtrim(pzwh)pzwh, xnh_code, xnh_name, xnh_ratio," +
- " xnh_quotamoney, xnh_status, xnh_bl, city_bl, syb_bl, cl_flag, avg_price, yb_flag_city, yb_flag_xnh, yb_code_city," +
- " yb_code_xnh, yb_comment_city, yb_comment_xnh, ddd_unit, wg_type, fh_name, yb_flag_new, yb_comment_new, rtrim(yb_bl_new)yb_bl_new," +
- " wjw_ypid, yjj_ypid, rsb_ypid, mz_restrict, isnull(byj_flag,0) byj_flag, national_code, national_name, national_status, match_oper," +
- " match_date, cancel_match_oper, cancel_match_date, new_name, oper_id, oper_date, uploaded_flag, prescription_limit_days," +
- " isnull(fz_flag,0)fz_flag,isnull(is_central_purchase,0)is_central_purchase,purchase_code,drug_control_code,selfpay_prop" +
- " from yp_zd_dict WITH(NOLOCK) where code = #{code,jdbcType=VARCHAR} and serial = #{serial}")
- YpZdDict selectYpZdDictByCodeAndSerial(@Param("code") String code, @Param("serial") String serial);
- /**
- * 根据药品编码集合查询药品字典列表
- *
- * @param codes
- * @return
- */
- @Select({"<script>",
- "select code, serial, name, class_code, dosage, concentration, weight, weigh_unit, volum, vol_unit, mini_unit," +
- " pack_size, pack_unit, ltrim(specification)specification, ltrim(specification2)specification2, pack_retprice, retprice, percent_group_mz, percent_group_zy," +
- " self_flag, separate_flag, suprice_flag, drug_flag, py_code, d_code as wb_code, infusion_flag, visible_flag, del_flag," +
- " country_flag, fix_price, new_flag, manu_code, yb_flag, sort_code, gmp_flag, cold_flag, chem_remark, drug_kind," +
- " zb_flag, zb_supplyer, n_code as yn_code, bill_item_mz, bill_item_zy, supply_type, rtrim(frequency)frequency, ps_flag, ex_code, kss_flag," +
- " zj_flag, spec_b, yb_code, yb_type, yb_code_zf, init_flag, yp_level, drug_id, serial_old, spec_pack, xnh_flag," +
- " buy_price, self_flag_yb, order_dosage, dosage_unit, yb_comment, isnull(rtrim(jb_flag),0) jb_flag, location, zs_flag, rtrim(audit_code)audit_code, comment," +
- " categories_flag, father_flag, ybxj_price, ym_flag, dpym_flag, yb_comment2, yb_code2, rtrim(kjyw_flag)kjyw_flag, ygyyjc_type," +
- " ddd_value, kj_limit_flag, yp_id, xtpp_name, sp_name, qj_flag, js_flag, rtrim(pzwh)pzwh, xnh_code, xnh_name, xnh_ratio," +
- " xnh_quotamoney, xnh_status, xnh_bl, city_bl, syb_bl, cl_flag, avg_price, yb_flag_city, yb_flag_xnh, yb_code_city," +
- " yb_code_xnh, yb_comment_city, yb_comment_xnh, ddd_unit, wg_type, fh_name, yb_flag_new, yb_comment_new, rtrim(yb_bl_new)yb_bl_new," +
- " wjw_ypid, yjj_ypid, rsb_ypid, mz_restrict, isnull(byj_flag,0) byj_flag, national_code, national_name, national_status, match_oper," +
- " match_date, cancel_match_oper, cancel_match_date, new_name, oper_id, oper_date, uploaded_flag, prescription_limit_days," +
- " isnull(fz_flag,0)fz_flag,isnull(is_central_purchase,0)is_central_purchase,purchase_code,drug_control_code,selfpay_prop" +
- " from yp_zd_dict WITH(NOLOCK)",
- "<when test='codes!=null'>",
- " where code in",
- "<foreach item='item' index='index' collection='codes' open='(' separator=',' close=')'>",
- "#{item}",
- "</foreach>",
- "</when>",
- "</script>"})
- List<YpZdDict> selectYpZdDictByCodeList(@Param("codes") List<String> codes);
- /**
- * 根据药品编码查询药品信息
- *
- * @param code
- * @return
- */
- @Select("select code, serial, name, class_code, dosage, concentration, weight, weigh_unit, volum, vol_unit, mini_unit," +
- " pack_size, pack_unit, ltrim(specification)specification, ltrim(specification2)specification2, pack_retprice, retprice, percent_group_mz, percent_group_zy," +
- " self_flag, separate_flag, suprice_flag, drug_flag, py_code, d_code as wb_code, infusion_flag, visible_flag, del_flag," +
- " country_flag, fix_price, new_flag, manu_code, yb_flag, sort_code, gmp_flag, cold_flag, chem_remark, drug_kind," +
- " zb_flag, zb_supplyer, n_code as yn_code, bill_item_mz, bill_item_zy, supply_type, rtrim(frequency)frequency, ps_flag, ex_code, kss_flag," +
- " zj_flag, spec_b, yb_code, yb_type, yb_code_zf, init_flag, yp_level, drug_id, serial_old, spec_pack, xnh_flag," +
- " buy_price, self_flag_yb, order_dosage, dosage_unit, yb_comment, isnull(rtrim(jb_flag),0) jb_flag, location, zs_flag, rtrim(audit_code)audit_code, comment," +
- " categories_flag, father_flag, ybxj_price, ym_flag, dpym_flag, yb_comment2, yb_code2, rtrim(kjyw_flag)kjyw_flag, ygyyjc_type," +
- " ddd_value, kj_limit_flag, yp_id, xtpp_name, sp_name, qj_flag, js_flag, rtrim(pzwh)pzwh, xnh_code, xnh_name, xnh_ratio," +
- " xnh_quotamoney, xnh_status, xnh_bl, city_bl, syb_bl, cl_flag, avg_price, yb_flag_city, yb_flag_xnh, yb_code_city," +
- " yb_code_xnh, yb_comment_city, yb_comment_xnh, ddd_unit, wg_type, fh_name, yb_flag_new, yb_comment_new, rtrim(yb_bl_new)yb_bl_new," +
- " wjw_ypid, yjj_ypid, rsb_ypid, mz_restrict, isnull(byj_flag,0) byj_flag, national_code, national_name, national_status, match_oper," +
- " match_date, cancel_match_oper, cancel_match_date, new_name, oper_id, oper_date, uploaded_flag, prescription_limit_days," +
- " isnull(fz_flag,0)fz_flag,isnull(is_central_purchase,0)is_central_purchase,purchase_code,drug_control_code,selfpay_prop" +
- " from yp_zd_dict WITH(NOLOCK) where code = #{code,jdbcType=VARCHAR} ")
- List<YpZdDict> selectYpZdDictByCode(@Param("code") String code);
- /**
- * 模糊查询药品关联药库
- *
- * @param searchTextDrug
- * @return
- */
- @Select("SELECT distinct a.code," +
- " a.serial," +
- " a.name," +
- " a.pack_size," +
- " a.pack_retprice," +
- " ltrim(a.specification)specification," +
- " a.drug_flag ," +
- " a.fix_price," +
- " a.manu_code," +
- " a.del_flag," +
- " a.class_code," +
- " a.prescription_limit_days," +
- " a.mz_restrict" +
- " FROM yp_zd_dict a WITH(NOLOCK) ,yp_print_name b WITH(NOLOCK) , yp_base c WITH(NOLOCK) " +
- " where" +
- " (b.py_code like '%${searchTextDrug}%' or a.py_code like '%${searchTextDrug}%' or" +
- " b.d_code like '%${searchTextDrug}%' or a.d_code like '%${searchTextDrug}%' or" +
- " b.charge_code = #{searchTextDrug} or" +
- " b.print_name like '%${searchTextDrug}%' or a.name like '%${searchTextDrug}%') and" +
- " a.code=b.charge_code and" +
- " a.code=c.charge_code order by a.del_flag")
- List<YpZdDict> selectYpBySearchText(@Param("searchTextDrug") String searchTextDrug);
- /**
- * 模糊查询所有药品
- *
- * @param searchText
- * @return
- */
- @Select("select d.code, d.serial, d.name, d.class_code, d.dosage, d.concentration, d.weight, d.weigh_unit, d.volum, d.vol_unit, d.mini_unit," +
- " pack_size, d.pack_unit, ltrim(d.specification)specification, ltrim(d.specification2)specification2, d.pack_retprice, d.retprice, d.percent_group_mz, d.percent_group_zy," +
- " self_flag, d.separate_flag, d.suprice_flag, d.drug_flag, d.py_code, d.d_code as wb_code, d.infusion_flag, d.visible_flag, d.del_flag," +
- " country_flag, d.fix_price, d.new_flag, d.manu_code, d.yb_flag, d.sort_code, d.gmp_flag, d.cold_flag, d.chem_remark, d.drug_kind," +
- " zb_flag, d.zb_supplyer, d.n_code as yn_code, d.bill_item_mz, d.bill_item_zy, d.supply_type, rtrim(d.frequency)frequency, d.ps_flag, d.ex_code, d.kss_flag," +
- " zj_flag, d.spec_b, d.yb_code, d.yb_type, d.yb_code_zf, d.init_flag, d.yp_level, d.drug_id, d.serial_old, d.spec_pack, d.xnh_flag," +
- " buy_price, d.self_flag_yb, d.order_dosage, d.dosage_unit, d.yb_comment, isnull(rtrim(jb_flag),0) jb_flag, d.location, d.zs_flag, rtrim(d.audit_code)audit_code, d.comment," +
- " categories_flag, d.father_flag, d.ybxj_price, d.ym_flag, d.dpym_flag, d.yb_comment2, d.yb_code2, rtrim(d.kjyw_flag)kjyw_flag, d.ygyyjc_type," +
- " ddd_value, d.kj_limit_flag, d.yp_id, d.xtpp_name, d.sp_name, d.qj_flag, d.js_flag, rtrim(d.pzwh)pzwh, d.xnh_code, d.xnh_name, d.xnh_ratio," +
- " xnh_quotamoney, d.xnh_status, d.xnh_bl, d.city_bl, d.syb_bl, d.cl_flag, d.avg_price, d.yb_flag_city, d.yb_flag_xnh, d.yb_code_city," +
- " yb_code_xnh, d.yb_comment_city, d.yb_comment_xnh, d.ddd_unit, d.wg_type, d.fh_name, d.yb_flag_new, d.yb_comment_new, rtrim(d.yb_bl_new)yb_bl_new," +
- " wjw_ypid, d.yjj_ypid, d.rsb_ypid, d.mz_restrict, isnull(byj_flag,0) byj_flag, d.national_code, d.national_name, d.national_status, d.match_oper," +
- " match_date, d.cancel_match_oper, d.cancel_match_date, d.new_name, d.oper_id, d.oper_date, d.uploaded_flag, d.prescription_limit_days,d.antitumor_level," +
- " isnull(fz_flag,0)fz_flag,isnull(is_central_purchase,0)is_central_purchase,purchase_code,drug_control_code,selfpay_prop" +
- " from " +
- " (select a.code, max(a.serial)serial" +
- " FROM yp_zd_dict a WITH(NOLOCK) ,yp_print_name b WITH(NOLOCK) " +
- " where" +
- " (b.py_code like '%${searchText}%' or a.py_code like '%${searchText}%' or" +
- " b.d_code like '%${searchText}%' or a.d_code like '%${searchText}%' or" +
- " b.charge_code = #{searchText} or" +
- " b.print_name like '%${searchText}%' or a.name like '%${searchText}%') and" +
- " a.code=b.charge_code group by a.code)as cc,yp_zd_dict d where cc.code=d.code and cc.serial=d.serial order by d.del_flag")
- List<YpZdDict> selectYpZdDictByLike(@Param("searchText") String searchText);
- /**
- * 更新药品处方限制天数
- *
- * @param prescriptionLimitDays
- * @param code
- * @return
- */
- @Update("update yp_zd_dict set prescription_limit_days=#{prescriptionLimitDays} where code = #{code}")
- int updateYpZdDictPrescriptionLimitDays(@Param("prescriptionLimitDays") Integer prescriptionLimitDays, @Param("code") String code);
- /**
- * 更新药品门诊月限购量
- *
- * @param mzRestrict
- * @param code
- * @return
- */
- @Update("update yp_zd_dict set mz_restrict=#{mzRestrict} where code = #{code}")
- int updateYpZdDictMzRestrict(@Param("mzRestrict") Integer mzRestrict, @Param("code") String code);
- /**
- * 更新药品信息
- *
- * @return
- */
- @Update({"<script>",
- "update yp_zd_dict ",
- "<trim prefix='set' prefixOverrides=',' >",
- "<when test='packRetprice!=null'>",
- ",pack_retprice =#{packRetprice,jdbcType=DOUBLE}",
- "</when>",
- "<when test='retprice!=null'>",
- ",retprice =#{retprice,jdbcType=DOUBLE}",
- "</when>",
- "<when test='buyPrice!=null'>",
- ",buy_price =#{buyPrice,jdbcType=DOUBLE}",
- "</when>",
- "<when test='fixPrice!=null'>",
- ",fix_price =#{fixPrice,jdbcType=DOUBLE}",
- "</when>",
- "<when test='ybxjPrice!=null'>",
- ",ybxj_price =#{ybxjPrice,jdbcType=DOUBLE}",
- "</when>",
- "<when test='avgPrice!=null'>",
- ",avg_price =#{avgPrice,jdbcType=DOUBLE}",
- "</when>",
- "<when test='manuCode!=null'>",
- ",manu_code =#{manuCode}",
- "</when>",
- "</trim>" +
- "<where>" +
- " <if test=\"code != null and code != ''\">" +
- " AND code = #{code}" +
- " </if>" +
- " <if test=\"serial != null and serial != ''\">" +
- " AND serial = #{serial}" +
- " </if>" +
- "</where>",
- "</script>"})
- int updateYpZdDict(YpZdDict ypZdDict);
- /**
- * 更新药品信息
- *
- * @return
- */
- @Update({"<script>",
- "update yp_zd_dict set ${sql} where code = #{code} AND serial = #{serial}",
- "</script>"})
- int updateYpZdDictSql(@Param("sql") String sql, @Param("code") String code, @Param("serial") String serial);
- /**
- * 大包装同步小包装数据
- *
- * @return
- */
- @Update({"<script>",
- "update yp_zd_dict set" +
- " yp_zd_dict.name =b.name , py_code =b.py_code , d_code =b.d_code , specification =b.specification2 , specification2 =b.specification2 ," +
- " class_code =b.class_code , dosage =b.dosage , concentration =b.concentration , weight =b.weight , weigh_unit =b.weigh_unit ," +
- " volum =b.volum , vol_unit =b.vol_unit , mini_unit =b.mini_unit , pack_unit =b.mini_unit , self_flag =b.self_flag ," +
- " separate_flag =b.separate_flag , suprice_flag =b.suprice_flag , drug_flag =b.drug_flag , infusion_flag =b.infusion_flag ," +
- " country_flag =b.country_flag , manu_code =b.manu_code , drug_kind =b.drug_kind , gmp_flag =b.gmp_flag , cold_flag =b.cold_flag ," +
- " chem_remark =b.chem_remark , bill_item_mz =b.bill_item_mz , bill_item_zy =b.bill_item_zy , percent_group_mz =b.percent_group_mz ," +
- " percent_group_zy =b.percent_group_zy , del_flag =b.del_flag , yb_flag =b.yb_flag , self_flag_yb =b.self_flag_yb , n_code =b.n_code , zb_flag =b.zb_flag ," +
- " zb_supplyer =b.zb_supplyer , ps_flag =b.ps_flag , ex_code =b.ex_code , supply_type =b.supply_type , frequency =rtrim(b.frequency) ," +
- " kss_flag =b.kss_flag , yp_level =b.yp_level , drug_id =b.drug_id , yb_code =b.yb_code, yb_comment =b.yb_comment , xnh_flag =b.xnh_flag , jb_flag =b.jb_flag ," +
- " audit_code =b.audit_code , comment =b.comment , categories_flag =b.categories_flag , ym_flag =b.ym_flag , dpym_flag =b.dpym_flag ," +
- " father_flag =b.father_flag , yb_code2 =b.yb_code2 , yb_comment2 =b.yb_comment2 , kjyw_flag =rtrim(b.kjyw_flag) , ygyyjc_type =b.ygyyjc_type ," +
- " ddd_value =b.ddd_value , yp_id =b.yp_id , xtpp_name =b.xtpp_name , sp_name =b.sp_name , yb_comment_new =b.yb_comment_new ," +
- " yb_bl_new =b.yb_bl_new , yb_flag_new =b.yb_flag_new , byj_flag =b.byj_flag,drug_control_code =b.drug_control_code,antitumor_level=b.antitumor_level" +
- " from ( select *from yp_zd_dict ) as b" +
- " where yp_zd_dict.code =#{code} and yp_zd_dict.serial !=#{serial} and yp_zd_dict.code =b.code and b.serial =#{serial}",
- "</script>"})
- int updateYpZdDictSync(@Param("code") String code, @Param("serial") String serial);
- /**
- * 获取范围内最大code
- *
- * @return
- */
- @Select("select max ( code ) from yp_zd_dict WITH(NOLOCK) where code >= #{minNum} and code <= #{maxNum}")
- String selectMaxCode(@Param("minNum") String minNum, @Param("maxNum") String maxNum);
- /**
- * 新增药品
- *
- * @return
- */
- @Insert("INSERT INTO yp_zd_dict ${sql}")
- int insertYpZdDictSql(@Param("sql") String sql);
- /**
- * 查询入库药品名称
- *
- * @return
- */
- @Select("select name,code from yp_zd_dict where code = #{code} group by name,code ")
- YpZdDict selectNameByCode(@Param("code") String code);
- /**
- * 根据输入参数模糊查询药品列表
- *
- * @param code
- * @return
- */
- @Select({"<script>",
- "select rtrim(code) code,rtrim(name) name from yp_zd_dict WITH(NOLOCK) ",
- "<when test='code!=null'>",
- " where (code like #{code} or name like #{code} or py_code like #{code} or d_code like #{code})",
- "</when>",
- " GROUP BY code,name </script>"})
- List<YpZdDict> selectYpZdDictList(@Param("code") String code);
- /**
- * @Description 药品编码与医嘱编码冲突重置编码
- * @Author hsh
- * @param code 新增预置药品编码
- * @return int
- * @Date 2024/1/29 15:15
- */
- @Select(" select count(1) from yz_zd_order_item_confirm where yz_zd_order_item_confirm.order_code = #{code} ")
- int selectYzOrderItemByCode(String code);
- }
|