Procházet zdrojové kódy

效期预警开发

WANGJIALIANG před 2 roky
rodič
revize
7e0c1a08b8

+ 26 - 0
src/main/java/cn/hnthyy/thmz/controller/yf/YfIncomingRecordsController.java

@@ -289,4 +289,30 @@ public class YfIncomingRecordsController {
             return resultMap;
         }
     }
+
+    /**
+     * 查询药品效期
+     *
+     * @param groupNo
+     * @param chargeCode
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getYpInDetlYfEffDate", method = {RequestMethod.GET})
+    public Map<String, Object> getYpInDetlYfEffDate(@RequestParam("groupNo") String groupNo, @RequestParam("chargeCode") String chargeCode) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            List<Map<String, Object>> ypInDetlYfs = ypInDetlYfService.queryYpInDetlYfEffDate(groupNo, chargeCode);
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询药品效期成功");
+            resultMap.put("data", ypInDetlYfs);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询药品效期失败,错误信息:【" + e.getMessage() + "】");
+            log.error("查询药品效期失败,错误信息:[]", e);
+            return resultMap;
+        }
+    }
 }

+ 41 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpInDetlYfMapper.java

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 药房药品入库持久化类
@@ -145,4 +146,44 @@ public interface YpInDetlYfMapper {
             "</when>" +
             "</script>")
     int countYpInDetlYf(YpInDetlYf ypInDetlYf);
+
+    /**
+     * 药品效期查询
+     * @param groupNo
+     * @param chargeCode
+     * @return
+     */
+    @Select("<script>" +
+            "SELECT\n" +
+            "  a.in_date,\n" +
+            "  a.charge_code,\n" +
+            "  a.serial,\n" +
+            "  a.current_stock,\n" +
+            "  a.manu_code,\n" +
+            "  a.in_docu_no,\n" +
+            "  a.eff_date,\n" +
+            "  a.license_no,\n" +
+            "  a.eff_del_flag,\n" +
+            "  drugname=b.name,\n" +
+            "  specification = b.specification,\n" +
+            "  manu_name = c.name,\n" +
+            "  xq=datediff(month,getdate(),a.eff_date),\n" +
+            "  b.py_code,\n" +
+            "  b.d_code\n" +
+            "FROM yp_in_detl_yf  a,yp_zd_dict b\n" +
+            "    left join yp_zd_manufactory c on b.manu_code=c.code,\n" +
+            "     (select charge_code,stock_amount=sum(stock_amount) from yp_base_yf where group_no = #{groupNo} group by charge_code) d\n" +
+            "     where a.charge_code=b.code and\n" +
+            "           a.serial=b.serial and\n" +
+            "          datediff(dd,getdate(),a.eff_date)<![CDATA[<=]]>90 and\n" +
+            "          a.group_no = #{groupNo} and\n" +
+            "          a.charge_code = #{chargeCode} and\n" +
+            "          a.charge_code = d.charge_code and\n" +
+            "          d.stock_amount <![CDATA[>]]> 0 and\n" +
+            "          isnull(a.eff_del_flag,'0')='0' and\n" +
+            "          isnull(b.visible_flag,'0')<![CDATA[<>]]>'1' and\n" +
+            "          isnull(b.del_flag,'0')<![CDATA[<>]]>'1'\n" +
+            "     order by xq,a.charge_code" +
+            "</script>")
+    List<Map<String, Object>> selectYpInDetlYfEffDate(@Param("groupNo") String groupNo, @Param("chargeCode") String chargeCode);
 }

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/his/yp/YpInDetlYfService.java

@@ -4,6 +4,7 @@ import cn.hnthyy.thmz.entity.his.yp.YpInDetlYf;
 import cn.hnthyy.thmz.entity.his.yp.YpInDetlYfCk;
 
 import java.util.List;
+import java.util.Map;
 
 public interface YpInDetlYfService {
 
@@ -26,4 +27,12 @@ public interface YpInDetlYfService {
      * @return
      */
     int countYpInDetlYf(YpInDetlYf ypInDetlYf);
+
+    /**
+     * 药品效期查询
+     * @param groupNo
+     * @param chargeCode
+     * @return
+     */
+    List<Map<String, Object>> queryYpInDetlYfEffDate(String groupNo, String chargeCode);
 }

+ 6 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/yp/YpInDetlYfServiceImpl.java

@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @description:
@@ -34,4 +35,9 @@ public class YpInDetlYfServiceImpl implements YpInDetlYfService {
     public int countYpInDetlYf(YpInDetlYf ypInDetlYf) {
         return ypInDetlYfMapper.countYpInDetlYf(ypInDetlYf);
     }
+
+    @Override
+    public List<Map<String, Object>> queryYpInDetlYfEffDate(String groupNo, String chargeCode) {
+        return ypInDetlYfMapper.selectYpInDetlYfEffDate(groupNo, chargeCode);
+    }
 }

+ 173 - 0
src/main/resources/static/js/yf/yf_inventory_list.js

@@ -19,9 +19,38 @@ $(function () {
     $('#searchText').on('input propertychange',function(e){
         initTable();
     });
+
+    //初始化药品查询弹出框
+    initSearchList('<div id="medicinePopoverContent"><table id="tb_table_medicine"></table></div>',
+        'searchTextEff', 600, 200);
+    $('#searchTextEff').on('input focus', function (e) {
+        showDrugPopover({
+            method: 'POST',
+            data: JSON.stringify({
+                searchText: $("#searchTextEff").val() == "" ? null : $("#searchTextEff").val(),
+                groupNo: $("#groupNoSearchText").val(),
+                delFlag: 0
+            }),
+            url: '/thmz/'+($("#groupNoSearchText").val()>=61?'getYpBaseYfLike':'getYpZdDictBase'),
+            columns: [
+                {
+                    field: 'stockAmount',
+                    title: '库存',
+                    align: "center",
+                    valign: 'middle'
+                }],
+            onClickRow: function (row, $element) {
+                $('#searchTextEff').webuiPopover('hide');
+            }
+        });
+    });
     $('#export_excel').on('click',function(e){
         exportExcel();
     });
+    $('#btn_eff_date').on('click',function(e){
+        $("#pharmacyModal").modal("show");
+        initEffDateTable()
+    });
 });
 
 
@@ -122,6 +151,150 @@ function getChildCom(node){
     });
 }
 
+/**
+ * 校期列表
+ */
+function initEffDateTable(chargeCode) {
+    $('#eff_table').bootstrapTable('destroy');
+    $('#eff_table').bootstrapTable({
+        url: '/thmz/getYpInDetlYfEffDate',         //请求后台的URL(*)
+        method: 'GET',                      //请求方式(*)
+        toolbar: '#toolbar',                //工具按钮用哪个容器
+        striped: true,                      //是否显示行间隔色
+        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
+        pagination: true,                   //是否显示分页(*)
+        sortable: true,                     //是否启用排序
+        sortOrder: "asc",                   //排序方式
+        queryParams: {
+            chargeCode: chargeCode,
+            groupNo: $("#groupNoSearchText").val()
+        },           //传递参数(*)
+        sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)
+        pageNumber: 1,                       //初始化加载第一页,默认第一页
+        pageSize: 15,                       //每页的记录行数(*)
+        pageList: [15, 20, 30, 50],        //可供选择的每页的行数(*)
+        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
+        strictSearch: true,
+        showColumns: false,                  //是否显示所有的列
+        showRefresh: false,                  //是否显示刷新按钮
+        minimumCountColumns: 2,             //最少允许的列数
+        clickToSelect: true,                //是否启用点击选中行
+        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列
+        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
+        cardView: false,                    //是否显示详细视图
+        detailView: false,
+        ajaxOptions: {
+            headers: {
+                'Accept': 'application/json',
+                'Authorization': 'Bearer ' + localStorage.getItem("token")
+            }
+        },
+        columns: [
+            {
+                field: 'checked',
+                checkbox: true,
+                align: "center",
+                valign: 'middle'
+            },{
+                field: 'location',
+                title: '校期',
+                align: "center",
+                width: 80,
+                valign: 'middle'
+            }, {
+                field: 'code',
+                title: '入库日期',
+                align: "center",
+                width: 50,
+                valign: 'middle'
+            }, {
+                field: 'code',
+                title: '药品编码',
+                align: "left",
+                width: 150,
+                valign: 'middle'
+            }, {
+                field: 'name',
+                title: '药品名',
+                align: "left",
+                width: 150,
+                valign: 'middle'
+            },
+            {
+                field: 'stockAmountMz',
+                title: '规格',
+                align: "center",
+                valign: 'middle',
+                width: 80,
+                visible: isMultiple==0?false:true,
+                formatter: function (value, row, index) {
+                    return Math.floor(value * 100) / 100;
+                },
+                cellStyle:function (value, row, index) {
+                    if(row.visibleFlagMz == 0){
+                        return {css:{background:'red'}};
+                    }
+                    return {css:{}};
+                }
+            },
+            {
+                field: 'stockAmountZy',
+                title: '有效期',
+                align: "center",
+                valign: 'middle',
+                width: 80,
+                visible: isMultiple==0?false:true,
+                formatter: function (value, row, index) {
+                    return Math.floor(value * 100) / 100;
+                },
+                cellStyle:function (value, row, index) {
+                    if(row.visibleFlagMz == 0){
+                        return {css:{background:'red'}};
+                    }
+                    return {css:{}};
+                }
+            },
+            {
+                field: 'stockAmountDz',
+                title: '生产厂商',
+                align: "center",
+                valign: 'middle',
+                width: 80,
+                visible: isMultiple==0?false:true,
+                formatter: function (value, row, index) {
+                    return Math.floor(value * 100) / 100;
+                }
+            }
+        ],
+        rowStyle: function (row, index) {
+            if (isMultiple == 0 && row.visibleFlagMz == 1 && row.visibleFlagZy == 1) {
+                return { css: { 'background-color': 'red' } };
+            }
+            return {css:{}}
+        },
+        responseHandler: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            var ress = eval(res);
+            if (ress.code == -1) {
+                errorMesage(res);
+                return {
+                    "total": 0,//总页数
+                    "rows": {}   //数据
+                };
+            }
+
+            return {
+                "total": ress.total,//总页数
+                "rows": ress.data   //数据
+            };
+        }
+    });
+}
+
+
 /**
  * 查询列表
  */

+ 33 - 2
src/main/resources/templates/yf/yf_inventory_list.html

@@ -47,7 +47,10 @@
                                 title="重置" onclick="resetSearch()"><i class="fa fa-rotate-left"></i>
                         </button>
                         <button type="button" id="btn_reset_virtual" class="btn btn-primary"
-                                title="平虚库存" onclick="resetVirtual()"><i class="fa fa-check-square-o"></i>
+                                title="平虚库存" onclick="resetVirtual()"><i class="fa fa-check-square-o">平虚库存</i>
+                        </button>
+                        <button type="button" id="btn_eff_date" class="btn btn-primary"
+                                title="效期预警"><i class="fa fa-check-square-o">效期预警</i>
                         </button>
                         <button type="button" id="export_excel" class="btn btn-primary"
                                 title="导出Excel"><i class="fa fa-file-excel-o"></i>
@@ -67,4 +70,32 @@
     </div>
 </div>
 
-
+<!--校期提示弹窗开始-->
+<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="editModal">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content" style="width: 1100px;margin-left: -20px;margin-top: 120px;">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
+                </button>
+                <h4 class="modal-title modal-title-thmz">药品请领【<span id="classTitle">新增</span>】</h4>
+            </div>
+            <div class="modal-body" style="background: #EBEBE4;">
+                <div class="col-md-12 col-sm-12 col-xs-12 ">
+                    <div class="col-md-3 col-sm-3 col-xs-12 ">
+                        <div class="input-group">
+                            <input type="text" id="searchTextEff" class="form-control" placeholder="药品名称" autocomplete="off">
+                            <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
+                        </div>
+                    </div>
+                </div>
+                <table id="eff_table" style="height: 300px;"></table>
+            </div>
+            <div class="modal-footer">
+                <input id="requestId" type="hidden"/>
+                <button type="button" class="btn btn-primary" id="btn_save">保存</button>
+                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
+<!--校期提示弹窗结尾-->