ソースを参照

Merge branch 'dev-1.1.4' of https://172.16.32.165/hurugang/thmz_system into dev-1.1.4

hurugang 3 年 前
コミット
8b7165766c

+ 30 - 37
src/main/java/cn/hnthyy/thmz/controller/yk/YpInDetlController.java

@@ -4,13 +4,12 @@ package cn.hnthyy.thmz.controller.yk;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.his.yp.YpInDetl;
+import cn.hnthyy.thmz.entity.his.yp.YpOutDetl;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.service.his.mz.EmployeeService;
-import cn.hnthyy.thmz.service.his.yp.YpInDetlService;
-import cn.hnthyy.thmz.service.his.yp.YpZdDictService;
-import cn.hnthyy.thmz.service.his.yp.YpZdManufactoryService;
-import cn.hnthyy.thmz.service.his.yp.YpZdSupplyService;
+import cn.hnthyy.thmz.service.his.yp.*;
 import cn.hnthyy.thmz.vo.YpInDetlVo;
+import cn.hnthyy.thmz.vo.YpOutDetlVo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +38,8 @@ public class YpInDetlController {
     EmployeeService employeeService;
     @Autowired
     YpZdSupplyService ypZdSupplyService;
+    @Autowired
+    YpOutDetlService ypOutDetlService;
 
     /**
      * 查询入库记录
@@ -72,50 +73,42 @@ public class YpInDetlController {
     /**
      * 查询药品入库记录
      *
-     * @param ypInDetl
+     * @param map
      * @return
      */
     @UserLoginToken
     @RequestMapping(value = "/getYpInDetl", method = {RequestMethod.POST})
-    public Map<String, Object> getYpInDetl(@RequestBody YpInDetl ypInDetl) {
+    public Map<String, Object> getYpInDetl(@RequestBody Map<String,Object> map) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
-            if (ypInDetl == null) {
+            if (map == null) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "查询药品入库记录信息失败,参数为空");
                 return resultMap;
             }
-            resultMap.put("data", ypInDetlService.queryYpInDetl(ypInDetl));
-            resultMap.put("code", 0);
-            resultMap.put("message", "查询药品入库记录信息成功");
-            return resultMap;
-        } catch (Exception e) {
-            log.error(e.toString());
-            resultMap.put("code", -1);
-            resultMap.put("message", "查询药品入库记录信息失败");
-            return resultMap;
-        }
-    }
-
-    /**
-     * 查询药品入库记录
-     * @param chargeCode
-     * @param serial
-     * @param groupNo
-     * @return
-     */
-    @UserLoginToken
-    @RequestMapping(value = "/getYpInDetl1", method = {RequestMethod.POST})
-    public Map<String, Object> getYpInDetl1(@RequestParam("chargeCode") String chargeCode,@RequestParam("serial") String serial,
-                                           @RequestParam("groupNo") String groupNo) {
-        Map<String, Object> resultMap = new HashMap<>();
-        try {
             YpInDetl ypInDetl = new YpInDetl();
-            ypInDetl.setChargeCode(chargeCode);
-            ypInDetl.setSerial(serial);
-            ypInDetl.setGroupNo(groupNo);
-            ypInDetl.setCurrentStock(0.0);
-            resultMap.put("data", ypInDetlService.queryYpInDetl(ypInDetl));
+            ypInDetl.setCurrentStock(Double.parseDouble(map.get("currentStock").toString()));
+            ypInDetl.setChargeCode(map.get("chargeCode").toString());
+            ypInDetl.setSerial(map.get("serial").toString());
+            ypInDetl.setGroupNo(map.get("groupNo").toString());
+            List<YpInDetlVo> ypInDetlVos = ypInDetlService.queryYpInDetl(ypInDetl);
+            if(StringUtils.isNotBlank(map.get("drawNo").toString())){
+                YpOutDetl ypOutDetl = new YpOutDetl();
+                ypOutDetl.setDrawNo(map.get("drawNo").toString());
+                List<YpOutDetlVo> ypOutDetlVos = ypOutDetlService.queryYpOutDetlDetail(ypOutDetl);
+                for (int i = 0; i < ypInDetlVos.size(); i++) {
+                    YpInDetlVo ypInDetlVo = ypInDetlVos.get(i);
+                    for (int j = 0; j < ypOutDetlVos.size(); j++) {
+                        YpOutDetlVo ypOutDetlVo = ypOutDetlVos.get(j);
+                        if(ypInDetlVo.getChargeCode().equals(ypOutDetlVo.getChargeCode())
+                                && ypInDetlVo.getSerial().equals(ypOutDetlVo.getSerial())
+                                && ypInDetlVo.getManuNo().equals(ypOutDetlVo.getManuNo())){
+                            ypInDetlVo.setAmountOut(ypOutDetlVo.getOutAmt());
+                        }
+                    }
+                }
+            }
+            resultMap.put("data", ypInDetlVos);
             resultMap.put("code", 0);
             resultMap.put("message", "查询药品入库记录信息成功");
             return resultMap;

+ 6 - 5
src/main/java/cn/hnthyy/thmz/controller/yk/YpOutDetlController.java

@@ -121,7 +121,7 @@ public class YpOutDetlController {
             }
             YpOutDetl ypOutDetl = new YpOutDetl();
             ypOutDetl.setDrawNo(drawNo);
-            List<YpOutDetlVo> ypOutDetlVos = ypOutDetlService.queryYpOutDetlDetail(ypOutDetl);
+            List<YpOutDetlVo> ypOutDetlVos = ypOutDetlService.queryYpOutDetlGroup(ypOutDetl);
             for (int i = 0; i < ypOutDetlVos.size(); i++) {
                 YpOutDetlVo ypOutDetlVo = ypOutDetlVos.get(i);
                 YpZdDict ypZdDict = ypZdDictService.queryYpZdDictByCodeAndSerial(ypOutDetlVo.getChargeCode(), ypOutDetlVo.getSerial());
@@ -137,11 +137,10 @@ public class YpOutDetlController {
                 ypInPlan.setDrawNo(ypOutDetlVo.getDrawYf());
                 ypInPlan.setChargeCode(ypOutDetlVo.getChargeCode());
                 ypInPlan.setSerial(ypOutDetlVo.getSerial());
+                //查询是否有请领记录,给请领数量赋值
                 List<YpInPlanDrugVo> ypInPlanDrugVos = ypInPlanService.queryYpInPlanDrug(ypInPlan);
-                if (ypInPlanDrugVos.size() > 0) {
-                    ypOutDetlVo.setAmount(ypInPlanDrugVos.get(0).getAmount());
-                }
-                ypOutDetlVo.setAmountOut(ypOutDetlVo.getAmount());
+                ypOutDetlVo.setAmount(ypInPlanDrugVos.size() > 0?ypInPlanDrugVos.get(0).getAmount():0);
+                ypOutDetlVo.setAmountOut(ypOutDetlVo.getOutAmt());
                 if (i > 0) {
                     ypOutDetlVo.setKeeperName(ypOutDetlVos.get(0).getKeeperName());
                     ypOutDetlVo.setConfirmName(ypOutDetlVos.get(0).getConfirmName());
@@ -160,6 +159,8 @@ public class YpOutDetlController {
                     }
                 }
             }
+            /*ypOutDetlVos.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()->
+                    new TreeSet<>(Comparator.comparing(ExportExcelObj -> ExportExcelObj.getChargeCode() + ";" + ExportExcelObj.getSerial()))), ArrayList::new))*/
             resultMap.put("code", 0);
             resultMap.put("message", "查询请领单药品成功");
             resultMap.put("data", ypOutDetlVos);

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

@@ -133,6 +133,32 @@ public interface YpOutDetlMapper {
             "</script>")
     List<YpOutDetlVo> selectYpOutDetlDetail(YpOutDetl ypOutDetl);
 
+    /**
+     * 查询药库出库单分组汇总
+     * @param ypOutDetl
+     * @return
+     */
+    @Select("<script>" +
+            "select dept_code,input_id,confirm_flag,confirm_id,confirm_date,out_date,draw_no,draw_yf,\n" +
+            "  drawer,serial,sum(out_amt)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"+
+            "</script>")
+    List<YpOutDetlVo> selectYpOutDetlGroup(YpOutDetl ypOutDetl);
+
     /**
      * 更新药房入库状态
      * @param drawNo

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/yz/YzYpZyOrderMapper.java

@@ -260,7 +260,7 @@ public interface YzYpZyOrderMapper {
      * @param pageNo 药单编码
      * @return
      */
-    @Select("select count(*) from yz_yp_zy_order WITH(NOLOCK) where page_no =#{pageNo} and status_flag in ( '1' , '3' , '4' )")
+    @Select("select count(*) from yz_yp_zy_order WITH(NOLOCK) where page_no =#{pageNo} and amount>0 and status_flag in ( '1' , '3' , '4' )")
     int selectDrugCountByPageNo(@Param("pageNo") Integer pageNo);
 
     /**

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/zy/YpZyPatientMapper.java

@@ -75,7 +75,7 @@ public interface YpZyPatientMapper {
      * @return
      */
     @Update("update yp_zy_patient set page_no=#{pageNo},keeper=#{keeper},confirm_time=#{confirmTime},doctor_name=#{doctorName}" +
-            ",page_type=#{pageType},jy_flag=#{jyFlag} where act_order_no = #{actOrderNo} and charge_code = #{chargeCode} and inpatient_no=#{inpatientNo}  and confirm_time is null")
+            ",page_type=#{pageType},jy_flag=#{jyFlag} where act_order_no = #{actOrderNo} and charge_code = #{chargeCode} and inpatient_no=#{inpatientNo} and order_date=#{orderDate} and confirm_time is null")
     int updateYpZyPatient(YpZyPatient ypZyPatient);
 
     /**

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

@@ -30,6 +30,13 @@ public interface YpOutDetlService {
      */
     List<YpOutDetlVo> queryYpOutDetlDetail(YpOutDetl ypOutDetl);
 
+    /**
+     * 查询药库出库单分组汇总
+     * @param ypOutDetl
+     * @return
+     */
+    List<YpOutDetlVo> queryYpOutDetlGroup(YpOutDetl ypOutDetl);
+
     /**
      * 保存药品出库信息
      * @param map

+ 6 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/yp/YpOutDetlServiceImpl.java

@@ -81,6 +81,10 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
     public List<YpOutDetlVo> queryYpOutDetlDetail(YpOutDetl ypOutDetl) {
         return ypOutDetlMapper.selectYpOutDetlDetail(ypOutDetl);
     }
+    @Override
+    public List<YpOutDetlVo> queryYpOutDetlGroup(YpOutDetl ypOutDetl) {
+        return ypOutDetlMapper.selectYpOutDetlGroup(ypOutDetl);
+    }
 
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     @Override
@@ -144,7 +148,8 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
                     ypOutDetl.setGroupNoOut(ypInPlanDrugVo.getGroupNo());
                     ypOutDetl.setDrawYf(m.get("drawNo").toString());
                 }else{
-                    ypOutDetl.setGroupNo(map.get("outType").toString());
+                    ypOutDetl.setGroupNo(map.get("groupNo").toString());
+                    ypOutDetl.setDrawer(userId);
                     YpZdGroupName ypZdGroupName = new YpZdGroupName();
                     ypZdGroupName.setDeptCode(map.get("deptCode").toString());
                     List<YpZdGroupName> ypZdGroupNames = ypZdGroupNameMapper.selectYpZdGroupNameList(ypZdGroupName);

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

@@ -132,4 +132,6 @@ public class YpInDetlVo extends PageBean {
     private String ypType;
     //标志;0:入库;1:退库;2:赠药;3:紧急入库
     private String inTypeName;
+    //出库数量
+    private Double amountOut;
 }

+ 10 - 8
src/main/resources/static/js/yk/drug_delivery.js

@@ -110,7 +110,8 @@ $(function () {
             data: JSON.stringify({
                 list: outDetlList,
                 outType: $("#outType1Search").val(),
-                deptCode: $("#deptCode").val()[0]
+                deptCode: $("#deptCode").val()[0],
+                groupNo:groupNo
                 //drawNo: $("#drawNoLabel").html()
             })
         }).then((res) => {
@@ -352,10 +353,11 @@ function loadInDetlDetailed(data) {
     $("#tb_table_indetl_detailed").jqGrid('setGridParam', {
         datatype: 'JSON',
         postData: JSON.stringify({
-            currentStock: 0.0,
-            chargeCode: data.chargeCode,
-            serial: data.serial,
-            groupNo: groupNo
+                currentStock: 0.0,
+                chargeCode: data.chargeCode,
+                serial: data.serial,
+                groupNo: groupNo,
+                drawNo: data.drawNo
         })
     }).trigger('reloadGrid');
 }
@@ -423,7 +425,7 @@ function initInDetlDetailed() {
                         warningMesageSimaple("出库量不允许大于现时库存!");
                         return '';
                     }
-                    return typeof (cellvalue) == 'undefined' ? '' : cellvalue;
+                    return isEmpty(cellvalue) ? 0 : cellvalue;
                 }
             },
             {name: 'manuNo', index: 'manuNo', align: 'center', width: 100},
@@ -521,9 +523,9 @@ function initDetailed() {
             },
             {
                 name: 'amountOutMoney', index: 'amountOutMoney', align: 'center',
-                /* formatter: function (cellvalue, options, rowObject) {
+                formatter: function (cellvalue, options, rowObject) {
                      return keepTwoDecimal((typeof rowObject.amount === 'undefined' ? rowObject.outAmt : rowObject.amountOut) * rowObject.packRetprice);
-                 }*/
+                 }
             },
             {
                 name: 'jbFlag', index: 'jbFlag', align: 'center',