Browse Source

出库删除药品调整

WANGJIALIANG 2 years ago
parent
commit
eb65989faf

+ 17 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/yp/YpOutDetlServiceImpl.java

@@ -288,7 +288,7 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
      *
      * @param map
      */
-    private void editYpOutDetlList(Map<String, Object> map, Map<String, Object> nmap) {
+    private void editYpOutDetlList(Map<String, Object> map, Map<String, Object> nmap)throws MzException {
         List<Map<String, Object>> list = (List) map.get("list");
         YpInPlan ypInPlan = new YpInPlan();
         String drawYf = ypOutDetlMapper.selectDrawYf(map.get("drawNo").toString());
@@ -307,7 +307,10 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
                 ypInPlan.setChargeCode(ypOutDetl.getChargeCode());
                 ypInPlan.setSerial(ypOutDetl.getSerial());
                 ypInPlan.setAmountOut(Double.parseDouble(nmap.get(ypInPlan.getChargeCode()).toString()));
-                ypInPlanMapper.updateYpInPlan(ypInPlan);
+                int num = ypInPlanMapper.updateYpInPlan(ypInPlan);
+                if (num <= 0) {
+                    throw new MzException("更新请领单记录异常!");
+                }
             }
         }
         List<Map<String, Object>> delList = (List) map.get("delList");
@@ -409,5 +412,17 @@ public class YpOutDetlServiceImpl implements YpOutDetlService {
                 ypOutDetlMapper.insertYpOutDetl(ypOutDetl);
             }
         }
+        //删除的药品,更新药房请领单
+        List<Map<String, Object>> delList = (List) map.get("delList");
+        for (int i = 0; i < delList.size(); i++) {
+            Map<String, Object> data = delList.get(i);
+            YpInPlan ypInPlan = new YpInPlan();
+            ypInPlan.setAmountOut(0.0);
+            ypInPlan.setStatusFlag("2");
+            ypInPlan.setDrawNo(map.get("drawNo").toString());
+            ypInPlan.setChargeCode(data.get("chargeCode").toString());
+            ypInPlan.setSerial(data.get("serial").toString());
+            ypInPlanMapper.updateYpInPlan(ypInPlan);
+        }
     }
 }