From e4b5fef59ea127c76f46ba785c19e9da46c9514d Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期一, 16 十二月 2024 18:12:13 +0800
Subject: [PATCH] zjh202412016

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java | 1420 ++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 1,020 insertions(+), 400 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
index 1e33d91..358ed9c 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
@@ -12,6 +12,7 @@
 import java.util.*;
 import java.util.List;
 import java.util.concurrent.*;
+import java.util.concurrent.locks.ReentrantLock;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import javax.annotation.Resource;
@@ -22,7 +23,9 @@
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.crypto.symmetric.DES;
 import cn.hutool.extra.pinyin.PinyinUtil;
 import cn.hutool.json.JSONArray;
@@ -31,19 +34,18 @@
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.databind.BeanProperty;
 import com.itextpdf.text.Document;
 import com.itextpdf.text.DocumentException;
+import com.ltkj.common.annotation.RepeatSubmit;
 import com.ltkj.common.core.domain.entity.SysDept;
 import com.ltkj.common.core.domain.entity.SysUser;
 import com.ltkj.common.core.redis.RedisCache;
 import com.ltkj.common.enums.DataSourceType;
-import com.ltkj.common.utils.AgeResult;
-import com.ltkj.common.utils.DateUtils;
-import com.ltkj.common.utils.PDFDocumentUtil;
-import com.ltkj.common.utils.SecurityUtils;
+import com.ltkj.common.utils.*;
 import com.ltkj.framework.config.MatchUtils;
 import com.ltkj.framework.config.ThreadPoolConfig;
 import com.ltkj.framework.config.UserHoder;
@@ -54,6 +56,7 @@
 import com.ltkj.hosp.hisDto.OutpinimpapplyDto;
 import com.ltkj.hosp.hisDto.OutpinmedicapplyDto;
 import com.ltkj.hosp.mapper.TestMapper;
+import com.ltkj.hosp.mapper.TjSamplingMapper;
 import com.ltkj.hosp.pacsDto.SavePacsApply;
 import com.ltkj.hosp.service.*;
 import com.ltkj.hosp.sqlDomain.LtkjMiddleDetail;
@@ -69,18 +72,16 @@
 import com.ltkj.mall.mallOrderUtils.TjConstants;
 import com.ltkj.mall.service.IMallCheckLogService;
 import com.ltkj.mall.service.IMallOrderService;
-import com.ltkj.system.service.ISysConfigService;
-import com.ltkj.system.service.ISysDeptService;
-import com.ltkj.system.service.ISysUserService;
-import com.ltkj.web.controller.his.HisApiGetMethodService;
-import com.ltkj.web.controller.his.HisApiMethod;
-import com.ltkj.web.controller.his.HisApiMethodService;
-import com.ltkj.web.controller.his.HisMzJysqController;
+import com.ltkj.system.domain.TjDjdDyjl;
+import com.ltkj.system.service.*;
+import com.ltkj.web.controller.his.*;
 import com.ltkj.web.controller.lis.LisApiMethod;
 import com.ltkj.web.controller.pacs.PacsApiMethodService;
+import com.ltkj.web.controller.service.TjSysAsyncServiceImpl;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import jodd.util.StringUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.aspectj.weaver.ast.Var;
@@ -89,6 +90,8 @@
 import org.springframework.http.HttpRequest;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.util.DigestUtils;
@@ -100,6 +103,8 @@
 import com.ltkj.common.utils.poi.ExcelUtil;
 import com.ltkj.common.core.page.TableDataInfo;
 
+import static com.ltkj.web.config.pdfutils.PDFBinaryUtil.getPDFBinary;
+
 /**
  * 浣撴璁板綍Controller
  *
@@ -107,8 +112,8 @@
  * @date 2022-11-21
  */
 @RestController
-@RequestMapping ("/hosp/order")
-@Api (tags = "PC绔� ----浣撴璁板綍鎺ュ彛")
+@RequestMapping("/hosp/order")
+@Api(tags = "PC绔� ----浣撴璁板綍鎺ュ彛")
 @Slf4j
 public class TjOrderController extends BaseController {
     @Resource
@@ -133,7 +138,7 @@
     private ITbTransitionService transitionService;
     @Resource
     private ISysConfigService configService;
-    @Value ("${path.filePath}")
+    @Value("${path.filePath}")
     private String value;
     @Resource
     private ITjOrderRemarkService remarkService;
@@ -141,61 +146,44 @@
     private TjAsyncService asyncService;
     @Resource
     private ISysUserService userService;
-
     @Resource
     private RedisCache redisCache;
     @Autowired
     private ITjReportPrintService tjReportPrintService;
-
     @Resource
     private ITjPrintOrderService printOrderService;
-
     @Resource
     private IJimuOnlineReportService reportService;
-
     @Resource
     private ITjSurveyRecordService surveyRecordService;
-
     @Autowired
     private IMallOrderService mallOrderService;
     @Autowired
     private IMallCheckLogService mallCheckLogService;
     @Resource
     private ITjDwDeptService dwDeptService;
-
     @Resource
     private ITjDwGroupingService dwGroupingService;
-
     @Resource
     private ITjOrderDetailRulesService orderDetailRulesService;
-
     @Resource
     private ITjRulesService rulesService;
-
     @Autowired
     private ITjAskMedicalHistoryService tjAskMedicalHistoryService;
-
     @Autowired
     private ITjReportGetAddressService tjReportGetAddressService;
-
     @Resource
     private TestMapper testMapper;
-
     @Resource
     private LtkjMiddleDetailService middleDetailService;
-
     @Resource
     private LtkjMiddleHeadService headService;
     @Resource
     private TjvLtkjvtjpatService tjvLtkjvtjpatService;
     @Autowired
     private ThreadPoolConfig threadPoolConfig;
-
     @Autowired
     private HisApiMethod hisApiMethod;
-
-    @Autowired
-    private HisMzJysqController hisMzJysqController;
     @Autowired
     private HisApiGetMethodService hisApiGetMethodService;
     @Autowired
@@ -204,6 +192,8 @@
     private HisApiMethodService controller;
     @Autowired
     private TjProBlService blService;
+    @Resource
+    private ITjReportTemplateService reportTemplateService;
     @Autowired
     private LtkjJianchajianyanTreeService ltkjJianchajianyanTreeService;
     @Autowired
@@ -212,9 +202,32 @@
     private ITbTransitionService tbTransitionService;
     @Autowired
     private LisApiMethod lisApiMethod;
-
     @Autowired
     private TjCfService cfService;
+    @Autowired
+    private TjReportController reportController;
+    @Resource
+    private ITjReportService tjReportService;
+    @Autowired
+    private HisPDFUtil hisPDFUtil;
+    @Value("${path.reportServer}")
+    private String urlValue;
+    @Autowired
+    private ITjSamplingService samplingService;
+    @Autowired
+    private TjSamplingMapper tjSamplingMapper;
+    @Autowired
+    private ITjGroupingProService groupingProService;
+    @Autowired
+    private ITjDjdDyjlService djdDyjlService;
+    @Autowired
+    private IdUtils idUtils;
+    @Autowired
+    private LtkjJybbzdService jybbzdService;
+    @Autowired
+    private LisJyflhbService lisJyflhbService;
+    @Autowired
+    private ISysDictDataService sysDictDataService;
 
     //灏嗘柟娉曡繑鍥炲�艰В鏋愭垚json鏍煎紡
     public JSONObject getJSONObject(String builder) {
@@ -231,8 +244,8 @@
      * 鏌ヨ浣撴璁板綍鍒楄〃
      */
 //    @PreAuthorize("@ss.hasPermi('hosp:order:list')")
-    @GetMapping ("/list")
-    @ApiOperation (value = "鏌ヨ浣撴璁板綍鍒楄〃(榛樿)")
+    @GetMapping("/list")
+    @ApiOperation(value = "鏌ヨ浣撴璁板綍鍒楄〃(榛樿)")
     public TableDataInfo list(TjOrder tjOrder) {
         startPage();
         startOrderBy();
@@ -265,16 +278,16 @@
     }
 
 
-    @GetMapping ("/getWenJuanList")
-    @ApiOperation (value = "鏌ヨ浣撴璁板綍鍒楄〃")
-    public AjaxResult getWenJuanList(@ApiParam (value = "椤电爜鏁�(榛樿1)") @RequestParam (defaultValue = "1") Integer pageNum,
-                                     @ApiParam (value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam (defaultValue = "10") Integer pageSize,
-                                     @ApiParam (value = "浣撴鍙�") @RequestParam (required = false) String tjNum,
-                                     @ApiParam (value = "濮撳悕") @RequestParam (required = false) String name,
-                                     @ApiParam (value = "鐧昏寮�濮嬫椂闂�") @RequestParam (required = false) Date djbeginTime,
-                                     @ApiParam (value = "鐧昏缁撴潫鏃堕棿") @RequestParam (required = false) Date djendTime,
-                                     @ApiParam (value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam (required = false) Date bgbeginTime,
-                                     @ApiParam (value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam (required = false) Date bgendTime) {
+    @GetMapping("/getWenJuanList")
+    @ApiOperation(value = "鏌ヨ浣撴璁板綍鍒楄〃")
+    public AjaxResult getWenJuanList(@ApiParam(value = "椤电爜鏁�(榛樿1)") @RequestParam(defaultValue = "1") Integer pageNum,
+                                     @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize,
+                                     @ApiParam(value = "浣撴鍙�") @RequestParam(required = false) String tjNum,
+                                     @ApiParam(value = "濮撳悕") @RequestParam(required = false) String name,
+                                     @ApiParam(value = "鐧昏寮�濮嬫椂闂�") @RequestParam(required = false) Date djbeginTime,
+                                     @ApiParam(value = "鐧昏缁撴潫鏃堕棿") @RequestParam(required = false) Date djendTime,
+                                     @ApiParam(value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam(required = false) Date bgbeginTime,
+                                     @ApiParam(value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam(required = false) Date bgendTime) {
         Map<String, Object> map = new HashMap<>();
         if (null != name) {
             LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>();
@@ -394,75 +407,27 @@
     }
 
 
-    @GetMapping ("/getOrderList")
-    @ApiOperation (value = "鏌ヨ浣撴璁板綍鍒楄〃")
-    public AjaxResult getOrderList(@ApiParam (value = "椤电爜鏁�(榛樿1)") @RequestParam (defaultValue = "1") Integer pageNum,
-                                   @ApiParam (value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam (defaultValue = "10") Integer pageSize,
-                                   @ApiParam (value = "浣撴鍙�)") @RequestParam (required = false) String tjNum,
-                                   @ApiParam (value = "濮撳悕)") @RequestParam (required = false) String name,
-                                   @ApiParam (value = "椤圭洰鍚�)") @RequestParam (required = false) String xmmc,
-                                   @ApiParam (value = "鐧昏寮�濮嬫椂闂�") @RequestParam (required = false) Date djbeginTime,
-                                   @ApiParam (value = "鐧昏缁撴潫鏃堕棿") @RequestParam (required = false) Date djendTime,
-                                   @ApiParam (value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam (required = false) Date bgbeginTime,
-                                   @ApiParam (value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam (required = false) Date bgendTime) {
+    @GetMapping("/getOrderList")
+    @ApiOperation(value = "鏌ヨ浣撴璁板綍鍒楄〃")
+    public AjaxResult getOrderList(@ApiParam(value = "椤电爜鏁�(榛樿1)") @RequestParam(defaultValue = "1") Integer pageNum,
+                                   @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize,
+                                   @ApiParam(value = "鐘舵��") @RequestParam(required = false) Integer zt,
+                                   @ApiParam(value = "浣撴鍙�)") @RequestParam(required = false) String tjNum,
+                                   @ApiParam(value = "濮撳悕)") @RequestParam(required = false) String name,
+                                   @ApiParam(value = "椤圭洰鍚�)") @RequestParam(required = false) String xmmc,
+                                   @ApiParam(value = "鐧昏寮�濮嬫椂闂�") @RequestParam(required = false) Date djbeginTime,
+                                   @ApiParam(value = "鐧昏缁撴潫鏃堕棿") @RequestParam(required = false) Date djendTime,
+                                   @ApiParam(value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam(required = false) Date bgbeginTime,
+                                   @ApiParam(value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam(required = false) Date bgendTime,
+                                   @ApiParam(value = "鍗曚綅") @RequestParam(required = false) String dw) {
         Map<String, Object> map = new HashMap<>();
+        List<Long> cusIds = null;
         if (null != name) {
             LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>();
             wqq.like(TjCustomer::getCusName, name);
-            List<TjCustomer> customerList = tjCustomerService.list(wqq);
-            if (null != customerList && customerList.size() > 0) {
-                List<TjOrder> list = new ArrayList<>();
-                for (TjCustomer customer : customerList) {
-                    LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
-                    if (null != djbeginTime && null != djendTime) {
-                        wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(djbeginTime), DateUtil.endOfDay(djendTime));
-                    }
-                    wq.eq(TjOrder::getUserId, customer.getCusId());
-                    list.addAll(tjOrderService.list(wq));
-                }
-                List<TjOrder> collect = null;
-                if (list.size() > 0) {
-                    for (TjOrder order : list) {
-                        TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId());
-                        if (null != tjCustomer) {
-//                            order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName()));
-                            order.setTjCustomerName(tjCustomer.getCusName());
-//                            order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone()));
-                            order.setTjCustomerPhone(tjCustomer.getCusPhone());
-//                            order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard()));
-                            order.setTjCusIdCard(tjCustomer.getCusIdcard());
-                            order.setTjCustomerSex(tjCustomer.getCusSex());
-                            order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
-                            order.setCareer(tjCustomer.getCareer());
-                            order.setIdType(tjCustomer.getIdType());
-                            order.setAgeUnit(tjCustomer.getAgeUnit());
-                            order.setTjCount(String.valueOf(tjCustomer.getCusNumber()));
-                        }
-                        String firmId = order.getFirmId();
-                        if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) {
-                            order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName());
-                        }
-                        if (null != order.getPacId()) {
-                            if (null != tjPackageService.getById(order.getPacId())) {
-                                order.setPacName(tjPackageService.getById(order.getPacId()).getPacName());
-                            }
-                            if (null != dwDeptService.getById(order.getPacId())) {
-                                order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName());
-                            }
-                        }
-                    }
-                    collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
-                }
-                if (null != collect) {
-                    map.put("total", collect.size());
-                } else {
-                    map.put("total", 0);
-                }
-                map.put("list", collect);
-                return AjaxResult.success(map);
-            }
-
+            cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList());
         }
+
         Page<TjOrder> page1 = new Page<>(pageNum, pageSize);
         LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
         if (null != djbeginTime && null != djendTime) {
@@ -478,6 +443,94 @@
 
         if (null != xmmc) {
             wq.in(TjOrder::getTjNumber, projectService.getTjNumLIstByXmmx(xmmc));
+        }
+
+        if (StrUtil.isNotBlank(dw)) {
+            wq.like(TjOrder::getFirmName, dw);
+        }
+
+        if (null != cusIds && !cusIds.isEmpty()) {
+            wq.in(TjOrder::getUserId, cusIds);
+        }
+
+        if(null !=zt && (zt==0 || zt==1 || zt==2)){
+            List<TjOrder> orders=new ArrayList<>();
+            List<TjOrder> tjOrders=null;
+            List<TjOrder> orderList = tjOrderService.list(wq);
+            if(null !=orderList && !orderList.isEmpty()){
+                for (TjOrder order : orderList) {
+                    int czwj = remarkService.panduaniscunzaiweijian(order.getTjNumber());
+                    int sfwc = remarkService.panduaniswancheng(order.getTjNumber());
+                    if (zt==0 && czwj == 0) {
+                        //鏈0
+                        order.setZt("鏈");
+                        orders.add(order);
+                    }
+                    if (zt==1 && czwj > 0) {
+                        //鍦ㄦ1
+                        order.setZt("鍦ㄦ");
+                        orders.add(order);
+                    }
+                    if (zt==2 && sfwc == 0) {
+                        //宸插畬鎴�2
+                        order.setZt("宸插畬鎴�");
+                        orders.add(order);
+                    }
+                }
+                if(!orders.isEmpty()){
+                    tjOrders=orders.stream().sorted(Comparator.comparing(TjOrder::getCreateTime).reversed())
+                            .skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
+                    for (TjOrder order : tjOrders) {
+                        TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId());
+                        if (null != tjCustomer) {
+                            order.setTjCustomerSex(tjCustomer.getCusSex());
+                            order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
+                            order.setTjCustomerName(tjCustomer.getCusName());
+                            order.setTjCustomerPhone(tjCustomer.getCusPhone());
+                            order.setTjCusIdCard(tjCustomer.getCusIdcard());
+                            order.setCareer(tjCustomer.getCareer());
+                            order.setIdType(tjCustomer.getIdType());
+                            order.setAgeUnit(tjCustomer.getAgeUnit());
+                            order.setTjCount(String.valueOf(tjCustomer.getCusNumber()));
+                            if (null != tjCustomer.getCompName()) {
+                                order.setDictCompName(tjCustomer.getCompName());
+                            } else {
+                                String firmId = order.getFirmId();
+                                if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) {
+                                    order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName());
+                                }
+                            }
+                            if (null != order.getPacId()) {
+                                if (null != tjPackageService.getById(order.getPacId())) {
+                                    order.setPacName(tjPackageService.getById(order.getPacId()).getPacName());
+                                } else if (null != dwDeptService.getById(order.getPacId())) {
+                                    order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName());
+                                }
+                            }
+                            TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber());
+                            if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs()));
+                        }
+                    }
+                }
+            }
+            map.put("list", tjOrders);
+            map.put("total", orders.size());
+            return AjaxResult.success(map);
+        }
+
+        if(null !=zt){
+            if(zt==3){
+                wq.isNotNull(TjOrder::getCheckTime);
+            }
+            if(zt==4){
+                wq.isNotNull(TjOrder::getReportTime);
+            }
+            if(zt==5){
+                wq.eq(TjOrder::getHeshouStatus,1);
+            }
+            if(zt==6){
+                wq.isNotNull(TjOrder::getPrintLastTime);
+            }
         }
 
         wq.orderByDesc(TjOrder::getCreateTime);
@@ -496,17 +549,72 @@
                     order.setIdType(tjCustomer.getIdType());
                     order.setAgeUnit(tjCustomer.getAgeUnit());
                     order.setTjCount(String.valueOf(tjCustomer.getCusNumber()));
+                    if (null != tjCustomer.getCompName()) {
+                        order.setDictCompName(tjCustomer.getCompName());
+                    } else {
+                        String firmId = order.getFirmId();
+                        if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) {
+                            order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName());
+                        }
+                    }
+                    if (null != order.getPacId()) {
+                        if (null != tjPackageService.getById(order.getPacId())) {
+                            order.setPacName(tjPackageService.getById(order.getPacId()).getPacName());
+                        } else if (null != dwDeptService.getById(order.getPacId())) {
+                            order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName());
+                        }
+                    }
+                    TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber());
+                    if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs()));
                 }
-                String firmId = order.getFirmId();
-                if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) {
-                    order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName());
-                }
-                if (null != order.getPacId()) {
-                    if (null != tjPackageService.getById(order.getPacId())) {
-                        order.setPacName(tjPackageService.getById(order.getPacId()).getPacName());
-                    }else
-                    if (null != dwDeptService.getById(order.getPacId())) {
-                        order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName());
+                int czwj = remarkService.panduaniscunzaiweijian(order.getTjNumber());
+                int sfwc = remarkService.panduaniswancheng(order.getTjNumber());
+                Date checkTime = order.getCheckTime();
+                Date reportTime = order.getReportTime();
+                Integer heshouStatus = order.getHeshouStatus();
+                Date lastTime = order.getPrintLastTime();
+
+                if(null !=zt){
+                    if(zt==3){
+                        order.setZt("宸插鏍�");
+                    }
+                    if(zt==4){
+                        order.setZt("鐢熸垚鎶ュ憡");
+                    }
+                    if(zt==5){
+                        order.setZt("鎶ュ憡鏍告敹");
+                    }
+                    if(zt==6){
+                        order.setZt("宸插嚭鎶ュ憡");
+                    }
+                }else {
+                    if (czwj == 0) {
+                        //鏈0
+                        order.setZt("鏈");
+                    }
+                    if (czwj > 0) {
+                        //鍦ㄦ1
+                        order.setZt("鍦ㄦ");
+                    }
+                    if (sfwc == 0) {
+                        //宸插畬鎴�2
+                        order.setZt("宸插畬鎴�");
+                    }
+                    if (null != checkTime) {
+                        //宸插鏍�3
+                        order.setZt("宸插鏍�");
+                    }
+                    if (null != reportTime) {
+                        //鐢熸垚鎶ュ憡4
+                        order.setZt("鐢熸垚鎶ュ憡");
+                    }
+                    if (1== heshouStatus) {
+                        //鎶ュ憡鏍告敹5
+                        order.setZt("鎶ュ憡鏍告敹");
+                    }
+                    if (null != lastTime) {
+                        //宸插嚭鎶ュ憡6
+                        order.setZt("宸插嚭鎶ュ憡");
                     }
                 }
             }
@@ -517,89 +625,173 @@
     }
 
 
-    @GetMapping ("/getOrderListOO")
-    @ApiOperation (value = "浣撴鎶ュ憡椤甸潰鈥斺�斾綋妫�璁板綍鍒楄〃")
-    public AjaxResult getOrderListOO(@ApiParam (value = "椤电爜鏁�(榛樿1)") @RequestParam (defaultValue = "1") Integer pageNum,
-                                     @ApiParam (value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam (defaultValue = "10") Integer pageSize,
-                                     @ApiParam (value = "浣撴鍙�)") @RequestParam (required = false) String tjNum,
-                                     @ApiParam (value = "濮撳悕)") @RequestParam (required = false) String name,
-                                     @ApiParam (value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam (required = false) Date bgbeginTime,
-                                     @ApiParam (value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam (required = false) Date bgendTime) {
+    @GetMapping("/getOrderListOO")
+    @ApiOperation(value = "浣撴鎶ュ憡椤甸潰鈥斺�斾綋妫�璁板綍鍒楄〃")
+    public AjaxResult getOrderListOO(@ApiParam(value = "椤电爜鏁�(榛樿1)") @RequestParam(defaultValue = "1") Integer pageNum,
+                                     @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize,
+                                     @ApiParam(value = "鎵撳嵃鏈墦鍗扮姸鎬� 0鏈墦鍗� 1宸叉墦鍗�") @RequestParam(defaultValue = "0") Integer dyzt,
+                                     @ApiParam(value = "浣撴鍙�)") @RequestParam(required = false) String tjNum,
+                                     @ApiParam(value = "濮撳悕)") @RequestParam(required = false) String name,
+                                     @ApiParam(value = "鍗曚綅") @RequestParam(required = false) String dw,
+                                     @ApiParam(value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam(required = false) String djbeginTime,
+                                     @ApiParam(value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam(required = false) String djendTime) {
         Map<String, Object> map = new HashMap<>();
-        if (null != name) {
+        List<Long> cusIds = null;
+        if (StringUtil.isNotBlank(name)) {
             LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>();
             wqq.like(TjCustomer::getCusName, name);
-            List<TjCustomer> customerList = tjCustomerService.list(wqq);
-            if (null != customerList && !customerList.isEmpty()) {
-                List<TjOrder> list = new ArrayList<>();
-                for (TjCustomer customer : customerList) {
-                    LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
-                    wq.isNotNull(TjOrder::getReportTime);
-                    wq.eq(TjOrder::getUserId, customer.getCusId());
-                    wq.eq(TjOrder::getHeshouStatus, 1); //鏍告敹鐘舵�佷负1鎵嶈兘鎵撳嵃
-                    list.addAll(tjOrderService.list(wq));
-                }
-                List<TjOrder> collect = null;
-                if (!list.isEmpty()) {
-
-                    for (int i = 0; i < list.size(); i++) {
-                        TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId());
-                        if (null == tjCustomer) {
-                            list.remove(list.get(i));
-                            continue;
-                        }
-                        list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
-                        list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
-                        list.get(i).setTjCustomerName(tjCustomer.getCusName());
-                        list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone()));
-                        list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard()));
-
-                        String firmId = list.get(i).getFirmId();
-                        if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) {
-                            list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName());
-                        }
-                        if (null != list.get(i).getPacId()) {
-                            if (null != tjPackageService.getById(list.get(i).getPacId())) {
-                                list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName());
-                            }
-                            if (null != dwDeptService.getById(list.get(i).getPacId())) {
-                                list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName());
-                            }
-                        }
-                        //浠庢墦鍗拌褰曟煡鍑烘渶鏂版墦鍗版椂闂�
-                        LambdaQueryWrapper<TjReportPrint> wqqq = new LambdaQueryWrapper<>();
-                        wqqq.eq(TjReportPrint::getTjNumber, list.get(i).getTjNumber());
-                        wqqq.orderByDesc(TjReportPrint::getPrintTime);
-                        wqqq.last("limit 1");
-                        TjReportPrint one = tjReportPrintService.getOne(wqqq);
-                        if (one != null) {
-                            list.get(i).setPrintLastTime(one.getPrintTime());
-                        }
-
-                    }
-                    collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
-                }
-                if (null != collect) {
-                    map.put("total", collect.size());
-                } else {
-                    map.put("total", 0);
-                }
-                map.put("list", collect);
-                return AjaxResult.success(map);
-            }
+            cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList());
+//            if (null != customerList && !customerList.isEmpty()) {
+//                List<TjOrder> list = new ArrayList<>();
+//                for (TjCustomer customer : customerList) {
+//                    LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
+//                    wq.eq(TjOrder::getUserId, customer.getCusId());
+//                    if (dyzt == 0) {
+//                        wq.isNull(TjOrder::getPrintLastTime);
+//                        wq.eq(TjOrder::getHeshouStatus, 1);
+//                    } else {
+//                        wq.isNotNull(TjOrder::getPrintLastTime);
+//                    }
+//                    list.addAll(tjOrderService.list(wq));
+//                }
+//                List<TjOrder> collect = null;
+//                if (!list.isEmpty()) {
+//
+//                    for (int i = 0; i < list.size(); i++) {
+//                        TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId());
+//                        if (null == tjCustomer) {
+//                            list.remove(list.get(i));
+//                            continue;
+//                        }
+//                        list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
+//                        list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
+//                        list.get(i).setTjCustomerName(tjCustomer.getCusName());
+//                        list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone());
+//                        list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard());
+//
+//                        if (null != tjCustomer.getCompName()) {
+//                            list.get(i).setDictCompName(tjCustomer.getCompName());
+//                        } else {
+//                            String firmId = list.get(i).getFirmId();
+//                            if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) {
+//                                list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName());
+//                            }
+//                        }
+//
+//                        if (null != list.get(i).getPacId()) {
+//                            if (null != tjPackageService.getById(list.get(i).getPacId())) {
+//                                list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName());
+//                            }
+//                            if (null != dwDeptService.getById(list.get(i).getPacId())) {
+//                                list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName());
+//                            }
+//                        }
+//                    }
+//                    collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
+//                }
+//                if (null != collect) {
+//                    map.put("total", collect.size());
+//                } else {
+//                    map.put("total", 0);
+//                }
+//                if (collect == null) collect = new ArrayList<>();
+//                map.put("list", collect);
+//                return AjaxResult.success(map);
+//            }
 
         }
+//        if (StringUtil.isNotBlank(dw)) {
+//            LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>();
+//            wqq.like(TjCustomer::getCompName, dw);
+//            List<TjCustomer> customerList = tjCustomerService.list(wqq);
+//            List<TjOrder> list = new ArrayList<>();
+//            if (null != customerList && !customerList.isEmpty()) {
+//                for (TjCustomer customer : customerList) {
+//                    LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
+//                    wq.eq(TjOrder::getUserId, customer.getCusId());
+//                    if (dyzt == 0) {
+//                        wq.isNull(TjOrder::getPrintLastTime);
+//                        wq.eq(TjOrder::getHeshouStatus, 1);
+//                    } else {
+//                        wq.isNotNull(TjOrder::getPrintLastTime);
+//                    }
+//                    list.addAll(tjOrderService.list(wq));
+//                }
+//            }
+//            List<String> dwIds = iDictCompService.getdwIdByDwName(dw);
+//
+//            LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
+//            wq.in(TjOrder::getFirmId, dwIds);
+//            list.addAll(tjOrderService.list(wq));
+//            List<TjOrder> collect = null;
+//            if (!list.isEmpty()) {
+//                List<TjOrder> orders = list.stream().distinct().collect(Collectors.toList());
+//                for (int i = 0; i < orders.size(); i++) {
+//                    TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId());
+//                    if (null == tjCustomer) {
+//                        list.remove(list.get(i));
+//                        continue;
+//                    }
+//                    list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
+//                    list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
+//                    list.get(i).setTjCustomerName(tjCustomer.getCusName());
+//                    list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone());
+//                    list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard());
+//
+//                    if (null != tjCustomer.getCompName()) {
+//                        list.get(i).setDictCompName(tjCustomer.getCompName());
+//                    } else {
+//                        String firmId = list.get(i).getFirmId();
+//                        if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) {
+//                            list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName());
+//                        }
+//                    }
+//
+//                    if (null != list.get(i).getPacId()) {
+//                        if (null != tjPackageService.getById(list.get(i).getPacId())) {
+//                            list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName());
+//                        }
+//                        if (null != dwDeptService.getById(list.get(i).getPacId())) {
+//                            list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName());
+//                        }
+//                    }
+//                }
+//                collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
+//            }
+//            if (null != collect) {
+//                map.put("total", collect.size());
+//            } else {
+//                map.put("total", 0);
+//            }
+//            map.put("list", collect);
+//            return AjaxResult.success(map);
+//
+//
+//        }
+
+
         Page<TjOrder> page1 = new Page<>(pageNum, pageSize);
         LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
-        wq.isNotNull(TjOrder::getReportTime);
-        wq.eq(TjOrder::getHeshouStatus, 1);  //鏍告敹鐘舵�佷负1鎵嶈兘鎵撳嵃
-        if (null != bgbeginTime && null != bgendTime) {
-            wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(bgbeginTime), DateUtil.endOfDay(bgendTime));
+        if (dyzt == 0) {
+            wq.isNull(TjOrder::getPrintLastTime);
+            wq.eq(TjOrder::getHeshouStatus, 1);  //鏍告敹鐘舵�佷负1鎵嶈兘鎵撳嵃
+        } else {
+            wq.isNotNull(TjOrder::getPrintLastTime);
+        }
+
+        if (null != djbeginTime && null != djendTime) {
+            wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(DateUtil.parseDate(djbeginTime)), DateUtil.endOfDay(DateUtil.parseDate(djendTime)));
         }
         if (null != tjNum) {
-            wq.eq(TjOrder::getTjNumber, tjNum);
+            wq.like(TjOrder::getTjNumber, tjNum);
         }
-        wq.orderByDesc(TjOrder::getReportTime);
+        if (StringUtil.isNotBlank(dw)) {
+            wq.like(TjOrder::getFirmName, dw);
+        }
+        if (null != cusIds && !cusIds.isEmpty()) {
+            wq.in(TjOrder::getUserId, cusIds);
+        }
+        wq.orderByDesc(TjOrder::getCreateTime);
         Page<TjOrder> page2 = tjOrderService.page(page1, wq);
         List<TjOrder> list = page2.getRecords();
         if (list != null) {
@@ -612,14 +804,18 @@
                 list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
                 list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
                 list.get(i).setTjCustomerName(tjCustomer.getCusName());
-                list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone()));
+                list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone());
                 if (tjCustomer.getCusIdcard() != null) {
-                    list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard()));
+                    list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard());
                 }
 
-                String firmId = list.get(i).getFirmId();
-                if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) {
-                    list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName());
+                if (null != tjCustomer.getCompName()) {
+                    list.get(i).setDictCompName(tjCustomer.getCompName());
+                } else {
+                    String firmId = list.get(i).getFirmId();
+                    if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) {
+                        list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName());
+                    }
                 }
                 if (null != list.get(i).getPacId()) {
                     if (null != tjPackageService.getById(list.get(i).getPacId())) {
@@ -630,14 +826,14 @@
                     }
                 }
                 //浠庢墦鍗拌褰曟煡鍑烘渶鏂版墦鍗版椂闂�
-                LambdaQueryWrapper<TjReportPrint> wqqq = new LambdaQueryWrapper<>();
-                wqqq.eq(TjReportPrint::getTjNumber, list.get(i).getTjNumber());
-                wqqq.orderByDesc(TjReportPrint::getPrintTime);
-                wqqq.last("limit 1");
-                TjReportPrint one = tjReportPrintService.getOne(wqqq);
-                if (one != null) {
-                    list.get(i).setPrintLastTime(one.getPrintTime());
-                }
+//                LambdaQueryWrapper<TjReportPrint> wqqq = new LambdaQueryWrapper<>();
+//                wqqq.eq(TjReportPrint::getTjNumber, list.get(i).getTjNumber());
+//                wqqq.orderByDesc(TjReportPrint::getPrintTime);
+//                wqqq.last("limit 1");
+//                TjReportPrint one = tjReportPrintService.getOne(wqqq);
+//                if (one != null) {
+//                    list.get(i).setPrintLastTime(one.getPrintTime());
+//                }
             }
         }
         map.put("list", list);
@@ -646,15 +842,15 @@
     }
 
 
-    @GetMapping ("/getPrintOrderList")
-    @ApiOperation (value = "浣撴鍙戠エ鎵撳嵃鎺ュ彛")
-    public AjaxResult getPrintOrderList(@ApiParam (value = "椤电爜鏁�(榛樿1)") @RequestParam (defaultValue = "1") Integer pageNum,
-                                        @ApiParam (value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam (defaultValue = "10") Integer pageSize,
-                                        @ApiParam (value = "浣撴鍙�)") @RequestParam (required = false) String tjNum,
-                                        @ApiParam (value = "宸叉墦鍗版湭鎵撳嵃0鏈墦鍗�1宸叉墦鍗�)") @RequestParam (required = false) Integer type,
-                                        @ApiParam (value = "濮撳悕") @RequestParam (required = false) String name,
-                                        @ApiParam (value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam (required = false) Date bgbeginTime,
-                                        @ApiParam (value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam (required = false) Date bgendTime) {
+    @GetMapping("/getPrintOrderList")
+    @ApiOperation(value = "浣撴鍙戠エ鎵撳嵃鎺ュ彛")
+    public AjaxResult getPrintOrderList(@ApiParam(value = "椤电爜鏁�(榛樿1)") @RequestParam(defaultValue = "1") Integer pageNum,
+                                        @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize,
+                                        @ApiParam(value = "浣撴鍙�)") @RequestParam(required = false) String tjNum,
+                                        @ApiParam(value = "宸叉墦鍗版湭鎵撳嵃0鏈墦鍗�1宸叉墦鍗�)") @RequestParam(required = false) Integer type,
+                                        @ApiParam(value = "濮撳悕") @RequestParam(required = false) String name,
+                                        @ApiParam(value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam(required = false) Date bgbeginTime,
+                                        @ApiParam(value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam(required = false) Date bgendTime) {
         Map<String, Object> map = new HashMap<>();
         List<TjOrder> collect = null;
         if (null != name) {
@@ -845,9 +1041,9 @@
      * 瀵煎嚭浣撴璁板綍鍒楄〃
      */
 //    @PreAuthorize("@ss.hasPermi('hosp:order:export')")
-    @Log (title = "浣撴璁板綍", businessType = BusinessType.EXPORT)
-    @PostMapping ("/export")
-    @ApiOperation (value = "瀵煎嚭浣撴璁板綍鍒楄〃")
+    @Log(title = "浣撴璁板綍", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ApiOperation(value = "瀵煎嚭浣撴璁板綍鍒楄〃")
     public void export(HttpServletResponse response, TjOrder tjOrder) {
         //List<TjOrder> list = tjOrderService.selectTjOrderList(tjOrder);
         List<TjOrder> list = tjOrderService.selectExportOrderList(tjOrder);
@@ -859,15 +1055,15 @@
      * 鑾峰彇浣撴璁板綍璇︾粏淇℃伅
      */
 //    @PreAuthorize("@ss.hasPermi('hosp:order:query')")
-    @GetMapping (value = "/{orderId}")
-    @ApiOperation (value = "鑾峰彇浣撴璁板綍璇︾粏淇℃伅")
-    public AjaxResult getInfo(@PathVariable ("orderId") Long orderId) {
+    @GetMapping(value = "/{orderId}")
+    @ApiOperation(value = "鑾峰彇浣撴璁板綍璇︾粏淇℃伅")
+    public AjaxResult getInfo(@PathVariable("orderId") Long orderId) {
         return success(tjOrderService.selectTjOrderByOrderId(orderId));
     }
 
 
-    @GetMapping ("/getIsRequired")
-    @ApiOperation (value = "鏍规嵁鍙傛暟閰嶇疆鑾峰彇鏄惁蹇呭~椤癸紙韬唤璇併�佹�у埆銆佺數璇濄�佺収鐗囥�佹槸鍚︾洿鎺ヤ笅鍗曪級")
+    @GetMapping("/getIsRequired")
+    @ApiOperation(value = "鏍规嵁鍙傛暟閰嶇疆鑾峰彇鏄惁蹇呭~椤癸紙韬唤璇併�佹�у埆銆佺數璇濄�佺収鐗囥�佹槸鍚︾洿鎺ヤ笅鍗曪級")
     public AjaxResult getIsRequired() {
         Map<String, String> res = new HashMap<>();
         res.put("has_idcard", configService.selectConfigByKey("has_idcard"));
@@ -882,9 +1078,14 @@
     /**
      * 浣撴绛惧埌鐧昏鎺ュ彛
      */
+
+
+    ReentrantLock lock = new ReentrantLock();
+
     @PostMapping
-    @ApiOperation (value = "浣撴绛惧埌鐧昏鎺ュ彛")
-    @Transactional  //(鍒囨崲鏁版嵁搴撳嚭閿欙紝鎵�浠ユ敞閲�)
+    @ApiOperation(value = "浣撴绛惧埌鐧昏鎺ュ彛")
+//    @Transactional  //(鍒囨崲鏁版嵁搴撳嚭閿欙紝鎵�浠ユ敞閲�)
+    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
     public AjaxResult addOrderAndDetail(@RequestBody TjOrder tjOrder) throws Exception {
         Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId());
         SysUser sysUser = userService.getById(userId);
@@ -906,7 +1107,6 @@
             transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId());
             return AjaxResult.error("涓嶅彲閲嶅鐧昏");
         }
-
         TjFlowingWater tjFlowingWater = new TjFlowingWater();
         LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>();
         wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard());
@@ -916,16 +1116,17 @@
         if (null != tjReservation) {
             tjOrder.setReservationId(tjReservation.getId());
             mallOrder = mallOrderService.getOne(new LambdaQueryWrapper<MallOrder>().eq(MallOrder::getReservationId, tjReservation.getId()));
-//            if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) {
-//                return AjaxResult.error("鏈埌棰勭害鏃堕棿");
-//            }
-            if (DateUtil.endOfDay(DateUtil.offsetDay(tjReservation.getReservationTime(),tjReservation.getYxts())).before(new Date())) {
+            //            if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) {
+            //                return AjaxResult.error("鏈埌棰勭害鏃堕棿");
+            //            }
+            if (DateUtil.endOfDay(DateUtil.offsetDay(tjReservation.getReservationTime(), tjReservation.getYxts())).before(new Date())) {
                 tjReservation.setIsExpire(1);
                 tjReservationService.updateById(tjReservation);
                 return AjaxResult.error("瀵逛笉璧锋偍鐨勯绾﹀凡瓒呮椂璇烽噸鏂伴绾�");
             }
             if (null != tjReservation.getTeamNo()) tjOrder.setTeamNo(tjReservation.getTeamNo());
-            if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId());
+//            if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId());
+//            if (null != tjReservation.getCompany()) tjOrder.setFirmName(tjReservation.getCompany());
             if (null != tjReservation.getDepartment()) tjOrder.setFirmDeptName(tjReservation.getDepartment());
             if (null != tjReservation.getJobNo()) tjOrder.setFirmWorkId(tjReservation.getJobNo());
             if (null != tjReservation.getPacId()) tjOrder.setPacId(tjReservation.getPacId());
@@ -934,18 +1135,25 @@
                 tjOrder.setGroupId(tjReservation.getGroupingId());
                 tjOrder.setFirmDeptId(tjReservation.getPacId());
             }
-//            if (null != tjReservation.getDepartmentId()) tjOrder.setFirmDeptId(tjReservation.getDepartmentId());
             tjReservation.setIsExpire(1);
             tjReservationService.updateById(tjReservation);
-            if (null != tjReservation.getTeamNo()) {
+            if (null != tjReservation.getTeamNo() && tjOrder.getTjType().equals("1")) {
                 tjOrder.setTjType("1");
-            } else {
+            } else if (tjOrder.getTjType().equals("2")) {
                 tjOrder.setTjType("2");
             }
         }
-        //鐢熸垚浣撴鍙�
-        String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date()));
-        tjOrder.setTjNumber(tjNumber);
+
+        if (null != tjCustomer.getCompName()) {
+            tjOrder.setFirmName(tjCustomer.getCompName());
+        }
+        if (null != tjCustomer.getDictCompId()) {
+            tjOrder.setFirmId(String.valueOf(tjCustomer.getDictCompId()));
+        } else {
+            tjOrder.setFirmId("0");
+        }
+
+
         if (null != tjOrder.getPhoto()) {
             File file = new File(tjOrder.getPhoto());
             if (file.isFile()) {
@@ -958,9 +1166,8 @@
                 tjOrder.setPhoto(encode);
             }
         }
-        if (tjOrder.getFirmId() == null) {
-            tjOrder.setFirmId("0");
-        }
+
+
         if (null == tjOrder.getPacId() && null != transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))) {
             tjOrder.setPacId(transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId())));
         }
@@ -972,13 +1179,34 @@
             tjOrder.setFinishTime(new Date());
             tjOrder.setCheckStatus(1);
             tjOrder.setStatus(TjConstants.TJ_WAIT);
-//            tjFlowingWater.setPayStasus(1L);
+            //            tjFlowingWater.setPayStasus(1L);
         }
-//        else {
-            tjFlowingWater.setPayStasus(0L);
-//        }
-        if (tjOrderService.save(tjOrder)) {
+        tjFlowingWater.setPayStasus(0L);
 
+        try {
+            boolean b = lock.tryLock(3, TimeUnit.MINUTES);
+            if (b) {
+                AjaxResult result = processOrderWithTransaction(tjOrder, tjCustomer, tjReservation, tjFlowingWater, mallOrder, sysUser);
+                if (!result.get("code").toString().equals("200"))
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                tjOrderService.tjQiandaodengji(tjOrder.getTjNumber());
+                return result;
+            }
+        } finally {
+            lock.unlock();
+        }
+        return AjaxResult.error();
+    }
+
+    @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
+    public AjaxResult processOrderWithTransaction(TjOrder tjOrder, TjCustomer tjCustomer, TjReservation tjReservation, TjFlowingWater tjFlowingWater, MallOrder mallOrder, SysUser sysUser) {
+        //鐢熸垚浣撴鍙�
+        String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date()));
+        tjOrder.setTjNumber(tjNumber);
+        BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount()));
+
+        tjOrder.setDiscount(discount.toString());
+        if (tjOrderService.save(tjOrder)) {
             //淇濆瓨鏀惰揣鍦板潃
             if ("2".equals(tjOrder.getGetType())) {
                 final TjReportGetAddress address = tjOrder.getAddAddress();
@@ -990,7 +1218,6 @@
             Long cusNumber = tjCustomer.getCusNumber();
             cusNumber += 1;
             tjCustomer.setCusNumber(cusNumber);
-            BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount()));
 
             if ("1".equals(tjOrder.getTjType())) {
                 if (null != tjReservation && tjReservation.getPayType() == 1) {
@@ -1043,7 +1270,7 @@
                     tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith());
                     tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn());
                     tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount());
-//                    tjFlowingWater.setPayStasus(0L);
+                    //                    tjFlowingWater.setPayStasus(0L);
                 }
             }
             if (tjFlowingWaterService.save(tjFlowingWater)) {
@@ -1057,21 +1284,22 @@
             /*璋冪敤his鎺ュ彛*/
             String config = configService.selectConfigByKey("sfkqdyhis");
             if (null != config && config.equals("Y")) {
-                AjaxResult result = hisApiMethod.HisApiMethods(tjCustomer,tjOrder);
+                AjaxResult result = hisApiMethod.HisApiMethods(tjCustomer, tjOrder);
                 if (!result.get("code").toString().equals("200")) {
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     Object jzh = result.get("jzh");
-                    if(null !=jzh && null !=jzh.toString()){
+                    if (null != jzh && null != jzh.toString()) {
                         hisApiMethod.ZfHisApiMethod(jzh.toString());
                     }
-                    log.info("璇ョ櫥璁颁汉鎸傚彿澶辫触, 灏辫瘖鍙蜂负: "+tjOrder.getCardId());
+                    log.info("璇ョ櫥璁颁汉鎸傚彿澶辫触, 灏辫瘖鍙蜂负: " + tjOrder.getCardId());
                     return AjaxResult.error("鎸傚彿澶辫触!" + result.get("msg").toString());
                 }
 
-                log.info("璇ョ櫥璁颁汉鐨刪is灏辫瘖鍙锋槸: "+tjOrder.getCardId());
+                log.info("璇ョ櫥璁颁汉鐨刪is灏辫瘖鍙锋槸: " + tjOrder.getCardId());
                 //鍥綋
                 if ("1".equals(tjOrder.getTjType())) {
-                    asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater);
+//                            asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater);
+                    ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater);
                 }
                 //涓汉
                 if ("2".equals(tjOrder.getTjType())) {
@@ -1079,19 +1307,18 @@
                     newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater);
                 }
                 // 鏌ヨ 瀵规帴Lis銆丳acs鐢宠濡傛灉绫诲瀷鍖呭惈鍦ㄩ厤缃唴鍒欎娇鐢ㄥ鎺is銆乸acs
-//                String useLisAndPacsRegisterDictTeam = configService.selectConfigByKey("use_lis_and_pacs_register_dict_team");
-//                String[] split = useLisAndPacsRegisterDictTeam.split(",");
-//                List<String> list = Arrays.asList(split);
-//                if (list.contains(tjOrder.getTjType())) {
-//                    List<TbTransition> detailList = tbTransitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(),tjOrder.getCardId());
-//                    pacsApiMethodService.save(tjOrder,tjCustomer,detailList);
-//                    lisApiMethod.save(tjOrder,tjCustomer,detailList);
-//                }else {
-//                    hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId());
-//                }
-
-                hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId());
-
+                if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) {
+                    // 杩欐槸涓婇潰涓汉鏂规硶寮曞叆鏁版嵁
+                    tjFlowingWater.setPayStasus(1L);
+                    newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater);
+                    AjaxResult ajaxResult = hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder, sysUser, result);
+                    if (!ajaxResult.get("code").toString().equals("200")) return ajaxResult;
+                    tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()),
+                            sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber()));
+                } else {
+                    hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId());
+                }
+//                        hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId());
                 return AjaxResult.success(tjNumber);
             } else {
                 tjCustomer.setCardId(tjOrder.getTjNumber());
@@ -1101,30 +1328,122 @@
                 tjOrderService.updateById(tjOrder);
             }
 
-
             //鍥綋
             if ("1".equals(tjOrder.getTjType())) {
+//                        asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater);
                 asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater);
             }
             //涓汉
             if ("2".equals(tjOrder.getTjType())) {
                 //asyncService.newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater);
                 newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater);
+                List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId());
+                addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null);
             }
+            // 鏌ヨ 瀵规帴Lis銆丳acs鐢宠濡傛灉绫诲瀷鍖呭惈鍦ㄩ厤缃唴鍒欎娇鐢ㄥ鎺is銆乸acs
+            if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) {
+                // 杩欐槸涓婇潰涓汉鏂规硶寮曞叆鏁版嵁
+                tjFlowingWater.setPayStasus(1L);
+                newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater);
+//                AjaxResult ajaxResult = hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder, sysUser, result);
+//                if (!ajaxResult.get("code").toString().equals("200")) return ajaxResult;
+                tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()),
+                        sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber()));
+
+                List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId());
+                addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null);
+
+            }
+//            pacsApiMethodService.OrderAdd(tjCustomer,tjOrder);
             return AjaxResult.success(tjNumber);
         }
+        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
         return AjaxResult.error();
     }
 
+    public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser, String jxbz) {
+        if (null != detailList && detailList1) {
+            Date date = new Date();
+            String format = DateUtil.format(date, "yyMMddHHmmssSSS");
+            for (TjOrderDetail detail : detailList) {
+                TjSampling sampling = new TjSampling();
+                if (null == projectService.getById(detail.getProId())) continue;
+                TjProject project = projectService.getById(detail.getProId());
+                Long proParentId = project.getProParentId();
+                String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType());
+                if (null != proParentId && proParentId == 0) {
+                    sampling.setJyxh(idUtils.generateLisID());
+                    sampling.setSpecimenTypeCode(project.getSpecimenType());
+                    sampling.setSpecimenType(dictLabel);
+                    sampling.setJyxmdm(project.getProId().toString());
+                } else {
+                    TjProject project1 = projectService.getById(proParentId);
+                    sampling.setJyxh(idUtils.generateLisID());
 
-    @PostMapping ("/addPlOrderAndDetail")
-    @ApiOperation (value = "浣撴鎵归噺绛惧埌鐧昏鎺ュ彛")
+                    sampling.setSpecimenTypeCode(project1.getSpecimenType());
+                    sampling.setSpecimenType(dictLabel);
+                    sampling.setJyxmdm(project.getProId().toString());
+
+                }
+                sampling.setSamplingNumber(format);
+                sampling.setTjNum(order.getTjNumber());
+                sampling.setCusId(String.valueOf(order.getUserId()));
+                if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) {
+                    sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName());
+                }
+                sampling.setApplicationTime(date);
+                sampling.setTjTime(order.getCreateTime());
+                sampling.setProId(String.valueOf(detail.getProId()));
+                sampling.setProName(projectService.getById(detail.getProId()).getProName());
+                sampling.setCreateBy(sysUser.getNickName());
+                sampling.setCreateTime(date);
+                sampling.setUpdateBy(sysUser.getNickName());
+                sampling.setUpdateTime(date);
+                sampling.setCreateId(String.valueOf(sysUser.getUserId()));
+                sampling.setUpdateId(String.valueOf(sysUser.getUserId()));
+                sampling.setJxbz(jxbz);
+                samplingService.save(sampling);
+            }
+        }
+        String config = configService.selectConfigByKey("sfkqdyhis");
+        if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))) {
+            AjaxResult ajaxResult = lisApiMethod.getJyFlHb();
+            if (ajaxResult.get("code").toString().equals("200")) {
+                String str = ajaxResult.get("data").toString();
+                str = str.replace("=", ":");
+                JSONArray array = JSONUtil.parseArray(str);
+                for (Object o : array) {
+                    JSONObject object = (JSONObject) o;
+                    LisJyflhb lisJyflhb = new LisJyflhb();
+                    lisJyflhb.setHbhxm(object.getStr("hbhxm"));
+                    lisJyflhb.setFlmc(object.getStr("flmc"));
+                    lisJyflhb.setMc(object.getStr("mc"));
+                    lisJyflhb.setFlbm(object.getStr("flbm"));
+                    LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>();
+                    wrapper.eq(LisJyflhb::getFlbm, lisJyflhb.getFlbm());
+                    LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper);
+                    if (jyflhb == null) {
+                        lisJyflhb.setId(IdUtil.getSnowflake().nextId());
+                        lisJyflhbService.save(lisJyflhb);
+                    } else {
+                        lisJyflhb.setId(jyflhb.getId());
+                        lisJyflhbService.updateById(lisJyflhb);
+                    }
+                }
+            }
+
+        }
+    }
+
+
+    @PostMapping("/addPlOrderAndDetail")
+    @ApiOperation(value = "浣撴鎵归噺绛惧埌鐧昏鎺ュ彛")
     @Transactional  //(鍒囨崲鏁版嵁搴撳嚭閿欙紝鎵�浠ユ敞閲�)
     public AjaxResult addPlOrderAndDetail(@RequestBody QianDaoDto daoDto, HttpServletResponse response) {
         SysUser sysUser = UserHoder.getLoginUser().getUser();
         List<String> cusIds = daoDto.getCusIds();
         ArrayList<String> tjNumbers = new ArrayList<>();
-        if (null != cusIds && cusIds.size() > 0) {
+        if (null != cusIds && !cusIds.isEmpty()) {
             ExecutorService threadPools = Executors.newFixedThreadPool(cusIds.size());
             for (String cusId : cusIds) {
                 threadPools.execute(new Runnable() {
@@ -1137,7 +1456,7 @@
             LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>();
             wq.in(TjCustomer::getCusIdcard, cusIds);
             List<Long> list = tjCustomerService.list(wq).stream().map(TjCustomer::getCusId).collect(Collectors.toList());
-            if (list.size() > 0) {
+            if (!list.isEmpty()) {
 //                ExecutorService threadPool = Executors.newFixedThreadPool(list.size());
                 ThreadPoolTaskExecutor executor = threadPoolConfig.threadPoolTaskExecutor();
                 for (Long aLong : list) {
@@ -1516,9 +1835,9 @@
      * 淇敼浣撴璁板綍
      */
 //    @PreAuthorize("@ss.hasPermi('hosp:order:edit')")
-    @Log (title = "浣撴璁板綍", businessType = BusinessType.UPDATE)
+    @Log(title = "浣撴璁板綍", businessType = BusinessType.UPDATE)
     @PutMapping
-    @ApiOperation (value = "淇敼浣撴璁板綍")
+    @ApiOperation(value = "淇敼浣撴璁板綍")
     public AjaxResult edit(@RequestBody TjOrder tjOrder) {
         return toAjax(tjOrderService.updateTjOrder(tjOrder));
     }
@@ -1527,16 +1846,16 @@
      * 鍒犻櫎浣撴璁板綍
      */
 //    @PreAuthorize("@ss.hasPermi('hosp:order:remove')")
-    @Log (title = "浣撴璁板綍", businessType = BusinessType.DELETE)
-    @DeleteMapping ("/{orderIds}")
-    @ApiOperation (value = "鍒犻櫎浣撴璁板綍")
+    @Log(title = "浣撴璁板綍", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{orderIds}")
+    @ApiOperation(value = "鍒犻櫎浣撴璁板綍")
     public AjaxResult remove(@PathVariable Long[] orderIds) {
         return toAjax(tjOrderService.deleteTjOrderByOrderIds(orderIds));
     }
 
-    @GetMapping ("/getOrderDetailByTjNumber")
-    @ApiOperation (value = "鏍规嵁浣撴鍙疯幏鍙栦綋妫�璇︽儏")
-    public AjaxResult getOrderDetailByTjNumber(@RequestParam @ApiParam (value = "浣撴鍙�") String tjNumber) {
+    @GetMapping("/getOrderDetailByTjNumber")
+    @ApiOperation(value = "鏍规嵁浣撴鍙疯幏鍙栦綋妫�璇︽儏")
+    public AjaxResult getOrderDetailByTjNumber(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNumber) {
         LambdaQueryWrapper<TjOrder> wq0 = new LambdaQueryWrapper<>();
         wq0.eq(TjOrder::getTjNumber, tjNumber);
         TjOrder tjOrder = tjOrderService.getOne(wq0);
@@ -1556,8 +1875,8 @@
         return AjaxResult.success("鏆傛棤鏁版嵁");
     }
 
-    @PostMapping ("/addtTransition")
-    @ApiOperation (value = "娣诲姞杩囨浮琛ㄦ暟鎹�")
+    @PostMapping("/addtTransition")
+    @ApiOperation(value = "娣诲姞杩囨浮琛ㄦ暟鎹�")
     @Transactional
     public AjaxResult addtTransition(@RequestBody Map<String, Object> map) {
         Object packId = map.get("pacId");
@@ -1573,7 +1892,7 @@
         if (null != tjCustomer) {
             cardId = tjCustomer.getCardId();
         }
-        if ((null == proIds || proIds.size() == 0) && (null == packId || packId.equals(""))) {
+        if ((null == proIds || proIds.isEmpty()) && (null == packId || packId.equals(""))) {
             transitionService.deletedTbTransitionByCusId(cusId);
             if (redisCache.hasKey(cardId + cusId)) {
                 redisCache.deleteObject(cardId + cusId);
@@ -1590,6 +1909,11 @@
                 transitionService.deletedTbTransitionListByCusIdAndPac(cusId, cardId);
                 List<TjPackageProject> ppList = tjPackageProjectService.getTjPackageProjectListByPacId(String.valueOf(pacId));
                 if (null != ppList && !ppList.isEmpty()) {
+                    String string = transitionService.panduantaocanshifouchongfu(cusId, pacId);
+                    if (!StringUtils.isBlank(string)) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("鎿嶄綔澶辫触! 浠ヤ笅椤圭洰宸插瓨鍦�: " + string);
+                    }
                     transitionService.saveRedisTransitionByPacId(cusId, cardId, pacId);
                 }
             }
@@ -1612,9 +1936,9 @@
     }
 
 
-    @GetMapping ("/getTransitionList")
-    @ApiOperation (value = "鏌ヨ杩囨浮琛ㄦ暟鎹�")
-    public AjaxResult getTransitionList(@RequestParam @ApiParam (value = "瀹㈡埛id") String cusId) {
+    @GetMapping("/getTransitionList")
+    @ApiOperation(value = "鏌ヨ杩囨浮琛ㄦ暟鎹�")
+    public AjaxResult getTransitionList(@RequestParam @ApiParam(value = "瀹㈡埛id") String cusId) {
         if (redisCache.hasKey(cusId + "cusId")) {
             List<Map<String, Object>> list = redisCache.getCacheMapValue(cusId + "cusId", cusId);
             return AjaxResult.success(list);
@@ -1629,16 +1953,16 @@
     }
 
 
-    @GetMapping ("/getQianLiList")
-    @ApiOperation (value = "鏌ヨ浣撴璁板綍鍒楄〃")
-    public AjaxResult getQianLiList(@ApiParam (value = "椤电爜鏁�(榛樿1)") @RequestParam (defaultValue = "1") Integer pageNum,
-                                    @ApiParam (value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam (defaultValue = "10") Integer pageSize,
-                                    @ApiParam (value = "浣撴鍙�") @RequestParam (required = false) String tjNum,
-                                    @ApiParam (value = "濮撳悕") @RequestParam (required = false) String name,
-                                    @ApiParam (value = "鐧昏寮�濮嬫椂闂�") @RequestParam (required = false) Date djbeginTime,
-                                    @ApiParam (value = "鐧昏缁撴潫鏃堕棿") @RequestParam (required = false) Date djendTime,
-                                    @ApiParam (value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam (required = false) Date bgbeginTime,
-                                    @ApiParam (value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam (required = false) Date bgendTime) {
+    @GetMapping("/getQianLiList")
+    @ApiOperation(value = "鏌ヨ浣撴璁板綍鍒楄〃")
+    public AjaxResult getQianLiList(@ApiParam(value = "椤电爜鏁�(榛樿1)") @RequestParam(defaultValue = "1") Integer pageNum,
+                                    @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize,
+                                    @ApiParam(value = "浣撴鍙�") @RequestParam(required = false) String tjNum,
+                                    @ApiParam(value = "濮撳悕") @RequestParam(required = false) String name,
+                                    @ApiParam(value = "鐧昏寮�濮嬫椂闂�") @RequestParam(required = false) Date djbeginTime,
+                                    @ApiParam(value = "鐧昏缁撴潫鏃堕棿") @RequestParam(required = false) Date djendTime,
+                                    @ApiParam(value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam(required = false) Date bgbeginTime,
+                                    @ApiParam(value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam(required = false) Date bgendTime) {
         Map<String, Object> map = new HashMap<>();
         if (null != name) {
             LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>();
@@ -1747,9 +2071,9 @@
     /**
      * 绛剧寮冩纭杩斿洖鏁版嵁
      */
-    @GetMapping ("/abandon")
-    @ApiOperation (value = "绛剧寮冩纭杩斿洖鏁版嵁")
-    public AjaxResult abandon(@RequestParam @ApiParam (value = "浣撴鍙�") String tjNumber) {
+    @GetMapping("/abandon")
+    @ApiOperation(value = "绛剧寮冩纭杩斿洖鏁版嵁")
+    public AjaxResult abandon(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNumber) {
         LambdaQueryWrapper<TjOrderRemark> wq = new LambdaQueryWrapper<>();
         wq.eq(TjOrderRemark::getTjNumber, tjNumber);
         List<TjOrderRemark> remarkList = remarkService.list(wq);
@@ -1774,8 +2098,8 @@
      *
      * @ApiParam(value = "浣撴鍙�") String tjNumber
      */
-    @PostMapping ("/tjGoOut")
-    @ApiOperation (value = "浣撴绛剧")
+    @PostMapping("/tjGoOut")
+    @ApiOperation(value = "浣撴绛剧")
     @Transactional
     public AjaxResult tjGoOut(@RequestBody Map<String, Object> map) {
         Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId());
@@ -1806,6 +2130,7 @@
                     }
                 }
             }
+            remarkService.updateRemark(tjNumber);
             asyncService.tjGoutAsync(domainVos, sysUser, list);
 
             TjCustomer customer = tjCustomerService.selectTjCustomerByCusId(tjOrder.getUserId());
@@ -1842,6 +2167,7 @@
             }*/
             return AjaxResult.success("绛剧鎴愬姛锛�");
         } else {
+            remarkService.updateRemark(tjNumber);
             return getAjaxResult(tjNumber);
         }
     }
@@ -1850,10 +2176,10 @@
     /**
      * 绛剧
      */
-    @GetMapping ("/goOut")
-    @ApiOperation (value = "绛剧")
+    @GetMapping("/goOut")
+    @ApiOperation(value = "绛剧")
     @Transactional
-    public AjaxResult goOut(@RequestParam @ApiParam (value = "浣撴鍙�") String tjNumber) {
+    public AjaxResult goOut(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNumber) {
         return getAjaxResult(tjNumber);
     }
 
@@ -1861,9 +2187,9 @@
     /**
      * 鏍搁攢璁㈠崟鎺ュ彛
      */
-    @GetMapping ("/orderShip")
-    @ApiOperation (value = "PC绔墜鍔ㄦ牳閿�璁㈠崟鎺ュ彛")
-    public AjaxResult orderShip(@RequestParam @ApiParam (value = "浣撴鍙�") String tjNum) {
+    @GetMapping("/orderShip")
+    @ApiOperation(value = "PC绔墜鍔ㄦ牳閿�璁㈠崟鎺ュ彛")
+    public AjaxResult orderShip(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNum) {
         if (tjNum == null) {
             return AjaxResult.error();
         }
@@ -2030,15 +2356,15 @@
     }
 
 
-    @GetMapping ("/tuanTiListById")
-    @ApiOperation (value = "鏌ヨ鍥綋浣撴鐘舵��")
-    public AjaxResult tuanTiListById(@ApiParam (value = "椤电爜鏁�(榛樿1)") @RequestParam (defaultValue = "1") Integer pageNum,
-                                     @ApiParam (value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam (defaultValue = "10") Integer pageSize,
-                                     @ApiParam (value = "鍗曚綅") @RequestParam String firmId,
-                                     @ApiParam (value = "閮ㄩ棬") @RequestParam (required = false) String dwDeptId,
-                                     @ApiParam (value = "鍒嗙粍") @RequestParam (required = false) String groupId,
-                                     @ApiParam (value = "鐧昏寮�濮嬫椂闂�") @RequestParam Date beginTime,
-                                     @ApiParam (value = "鐧昏缁撴潫鏃堕棿") @RequestParam Date endTime) {
+    @GetMapping("/tuanTiListById")
+    @ApiOperation(value = "鏌ヨ鍥綋浣撴鐘舵��")
+    public AjaxResult tuanTiListById(@ApiParam(value = "椤电爜鏁�(榛樿1)") @RequestParam(defaultValue = "1") Integer pageNum,
+                                     @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize,
+                                     @ApiParam(value = "鍗曚綅") @RequestParam String firmId,
+                                     @ApiParam(value = "閮ㄩ棬") @RequestParam(required = false) String dwDeptId,
+                                     @ApiParam(value = "鍒嗙粍") @RequestParam(required = false) String groupId,
+                                     @ApiParam(value = "鐧昏寮�濮嬫椂闂�") @RequestParam Date beginTime,
+                                     @ApiParam(value = "鐧昏缁撴潫鏃堕棿") @RequestParam Date endTime) {
         Map<String, Object> map = new HashMap<>();
         int a = 0;
         int b = 0;
@@ -2103,11 +2429,11 @@
     }
 
 
-    @GetMapping ("/tuanTiBingById")
-    @ApiOperation (value = "鏌ヨ鍥綋浣撴鐥呯璇︾粏淇℃伅")
-    public AjaxResult tuanTiBingById(@ApiParam (value = "鍗曚綅") @RequestParam String firmId,
-                                     @ApiParam (value = "閮ㄩ棬") @RequestParam String firmDeptId,
-                                     @ApiParam (value = "鐥呯") @RequestParam (required = false) String bingZhong) {
+    @GetMapping("/tuanTiBingById")
+    @ApiOperation(value = "鏌ヨ鍥綋浣撴鐥呯璇︾粏淇℃伅")
+    public AjaxResult tuanTiBingById(@ApiParam(value = "鍗曚綅") @RequestParam String firmId,
+                                     @ApiParam(value = "閮ㄩ棬") @RequestParam String firmDeptId,
+                                     @ApiParam(value = "鐥呯") @RequestParam(required = false) String bingZhong) {
         List<TjOrderDetailRules> res1 = new ArrayList<>();
         List<BingZhongVO> res = new ArrayList<>();
 
@@ -2166,8 +2492,8 @@
     }
 
 
-    @PostMapping ("/tuanTiBingChart")
-    @ApiOperation (value = "鏌ヨ鍥綋浣撴鐥呯缁熻鍥�")
+    @PostMapping("/tuanTiBingChart")
+    @ApiOperation(value = "鏌ヨ鍥綋浣撴鐥呯缁熻鍥�")
     public AjaxResult tuanTiBingChart(@RequestBody BingZhongVO bingZhongVO) {
         List<TjOrderDetailRules> res1 = new ArrayList<>();
 
@@ -2206,18 +2532,18 @@
     }
 
 
-    @PostMapping ("/deletedTbTransitionByCusId")
-    @ApiOperation (value = "鏍规嵁韬唤璇佸彿鍒犻櫎涓存椂琛ㄦ暟鎹�")
-    public AjaxResult deletedTbTransitionByCusId(@RequestParam @ApiParam (value = "韬唤璇佸彿") String cusId) {
+    @PostMapping("/deletedTbTransitionByCusId")
+    @ApiOperation(value = "鏍规嵁韬唤璇佸彿鍒犻櫎涓存椂琛ㄦ暟鎹�")
+    public AjaxResult deletedTbTransitionByCusId(@RequestParam @ApiParam(value = "韬唤璇佸彿") String cusId) {
         LambdaQueryWrapper<TbTransition> wq = new LambdaQueryWrapper<>();
         wq.between(TbTransition::getCreateTime, transitionService.getTbTransitionCreateTimeByCusId(cusId), new Date());
         wq.eq(TbTransition::getCusId, cusId);
         return AjaxResult.success(transitionService.remove(wq));
     }
 
-    @GetMapping ("/getTransitionInfo")
-    @ApiOperation (value = "鏍规嵁浣撴鍙疯幏鍙栨眹鎬诲拰鏄庣粏鐨勬暟鎹�")
-    public AjaxResult getTransitionInfo(@RequestParam ("tjNumber") String tjNumber) {
+    @GetMapping("/getTransitionInfo")
+    @ApiOperation(value = "鏍规嵁浣撴鍙疯幏鍙栨眹鎬诲拰鏄庣粏鐨勬暟鎹�")
+    public AjaxResult getTransitionInfo(@RequestParam("tjNumber") String tjNumber) {
         QueryWrapper<TbTransition> wrapper = new QueryWrapper<>();
         wrapper.select("parent_pro_id", "parent_pro_name", "sum(ord_price) as ord_price")
                 .eq("tj_num", tjNumber)
@@ -2274,16 +2600,17 @@
         return AjaxResult.success().put("data", map);
     }
 
+
     public void newSaveextracted(TjOrder tjOrder, TjCustomer tjCustomer, BigDecimal discount, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) {
         tjAskMedicalHistoryService.updateTjAskMedicalHistoryByCusId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjCustomer.getCusId()));
         if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) {
             tjOrderDetailService.saveJSYTjOrderDetailsByCusId(tjCustomer.getCusIdcard(),
-                    String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()),tjOrder.getCardId(),String.valueOf(tjFlowingWater.getTjSerialNumber()));
+                    String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId(), String.valueOf(tjFlowingWater.getTjSerialNumber()));
         } else {
-            tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()),tjOrder.getCardId());
+            tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId());
         }
 
-        tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(),String.valueOf(sysUser.getUserId()),tjOrder.getCardId());
+        tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId());
 
         //娣诲姞remark琛ㄦ暟鎹�
         if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) {
@@ -2312,25 +2639,219 @@
     }
 
 
-    @PostMapping ("/heXiaoByIds/{orderIds}")
-    @ApiOperation (value = "鏍告敹鎶ュ憡鈥斺�斺�斺�斺�斺�旀�绘瀹℃牳閫氳繃鍚庡彲浠ユ牳閿�锛屾牳鏀跺悗鎵嶈兘鎵撳嵃")
+    public void ttextracted(TjOrder tjOrder, TjCustomer tjCustomer, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) {
+
+        tjAskMedicalHistoryService.updateTjAskMedicalHistoryByCusId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjCustomer.getCusId()));
+        boolean b = tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(),
+                String.valueOf(sysUser.getUserId()), tjOrder.getCardId());
+        if (!b) {
+            List<TjGroupingPro> proList = groupingProService.list(new LambdaQueryWrapper<TjGroupingPro>().eq(TjGroupingPro::getGroupingId, tjOrder.getGroupId()));
+            if (null != proList && !proList.isEmpty()) {
+                for (TjGroupingPro groupingPro : proList) {
+                    TjOrderDetail detail = new TjOrderDetail();
+                    TjProject tjProject = projectService.selectTjProjectByProId(Long.valueOf(groupingPro.getProId()));
+                    detail.setIsSampling(String.valueOf(tjProject.getIsSampling()));
+                    detail.setOrderId(tjOrder.getOrderId());
+                    detail.setProId(Long.valueOf(groupingPro.getProId()));
+                    detail.setTjStatus(0L);
+                    detail.setCreateBy(sysUser.getNickName());
+                    detail.setCreateTime(new Date());
+                    detail.setUpdateBy(sysUser.getNickName());
+                    detail.setUpdateTime(new Date());
+                    detail.setCreateId(String.valueOf(sysUser.getUserId()));
+                    detail.setUpdateId(String.valueOf(sysUser.getUserId()));
+                    tjOrderDetailService.save(detail);
+                }
+                List<String> list = proList.stream().map(TjGroupingPro::getProId).collect(Collectors.toList());
+                List<TjProject> projectList = projectService.list(new LambdaQueryWrapper<TjProject>().in(TjProject::getProParentId, list));
+                for (TjProject project : projectList) {
+                    TjOrderDetail detail = new TjOrderDetail();
+                    detail.setOrderId(tjOrder.getOrderId());
+                    detail.setProId(project.getProId());
+                    detail.setTjStatus(0L);
+                    detail.setCreateBy(sysUser.getNickName());
+                    detail.setCreateTime(new Date());
+                    detail.setUpdateBy(sysUser.getNickName());
+                    detail.setUpdateTime(new Date());
+                    detail.setCreateId(String.valueOf(sysUser.getUserId()));
+                    detail.setUpdateId(String.valueOf(sysUser.getUserId()));
+                    //鑾峰彇璇ラ」鐩殑榛樿鍊艰祴鍊肩粰缁撴灉
+                    if (null != project.getProDefault()) {
+                        detail.setProResult(project.getProDefault());
+                    } else {
+                        detail.setProResult(null);
+                    }
+                    detail.setIsSampling(String.valueOf(project.getIsSampling()));
+
+                    tjOrderDetailService.save(detail);
+                }
+            }
+        }
+
+        //娣诲姞remark琛ㄦ暟鎹�
+        remarkService.saveTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId()));
+
+        //鍒ゆ柇鏄惁浜ら挶
+        if ("1".equals(tjOrder.getTjType())) {
+            if (null != tjReservation && tjReservation.getPayType() == 1) {
+                tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()),
+                        sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber()));
+            }
+        }
+        if (tjFlowingWater.getPayStasus() == 1) {
+            tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()),
+                    sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber()));
+        }
+        if (tjFlowingWater.getDiscount() == null) {
+            transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), new BigDecimal(10), tjOrder.getTjNumber());
+        } else {
+            transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), BigDecimal.valueOf(Long.parseLong(tjFlowingWater.getDiscount())), tjOrder.getTjNumber());
+        }
+
+        tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId());
+//        List<TjOrderDetail> list = tjOrderDetailService.getTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()));
+//        if (list != null) {
+//            for (TjOrderDetail tjOrderDetail : list) {
+//                TjProject tjProject = projectService.getById(tjOrderDetail.getProId());
+//                if(tjProject==null){
+//                    continue;
+//                }
+//                tjOrderDetail.setProject(tjProject);
+//                if (tjProject.getProParentId() == 0) {
+//                    TjOrderRemark tjOrderRemark = new TjOrderRemark();
+//                    tjOrderRemark.setProId(tjProject.getProId());
+//                    tjOrderRemark.setProName(tjProject.getProName());
+//                    tjOrderRemark.setDeptId(tjProject.getDeptId());
+//                    tjOrderRemark.setTjNumber(tjOrder.getTjNumber());
+//                    tjOrderRemark.setCreateBy(sysUser.getNickName());
+//                    tjOrderRemark.setCreateTime(new Date());
+//                    tjOrderRemark.setUpdateBy(sysUser.getNickName());
+//                    tjOrderRemark.setUpdateTime(new Date());
+//                    tjOrderRemark.setCreateId(String.valueOf(sysUser.getUserId()));
+//                    tjOrderRemark.setUpdateId(String.valueOf(sysUser.getUserId()));
+//                    orderRemarkService.save(tjOrderRemark);
+//                }
+//                if ("1".equals(tjOrder.getTjType())) {
+//                    if (null != tjReservation && tjReservation.getPayType() == 1) {
+//                        tjOrderDetail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber()));
+//                    }
+//                }
+//                if(tjFlowingWater.getPayStasus()==1){
+//                    tjOrderDetail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber()));
+//                }
+//                tjOrderDetailService.updateById(tjOrderDetail);
+//            }
+//        }
+    }
+
+    @PostMapping("/heXiaoByIds/{orderIds}")
+    @ApiOperation(value = "鏍告敹鎶ュ憡鈥斺�斺�斺�斺�斺�旀�绘瀹℃牳閫氳繃鍚庡彲浠ユ牳閿�锛屾牳鏀跺悗鎵嶈兘鎵撳嵃")
     @Transactional
+    @RepeatSubmit
     public AjaxResult heXiaoByIds(@PathVariable String[] orderIds) {
+        Date date = new Date();
         for (String orderId : orderIds) {
-            final TjOrder byId = tjOrderService.getById(orderId);
-            byId.setHeshouStatus(1);
-            byId.setHeshouDoctor(UserHoder.getLoginUser().getUserId());
-            byId.setHeshouTime(new DateTime());
-            final boolean b = tjOrderService.updateById(byId);
-            if (!b) {
-                return AjaxResult.error("鏍告敹澶辫触");
+            TjOrder byId = tjOrderService.getById(orderId);
+            if (null != byId) {
+                if (byId.getReportTime() == null) {
+                    LambdaQueryWrapper<TjReportTemplate> tjReportTemplateLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                    tjReportTemplateLambdaQueryWrapper.eq(TjReportTemplate::getFlag, 1);
+                    tjReportTemplateLambdaQueryWrapper.eq(TjReportTemplate::getOpen, 0);
+                    TjReportTemplate reportTemplate = reportTemplateService.getOne(tjReportTemplateLambdaQueryWrapper);
+                    if ("鎶ヨ〃".equals(reportTemplate.getPrint())) {
+                        TjReport tjReport = new TjReport();
+                        tjReport.setTjNumber(String.valueOf(byId.getTjNumber()));
+                        tjReport.setPath(reportTemplate.getUrl() + "?tjNum=" + byId.getTjNumber());
+                        tjReport.setType("浣撴鎶ュ憡");
+                        tjReport.setPrint("鎶ヨ〃");
+                        tjReportService.save(tjReport);
+                        //淇敼order琛ㄤ腑鐨勬墦鍗版姤鍛婃椂闂翠负褰撳墠鏃堕棿
+                        LambdaUpdateWrapper<TjOrder> updateWrapper = new LambdaUpdateWrapper<>();
+                        updateWrapper.eq(TjOrder::getTjNumber, byId.getTjNumber());
+//                        updateWrapper.set(TjOrder::getReportTime, new Date());
+//                        updateWrapper.set(TjOrder::getPrintLastTime, new Date());
+//                        updateWrapper.set(TjOrder::getDownloadLastTime, new Date());
+                        updateWrapper.set(TjOrder::getStatus, TjConstants.TJ_END);
+                        tjOrderService.update(updateWrapper);
+                    }
+                    String hisRegistrationId = byId.getCardId();
+                    Date createTime = byId.getCreateTime();
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    String ksrq = dateFormat.format(createTime);
+                    String jsrq = dateFormat.format(date);
+                    HashMap<String, Object> params = new HashMap<>();
+                    params.put("his_registration_id", hisRegistrationId);
+                    params.put("ksbm", "");
+                    params.put("pationid", "");
+                    params.put("ksrq", ksrq);
+                    params.put("jsrq", jsrq);
+                    params.put("pagecount", 100);
+                    params.put("page", 1);
+                    LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>();
+                    wq1.eq(TjCustomer::getCusId, byId.getUserId());
+                    TjCustomer tjCustomer = tjCustomerService.getOne(wq1);
+                    LambdaQueryWrapper<TjReportTemplate> wrapper = new LambdaQueryWrapper<>();
+                    wrapper.eq(TjReportTemplate::getFlag, "4");
+                    wrapper.eq(TjReportTemplate::getOpen, "1");
+                    TjReportTemplate zongJianYiShiQianMing = reportTemplateService.getOne(wrapper);
+                    try {
+                        shengchengbgmoban(byId.getTjNumber(), byId, tjCustomer, reportTemplate, zongJianYiShiQianMing);
+                        byId.setStatus(TjConstants.TJ_END);
+//                        byId.setReportTime(date);
+//                        byId.setPrintLastTime(date);
+//                        byId.setDownloadLastTime(date);
+                    } catch (Exception e) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        e.printStackTrace();
+                        // 璋冪敤鎾ら攢
+                        logger.error("鐢熸垚鎶ュ憡寮傚父");
+                        return AjaxResult.error("鐢熸垚鎶ュ憡寮傚父,鏍告敹澶辫触");
+                    }
+                }
+
+                byId.setHeshouStatus(1);
+                byId.setHeshouDoctor(UserHoder.getLoginUser().getUserId());
+                byId.setHeshouTime(date);
+                final boolean b = tjOrderService.updateById(byId);
+                if (!b) {
+                    return AjaxResult.error("鏍告敹澶辫触");
+                }
             }
         }
         return AjaxResult.success("鏍告敹鎴愬姛");
     }
 
-    @GetMapping ("/getHistryTjOrderByCusIdCard")
-    @ApiOperation (value = "鏍规嵁韬唤璇佸彿鏌ョ湅鍘嗗彶浣撴璁板綍")
+
+    public AjaxResult shengchengbgmoban(String tjNumber, TjOrder tjOrder, TjCustomer tjCustomer, TjReportTemplate reportTemplate, TjReportTemplate zongJianYiShiQianMing) throws Exception {
+//        AjaxResult ajaxResult = hisPDFUtil.hisPDF(tjOrder, tjCustomer, reportTemplate);
+//        AjaxResult ajaxResult = hisPDFUtil.hisPDFNew(tjOrder, tjCustomer, reportTemplate);
+        AjaxResult ajaxResult = hisPDFUtil.hisPDFNew2(tjOrder, tjCustomer, reportTemplate, zongJianYiShiQianMing);
+        if (!ajaxResult.get("code").toString().equals("200")) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+        } else {
+            Long userId = tjCustomer.getCusId();
+            String outputFileName1 = userId + tjNumber + tjCustomer.getCusName() + "_鎶ュ憡.pdf";
+            TjReport tjReport = new TjReport();
+            tjReport.setTjNumber(String.valueOf(tjNumber));
+            tjReport.setPath(urlValue + outputFileName1);
+            String outputPath1 = value + File.separator;
+            String pdfBinary = getPDFBinary(outputPath1 + outputFileName1);
+            tjReport.setReport(pdfBinary);
+            tjReport.setType("浣撴鎶ュ憡");
+            tjReport.setPrint("pdf");
+            tjReportService.save(tjReport);
+//            Date date = new Date();
+//            tjOrder.setStatus(TjConstants.TJ_END);
+//            tjOrder.setReportTime(date);
+//            tjOrder.setPrintLastTime(date);
+//            tjOrder.setDownloadLastTime(date);
+//            tjOrderService.updateById(tjOrder);
+        }
+        return ajaxResult;
+    }
+
+    @GetMapping("/getHistryTjOrderByCusIdCard")
+    @ApiOperation(value = "鏍规嵁韬唤璇佸彿鏌ョ湅鍘嗗彶浣撴璁板綍")
     @Transactional
     public AjaxResult getHistryTjOrderByCusIdCard(@RequestParam String cusIdCard) {
         TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdCard);
@@ -2350,8 +2871,8 @@
     }
 
 
-    @GetMapping ("/getHistryTjOrderProByCusIdCard")
-    @ApiOperation (value = "鏍规嵁韬唤璇佸彿鏌ョ湅鍘嗗彶浣撴椤圭洰璁板綍")
+    @GetMapping("/getHistryTjOrderProByCusIdCard")
+    @ApiOperation(value = "鏍规嵁韬唤璇佸彿鏌ョ湅鍘嗗彶浣撴椤圭洰璁板綍")
     @Transactional
     public AjaxResult getHistryTjOrderProByCusIdCard(@RequestParam String cusIdCard) {
         TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdCard);
@@ -2410,8 +2931,8 @@
     }
 
 
-    @GetMapping ("/getHistryTjOrderByCusId")
-    @ApiOperation (value = "鏍规嵁瀹㈡埛id鏌ョ湅鍘嗗彶浣撴璁板綍")
+    @GetMapping("/getHistryTjOrderByCusId")
+    @ApiOperation(value = "鏍规嵁瀹㈡埛id鏌ョ湅鍘嗗彶浣撴璁板綍")
     @Transactional
     public AjaxResult getHistryTjOrderByCusId(@RequestParam String cusId) {
         TjCustomer tjCustomer = tjCustomerService.getById(cusId);
@@ -2445,10 +2966,10 @@
     }
 
 
-    @GetMapping ("/revokeTjOrderByTjNum")
-    @ApiOperation (value = "鏍规嵁瀹㈡埛浣撴鍙锋挙閿�浣撴璁板綍")
+    @GetMapping("/revokeTjOrderByTjNum")
+    @ApiOperation(value = "鏍规嵁瀹㈡埛浣撴鍙锋挙閿�浣撴璁板綍")
     @Transactional
-    public AjaxResult revokeTjOrderByTjNum(@RequestParam @ApiParam (value = "浣撴鍙�") String tjNum) {
+    public AjaxResult revokeTjOrderByTjNum(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNum) {
 
         TjOrder order = tjOrderService.getOrderByTjNum(tjNum);
         if (null != order) {
@@ -2456,6 +2977,7 @@
 //            if (null != payByTjNum) {
 //                return AjaxResult.error("璇ョ敤鎴峰凡鏀惰垂涓嶅彲鎾ら攢绛惧埌!");
 //            }
+            if (null != order.getFinishTime()) return AjaxResult.error("璇ヤ汉鍛樺凡绛剧,涓嶅彲鎾ら攢!!!");
             tjOrderService.deleteTjOrderByOrderId(order.getOrderId());
             tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId()));
             remarkService.deletedOrderRemarkByTjNum(tjNum);
@@ -2466,6 +2988,7 @@
             customer.setCardId("0");
             tjCustomerService.updateById(customer);
             String configByKey = configService.selectConfigByKey("sfkqdyhis");
+            tjSamplingMapper.deleteByTjNumAndCusId(tjNum, order.getUserId());
             if (configByKey.equals("Y")) {
 
                 HashMap<String, Object> hisRequestParams = new HashMap<>();
@@ -2484,7 +3007,7 @@
                         return AjaxResult.error("鎾ら攢澶辫触,璇ヤ汉鍛樺凡缂磋垂,璇峰厛閫�璐�!");
                     }
                 }
-                boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order);
+                boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order, lisApiMethod.isUseLisAndPacsRegister(order));
                 if (zfHisApiMethods) {
                     return AjaxResult.success("鎾ら攢鎴愬姛");
                 } else {
@@ -2493,20 +3016,19 @@
                 }
 
             }
-            return AjaxResult.success("鎾ら攢鎴愬姛!!!");
         }
         return AjaxResult.success("绛惧埌璁板綍涓嶅瓨鍦�!");
     }
 
 
-    @GetMapping ("/getCusTomterListByCompId")
-    @ApiOperation (value = "鑾峰彇鍗曚綅id浣撴浜轰俊鎭帴鍙�")
-    public AjaxResult getCusTomterListByCompId(@RequestParam (required = false) @ApiParam (value = "鍗曚綅id") String compId,
-                                               @RequestParam (required = false) @ApiParam (value = "鍚嶅瓧") String name,
-                                               @RequestParam (required = false) @ApiParam (value = "閮ㄩ棬id") String deptId,
-                                               @RequestParam (required = false) @ApiParam (value = "棰勭害鏃堕棿") Date reservationTime,
-                                               @RequestParam (defaultValue = "1") Integer page,
-                                               @RequestParam (defaultValue = "10") Integer pageSize) {
+    @GetMapping("/getCusTomterListByCompId")
+    @ApiOperation(value = "鑾峰彇鍗曚綅id浣撴浜轰俊鎭帴鍙�")
+    public AjaxResult getCusTomterListByCompId(@RequestParam(required = false) @ApiParam(value = "鍗曚綅id") String compId,
+                                               @RequestParam(required = false) @ApiParam(value = "鍚嶅瓧") String name,
+                                               @RequestParam(required = false) @ApiParam(value = "閮ㄩ棬id") String deptId,
+                                               @RequestParam(required = false) @ApiParam(value = "棰勭害鏃堕棿") Date reservationTime,
+                                               @RequestParam(defaultValue = "1") Integer page,
+                                               @RequestParam(defaultValue = "10") Integer pageSize) {
         Page<TjReservation> pages = new Page<>(page, pageSize);
         LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>();
         if (null != compId) wq.eq(TjReservation::getCompanyId, compId);
@@ -2532,10 +3054,10 @@
     }
 
 
-    @PostMapping ("/plRevokeTjOrderByTjNum")
-    @ApiOperation (value = "鏍规嵁瀹㈡埛浣撴鍙锋壒閲忔挙閿�浣撴璁板綍")
+    @PostMapping("/plRevokeTjOrderByTjNum")
+    @ApiOperation(value = "鏍规嵁瀹㈡埛浣撴鍙锋壒閲忔挙閿�浣撴璁板綍")
     @Transactional
-    public AjaxResult plRevokeTjOrderByTjNum(@RequestBody @ApiParam (value = "棰勭害涓婚敭id闆嗗悎") List<String> reservationIds) {
+    public AjaxResult plRevokeTjOrderByTjNum(@RequestBody @ApiParam(value = "棰勭害涓婚敭id闆嗗悎") List<String> reservationIds) {
         if (null != reservationIds && reservationIds.size() > 0) {
             LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
             wq1.in(TjOrder::getReservationId, reservationIds);
@@ -2569,8 +3091,8 @@
         return AjaxResult.error("璇烽�夋嫨瑕佹挙閿�鐨勪汉鍛�!");
     }
 
-    @PostMapping ("makeTjPDF")
-    @ApiOperation (value = "鎵归噺鐢熸垚PDF")
+    @PostMapping("makeTjPDF")
+    @ApiOperation(value = "鎵归噺鐢熸垚PDF")
     public AjaxResult makeTjPDF(@RequestBody List<String> reservations) {
         QueryWrapper<TjOrder> queryWrapper = new QueryWrapper<>();
         queryWrapper.in("reservation_id", reservations);
@@ -2612,11 +3134,11 @@
     }
 
 
-    @GetMapping ("/delTbBycusCardIdAndProId")
-    @ApiOperation (value = "鏍规嵁瀹㈡埛韬唤璇佸彿鍜岄」鐩埗椤筰d鍒犻櫎涓存椂琛ㄦ暟鎹�")
+    @GetMapping("/delTbBycusCardIdAndProId")
+    @ApiOperation(value = "鏍规嵁瀹㈡埛韬唤璇佸彿鍜岄」鐩埗椤筰d鍒犻櫎涓存椂琛ㄦ暟鎹�")
     @Transactional
-    public AjaxResult delTbBycusCardIdAndProId(@RequestParam @ApiParam (value = "韬唤璇佸彿") String cusCardId,
-                                               @RequestParam @ApiParam (value = "鐖堕」id") String proId) {
+    public AjaxResult delTbBycusCardIdAndProId(@RequestParam @ApiParam(value = "韬唤璇佸彿") String cusCardId,
+                                               @RequestParam @ApiParam(value = "鐖堕」id") String proId) {
 
         if (transitionService.delTbBycusCardIdAndProId(cusCardId, proId)) {
             return AjaxResult.success();
@@ -2625,12 +3147,14 @@
     }
 
 
-    @GetMapping ("/revokeTjOrderByTjCardId")
-    @ApiOperation (value = "鏍规嵁灏辫瘖鍙锋挙閿�鐢宠璁板綍")
+    @GetMapping("/revokeTjOrderByTjCardId")
+    @ApiOperation(value = "鏍规嵁灏辫瘖鍙锋挙閿�鐢宠璁板綍")
     @Transactional
-    public AjaxResult revokeTjOrderByTjCardId(@RequestParam @ApiParam (value = "灏辫瘖鍙�") String cardId) {
+    public AjaxResult revokeTjOrderByTjCardId(@RequestParam @ApiParam(value = "灏辫瘖鍙�") String cardId) {
 
-        TjOrder order = new TjOrder();
+        LambdaQueryWrapper<TjOrder> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(TjOrder::getCardId, cardId);
+        TjOrder order = tjOrderService.getOne(queryWrapper);
         order.setCardId(cardId);
         String configByKey = configService.selectConfigByKey("sfkqdyhis");
         if (configByKey.equals("Y")) {
@@ -2650,7 +3174,7 @@
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error("鎾ら攢澶辫触,闂ㄨ瘖鎮h�呰垂鐢ㄦ竻鍗曚俊鎭笉涓虹┖");
             } else {
-                boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order);
+                boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order, lisApiMethod.isUseLisAndPacsRegister(order));
                 if (zfHisApiMethods) {
                     return AjaxResult.success("鎾ら攢鎴愬姛", map);
                 } else {
@@ -2663,10 +3187,10 @@
     }
 
 
-    @GetMapping ("/revokeTjOrderByTjh")
-    @ApiOperation (value = "鏍规嵁灏变綋妫�鍙峰垹闄よ褰�")
+    @GetMapping("/revokeTjOrderByTjh")
+    @ApiOperation(value = "鏍规嵁灏变綋妫�鍙峰垹闄よ褰�")
     @Transactional
-    public AjaxResult revokeTjOrderByTjh(@RequestParam @ApiParam (value = "浣撴鍙�") String tjNum) {
+    public AjaxResult revokeTjOrderByTjh(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNum) {
 
         TjOrder order = tjOrderService.getOrderByTjNum(tjNum);
         if (null != order) {
@@ -2684,10 +3208,10 @@
     }
 
 
-    @GetMapping ("/getBlproByTjh")
-    @ApiOperation (value = "鏍规嵁浣撴鍙疯幏鍙栬ˉ褰曢」鐩褰�")
+    @GetMapping("/getBlproByTjh")
+    @ApiOperation(value = "鏍规嵁浣撴鍙疯幏鍙栬ˉ褰曢」鐩褰�")
     @Transactional
-    public AjaxResult getBlproByTjh(@RequestParam @ApiParam (value = "浣撴鍙�") String tjNum) {
+    public AjaxResult getBlproByTjh(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNum) {
 
         TjOrder order = tjOrderService.getOrderByTjNum(tjNum);
         if (null != order) {
@@ -2718,12 +3242,13 @@
     }
 
 
-    @PostMapping ("/revokeBlProByBldhAndTjh")
-    @ApiOperation (value = "鏍规嵁琛ュ綍鍗曞彿鍜屼綋妫�鍙峰垹闄よ褰�")
-    @Transactional
+    @PostMapping("/revokeBlProByBldhAndTjh")
+    @ApiOperation(value = "鏍规嵁琛ュ綍鍗曞彿鍜屼綋妫�鍙峰垹闄よ褰�")
+//    @Transactional
     public AjaxResult revokeBlProByBldhAndTjh(@RequestBody TjProBlDto dto) {
 
         if (null == dto.getBldhs() || dto.getBldhs().size() == 0) {
+            log.info("璇烽�夋嫨瑕佹挙閿�鐨勮ˉ褰曢」鐩�");
             return AjaxResult.error("璇烽�夋嫨瑕佹挙閿�鐨勮ˉ褰曢」鐩�");
         }
 
@@ -2731,45 +3256,69 @@
         if (null != order) {
             String configByKey = configService.selectConfigByKey("sfkqdyhis");
             if (null != configByKey && configByKey.equals("Y")) {
+                log.info("dto鐨勬暟鎹槸" + JSONUtil.toJsonStr(dto));
                 HashMap<String, Object> hisRequestParams = new HashMap<>();
                 hisRequestParams.put("patientId", order.getCardId());
                 AjaxResult queryPay = hisApiGetMethodService.getHISDataNew("QueryPay", hisRequestParams);
+                log.info("queryPay ->{}", JSONUtil.toJsonStr(queryPay));
                 if (Integer.parseInt(queryPay.get("code").toString()) == 200) {
                     List<Map<String, String>> data = (List<Map<String, String>>) queryPay.get("data");
-                    BigDecimal cateFeeAll = BigDecimal.ZERO;
-                    List<String> advIds = new ArrayList<>();
-                    for (Map<String, String> datum : data) {
-                        String advId = datum.get("Adv_Id").split("_")[1];
-                        BigDecimal cateFee = new BigDecimal(datum.get("CateFee"));
-                        cateFeeAll = cateFeeAll.add(cateFee);
-                        advIds.add(advId);
+                    log.info("data鐨勬暟鎹槸" + JSONUtil.toJsonStr(data));
+//                    BigDecimal cateFeeAll = BigDecimal.ZERO;
+//                    List<String> advIds = new ArrayList<>();
+                    List<LtkjJianchajianyanTree> buLuXmXinXi = tjOrderService.getBuLuXmXinXi(dto.getBldhs(), order.getCardId());
+                    log.info("buLuXmXinXi鐨勫�间负:==========" + buLuXmXinXi);
+                    if (null != buLuXmXinXi && !buLuXmXinXi.isEmpty()) {
+                        for (Map<String, String> datum : data) {
+                            for (LtkjJianchajianyanTree tree : buLuXmXinXi) {
+                                String advId = datum.get("Adv_Id").split("_")[1];
+                                log.info("advid鐨勫�间负:==========" + advId);
+                                log.info("tree鐨勫�间负:==========" + advId);
+                                BigDecimal cateFee = new BigDecimal(datum.get("CateFee"));
+                                log.info("cateFee鐨勫�间负:==========" + cateFee);
+                                log.info("tree.getFyhj()鐨勫�间负:==========" + tree.getFyhj());
+                                if (tree.getSqdh().equals(advId) && cateFee.compareTo(new BigDecimal(tree.getFyhj())) == 0) {
+                                    log.info("璇ラ」鐩凡缂磋垂涓嶅彲鎾ら攢");
+                                    return AjaxResult.error("璇ラ」鐩凡缂磋垂涓嶅彲鎾ら攢!!!");
+                                }
+                            }
+                        }
                     }
-                    if (advIds.containsAll(dto.getBldhs()) && cateFeeAll.compareTo(BigDecimal.ZERO) != 0) {
-                        return AjaxResult.error("鏀归」鐩凡缂磋垂涓嶅彲鎾ら攢!!!");
-                    }
-
                 }
+
                 boolean b = hisApiMethod.ZfBlXm(dto.getBldhs(), order);
-                if(!b){
-                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                if (!b) {
+//                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    log.info("鎾ら攢澶辫触,璋冪敤浣滃簾鍑虹幇澶辫触");
                     return AjaxResult.error("鎾ら攢澶辫触,璋冪敤浣滃簾鍑虹幇澶辫触");
                 }
             }
-            for (String bldh : dto.getBldhs()) {
-                remarkService.deleteTjOrderDetailByjxbz(bldh);
-                tjOrderDetailService.deleteTjOrderDetailByjxbz(bldh);
-                tjFlowingWaterService.deleteTjOrderDetailByjxbz(bldh);
-                transitionService.deleteTjOrderDetailByjxbz(bldh);
-                blService.remove(new LambdaQueryWrapper<TjProBl>().eq(TjProBl::getTjh, dto.getTjh()).eq(TjProBl::getBldh, bldh));
+            try {
+                extracted(dto, order);
+            } catch (Exception e) {
+                log.info("鎾ら攢澶辫触,鍒犻櫎琛ㄥけ璐�");
+                return AjaxResult.error("鎾ら攢澶辫触,鍒犻櫎琛ㄥけ璐�!");
             }
             return AjaxResult.success();
         }
         return AjaxResult.error();
     }
 
+    //    @Transactional(propagation =Propagation.REQUIRES_NEW)
+    public void extracted(TjProBlDto dto, TjOrder order) {
+        for (String bldh : dto.getBldhs()) {
+            remarkService.deleteTjOrderDetailByjxbz(bldh);
+            tjOrderDetailService.deleteTjOrderDetailByjxbz(bldh);
+            tjFlowingWaterService.deleteTjOrderDetailByjxbz(bldh);
+            transitionService.deleteTjOrderDetailByjxbz(bldh);
+            blService.remove(new LambdaQueryWrapper<TjProBl>().eq(TjProBl::getTjh, dto.getTjh()).eq(TjProBl::getBldh, bldh));
+        }
+        tjSamplingMapper.deleteByTjNumAndCusIdAndJxbz(dto.getTjh(), order.getUserId(), dto.getBldhs());
+    }
 
-    @PostMapping ("/addYaoPinShenQing")
-    @ApiOperation (value = "鑽搧淇℃伅鐢宠")
+
+    @PostMapping("/addYaoPinShenQing")
+    @ApiOperation(value = "鑽搧淇℃伅鐢宠")
     @Transactional
     public AjaxResult addYaoPinShenQing(@RequestBody OutpinmedicapplyDto dto) {
         AjaxResult result = controller.Outpinmedicapply(dto);
@@ -2783,5 +3332,76 @@
     }
 
 
+    @GetMapping("/chushenyemianqijianjiekou")
+    @ApiOperation(value = "鍒濆椤甸潰寮冩鎺ュ彛")
+    @Transactional
+    public AjaxResult chushenyemianqijianjiekou(@RequestParam String tjNUm, @RequestParam String proId) {
+        LambdaQueryWrapper<TjOrderRemark> wq = new LambdaQueryWrapper<>();
+        wq.eq(TjOrderRemark::getTjNumber, tjNUm);
+        wq.eq(TjOrderRemark::getProId, proId);
+        TjOrderRemark remark = remarkService.getOne(wq);
+        remark.setType(1);
+        remarkService.updateById(remark);
+        return AjaxResult.success("鎿嶄綔鎴愬姛!");
+    }
+
+
+    @PostMapping("/zongjanyemianshjianzhou")
+    @ApiOperation(value = "鎬绘鑾峰彇鏃堕棿杞存帴鍙�")
+    @Transactional
+    public AjaxResult zongjanyemianshjianzhou(@RequestBody List<String> tjNUms) {
+
+        if(null !=tjNUms && !tjNUms.isEmpty()){
+            List<Map<String,Object>> list=new ArrayList<>();
+            for (String tjNUm : tjNUms) {
+                Map<String,Object> map=new HashMap<>();
+                TjOrder order = tjOrderService.getOrderByTjNum(tjNUm);
+                if (null != order) {
+                    int czwj = remarkService.panduaniscunzaiweijian(tjNUm);
+                    int sfwc = remarkService.panduaniswancheng(tjNUm);
+                    Date checkTime = order.getCheckTime();
+                    Date reportTime = order.getReportTime();
+                    Integer heshouStatus = order.getHeshouStatus();
+                    Date lastTime = order.getPrintLastTime();
+                    int a=0;
+                    if (czwj == 0) {
+                        //鏈
+                        a=0;
+                    }
+                    if (czwj > 0) {
+                        //鍦ㄦ
+                        a=1;
+                    }
+                    if (sfwc == 0) {
+                        //宸插畬鎴�
+                        a=2;
+                    }
+                    if (null != checkTime) {
+                        //宸插鏍�
+                        a=3;
+                    }
+                    if (null != reportTime) {
+                        //鐢熸垚鎶ュ憡
+                        a=4;
+                    }
+                    if (null != heshouStatus) {
+                        //鎶ュ憡鏍告敹
+                        a=5;
+                    }
+                    if (null != lastTime) {
+                        //宸插嚭鎶ュ憡
+                        a=6;
+                    }
+                    map.put("tjNUm",tjNUm);
+                    map.put("sjz",a);
+                    list.add(map);
+            }
+        }
+            return AjaxResult.success(list);
+        }
+        return AjaxResult.error();
+    }
+
+
 }
 

--
Gitblit v1.8.0