Browse Source

查询打印状态取消登录验证 退库开发

WANGJIALIANG 3 years ago
parent
commit
2093d73930

+ 0 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java

@@ -1163,7 +1163,6 @@ public class MzPharmacyController {
      * @param orderNo
      * @return
      */
-    @UserLoginToken
     @RequestMapping(value = "/getPrintFlag",method = RequestMethod.GET)
     public Map<String,Object> getPrintFlag(@RequestParam("patientId") String patientId,@RequestParam("times") String times
             ,@RequestParam("orderNo") Integer orderNo){

+ 29 - 0
src/main/java/cn/hnthyy/thmz/controller/yk/YpOutDetlController.java

@@ -349,4 +349,33 @@ public class YpOutDetlController {
             return resultMap;
         }
     }
+
+    /**
+     * 保存退库
+     *
+     * @param map
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/saveDrugReturn", method = {RequestMethod.POST})
+    public Map<String, Object> saveDrugReturn(@RequestBody List<Map> list, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (null == list || list.size() == 0) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "保存退库信息失败,参数为空");
+                return resultMap;
+            }
+            User user = TokenUtil.getUser(httpServletRequest);
+            resultMap.put("code", 0);
+            resultMap.put("message", "审核出库信息成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("系统异常,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "审核出库信息失败");
+            return resultMap;
+        }
+    }
 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpOutDetl.java

@@ -79,7 +79,9 @@ public class YpOutDetl extends PageBean {
   private Date confirmDate;
   //录入人
   private String inputId;
+  //退货序号
   private Integer serialTh;
+  //退货数量
   private Double amountTh;
 
 //请领人名称

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

@@ -39,6 +39,15 @@ public interface YpOutDetlService {
      */
     int saveYpOutDetlList(Map<String,Object> map, String userId)throws MzException;
 
+    /**
+     * 保存药品退库信息
+     * @param list
+     * @param userId
+     * @return
+     * @throws MzException
+     */
+    int saveDrugReturn(List<Map> list, String userId)throws MzException;
+
     /**
      * 审核出库单
      * @param drawYf

+ 8 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/yp/YpOutDetlServiceImpl.java

@@ -162,6 +162,14 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
         return 0;
     }
 
+    @Override
+    public int saveDrugReturn(List<Map> list, String userId) throws MzException {
+        for (int i = 0; i < list.size(); i++) {
+
+        }
+        return 0;
+    }
+
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     @Override
     public int auditYpOutDetl(String drawYf, String userId) throws MzException {

+ 2 - 0
src/main/java/cn/hnthyy/thmz/vo/YpOutDetlVo.java

@@ -79,7 +79,9 @@ public class YpOutDetlVo extends PageBean {
     private Date confirmDate;
     //录入人
     private String inputId;
+    //退货序号
     private Integer serialTh;
+    //退货数量
     private Double amountTh;
 
     //拆零比例

+ 23 - 45
src/main/resources/static/js/yk/drug_return.js

@@ -26,25 +26,14 @@ $(function () {
     });
     //保存按钮点击事件
     $("#btn_save").click(function (t) {
-        var data = $('#add_drug_table').bootstrapTable('getData', true);
+        var data = $('#tb_table').bootstrapTable('getData', true);
         if (data.length > 0) {
             var ypInPlans = [];
             for (let i = 0; i < data.length; i++) {
-                if (data[i].amount == 0 || data[i].amount == null) {
-                    return errorMesageSimaple('含有请领数量为0的药品');
+                if (data[i].newOutAmt == 0 || data[i].newOutAmt == null) {
+                    return warningMesageSimaple('含有退药数量为0的记录');
                 }
             }
-            for (let i = 0; i < data.length; i++) {
-                let ypInPlan = {
-                    planSeri: i + 1,
-                    chargeCode: data[i].code,
-                    serial: data[i].serial,
-                    groupNo: data[i].groupNo,
-                    groupYk: data[i].groupYk,
-                    amount: data[i].amount
-                };
-                ypInPlans.push(ypInPlan);
-            }
             saveDrugApply(ypInPlans);
         }
     });
@@ -81,8 +70,8 @@ $(function () {
         var rows = $table.bootstrapTable('getSelections');
         for (let i = 0; i < rows.length; i++) {
             $table.bootstrapTable('remove', {
-                field: "no",       //列名
-                values: rows[i].no        //值数组
+                field: "id",       //列名
+                values: rows[i].id        //值数组
             });
         }
     });
@@ -95,7 +84,7 @@ $(function () {
 function saveDrugApply(data) {
     $.ajax({
         type: "POST",
-        url: '/thmz/saveDrugApply',
+        url: '/thmz/saveDrugReturn',
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
@@ -106,7 +95,6 @@ function saveDrugApply(data) {
                 return;
             }
             if (res.code == 0) {
-                $("#editModal").modal("hide");
                 $('#tb_table').bootstrapTable('refresh');
                 successMesage(res);
             } else {
@@ -236,15 +224,17 @@ function initTbTable() {
          * @param {td 元素} $element
          */
         onClickCell: function(field, value, row, $element) {
-            if(field == 'outAmt'){
+            if(field == 'newOutAmt'){
                 $element.attr('contenteditable', true);
                 $element.html(null);
                 $element.focus();
                 $element.blur(function() {
-                    var index = $element.parent().data('index');
+                    let index = $element.parent().data('index');
                     var tdValue = $element.html();
+                    tdValue = tdValue.replaceAll("&nbsp;","");
+                    tdValue = tdValue.replaceAll("<br>","");
                     saveData(index, field, tdValue);
-                })
+                });
             }
         },
         responseHandler: function (res) {
@@ -335,7 +325,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+ '\')"><i class="glyphicon glyphicon-plus"></i></button>';
+                        + row.effDate+ '\',\'' + row.drawNo+ '\',\'' + row.inDrawNo+ '\',\'' + row.outSeri+ '\')"><i class="glyphicon glyphicon-plus"></i></button>';
                     return str;
                 }
             }, {
@@ -446,28 +436,6 @@ function initAddDrugTable() {
                 "total": ress.total,//总页数
                 "rows": ress.data   //数据
             };
-        },
-        /**
-         * @param {点击列的 field 名称} field
-         * @param {点击列的 value 值} value
-         * @param {点击列的整行数据} row
-         * @param {td 元素} $element
-         */
-        onClickCell: function (field, value, row, $element) {
-            if (field == 'amount') {
-                $element.attr('contenteditable', true);
-                $element.html(null);
-                $element.focus();
-                $element.blur(function () {
-                    var index = $element.parent().data('index');
-                    var tdValue = $element.html();
-                    if (parseFloat(tdValue).toString() != "NaN") {
-                        saveCellData($('#add_drug_table'), index, field, tdValue);
-                    } else {
-                        $element.html(null);
-                    }
-                })
-            }
         }
     });
 }
@@ -477,8 +445,17 @@ function initAddDrugTable() {
  * @param field
  * @param values
  */
-function addData(outDate,chargeCode,name,specification,groupNoOutName,outAmt,effDate,drawNo,inDrawNo) {
+function addData(outDate,chargeCode,name,specification,groupNoOutName,outAmt,effDate,drawNo,inDrawNo,outSeri) {
+    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,
@@ -487,6 +464,7 @@ function addData(outDate,chargeCode,name,specification,groupNoOutName,outAmt,eff
         outAmt: outAmt,
         effDate: effDate,
         drawNo: drawNo,
+        outSeri:outSeri,
         inDrawNo: inDrawNo
     };
     $table.bootstrapTable('prepend', row);