| 
														
															@@ -489,27 +489,26 @@ public class YiZhuLuRuServer { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @param param 参数 
														 | 
														
														 | 
														
															      * @param param 参数 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * @return 
														 | 
														
														 | 
														
															      * @return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      */ 
														 | 
														
														 | 
														
															      */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public ResultVo<List<BigDecimal>> insertTemplateOrder(XinZhenYiZhu param) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public ResultVo<List<String>> insertTemplateOrder(XinZhenYiZhu param) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (StringUtil.isBlank(param.getInpatientNo())) { 
														 | 
														
														 | 
														
															         if (StringUtil.isBlank(param.getInpatientNo())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return ResultVoUtil.fail(ExceptionEnum.ERROR_MESSAGE, "请先选择患者."); 
														 | 
														
														 | 
														
															             return ResultVoUtil.fail(ExceptionEnum.ERROR_MESSAGE, "请先选择患者."); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<String> returnOrderList = new ArrayList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        XinZhenYiZhu patInfo = dao.queryPatientInfo(param.getInpatientNo(), param.getAdmissTimes()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<XinZhenYzActOrder> list = param.getList(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<BigDecimal> list = new ArrayList<>(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        XinZhenYiZhu huanZheXinXi = dao.queryPatientInfo(param.getInpatientNo(), param.getAdmissTimes()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        // 把模板的数据插入到医嘱 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        getThis().templateInsertToOrder(treemapTransformation(param.getList(), list), huanZheXinXi); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "插入模板数据成功。", list); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    private List<XinZhenYzActOrder> treemapTransformation(List<XinZhenYzActOrder> list, List<BigDecimal> returnList) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<XinZhenYzActOrder> resList = new ArrayList<>(); 
														 | 
														
														 | 
														
															         List<XinZhenYzActOrder> resList = new ArrayList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         Map<BigDecimal, XinZhenYzActOrder> map = new HashMap<>(list.size()); 
														 | 
														
														 | 
														
															         Map<BigDecimal, XinZhenYzActOrder> map = new HashMap<>(list.size()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String userCode = TokenUtil.getTokenUserId(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Queue<BigDecimal> queue = new LinkedList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         for (XinZhenYzActOrder item : list) { 
														 | 
														
														 | 
														
															         for (XinZhenYzActOrder item : list) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if (item.getParentNo() == null) { 
														 | 
														
														 | 
														
															             if (item.getParentNo() == null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 resList.add(item); 
														 | 
														
														 | 
														
															                 resList.add(item); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             map.put(item.getActOrderNo(), item); 
														 | 
														
														 | 
														
															             map.put(item.getActOrderNo(), item); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            queue.offer(publicServer.getActOrderNo()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         list.forEach(item -> { 
														 | 
														
														 | 
														
															         list.forEach(item -> { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -523,30 +522,39 @@ public class YiZhuLuRuServer { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }); 
														 | 
														
														 | 
														
															         }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<XinZhenYzActOrder> data = new LinkedList<>(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        getThis().templateInsertToOrder(resList, patInfo, userCode, returnOrderList, queue); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "插入模板数据成功。", returnOrderList); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * 把模板数据插入到医嘱中 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @param resList         医嘱数据 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @param patInfo         患者信息 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @param userCode        用户编码 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @param returnOrderList 返回的医嘱号 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Transactional(rollbackFor = Exception.class) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public void templateInsertToOrder(List<XinZhenYzActOrder> resList, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                      XinZhenYiZhu patInfo, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                      String userCode, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                      List<String> returnOrderList, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                                      Queue<BigDecimal> queue) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         resList.forEach(item -> { 
														 | 
														
														 | 
														
															         resList.forEach(item -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            item.setActOrderNo(publicServer.getActOrderNo()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            data.add(item); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            returnList.add(item.getActOrderNo()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            item.setActOrderNo(queue.poll()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            returnOrderList.add(item.getActOrderNo().stripTrailingZeros().toPlainString()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            dao.insertEntryOrder(patInfo, item, userCode); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if (ListUtil.notBlank(item.getChildren())) { 
														 | 
														
														 | 
														
															             if (ListUtil.notBlank(item.getChildren())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 item.getChildren().forEach(children -> { 
														 | 
														
														 | 
														
															                 item.getChildren().forEach(children -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    children.setActOrderNo(publicServer.getActOrderNo()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    children.setActOrderNo(queue.poll()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     children.setParentNo(item.getActOrderNo()); 
														 | 
														
														 | 
														
															                     children.setParentNo(item.getActOrderNo()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    returnList.add(children.getActOrderNo()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    dao.insertEntryOrder(patInfo, children, userCode); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 }); 
														 | 
														
														 | 
														
															                 }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                data.addAll(item.getChildren()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }); 
														 | 
														
														 | 
														
															         }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return data; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    @Transactional(rollbackFor = Exception.class) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public void templateInsertToOrder(List<XinZhenYzActOrder> list, XinZhenYiZhu huanZheXinXi) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String userCode = TokenUtil.getTokenUserId(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        list.forEach(item -> { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            dao.insertEntryOrder(huanZheXinXi, item, userCode); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        }); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /** 
														 | 
														
														 | 
														
															     /** 
														 |