Browse Source

药房退库问题处理 药品筛选添加查询条件

WANGJIALIANG 2 years ago
parent
commit
0ae62264cd

+ 32 - 1
src/main/java/cn/hnthyy/thmz/controller/yk/YpOutDetlController.java

@@ -173,6 +173,37 @@ public class YpOutDetlController {
         }
     }
 
+    /**
+     * 查询退库药品详细(药房退库到药库)
+     *
+     * @param drawNo 退库单号
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getDrugTkRecord", method = {RequestMethod.GET})
+    public Map<String, Object> getDrugTkRecord(@RequestParam("drawNo") String drawNo) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (StringUtils.isBlank(drawNo)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询退库单药品失败,退库单号为空");
+                return resultMap;
+            }
+            YpOutDetl ypOutDetl = new YpOutDetl();
+            ypOutDetl.setDrawNo(drawNo);
+            List<YpOutDetlVo> ypOutDetlVos = ypOutDetlService.queryDrugTkRecord(ypOutDetl);
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询退库单药品成功");
+            resultMap.put("data", ypOutDetlVos);
+            return resultMap;
+        } catch (Exception e) {
+            log.error(e.toString());
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询退库单药品失败");
+            return resultMap;
+        }
+    }
+
     /**
      * 保存出库记录
      *
@@ -206,7 +237,7 @@ public class YpOutDetlController {
     /**
      * 审核出库
      *
-     * @param drawYf
+     * @param drawNo
      * @return
      */
     @UserLoginToken

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

@@ -82,7 +82,8 @@ public interface YpBaseMapper {
             "  b.d_code  like '%${searchText}%'  or c.d_code  like '%${searchText}%' or" +
             "  b.charge_code = #{searchText} or c.charge_code = #{searchText} or" +
             "  b.print_name like '%${searchText}%' or c.drugname like '%${searchText}%') and" +
-            "  c.group_no=#{ypBase.groupNo} " +
+            "  c.group_no=#{ypBase.groupNo} and" +
+            "  c.drug_id is not null" +
             "  <when test='ypBase.delFlag!=null'>" +
             "   and isnull(c.drug_flag,0)=#{ypBase.delFlag}" +
             "  </when>" +

+ 40 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpOutDetlMapper.java

@@ -39,6 +39,9 @@ public interface YpOutDetlMapper {
             "<when test='groupNoOut != null'>" +
             " and a.group_no_out= #{groupNoOut}" +
             "</when>" +
+            "<when test='groupNo != null'>" +
+            " and a.group_no= #{groupNo}" +
+            "</when>" +
             "<when test='drawNo != null'>" +
             " and a.draw_no= #{drawNo}" +
             "</when>" +
@@ -159,6 +162,43 @@ public interface YpOutDetlMapper {
             "</script>")
     List<YpOutDetlVo> selectYpOutDetlGroup(YpOutDetl ypOutDetl);
 
+    /**
+     * 查询药房退库单详细
+     * @param ypOutDetl
+     * @return
+     */
+    @Select("<script>" +
+            "select dept_code,input_id,confirm_flag,confirm_id,confirm_date,out_date,draw_no,draw_yf,in_draw_no,\n" +
+            "  drawer,serial,out_amt,pack_retprice,fix_price,acct_sign,buy_price,charge_code,group_no_out,\n" +
+            "  group_no,accept_sign,keeper" +
+            " from yp_out_detl WITH(NOLOCK)" +
+            "<where>" +
+            "   <if test=\"drawNo != null and drawNo != ''\">" +
+            "        AND draw_no = #{drawNo}" +
+            "   </if>" +
+            "   <if test=\"drawYf != null and drawYf != ''\">" +
+            "        AND draw_yf = #{drawYf}" +
+            "   </if>" +
+            "   <if test=\"outSeri != null and outSeri != ''\">" +
+            "        AND out_seri = #{outSeri}" +
+            "   </if>" +
+            "</where>" +
+            " group by dept_code,input_id,confirm_flag,confirm_id,confirm_date,out_date,draw_no,draw_yf," +
+            "   drawer,serial,pack_retprice,fix_price,acct_sign,buy_price,charge_code,group_no_out,group_no,accept_sign,keeper,in_draw_no,out_amt"+
+            "</script>")
+    List<YpOutDetlVo> selectDrugTkRecord(YpOutDetl ypOutDetl);
+
+    /**
+     * 查询药房请领单药库最终出库数量
+     * @param inDrawNo
+     * @param chargeCode
+     * @return
+     */
+    @Select("<script>" +
+            "select isnull(sum(out_amt),0) from yp_out_detl WHERE in_draw_no = #{inDrawNo} and charge_code=#{chargeCode}"+
+            "</script>")
+    Double selectSumOutAmt(@Param("inDrawNo") String inDrawNo,@Param("chargeCode") String chargeCode);
+
     /**
      * 更新药房入库状态
      * @param drawNo

+ 7 - 0
src/main/java/cn/hnthyy/thmz/service/his/yp/YpOutDetlService.java

@@ -37,6 +37,13 @@ public interface YpOutDetlService {
      */
     List<YpOutDetlVo> queryYpOutDetlGroup(YpOutDetl ypOutDetl);
 
+    /**
+     * 查询药房退库单详细
+     * @param ypOutDetl
+     * @return
+     */
+    List<YpOutDetlVo> queryDrugTkRecord(YpOutDetl ypOutDetl);
+
     /**
      * 保存药品出库信息
      * @param map

+ 34 - 4
src/main/java/cn/hnthyy/thmz/service/impl/his/yp/YpOutDetlServiceImpl.java

@@ -50,6 +50,9 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
     private YpBaseMapper ypBaseMapper;
     @SuppressWarnings("all")
     @Autowired
+    private YpBaseYfMapper ypBaseYfMapper;
+    @SuppressWarnings("all")
+    @Autowired
     private YpZdDictMapper ypZdDictMapper;
     @SuppressWarnings("all")
     @Autowired
@@ -66,6 +69,9 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
     @SuppressWarnings("all")
     @Autowired
     private YpZdDrugKindMapper ypZdDrugKindMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private YpZdManufactoryMapper ypZdManufactoryMapper;
 
     @Override
     public List<YpOutDetl> queryYpOutDetlPage(YpOutDetl ypOutDetl) {
@@ -86,6 +92,29 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
         return ypOutDetlMapper.selectYpOutDetlGroup(ypOutDetl);
     }
 
+    @Override
+    public List<YpOutDetlVo> queryDrugTkRecord(YpOutDetl ypOutDetl) {
+        List<YpOutDetlVo> ypOutDetlVos = ypOutDetlMapper.selectDrugTkRecord(ypOutDetl);
+        for (int i = 0; i < ypOutDetlVos.size(); i++) {
+            YpOutDetlVo ypOutDetlVo = ypOutDetlVos.get(i);
+            YpZdDict ypZdDict = ypZdDictMapper.selectYpZdDictByCodeAndSerial(ypOutDetlVo.getChargeCode(), ypOutDetlVo.getSerial());
+            ypOutDetlVo.setName(ypZdDict.getName());
+            ypOutDetlVo.setPackRetprice(ypZdDict.getPackRetprice());
+            ypOutDetlVo.setBuyPrice(ypZdDict.getBuyPrice());
+            ypOutDetlVo.setSpecification(ypZdDict.getSpecification());
+            ypOutDetlVo.setJbFlag(ypZdDict.getJbFlag());
+            ypOutDetlVo.setManufactoryName(ypZdManufactoryMapper.selectYpZdManufactoryByCode(ypZdDict.getManuCode()));
+            //查询出库记录,给出库总数量赋值
+            ypOutDetlVo.setNewOutAmt(ypOutDetlVo.getOutAmt());
+            Double sumOutAmt = ypOutDetlMapper.selectSumOutAmt(ypOutDetlVo.getInDrawNo(), ypOutDetlVo.getChargeCode());
+            ypOutDetlVo.setOutAmt(sumOutAmt);
+            ypOutDetlVo.setGroupNoOutName(ypZdGroupNameMapper.selectByGroupNo(ypOutDetlVo.getGroupNoOut()).getGroupName());
+            YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf(ypOutDetlVo.getChargeCode(), ypOutDetlVo.getSerial(), ypOutDetlVo.getGroupNoOut(), null);
+            ypOutDetlVo.setStockAmount(ypBaseYf.getStockAmount());
+        }
+        return ypOutDetlVos;
+    }
+
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     @Override
     public int saveYpOutDetlList(Map<String, Object> map, String userId) throws MzException {
@@ -197,13 +226,14 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
         Date date = new Date();
         for (int i = 0; i < list.size(); i++) {
             Map map = list.get(i);
+            Double newOutAmt = Double.parseDouble(map.get("newOutAmt").toString());
             YpOutDetl ypOutDetl = new YpOutDetl();
             ypOutDetl.setDrawNo(map.get("drawNo").toString());
             ypOutDetl.setOutSeri(Integer.parseInt(map.get("outSeri").toString()));
             YpOutDetlVo ypOutDetlVo = ypOutDetlMapper.selectYpOutDetlDetail(ypOutDetl).get(0);
-            ypOutDetl.setAmountTh(-Double.parseDouble(map.get("newOutAmt").toString()));
+            ypOutDetl.setAmountTh(-newOutAmt);
             YpInDetl ypInDetl = new YpInDetl();
-            ypInDetl.setCurrentStock(Double.parseDouble(map.get("newOutAmt").toString()));
+            ypInDetl.setCurrentStock(newOutAmt);
             ypInDetl.setInSeri(Integer.parseInt(map.get("inSeri").toString()));
             ypInDetl.setInDocuNo(map.get("inDrawNo").toString());
             if(ypOutDetlMapper.updateYpOutDetl(ypOutDetl) != 1){
@@ -229,11 +259,11 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
             insertYpOutDetl.setConfirmFlag("1");
             insertYpOutDetl.setConfirmDate(date);
             insertYpOutDetl.setConfirmId(userId);
-            insertYpOutDetl.setOutAmt(-Double.parseDouble(map.get("newOutAmt").toString()));
+            insertYpOutDetl.setOutAmt(-newOutAmt);
             if(ypOutDetlMapper.insertYpOutDetl(insertYpOutDetl) == 0){
                 throw new MzException("新增出库记录异常!");
             }
-            if(ypBaseMapper.updateYpBaseStock(ypOutDetl.getAmountTh(),ypOutDetl.getAmountTh()*Double.parseDouble(map.get("newOutAmt").toString()),
+            if(ypBaseMapper.updateYpBaseStock(newOutAmt,newOutAmt*Double.parseDouble(map.get("packRetprice").toString()),
                     insertYpOutDetl.getChargeCode(),insertYpOutDetl.getSerial(),insertYpOutDetl.getGroupNo()) != 1){
                 throw new MzException("更新库存异常!");
             }

+ 3 - 0
src/main/resources/static/js/common/pharmacy-com.js

@@ -808,6 +808,9 @@ function getGroupName(groupNo) {
         case '71':
             groupName='门诊西药房';
             break;
+        case '81':
+            groupName='门诊中药房';
+            break;
         case '73':
             groupName='住院药房';
             break;

+ 0 - 424
src/main/resources/static/js/yk/drug_info.js

@@ -56,9 +56,6 @@ $(function () {
         $("#tkForm")[0].reset();
         initRecordTable();
     });
-    $("#btn_daily").click(function (t) {
-        initPrintHtml();
-    });
 
     //初始化药品查询弹出框
     initSearchList('<div id="medicinePopoverContent"><table id="tb_table_medicine"></table></div>',
@@ -210,50 +207,6 @@ function setSelectValue(ids, data) {
     }
 }
 
-/**
- * 保存数据
- */
-function saveDrugApply(data) {
-
-    $.ajax({
-        type: "POST",
-        url: '/thmz/saveDrugReturn',
-        contentType: "application/json;charset=UTF-8",
-        dataType: "json",
-        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
-        data: JSON.stringify(data),
-        success: function (res) {
-            if (res == '401' || res == 401) {
-                window.location.href = '/thmz/login/view'
-                return;
-            }
-            if (res.code == 0) {
-                successMesage(res);
-                getDetail(res.data);
-            } else {
-                errorMesage(res);
-            }
-        }
-    });
-}/*
-/!**
- * 保存数据
- *!/
-function saveDrugApply(data) {
-    request({
-        type: "POST",
-        url: '/thmz/saveDrugReturn',
-        data: JSON.stringify(data)
-    }).then((res) => {
-        successMesage(res);
-        if (!confirm("是否需要打印退库单?")) {
-            $('#tb_table').bootstrapTable('removeAll');
-            return;
-        }
-        initPrintHtml();
-        $('#tb_table').bootstrapTable('removeAll');
-    });
-}*/
 
 /**
  * 重置查询表单
@@ -265,154 +218,6 @@ function resetSearch() {
     $("#drawNoSearch").val(null);
 }
 
-/**
- * 待确认退药表
- */
-var $table;
-
-function initTbTable() {
-    $('#tb_table').bootstrapTable("destroy");
-    $table = $('#tb_table').bootstrapTable({
-        toolbar: '#tb_table_toolbar',
-        striped: true,                      //是否显示行间隔色
-        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
-        pagination: false,                   //是否显示分页(*)
-        strictSearch: true,
-        showColumns: false,                  //是否显示所有的列
-        showRefresh: false,                  //是否显示刷新按钮
-        minimumCountColumns: 2,             //最少允许的列数
-        clickToSelect: true,                //是否启用点击选中行
-        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列
-        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
-        cardView: false,                    //是否显示详细视图
-        detailView: false,
-        //rowStyle:rowStyle,//通过自定义函数设置行样式
-        ajaxOptions: {
-            headers: {
-                'Accept': 'application/json',
-                'Authorization': 'Bearer ' + localStorage.getItem("token")
-            }
-        },
-        columns: [
-            {
-                field: 'checked',
-                checkbox: true,
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'no',
-                title: '序号',
-                align: "center",
-                valign: 'middle',
-                width: 40,
-                formatter: function (value, row, index) {
-                    return index + 1;
-                }
-            }, {
-                field: 'outDate',
-                title: '出库日期',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return format(value, "yyyy-MM-dd");
-                }
-            }, {
-                field: 'code',
-                title: '编码',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return value == null ? row.chargeCode : value;
-                }
-            }, {
-                field: 'name',
-                title: '药品名',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'specification',
-                title: '规格',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'groupNoOutName',
-                title: '接收药房',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'outAmt',
-                title: '累计出库量',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return value < 0 ? '-' : value;
-                }
-            },
-            {
-                field: 'newOutAmt',
-                title: '退库量',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'drawNo',
-                title: '出库单号',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'inDrawNo',
-                title: '请领单号',
-                align: "center",
-                valign: 'middle'
-            }
-        ],
-        /**
-         * @param {点击列的 field 名称} field
-         * @param {点击列的 value 值} value
-         * @param {点击列的整行数据} row
-         * @param {td 元素} $element
-         */
-        onClickCell: function (field, value, row, $element) {
-            if (field == 'newOutAmt') {
-                $element.attr('contenteditable', true);
-                $element.html(null);
-                $element.focus();
-                $element.blur(function () {
-                    let index = $element.parent().data('index');
-                    var tdValue = $element.html();
-                    tdValue = tdValue.replaceAll("&nbsp;", "");
-                    tdValue = tdValue.replaceAll("<br>", "");
-                    saveData(index, field, tdValue, 'tb_table');
-                });
-            }
-        },
-        responseHandler: function (res) {
-            if (res == '401' || res == 401) {
-                window.location.href = '/thmz/login/view'
-                return;
-            }
-            var ress = eval(res);
-            if (ress.code == -1) {
-                if (ress.message != null && ress.message != '') {
-                    errorMesage(res);
-                }
-                return {
-                    "total": 0,//总页数
-                    "rows": {}   //数据
-                };
-            }
-            return {
-                "total": ress.data.length,//总页数
-                "rows": ress.data   //数据
-            };
-        },
-    });
-}
-
 /**
  * 初始化别名列表
  */
@@ -560,235 +365,6 @@ function initTable() {
     });
 }
 
-/**
- * 添加行数据
- * @param field
- * @param values
- */
-function addData(outDate, chargeCode, name, specification, groupNoOutName, outAmt, effDate, drawNo, inDrawNo, outSeri, inSeri) {
-    var tableData = $table.bootstrapTable('getData');
-    for (let i = 0; i < tableData.length; i++) {
-        let data = tableData[i];
-        if (drawNo === data.drawNo && outSeri === data.outSeri) {
-            warningMesageSimaple("请勿重复添加");
-            return;
-        }
-    }
-    let row = {
-        id: new Date().getTime() + "",
-        outDate: outDate,
-        chargeCode: chargeCode,
-        name: name,
-        specification: specification,
-        groupNoOutName: groupNoOutName,
-        outAmt: outAmt,
-        effDate: effDate,
-        drawNo: drawNo,
-        outSeri: outSeri,
-        inSeri: inSeri,
-        inDrawNo: inDrawNo
-    };
-    $table.bootstrapTable('prepend', row);
-}
-
-/**
- * 查询列表
- */
-function initRecordTable() {
-    $('#tk_record').bootstrapTable('destroy');
-    $('#tk_record').bootstrapTable({
-        url: '/thmz/getYpOutDetlYk',         //请求后台的URL(*)
-        method: 'POST',                      //请求方式(*)
-        toolbar: '#toolbar',                //工具按钮用哪个容器
-        striped: true,                      //是否显示行间隔色
-        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
-        pagination: true,                   //是否显示分页(*)
-        sortable: true,                     //是否启用排序
-        sortOrder: "asc",                   //排序方式
-        queryParams: recordTableQueryParams,           //传递参数(*)
-        sidePagination: "server",          //分页方式:client客户端分页,server服务端分页(*)
-        pageNumber: 1,                       //初始化加载第一页,默认第一页
-        pageSize: 10,                       //每页的记录行数(*)
-        pageList: [10, 20, 40, 100],        //可供选择的每页的行数(*)
-        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: [
-            {
-                title: '操作',
-                field: 'op',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return '<button type="button" class="registration-no-color-foot-button" title="详细" onclick="getDetail(\'' + row.drawNo + '\')"><i class="fa fa-plus"></i></button>';
-                }
-            }, {
-                field: 'outDate',
-                title: '退库日期',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return format(value, "yyyy-MM-dd HH:mm:ss");
-                }
-            }, {
-                field: 'drawNo',
-                title: '退库单号',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'groupNoOut',
-                title: '退药库房',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return getGroupName(value);
-                }
-            },
-            {
-                field: 'drawerName',
-                title: '申请人',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'keeperName',
-                title: '经发人',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'groupNo',
-                title: '发药库房',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return getGroupName(value);
-                }
-            }
-        ],
-        onDblClickRow: function (row) {
-            getDetail(row.drawNo);
-        },
-        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   //数据
-            };
-        }
-    });
-}
-
-function recordTableQueryParams(params) {
-    let rePortRangeArr = getRePortRangeArr();
-    let temp = {
-        drawNo: $("#drawNoTkSearch").val() === '' ? null : $("#drawNoTkSearch").val(),
-        outType: 2,
-        groupNo: groupYk,
-        beginTime: rePortRangeArr[0],
-        endTime: rePortRangeArr[1],
-        pageSize: params.limit,   //页面大小
-        pageIndex: params.offset / params.limit  //页码
-    };
-    return JSON.stringify(temp);
-}
-
-function getDetail(drawNo) {
-    $("#recordModal").modal("hide");
-    $("#tb_table").bootstrapTable('refreshOptions', {
-        method: 'GET',
-        url: '/thmz/getYpOutDetlDrugYk', queryParams: {drawNo: drawNo}
-    });
-    $("#tb_table").bootstrapTable('refresh');
-}
-
-function initPrintHtml() {
-    var datas = $('#tb_table').bootstrapTable('getData', true);
-    let html = '';
-    let packRetpriceSum = 0;
-    let buyPriceSum = 0;
-    $('.sjh').remove();
-    for (let i = 0; i < datas.length; i++) {
-        let data = datas[i];
-        let packRetprice = keepTwoDecimal(parseFloat(data['newOutAmt']) * parseFloat(data['packRetprice']));
-        let buyPrice = keepTwoDecimal(parseFloat(data['newOutAmt']) * parseFloat(data['buyPrice']));
-        packRetpriceSum += packRetprice;
-        buyPriceSum += buyPrice;
-        if (i === 0) {
-            $(".printDate").html(format(new Date(), "yyyy-MM-dd HH:mm"));
-            $(".groupName").html(data['groupNoOutName']);
-            $(".drawNo").html(data['drawNo']);
-            $(".planDate").html(format(data['confirmDate'], "yyyy-MM-dd HH:mm"));
-            $(".confirmDate").html(format(data['confirmDate'], "yyyy-MM-dd HH:mm"));
-            $(".lister").html($(".current_user")[0].innerText);
-            $(".listerAudit").html(data['confirmName']);
-        }
-        html += '<tr class="sjh">';
-        html += '<td class="xtd" style="text-align: center;">' + data['chargeCode'] + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + data['location'] + '</td>';
-        html += '<td class="xtd" style="text-align: left;">' + data['name'] + '</td>';
-        html += '<td class="xtd" style="text-align: left;">' + data['specification'] + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + data['newOutAmt'] + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + data['buyPrice'] + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + data['packRetprice'] + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + buyPrice + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + packRetprice + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + data['manuNo'] + '</td>';
-        html += '<td class="xtd" style="text-align: left;">' + data['manufactoryName'] + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + format(data['effDate'], "yyyy-MM-dd") + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + data['stockAmount'] + '</td>';
-        html += '</tr>';
-    }
-    $("#base_tr").after(html);
-    $(".packRetpriceSum").html(keepTwoDecimal(packRetpriceSum));
-    $(".buyPriceSum").html(keepTwoDecimal(buyPriceSum));
-    ;
-    print();
-}
-
-/**
- * 打印报表
- */
-function print() {
-    setDefaultPrint();
-    LODOP = getLodop();
-    LODOP.PRINT_INITA(6, 0, "210mm", "297mm", "长沙泰和医院西药库退库单");
-    LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A4");
-    //设置默认打印机
-    LODOP.SET_PRINTER_INDEX(defaultPrintIndex);
-    LODOP.ADD_PRINT_TEXT('190mm', '140mm', '40mm', '40mm', '第#页/共&页');
-    LODOP.SET_PRINT_STYLEA(0, "ItemType", 2);
-    var strStyle = "<style>table,td,th {border-width: 1px;" +
-        "border-style: solid;border-collapse: collapse;table-layout:fixed;word-wrap:break-word;font-size: 13px}</style>";
-    LODOP.ADD_PRINT_HTM("2mm", "4mm", "RightMargin:2mm", "BottomMargin:15mm", strStyle + document.getElementById("report_table_1").innerHTML);
-    //LODOP.PRINT();
-    LODOP.PREVIEW();
-}
-
 /**
  * 重置查询表单
  */

+ 20 - 16
src/main/resources/static/js/yk/drug_return.js

@@ -54,7 +54,10 @@ $(function () {
     $("#btn_daily").click(function (t) {
         initPrintHtml();
     });
-
+    //重置表格
+    $("#btn_clear").click(function (t) {
+        $('#tb_table').bootstrapTable('removeAll');
+    });
     //初始化药品查询弹出框
     initSearchList('<div id="medicinePopoverContent"><table id="tb_table_medicine"></table></div>',
         'drugSearchText', 600, 200);
@@ -100,7 +103,6 @@ $(function () {
  * 保存数据
  */
 function saveDrugApply(data) {
-
     $.ajax({
         type: "POST",
         url: '/thmz/saveDrugReturn',
@@ -213,16 +215,16 @@ function initTbTable() {
                 field: 'outAmt',
                 title: '累计出库量',
                 align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return value < 0 ? '-' : value;
-                }
+                valign: 'middle'
             },
             {
                 field: 'newOutAmt',
                 title: '退库量',
                 align: "center",
-                valign: 'middle'
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    return -value;
+                }
             },
             {
                 field: 'drawNo',
@@ -258,6 +260,7 @@ function initTbTable() {
             }
         },
         responseHandler: function (res) {
+            console.log(res);
             if (res == '401' || res == 401) {
                 window.location.href = '/thmz/login/view'
                 return;
@@ -326,7 +329,7 @@ function initAddDrugTable() {
                 formatter: function (value, row, index) {
                     var str = '<button type="button" class="registration-no-color-foot-button" title="选择" onclick="addData(\'' + row.outDate + '\',\''
                         + row.chargeCode + '\',\'' + row.name + '\',\'' + row.specification+ '\',\'' + row.groupNoOutName+ '\',\'' + row.outAmt+ '\',\''
-                        + row.effDate+ '\',\'' + row.drawNo+ '\',\'' + row.inDrawNo+ '\',\'' + row.outSeri+ '\',\'' + row.inSeri+ '\')"><i class="glyphicon glyphicon-plus"></i></button>';
+                        + row.effDate+ '\',\'' + row.drawNo+ '\',\'' + row.inDrawNo+ '\',\'' + row.outSeri+ '\',\'' + row.inSeri+ '\',\'' + row.packRetprice+ '\')"><i class="glyphicon glyphicon-plus"></i></button>';
                     return str;
                 }
             }, {
@@ -446,7 +449,7 @@ function initAddDrugTable() {
  * @param field
  * @param values
  */
-function addData(outDate,chargeCode,name,specification,groupNoOutName,outAmt,effDate,drawNo,inDrawNo,outSeri,inSeri) {
+function addData(outDate,chargeCode,name,specification,groupNoOutName,outAmt,effDate,drawNo,inDrawNo,outSeri,inSeri,packRetprice) {
     var tableData = $table.bootstrapTable('getData');
     for (let i = 0; i < tableData.length; i++) {
         let data = tableData[i];
@@ -467,7 +470,8 @@ function addData(outDate,chargeCode,name,specification,groupNoOutName,outAmt,eff
         drawNo: drawNo,
         outSeri:outSeri,
         inSeri:inSeri,
-        inDrawNo: inDrawNo
+        inDrawNo: inDrawNo,
+        packRetprice: packRetprice
     };
     $table.bootstrapTable('prepend', row);
 }
@@ -601,7 +605,7 @@ function recordTableQueryParams(params) {
 function getDetail(drawNo) {
     $("#recordModal").modal("hide");
     $("#tb_table").bootstrapTable('refreshOptions',{method: 'GET',
-        url: '/thmz/getYpOutDetlDrugYk',queryParams:{drawNo:drawNo}});
+        url: '/thmz/getDrugTkRecord',queryParams:{drawNo:drawNo}});
     $("#tb_table").bootstrapTable('refresh');
 }
 
@@ -628,7 +632,7 @@ function initPrintHtml(){
         }
         html += '<tr class="sjh">';
         html += '<td class="xtd" style="text-align: center;">' + data['chargeCode'] + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + data['location'] + '</td>';
+        html += '<td class="xtd" style="text-align: center;">' + (isEmpty(data['location'])?'':data['location']) + '</td>';
         html += '<td class="xtd" style="text-align: left;">' + data['name'] + '</td>';
         html += '<td class="xtd" style="text-align: left;">' + data['specification'] + '</td>';
         html += '<td class="xtd" style="text-align: center;">' + data['newOutAmt'] + '</td>';
@@ -636,10 +640,10 @@ function initPrintHtml(){
         html += '<td class="xtd" style="text-align: center;">' + data['packRetprice'] + '</td>';
         html += '<td class="xtd" style="text-align: center;">' + buyPrice + '</td>';
         html += '<td class="xtd" style="text-align: center;">' + packRetprice + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + data['manuNo'] + '</td>';
-        html += '<td class="xtd" style="text-align: left;">' + data['manufactoryName'] + '</td>';
+        html += '<td class="xtd" style="text-align: center;">' + (isEmpty(data['manuNo'])?'':isEmpty(data['manuNo'])) + '</td>';
+        html += '<td class="xtd" style="text-align: left;">' + (isEmpty(data['manufactoryName'])?'':data['manufactoryName']) + '</td>';
         html += '<td class="xtd" style="text-align: center;">' + format(data['effDate'], "yyyy-MM-dd") + '</td>';
-        html += '<td class="xtd" style="text-align: center;">' + data['stockAmount'] + '</td>';
+        html += '<td class="xtd" style="text-align: center;">' + (isEmpty(data['stockAmount'])?'':data['stockAmount']) + '</td>';
         html += '</tr>';
     }
     $("#base_tr").after(html);
@@ -654,7 +658,7 @@ function initPrintHtml(){
 function print() {
     setDefaultPrint();
     LODOP = getLodop();
-    LODOP.PRINT_INITA(6, 0, "210mm", "297mm", "长沙泰和医院西药库退库单");
+    LODOP.PRINT_INITA(6, 0, "210mm", "297mm", "长沙泰和医院退库单");
     LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A4");
     //设置默认打印机
     LODOP.SET_PRINTER_INDEX(defaultPrintIndex);

+ 4 - 1
src/main/resources/templates/yk/drug_return.html

@@ -24,6 +24,9 @@
                         <button type="button" style="margin-left:3px" id="btn_save" class="btn btn-primary"
                                 title="保存"><i class="fa fa-save">&nbsp;&nbsp;保存</i>
                         </button>
+                        <button type="button" style="margin-left:3px" id="btn_clear" class="btn btn-primary"
+                                title="重置"><i class="fa fa-rotate-left">&nbsp;&nbsp;重置</i>
+                        </button>
                         <button type="button" id="btn_daily" class="btn btn-primary"
                                 title="打印"><i class="fa fa-print">&nbsp;&nbsp;打印</i>
                         </button>
@@ -41,7 +44,7 @@
                            style="margin-top: 0px;border: transparent !important;">
                         <tr style="font-weight: 700;background-color: #EBEBE4;height: 70px;">
                             <td colspan="14" style="font-size: 21px;text-align: center;border: transparent !important;">
-                                <span class="title">长沙泰和医院西药库退库单</span></td>
+                                <span class="title">长沙泰和医院退库单</span></td>
                         </tr>
                         <tr style="font-weight: 700;background-color: #EBEBE4">
                             <td colspan="3" style="text-align: left;border: transparent !important;">领用库房:<span

+ 1 - 1
src/main/resources/templates/yk/drug_sales_return.html

@@ -25,7 +25,7 @@
                                 title="保存"><i class="fa fa-save">&nbsp;&nbsp;保存</i>
                         </button>
                         <button type="button" style="margin-left:3px" id="btn_clear" class="btn btn-primary"
-                                title="重置"><i class="fa fa-save">&nbsp;&nbsp;重置</i>
+                                title="重置"><i class="fa fa-rotate-left">&nbsp;&nbsp;重置</i>
                         </button>
                         <button type="button" id="btn_daily" class="btn btn-primary"
                                 title="打印"><i class="fa fa-print">&nbsp;&nbsp;打印</i>