|
@@ -1637,5 +1637,55 @@ public class YiZhuLuRuServer {
|
|
|
return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
|
|
|
}
|
|
|
|
|
|
+ public ResultVo<String> copyTheDoctorSOrder(BigDecimal orderNo) {
|
|
|
+ QueryWrapper<?> qw = new QueryWrapper<>();
|
|
|
+ qw.eq("a.act_order_no", orderNo);
|
|
|
+ List<XinZhenYzActOrder> yiZhuList = dao.selectOrderNo(qw);
|
|
|
+ if (ListUtil.isBlank(yiZhuList)) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "原医嘱已经不存在了。");
|
|
|
+ }
|
|
|
+ XinZhenYzActOrder fatherOrder = yiZhuList.get(0);
|
|
|
+ QueryWrapper<?> childQw = new QueryWrapper<>();
|
|
|
+ childQw.eq("a.parent_no", fatherOrder.getActOrderNo());
|
|
|
+ List<XinZhenYzActOrder> childOrderList = dao.selectOrderNo(childQw);
|
|
|
+ UserInfo us = redisLikeService.getUserInfoByToken();
|
|
|
+ revertToTheDefaultState(fatherOrder, us, null);
|
|
|
+
|
|
|
+ List<XinZhenYzActOrder> addOrderList = new ArrayList<>();
|
|
|
+ addOrderList.add(fatherOrder);
|
|
|
+
|
|
|
+ if (ListUtil.notBlank(childOrderList)) {
|
|
|
+ childOrderList.forEach(item -> {
|
|
|
+ revertToTheDefaultState(item, us, fatherOrder.getActOrderNo());
|
|
|
+ addOrderList.add(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ XinZhenYiZhu patInfo = dao.queryPatientInfo(fatherOrder.getInpatientNo(), fatherOrder.getAdmissTimes());
|
|
|
+ getThis().insertATemplate(addOrderList, patInfo);
|
|
|
+ return ResultVoUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void insertATemplate(List<XinZhenYzActOrder> list, XinZhenYiZhu patInfo) {
|
|
|
+ String userCode = TokenUtil.getTokenUserId();
|
|
|
+ list.forEach(item -> {
|
|
|
+ dao.insertEntryOrder(patInfo, item, userCode);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void revertToTheDefaultState(XinZhenYzActOrder param, UserInfo us, BigDecimal parentNo) {
|
|
|
+ param.setActOrderNo(publicServer.getActOrderNo());
|
|
|
+ param.setStatusFlag("1");
|
|
|
+ Date newDate = new Date();
|
|
|
+ param.setOrderTime(newDate);
|
|
|
+ param.setStartTime(newDate);
|
|
|
+ param.setEndTime(null);
|
|
|
+ param.setEnterOper(us.getCode());
|
|
|
+ param.setSigner("");
|
|
|
+ param.setModifier("");
|
|
|
+ param.setParentNo(parentNo);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|