Sfoglia il codice sorgente

药品临购以及药品账页维护优化

hsh 1 anno fa
parent
commit
30931152f6

+ 5 - 0
src/main/java/thyyxxk/webserver/controller/yp/YpDictController.java

@@ -224,4 +224,9 @@ public class YpDictController {
         return service.updateYpJbFlag(code, serial, jbFlag);
     }
 
+    @GetMapping("/selectYpStorageInfo")
+    public ResultVo<Map<String, Object>> selectYpStorageInfo(@RequestParam("code") String code, @RequestParam("groupNo") String groupNo){
+        return service.selectYpStorageInfo(code, groupNo);
+    }
+
 }

+ 31 - 0
src/main/java/thyyxxk/webserver/dao/his/yp/YpDictDao.java

@@ -543,4 +543,35 @@ public interface YpDictDao extends BaseMapper<YpZdDict> {
     @Update(" update yp_zd_dict set jb_flag = #{jbFlag} where code = #{code} ")
     int updateYpJbFlagByCode(@Param("code") String code, @Param("jbFlag") String jbFlag);
 
+    @Select("<script>" +
+            " select yk.charge_code as code, yk.stock_amount as stockAmount, yk.group_no as groupNo, kf.group_name as groupName " +
+            " from yp_base as yk, yp_zd_group_name as kf " +
+            " where yk.charge_code = #{code} " +
+            " and yk.stock_amount > 0.0001 " +
+            " and yk.group_no = kf.group_no " +
+            "<if test=\" groupNo != null and groupNo != '' \">" +
+            " and yk.group_no = #{groupNo} " +
+            "</if>" +
+            " </script>")
+    List<Map<String, Object>> selectYpStorageBase(@Param("code") String code, @Param("groupNo") String groupNo);
+
+    @Select(" select yf.charge_code as code, yf.stock_amount as stockAmount, yf.group_no as groupNo, kf.group_name as groupName " +
+            " from yp_base_yf as yf, yp_zd_group_name as kf " +
+            " where yf.charge_code = #{code} " +
+            " and yf.stock_amount > 0.0001 " +
+            " and yf.group_no = kf.group_no ")
+    List<Map<String, Object>> selectYpStorageBaseYf(@Param("code") String code);
+
+    @Update({"<script>" +
+            " update yp_base set del_flag = #{delFlag} " +
+            " where charge_code = #{code} " +
+            "<if test=\" groupNo != null and groupNo != '' \">" +
+            " and group_no = #{groupNo} " +
+            "</if>" +
+            "</script>"})
+    void updateYpBaseNoDelFlagByCode(@Param("code") String code, @Param("delFlag") String delFlag, @Param("groupNo") String groupNo);
+
+    @Update(" update yp_base_yf set visible_flag_mz = #{delFlag}, visible_flag_zy = #{delFlag} where charge_code = #{code} ")
+    void updateYpBaseYfDelFlagByCode(@Param("code") String code, @Param("delFlag") String delFlag);
+
 }

+ 18 - 0
src/main/java/thyyxxk/webserver/dao/his/yp/YpTempPurchaseDao.java

@@ -146,6 +146,24 @@ public interface YpTempPurchaseDao extends BaseMapper<YpTempPurchase> {
             "<if test=\"result != null and result != '' \">" +
             "result = #{result}, " +
             "</if>" +
+            "<if test=\"auditId != null \">" +
+            "audit_id = #{auditId}, " +
+            "</if>" +
+            "<if test=\"auditName != null \">" +
+            "audit_name = #{auditName}, " +
+            "</if>" +
+            "<if test=\"purchaseId != null \">" +
+            "purchase_id = #{purchaseId}, " +
+            "</if>" +
+            "<if test=\"purchaseName != null \">" +
+            "purchase_name = #{purchaseName}, " +
+            "</if>" +
+            "<if test=\"storageId != null \">" +
+            "storage_id = #{storageId}, " +
+            "</if>" +
+            "<if test=\"storageName != null \">" +
+            "storage_name = #{storageName}, " +
+            "</if>" +
             "</trim>" +
             "where apply_id = #{applyId} " +
             "</script>")

+ 6 - 0
src/main/java/thyyxxk/webserver/entity/yp/YpTempPurchase.java

@@ -42,6 +42,12 @@ public class YpTempPurchase implements Serializable {
     private String result; // 采购原因
     private String useResult; // 申请使用理由
     private String manuFactory; // 生产厂家
+    private String auditId; // 审核人id
+    private String auditName; // 审核人
+    private String purchaseId; // 采购人id
+    private String purchaseName; // 采购人
+    private String storageId; // 入库人id
+    private String storageName; // 入库人
     @TableField("exist = false")
     private String permissions; // 0: 修改权限; 1: 审核权限
 

+ 3 - 14
src/main/java/thyyxxk/webserver/service/highreport/AllStatisticsService.java

@@ -88,12 +88,7 @@ public class AllStatisticsService {
         List<Map<String, Object>> zyrs = highReportDao.selectReportPortalData(report_zy.getReportId(), report_zy.getMenuId(), report_zy.getReportType(), sql_zy);
 
         List<Map<String, Object>> list = new ArrayList<>();
-        int count = 0;
-        if(mzrs.size() >= jzrs.size()){
-            count = mzrs.size();
-        } else {
-            count = jzrs.size();
-        }
+        int count = Math.max(mzrs.size(), jzrs.size());
 
         if(count < thrs.size()){
             count = thrs.size();
@@ -111,7 +106,6 @@ public class AllStatisticsService {
             count = zyrs.size();
         }
 
-        Map<String, Object> hj = new HashMap<>();
         int mzHj = 0;
         int jzHj = 0;
         int thHj = 0;
@@ -151,7 +145,7 @@ public class AllStatisticsService {
         Map<String, Object> hjm = new HashMap<>();
         hjm.put("ks_mz", "合计");
         hjm.put("rs_mz", mzHj);
-        hj.putAll(hjm);
+        Map<String, Object> hj = new HashMap<>(hjm);
 
         hjm = new HashMap<>();
         hjm.put("ks_jz", "合计");
@@ -376,12 +370,7 @@ public class AllStatisticsService {
         }
 
         List<Map<String, Object>> list = new ArrayList<>();
-        int count = 0;
-        if(ksSrList.size() >= yzbList.size()){
-            count = ksSrList.size();
-        } else {
-            count = yzbList.size();
-        }
+        int count = Math.max(ksSrList.size(), yzbList.size());
 
         if(count < hzbList.size()){
             count = hzbList.size();

+ 44 - 2
src/main/java/thyyxxk/webserver/service/yp/YpDictService.java

@@ -691,6 +691,8 @@ public class YpDictService {
             if(num == 0){
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新药品账页字典停用或启用失败!");
             }
+            // 更新药房对应药品的状态
+            dao.updateYpBaseYfDelFlagByCode(code, delFlag);
             resultMap.put("cg", "更新药品账页字典停用或启用成功!");
             return ResultVoUtil.success(resultMap);
         } catch(Exception e){
@@ -758,8 +760,8 @@ public class YpDictService {
     /**
      * @Description 药品账页信息保存
      * @Author hsh
-     * @param
-     * @return
+     * @param ypZdDictVo 药品账页信息
+     * @return map
      * @Date 2024/2/17 9:33
      */
     public ResultVo<Map<String, Object>> saveYpDict(YpZdDictVo ypZdDictVo){
@@ -1039,6 +1041,8 @@ public class YpDictService {
             if(num == 0){
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新药库药品停用或启用失败!");
             }
+            // 更新药库药品的状态
+            dao.updateYpBaseNoDelFlagByCode(code, delFlag, groupNo);
             resultMap.put("cg", "更新药库药品停用或启用成功!");
             return ResultVoUtil.success(resultMap);
         } catch(Exception e){
@@ -1078,4 +1082,42 @@ public class YpDictService {
 
     }
 
+    public ResultVo<Map<String, Object>> selectYpStorageInfo(String code, String groupNo){
+        if(StringUtil.isBlank(code)) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到药品编码,请检查!");
+        }
+        Map<String, Object> resultMap = new HashMap<>();
+        StringBuilder msg = new StringBuilder();
+        if(StringUtil.isBlank(groupNo)){
+            List<Map<String, Object>> msgYf = dao.selectYpStorageBaseYf(code);
+            if(!msgYf.isEmpty()){
+                for(Map<String, Object> yfMap : msgYf){
+                    String groupName = (String) yfMap.get("groupName");
+                    Double stockAmount = (Double) yfMap.get("stockAmount");
+                    msg.append(groupName).append("剩余库存:").append(stockAmount).append("。 ");
+                }
+            }
+            if(msg.length() > 0){
+                resultMap.put("msg", msg);
+            } else {
+                resultMap.put("msg", "各药房无库存。");
+            }
+        } else {
+            List<Map<String, Object>> msgYk = dao.selectYpStorageBase(code, groupNo);
+            if(!msgYk.isEmpty()){
+                for(Map<String, Object> ykMap : msgYk){
+                    String groupName = (String) ykMap.get("groupName");
+                    Double stockAmount = (Double) ykMap.get("stockAmount");
+                    msg.append(groupName).append("剩余库存:").append(stockAmount).append("。 ");
+                }
+            }
+            if(msg.length() > 0){
+                resultMap.put("msg", msg);
+            } else {
+                resultMap.put("msg", "各药库无库存。");
+            }
+        }
+        return ResultVoUtil.success(resultMap);
+    }
+
 }

+ 29 - 0
src/main/java/thyyxxk/webserver/service/yp/YpTempPurchaseService.java

@@ -156,6 +156,35 @@ public class YpTempPurchaseService {
         int num;
         try{
             if(null != tempPurchase){
+                // 增加审核(接收)人,采购人,入库人审核信息
+                UserInfo us = redisLikeService.getUserInfoByToken();
+                if("1".equals(ypTempPurchase.getReceptFlag())){
+                    if(!"1".equals(tempPurchase.getReceptFlag())){
+                        ypTempPurchase.setAuditId(us.getCode().trim());
+                        ypTempPurchase.setAuditName(us.getName().trim());
+                    }
+                } else {
+                    ypTempPurchase.setAuditId("");
+                    ypTempPurchase.setAuditName("");
+                }
+                if("1".equals(ypTempPurchase.getPurchaseFlag())){
+                    if(!"1".equals(tempPurchase.getPurchaseFlag())){
+                        ypTempPurchase.setPurchaseId(us.getCode().trim());
+                        ypTempPurchase.setPurchaseName(us.getName().trim());
+                    }
+                } else {
+                    ypTempPurchase.setPurchaseId("");
+                    ypTempPurchase.setPurchaseName("");
+                }
+                if("1".equals(ypTempPurchase.getStorageFlag())){
+                    if(!"1".equals(tempPurchase.getStorageFlag())){
+                        ypTempPurchase.setStorageId(us.getCode().trim());
+                        ypTempPurchase.setStorageName(us.getName().trim());
+                    }
+                } else {
+                    ypTempPurchase.setStorageId("");
+                    ypTempPurchase.setStorageName("");
+                }
                 num = dao.updateYpTempPurchaseFlagByApplyId(ypTempPurchase);
             } else {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未查到临购药品审核信息!");