| 
					
				 | 
			
			
				@@ -78,6 +78,7 @@ public class YiZhuLuRuServer { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private final String ITEM = "00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private final String SMALL_PACKAGE = "01"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private final String BIG_PACKAGE = "99"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private final String 出院带药 = "007"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private YiZhuLuRuServer getThis() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return SpringUtil.getBean(this.getClass()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -405,7 +406,7 @@ public class YiZhuLuRuServer { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "两次医嘱录入时患者不一致。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!oldOrderNo.getEnterOper().equals(userCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医嘱录入人不是您,无法修改。。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医嘱录入人不是您,无法修改。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 获取医生开药品的权限 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -583,8 +584,6 @@ public class YiZhuLuRuServer { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResultVo<Map<String, String>> deleteMultipleOrders(XinZhenYiZhu param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         QueryWrapper<?> qw = new QueryWrapper<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        qw.eq("inpatient_no", param.getInpatientNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        qw.eq("admiss_times", param.getAdmissTimes()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<BigDecimal> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         param.getList().forEach(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             list.add(item.getActOrderNo()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -601,7 +600,6 @@ public class YiZhuLuRuServer { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 map.put(item.getActOrderNo().stripTrailingZeros().toPlainString(), error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("数据:{}", deleteOrderList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (map.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dao.deleteParentChildRelationship(param.getInpatientNo(), param.getAdmissTimes(), list); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -616,8 +614,8 @@ public class YiZhuLuRuServer { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (oldData == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return "没有找到原医嘱可能已经被删除了"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!"1".equals(oldData.getStatusFlag())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            str.append("该医嘱不是录入状态,无法删除"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!("1".equals(oldData.getStatusFlag()) || "2".equals(oldData.getStatusFlag()))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            str.append("该医嘱不是录入或确认状态,无法删除"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!oldData.getEnterOper().equals(TokenUtil.getTokenUserId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             str.append("该医嘱录入人不是您,无法删除."); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1046,20 +1044,23 @@ public class YiZhuLuRuServer { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (item.getSelfBuy() != null && "4".equals(item.getSelfBuy())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 如果是临时医嘱 开了就结束了. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if ("ONCE".equals(item.getFrequCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        item.setEndTime(item.getStartTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (dao.dischargeWithMedicationAdministration(item.getSupplyCode()) == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        errorMessage.add("出院带药给药方式不能包含费用。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (item.getStartTime() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        errorMessage.add("出院带药请输入开始时间。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (item.getEndTime() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        errorMessage.add("出院带药请输入结束时间。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (item.getSupplyCode() != null && 出院带药.equals(item.getSupplyCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!ONCE.equals(item.getFrequCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        errorMessage.add("出院带药不能是长期医嘱。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 如果是临时医嘱 开了就结束了. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    if ("ONCE".equals(item.getFrequCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        item.setEndTime(item.getStartTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    if (dao.dischargeWithMedicationAdministration(item.getSupplyCode()) == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        errorMessage.add("出院带药给药方式不能包含费用。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    if (item.getStartTime() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        errorMessage.add("出院带药请输入开始时间。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    if (item.getEndTime() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        errorMessage.add("出院带药请输入结束时间。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     item.setDrugOcc(item.getDrugQuan()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 计算普通药品的领量 durg_quan durg_occ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1547,7 +1548,7 @@ public class YiZhuLuRuServer { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq("a.admiss_times", times) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq("a.status_flag", "1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq("a.enter_oper", TokenUtil.getTokenUserId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .eq("isnull(a.self_buy,'0')", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq("isnull(a.supply_code,'0')", 出院带药); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         XinZhenYiZhu patInfo = dao.queryPatientInfo(patNo, times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         patInfo.setList(dao.selectOrderNo(qw)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String userCode = TokenUtil.getTokenUserId(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1582,13 +1583,13 @@ public class YiZhuLuRuServer { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResultVo<Map<String, Object>> getMapResultVo(XinZhenYiZhu patInfo, String userCode, Map<String, List<XinZhenYzActOrder>> takeTheMedicineList, List<Integer> pageNoList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 根据不同的药房,生成不同的单子. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        int index = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (Map.Entry<String, List<XinZhenYzActOrder>> entry : takeTheMedicineList.entrySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer pageNo = pageNoList.get(index); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dao.summarySheetOfDrugs(pageNo, patInfo, userCode, entry.getKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dao.insertDetailedMedicineList(pageNo, patInfo, userCode, entry.getKey(), entry.getValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            index++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        int index = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        for (Map.Entry<String, List<XinZhenYzActOrder>> entry : takeTheMedicineList.entrySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            Integer pageNo = pageNoList.get(index); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            dao.summarySheetOfDrugs(pageNo, patInfo, userCode, entry.getKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            dao.insertDetailedMedicineList(pageNo, patInfo, userCode, entry.getKey(), entry.getValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            index++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (XinZhenYzActOrder order : patInfo.getList()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 出院带药 确认了直接停止医嘱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dao.takeMedicineAfterDischargeStopOrder(order.getActOrderNo(), userCode, new Date()); 
			 |