Browse Source

优化药品盘点筛选

hsh 5 months ago
parent
commit
9b36ad12ba

+ 2 - 2
src/main/java/cn/hnthyy/thmz/controller/yf/YfInventoryController.java

@@ -44,7 +44,7 @@ public class YfInventoryController {
     @UserLoginToken
     @RequestMapping(value = "/getYpInventoryData",method = {RequestMethod.GET})
     public Map<String,Object> getYpInventoryData(@RequestParam("groupNo") String groupNo,@RequestParam(value = "infusionFlag",required = false) String infusionFlag
-            ,@RequestParam(value = "visibleFlag",required = false) String visibleFlag){
+            ,@RequestParam(value = "visibleFlag",required = false) String visibleFlag,@RequestParam("drugText") String drugText){
         Map<String, Object> resultMap = new HashMap<>();
         try {
             if(StringUtils.isBlank(groupNo)){
@@ -52,7 +52,7 @@ public class YfInventoryController {
                 resultMap.put("message", "生成失败,药房编码为空");
                 return resultMap;
             }
-            List<YpBaseYfVo> list = yfInventoryService.queryYpInventoryData(groupNo, infusionFlag, visibleFlag);
+            List<YpBaseYfVo> list = yfInventoryService.queryYpInventoryData(groupNo, infusionFlag, visibleFlag, drugText);
             resultMap.put("code", 0);
             resultMap.put("message", "生成药品盘点成功");
             resultMap.put("data", list);

+ 3 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpBaseYfMapper.java

@@ -249,12 +249,13 @@ public interface YpBaseYfMapper {
             " where a.code=b.charge_code and" +
             "    a.serial=b.serial and" +
             "    a.code  =c.charge_code and" +
-            "    b.group_no=#{groupNo} and" +
+            "    b.group_no=#{groupNo} and " +
+            "    (a.code like '${drugText}%' or a.name like '${drugText}%' or a.py_code like '${drugText}%' or a.d_code like '${drugText}%' ) and " +
             "    isnull(a.infusion_flag,'0') like '${infusionFlag}%'" +
             "    and ((isnull(a.del_flag,'0') <>'1' and (isnull(visible_flag_zy,'0')<>'1' or" +
             "    isnull(visible_flag_mz,'0')<>'1')) or ( b.stock_amount <> 0))" +
             "   order by location")
-    List<YpBaseYfVo> selectYpInventoryData(@Param("groupNo") String groupNo, @Param("infusionFlag") String infusionFlag, @Param("visibleFlag") String visibleFlag);
+    List<YpBaseYfVo> selectYpInventoryData(@Param("groupNo") String groupNo, @Param("infusionFlag") String infusionFlag, @Param("visibleFlag") String visibleFlag, @Param("drugText") String drugText);
 
     /**
      * 查询药房药品库存合计(大规格)

+ 2 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpOutDetlYfMapper.java

@@ -76,9 +76,10 @@ public interface YpOutDetlYfMapper {
             "    a.charge_code = c.charge_code and" +
             "    a.serial= c.serial and" +
             "    a.group_no = c.group_no and" +
+            "    (b.code like '${drugText}%' or b.name like '${drugText}%' or b.py_code like '${drugText}%' or b.d_code like '${drugText}%' ) and " +
             "    out_type>=6 and" +
             "    out_type<=8 order by c.location" )
-    List<YpBaseYfVo> selectYpInventoryData(@Param("drawNo") String drawNo);
+    List<YpBaseYfVo> selectYpInventoryData(@Param("drawNo") String drawNo, @Param("drugText") String drugText);
 
     /**
      * 删除出库记录

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/his/yf/YfInventoryService.java

@@ -21,7 +21,7 @@ public interface YfInventoryService {
      * @param visibleFlag
      * @return
      */
-    List<YpBaseYfVo> queryYpInventoryData(String groupNo, String infusionFlag, String visibleFlag);
+    List<YpBaseYfVo> queryYpInventoryData(String groupNo, String infusionFlag, String visibleFlag, String drugText);
 
     /**
      * 保存盘点药品数据

+ 5 - 3
src/main/java/cn/hnthyy/thmz/service/impl/his/yf/YfInventoryServiceImpl.java

@@ -8,6 +8,7 @@ import cn.hnthyy.thmz.mapper.his.yp.YpConfigMapper;
 import cn.hnthyy.thmz.mapper.his.yp.YpOutDetlYfMapper;
 import cn.hnthyy.thmz.service.his.yf.YfInventoryService;
 import cn.hnthyy.thmz.vo.YpBaseYfVo;
+import cn.hutool.core.convert.Convert;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -39,13 +40,14 @@ public class YfInventoryServiceImpl implements YfInventoryService {
     private YpConfigMapper ypConfigMapper;
 
     @Override
-    public List<YpBaseYfVo> queryYpInventoryData(String groupNo,String infusionFlag,String visibleFlag) {
+    public List<YpBaseYfVo> queryYpInventoryData(String groupNo,String infusionFlag,String visibleFlag,String drugText) {
         List<YpBaseYfVo> ypBaseYfVos;
         String drawNo = ypOutDetlYfMapper.selectInventoryDrawNo(groupNo);
+        drugText = Convert.toStr(drugText, "").toUpperCase();
         if(StringUtils.isNotBlank(drawNo)){//当月已含有未审核盘点记录,查出修改
-            ypBaseYfVos = ypOutDetlYfMapper.selectYpInventoryData(drawNo);
+            ypBaseYfVos = ypOutDetlYfMapper.selectYpInventoryData(drawNo, drugText);
         }else{
-            ypBaseYfVos = ypBaseYfMapper.selectYpInventoryData(groupNo, infusionFlag, visibleFlag);
+            ypBaseYfVos = ypBaseYfMapper.selectYpInventoryData(groupNo, infusionFlag, visibleFlag, drugText);
         }
         return ypBaseYfVos;
     }

+ 6 - 2
src/main/resources/static/js/yf/yf_inventory.js

@@ -27,6 +27,10 @@ $(function () {
     $("#btn_audit").on('click',function(e){
         audit();
     });
+    // 查询药品
+    $("#btn_query_cx").on('click',function(e){
+        loadTbTable();
+    });
     $("#btn_save").on('click',function(e){
         saveTbTable();
     });
@@ -127,7 +131,7 @@ function loadTbTable() {
     $("#btn_create").attr("disabled",true);
     $("#tb_add").jqGrid('setGridParam', {
         datatype:'json',
-        postData: { groupNo: pharmacyGroupNo,infusionFlag:$('#infusionFlag').val(),visibleFlag:$('#visibleFlag').val() }
+        postData: { groupNo: pharmacyGroupNo,infusionFlag:$('#infusionFlag').val(),visibleFlag:$('#visibleFlag').val(),drugText:$('#drugText').val() }
     }).trigger('reloadGrid');
 }
 /**
@@ -265,7 +269,7 @@ function initTbAdd() {
                 return;
             }
             if (res.code == 0) {
-                if(res.data[0].drawNo!=null){
+                if(res.data[0]!=null && res.data[0].drawNo!=null){
                     $("#tipsModal").modal('show');
                 }
             }else if (res.code == -1){

+ 10 - 5
src/main/resources/templates/yf/yf_inventory.html

@@ -24,7 +24,7 @@
         <div class="x_panel" style="background: #EBEBE4;">
             <div class="panel-body">
                 <form id="formSearch" class="form-horizontal" autocomplete="off" onsubmit="return false;">
-                    <div class="btn-group col-md-4 col-sm-4 col-xs-12" id="send_refund_group">
+                    <div class="btn-group col-md-2 col-sm-2 col-xs-12" id="send_refund_group">
                         <button class="btn btn-sm btn-primary" type="button" onclick="inventoryButtonChange(this,0)">
                             &nbsp;&nbsp;盘点表录入&nbsp;&nbsp;
                         </button>
@@ -43,10 +43,7 @@
                                 <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
                                 <span>December 30, 2014 - January 28, 2015</span> <b class="caret"></b>
                             </div>
-                        </div>
-                        <button type="button" style="margin-left:3px" id="btn_query" class="btn btn-primary"
-                                title="查询"><i class="fa fa-search"></i>
-                        </button>-->
+                        </div>-->
                         <button type="button" id="btn_record" class="btn btn-primary"
                                 title="盘点记录">盘点记录</i>
                         </button>
@@ -61,6 +58,11 @@
                         </a>
                     </div>
                     <div class="form-group" ID="addDiv">
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="drugText">药品
+                        </label>
+                        <div class="col-md-2 col-sm-2 col-xs-12">
+                            <input id="drugText" class="form-control optional" type="text">
+                        </div>
                         <label class="control-label col-md-1 col-sm-1 col-xs-12" for="infusionFlag">药品类型
                         </label>
                         <div class="col-md-1 col-sm-1 col-xs-12">
@@ -80,6 +82,9 @@
                                 <option value="">全部</option>
                             </select>
                         </div>
+                        <button type="button" style="margin-left:3px" id="btn_query_cx" class="btn btn-primary"
+                                title="查询"><i class="fa fa-search">查询</i>
+                        </button>
                         <button type="button" style="margin-left:3px" id="btn_create" class="btn btn-primary"
                                 title="自动生成">自动生成
                         </button>