zhaowenxuan
2024-10-14 7d702f59202496e28a80582b4aeeab2a9b9da76d
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;
@@ -20,7 +21,9 @@
import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.crypto.symmetric.DES;
import cn.hutool.extra.pinyin.PinyinUtil;
import cn.hutool.json.JSONArray;
@@ -29,15 +32,19 @@
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.framework.config.MatchUtils;
@@ -50,6 +57,7 @@
import com.ltkj.hosp.hisDto.OutpinimpapplyDto;
import com.ltkj.hosp.hisDto.OutpinmedicapplyDto;
import com.ltkj.hosp.mapper.TestMapper;
import com.ltkj.hosp.pacsDto.SavePacsApply;
import com.ltkj.hosp.service.*;
import com.ltkj.hosp.sqlDomain.LtkjMiddleDetail;
import com.ltkj.hosp.sqlDomain.LtkjMiddleHead;
@@ -67,20 +75,23 @@
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.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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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;
@@ -92,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
 *
@@ -99,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
@@ -125,7 +138,7 @@
    private ITbTransitionService transitionService;
    @Resource
    private ISysConfigService configService;
    @Value ("${path.filePath}")
    @Value("${path.filePath}")
    private String value;
    @Resource
    private ITjOrderRemarkService remarkService;
@@ -133,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
@@ -196,11 +192,26 @@
    private HisApiMethodService controller;
    @Autowired
    private TjProBlService blService;
    @Resource
    private ITjReportTemplateService reportTemplateService;
    @Autowired
    private LtkjJianchajianyanTreeService ltkjJianchajianyanTreeService;
    @Autowired
    private PacsApiMethodService pacsApiMethodService;
    @Autowired
    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;
    //将方法返回值解析成json格式
    public JSONObject getJSONObject(String builder) {
@@ -217,8 +228,8 @@
     * 查询体检记录列表
     */
//    @PreAuthorize("@ss.hasPermi('hosp:order:list')")
    @GetMapping ("/list")
    @ApiOperation (value = "查询体检记录列表(默认)")
    @GetMapping("/list")
    @ApiOperation(value = "查询体检记录列表(默认)")
    public TableDataInfo list(TjOrder tjOrder) {
        startPage();
        startOrderBy();
@@ -251,16 +262,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<>();
@@ -380,17 +391,17 @@
    }
    @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) 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) {
        Map<String, Object> map = new HashMap<>();
        if (null != name) {
            LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>();
@@ -490,8 +501,7 @@
                if (null != order.getPacId()) {
                    if (null != tjPackageService.getById(order.getPacId())) {
                        order.setPacName(tjPackageService.getById(order.getPacId()).getPacName());
                    }else
                    if (null != dwDeptService.getById(order.getPacId())) {
                    } else if (null != dwDeptService.getById(order.getPacId())) {
                        order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName());
                    }
                }
@@ -503,20 +513,20 @@
    }
    @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 = "体检号)") @RequestParam(required = false) String tjNum,
                                     @ApiParam(value = "姓名)") @RequestParam(required = false) String name,
                                     @ApiParam(value = "报告开始时间") @RequestParam(required = false) String djbeginTime,
                                     @ApiParam(value = "报告结束时间") @RequestParam(required = false) String djendTime) {
        Map<String, Object> map = new HashMap<>();
        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) {
            if (null != customerList && !customerList.isEmpty()) {
                List<TjOrder> list = new ArrayList<>();
                for (TjCustomer customer : customerList) {
                    LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
@@ -526,7 +536,7 @@
                    list.addAll(tjOrderService.list(wq));
                }
                List<TjOrder> collect = null;
                if (list.size() > 0) {
                if (!list.isEmpty()) {
                    for (int i = 0; i < list.size(); i++) {
                        TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId());
@@ -536,7 +546,7 @@
                        }
                        list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
                        list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
                        list.get(i).setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName()));
                        list.get(i).setTjCustomerName(tjCustomer.getCusName());
                        list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone()));
                        list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard()));
@@ -579,13 +589,13 @@
        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 (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.orderByDesc(TjOrder::getReportTime);
        wq.orderByDesc(TjOrder::getCreateTime);
        Page<TjOrder> page2 = tjOrderService.page(page1, wq);
        List<TjOrder> list = page2.getRecords();
        if (list != null) {
@@ -597,7 +607,7 @@
                }
                list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
                list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
                list.get(i).setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName()));
                list.get(i).setTjCustomerName(tjCustomer.getCusName());
                list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone()));
                if (tjCustomer.getCusIdcard() != null) {
                    list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard()));
@@ -632,15 +642,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) {
@@ -831,9 +841,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);
@@ -845,15 +855,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"));
@@ -865,12 +875,18 @@
    }
    /**
     * 体检签到登记接口
     */
    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);
@@ -892,8 +908,7 @@
            transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId());
            return AjaxResult.error("不可重复登记");
        }
        TjFlowingWater tjFlowingWater = new TjFlowingWater();
        LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard());
        wq1.eq(TjReservation::getIsExpire, 2);
@@ -902,10 +917,10 @@
        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("对不起您的预约已超时请重新预约");
@@ -920,7 +935,7 @@
                tjOrder.setGroupId(tjReservation.getGroupingId());
                tjOrder.setFirmDeptId(tjReservation.getPacId());
            }
//            if (null != tjReservation.getDepartmentId()) tjOrder.setFirmDeptId(tjReservation.getDepartmentId());
            //            if (null != tjReservation.getDepartmentId()) tjOrder.setFirmDeptId(tjReservation.getDepartmentId());
            tjReservation.setIsExpire(1);
            tjReservationService.updateById(tjReservation);
            if (null != tjReservation.getTeamNo()) {
@@ -929,9 +944,7 @@
                tjOrder.setTjType("2");
            }
        }
        //生成体检号
        String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date()));
        tjOrder.setTjNumber(tjNumber);
        if (null != tjOrder.getPhoto()) {
            File file = new File(tjOrder.getPhoto());
            if (file.isFile()) {
@@ -958,145 +971,162 @@
            tjOrder.setFinishTime(new Date());
            tjOrder.setCheckStatus(1);
            tjOrder.setStatus(TjConstants.TJ_WAIT);
            //            tjFlowingWater.setPayStasus(1L);
        }
        if (tjOrderService.save(tjOrder)) {
        tjFlowingWater.setPayStasus(0L);
            //保存收货地址
            if ("2".equals(tjOrder.getGetType())) {
                final TjReportGetAddress address = tjOrder.getAddAddress();
                if (address != null) {
                    address.setTjNumber(tjNumber);
                    tjReportGetAddressService.save(address);
                }
            }
            Long cusNumber = tjCustomer.getCusNumber();
            cusNumber += 1;
            tjCustomer.setCusNumber(cusNumber);
            BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount()));
            TjFlowingWater tjFlowingWater = new TjFlowingWater();
            tjFlowingWater.setPayStasus(0L);
            if ("1".equals(tjOrder.getTjType())) {
                if (null != tjReservation && tjReservation.getPayType() == 1) {
                    tjFlowingWater.setPayStasus(3L);
                }
            }
        try {
            boolean b = lock.tryLock(3, TimeUnit.MINUTES);
            if(b){
                //生成体检号
                String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date()));
                tjOrder.setTjNumber(tjNumber);
            //调用SQL server拿取收费情况
            //根据配置调取存储过程 将临时表数据存入预约表2023.12.12
            final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData");
            final String isPay = configService.selectConfigByKey("isPay");
            if ("Y".equals(getInfoFromSqlData)) {
                LtkjMiddleHead middleHead = headService.getMiddleHeadByPartId(tjCustomer.getCardId());
                if (null != middleHead) {
                    tjFlowingWater.setPayStasus(1L);
                }
            }
            tjFlowingWater.setOrderId(tjOrder.getOrderId());
            Date date1 = new Date(System.currentTimeMillis());
            String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date1);
            tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(tjCustomer.getCusName(), "").toUpperCase() + s1);
            tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith());
            tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn());
            tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount());
            if (isPay.equals("true")) {
                if (null != mallOrder) {
                    if (mallOrder.getOrderStatus().equals(201L)) {
                        tjFlowingWater.setCopeWith(mallOrder.getActualPrice());
                        tjFlowingWater.setPaidIn(mallOrder.getActualPrice());
                        tjFlowingWater.setDiscount(String.valueOf(1));
                        tjFlowingWater.setPayStasus(1L);
                        tjFlowingWater.setPayType(3L);
                        MallCheckLog checkLog = new MallCheckLog();
                        checkLog.setCheckBy(sysUser.getNickName());
                        checkLog.setUserId(mallOrder.getUserId());
                        checkLog.setConsignee(mallOrder.getConsignee());
                        checkLog.setIdCard(mallOrder.getIdCard());
                        checkLog.setOrderId(String.valueOf(mallOrder.getId()));
                        checkLog.setOrderSn(mallOrder.getOrderSn());
                        checkLog.setCheckTime(new Date());
                        checkLog.setShipSn("HX" + s1);
                        mallCheckLogService.save(checkLog);
                        mallOrder.setOrderStatus(301L);
                        mallOrderService.updateById(mallOrder);
                if (tjOrderService.save(tjOrder)) {
                    //保存收货地址
                    if ("2".equals(tjOrder.getGetType())) {
                        final TjReportGetAddress address = tjOrder.getAddAddress();
                        if (address != null) {
                            address.setTjNumber(tjNumber);
                            tjReportGetAddressService.save(address);
                        }
                    }
                } else {
                    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) {
                            tjFlowingWater.setPayStasus(3L);
                        }
                    }
                    //调用SQL server拿取收费情况
                    //根据配置调取存储过程 将临时表数据存入预约表2023.12.12
                    final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData");
                    final String isPay = configService.selectConfigByKey("isPay");
                    if ("Y".equals(getInfoFromSqlData)) {
                        LtkjMiddleHead middleHead = headService.getMiddleHeadByPartId(tjCustomer.getCardId());
                        if (null != middleHead) {
                            tjFlowingWater.setPayStasus(1L);
                        }
                    }
                    tjFlowingWater.setOrderId(tjOrder.getOrderId());
                    Date date1 = new Date(System.currentTimeMillis());
                    String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date1);
                    tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(tjCustomer.getCusName(), "").toUpperCase() + s1);
                    tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith());
                    tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn());
                    tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount());
//                    tjFlowingWater.setPayStasus(0L);
                }
            }
            if (tjFlowingWaterService.save(tjFlowingWater)) {
                tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber()));
                tjOrderService.updateById(tjOrder);
            }
            //修改每项的原价现价 //修改临时表体检号
            transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount, tjOrder.getTjNumber());
            /*调用his接口*/
            String config = configService.selectConfigByKey("sfkqdyhis");
            if (null != config && config.equals("Y")) {
                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()){
                        hisApiMethod.ZfHisApiMethod(jzh.toString());
                    if (isPay.equals("true")) {
                        if (null != mallOrder) {
                            if (mallOrder.getOrderStatus().equals(201L)) {
                                tjFlowingWater.setCopeWith(mallOrder.getActualPrice());
                                tjFlowingWater.setPaidIn(mallOrder.getActualPrice());
                                tjFlowingWater.setDiscount(String.valueOf(1));
                                tjFlowingWater.setPayStasus(1L);
                                tjFlowingWater.setPayType(3L);
                                MallCheckLog checkLog = new MallCheckLog();
                                checkLog.setCheckBy(sysUser.getNickName());
                                checkLog.setUserId(mallOrder.getUserId());
                                checkLog.setConsignee(mallOrder.getConsignee());
                                checkLog.setIdCard(mallOrder.getIdCard());
                                checkLog.setOrderId(String.valueOf(mallOrder.getId()));
                                checkLog.setOrderSn(mallOrder.getOrderSn());
                                checkLog.setCheckTime(new Date());
                                checkLog.setShipSn("HX" + s1);
                                mallCheckLogService.save(checkLog);
                                mallOrder.setOrderStatus(301L);
                                mallOrderService.updateById(mallOrder);
                            }
                        } else {
                            tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith());
                            tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn());
                            tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount());
    //                    tjFlowingWater.setPayStasus(0L);
                        }
                    }
                    return AjaxResult.error("挂号失败!" + result.get("msg").toString());
                    if (tjFlowingWaterService.save(tjFlowingWater)) {
                        tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber()));
                        tjOrderService.updateById(tjOrder);
                    }
                    //修改每项的原价现价 //修改临时表体检号
                    transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount, tjOrder.getTjNumber());
                    /*调用his接口*/
                    String config = configService.selectConfigByKey("sfkqdyhis");
                    if (null != config && config.equals("Y")) {
                        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()) {
                                hisApiMethod.ZfHisApiMethod(jzh.toString());
                            }
                            log.info("该登记人挂号失败, 就诊号为: " + tjOrder.getCardId());
                            return AjaxResult.error("挂号失败!" + result.get("msg").toString());
                        }
                        log.info("该登记人的his就诊号是: " + tjOrder.getCardId());
                        //团体
                        if ("1".equals(tjOrder.getTjType())) {
                            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);
                        }
                        // 查询 对接Lis、Pacs申请如果类型包含在配置内则使用对接lis、pacs
//                        if (isUseLisAndPacsRegister(tjOrder)) {
//                          hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"),tjOrder,sysUser,result);
//                        }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());
                        tjCustomerService.updateById(tjCustomer);
                        transitionService.updateCardIdByTjNumAndIdCard(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), tjOrder.getTjNumber());
                        tjOrder.setCardId(tjOrder.getTjNumber());
                        tjOrderService.updateById(tjOrder);
                    }
                    //团体
                    if ("1".equals(tjOrder.getTjType())) {
                        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);
                    }
                    return AjaxResult.success(tjNumber);
                }
                log.info("该登记人的his就诊号是: "+tjOrder.getCardId());
                //团体
                if ("1".equals(tjOrder.getTjType())) {
                    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);
                }
                hisApiMethod.tijianshenqing(tjCustomer,DateUtil.format(date1,"yyyy-MM-dd HH:mm:ss"),tjOrder.getCardId());
                return AjaxResult.success(tjNumber);
            } else {
                tjCustomer.setCardId(tjOrder.getTjNumber());
                tjCustomerService.updateById(tjCustomer);
                transitionService.updateCardIdByTjNumAndIdCard(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), tjOrder.getTjNumber());
                tjOrder.setCardId(tjOrder.getTjNumber());
                tjOrderService.updateById(tjOrder);
                return AjaxResult.error();
            }
            //团体
            if ("1".equals(tjOrder.getTjType())) {
                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);
            }
            return AjaxResult.success(tjNumber);
        } finally {
            lock.unlock();
        }
        return AjaxResult.error();
    }
    @PostMapping ("/addPlOrderAndDetail")
    @ApiOperation (value = "体检批量签到登记接口")
    @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() {
@@ -1109,7 +1139,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) {
@@ -1488,9 +1518,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));
    }
@@ -1499,16 +1529,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);
@@ -1528,8 +1558,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");
@@ -1554,150 +1584,39 @@
                redisCache.deleteCacheMapValue(cardId + cusId + "cusId", cardId + cusId);
            }
        }
//        List<TbTransition> tbTransitionList = null;
//        if (!redisCache.hasKey(cardId + cusId)) {
//            tbTransitionList = new ArrayList<>();
//        } else {
//            tbTransitionList = redisCache.getCacheList(cardId + cusId);
//        }
        //套餐
        /*套餐*/
        if (null != packId && !packId.equals("")) {
            Long pacId = Long.valueOf(packId.toString());
            List<TbTransition> list = transitionService.getTbTransitionListByCusIdAndPac(cusId, String.valueOf(pacId));
            if (null == list || list.size() == 0) {
            if (null == list || list.isEmpty()) {
                transitionService.deletedTbTransitionListByCusIdAndPac(cusId, cardId);
//                if (redisCache.hasKey(cardId + cusId + "cusId"))
//                    redisCache.deleteCacheMapValue(cardId + cusId + "cusId", cardId + cusId);
//                if (redisCache.hasKey(cardId + cusId)) {
//                    tbTransitionList = new ArrayList<>();
//                    redisCache.deleteObject(cardId + cusId);
//                }
                List<TjPackageProject> ppList = tjPackageProjectService.getTjPackageProjectListByPacId(String.valueOf(pacId));
                if (null != ppList && ppList.size() > 0) {
                if (null != ppList && !ppList.isEmpty()) {
                    transitionService.saveRedisTransitionByPacId(cusId, cardId, pacId);
                    //异步保存数据库
//                    asyncService.addRedisTransitionPac(cusId, pacId, ppList);
//                    asyncService.saveRedisTransitionByPacId(cusId, cardId, pacId, null);
//                    for (TjPackageProject tjPackageProject : ppList) {
//                        TjProject project = projectService.getTjProjectById(String.valueOf(tjPackageProject.getProId()));
//                        if (null != project) {
//
//                            BigDecimal divide = BigDecimal.valueOf(0);
//                            if (tjPackageProject.getPriceNow().compareTo(BigDecimal.valueOf(0)) == 0 || project.getProPrice().compareTo(BigDecimal.valueOf(0)) == 0) {
//                                divide = BigDecimal.valueOf(0);
//                            } else {
//                                divide = tjPackageProject.getPriceNow().divide(project.getProPrice(), 5, RoundingMode.HALF_DOWN);
//                            }
//                            List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId()));
//                            if (null != tjProSonList && tjProSonList.size() > 0) {
//                                //addRedisTransitionPac(cusId, tbTransitionList, pacId, tjPackageProject, project, divide, tjProSonList);
//                                for (TjProject tjProject : tjProSonList) {
//                                    TbTransition tbTransition = new TbTransition();
//                                    tbTransition.setCusId(cusId);
//                                    tbTransition.setPacId(pacId);
//                                    if (null != tjPackageProject.getPriceNow() && divide.compareTo(BigDecimal.valueOf(0)) > 0) {
//                                        tbTransition.setNowPrice(tjProject.getProPrice().multiply(divide).setScale(2, RoundingMode.HALF_DOWN));
//                                        tbTransition.setOrdPrice(tjProject.getProPrice().multiply(divide).setScale(2, RoundingMode.HALF_DOWN));
//                                    } else {
//                                        tbTransition.setNowPrice(BigDecimal.valueOf(0.00));
//                                        tbTransition.setOrdPrice(BigDecimal.valueOf(0.00));
//                                    }
//                                    tbTransition.setParentProId(project.getProId());
//                                    tbTransition.setParentProName(project.getProName());
//                                    tbTransition.setProId(tjProject.getProId());
//                                    tbTransition.setProName(tjProject.getProName());
//                                    tbTransition.setPacName(tjPackageService.getById(tbTransition.getPacId()).getPacName());
//                                    tbTransition.setProType(tjProject.getProType());
//                                    tbTransition.setProCheckMethod(tjProject.getProCheckMethod());
//                                    tbTransitionList.add(tbTransition);
//                                }
//
//                            }
//                        }
//                    }
                }
            }
        }
        //单项
        if (null != proIds && proIds.size() > 0) {
        if (null != proIds && !proIds.isEmpty()) {
            //异步保存数据库表
//            asyncService.saveRedisTransitionByPacId(cusId, cardId, null, proIds);
            for (Long proId : proIds) {
                TjProject project = projectService.selectTjProjectByProId(proId);
                if (null != project) { //&& (!project.getProName().contains("静脉采血")|| !project.getProName().contains("费"))
                if (null != project) {
                    List<TbTransition> transitionList = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId));
                    if (null == transitionList || transitionList.size() == 0) {
                    if (null == transitionList || transitionList.isEmpty()) {
                        transitionService.saveRedisTransitionByProId(cusId, cardId, proId);
                    }
                }
//            if(null !=project) transitionService.saveRedisTransitionByProId(cusId,cardId, proId);
            }
//            for (Long proId : proIds) {
//                List<TbTransition> transitions = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId));
//                if (null != transitions && transitions.size() > 0) {
//                    continue;
//                }
//                TjProject tjProject = projectService.getTjProjectById(String.valueOf(proId));
//                if (null != tjProject) {
////                    List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId()));
////                    if (null != tjProSonList && tjProSonList.size() > 0) {
////                        for (TjProject tjProject : tjProSonList) {
////                    List<TbTransition> transitionss = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(tjProject.getProId()));
////                    if (null != transitionss && transitionss.size() > 0) {
////                        continue;
////                    }
//                    TbTransition tbTransition = new TbTransition();
//                    tbTransition.setCusId(cusId);
//                    tbTransition.setPacId(null);
//                    if (null != tjProject.getProPrice()) {
//                        tbTransition.setOrdPrice(tjProject.getProPrice());
//                        tbTransition.setNowPrice(tjProject.getProPrice());
//                    } else {
//                        tbTransition.setOrdPrice(BigDecimal.valueOf(0.00));
//                        tbTransition.setNowPrice(BigDecimal.valueOf(0.00));
//                    }
//                    tbTransition.setParentProId(tjProject.getProParentId());
//                    if (tjProject.getProParentId() != null) {
//                        TjProject byId = projectService.getById(tjProject.getProParentId());
//                        if (null != byId) {
//                            tbTransition.setParentProName(byId.getProName());
//                        }
//                    }
//                    tbTransition.setParentProName("");
//
//                    tbTransition.setProId(tjProject.getProId());
//                    tbTransition.setProName(tjProject.getProName());
//                    tbTransition.setProType(tjProject.getProType());
//                    tbTransition.setProCheckMethod(tjProject.getProCheckMethod());
//                    tbTransitionList.add(tbTransition);
////                        }
////                    }
//                }
//            }
        }
//        if (null != tbTransitionList && tbTransitionList.size() > 0) {
//            if (redisCache.hasKey(cardId + cusId)) {
//                redisCache.deleteObject(cardId + cusId);
//                redisCache.setCacheList(cardId + cusId, tbTransitionList);
//                redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId));
//            } else {
//                redisCache.setCacheList(cardId + cusId, tbTransitionList);
//                redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId));
//            }
//            List<Map<String, Object>> map1 = getMap(cusId, cardId, tbTransitionList);
//            return AjaxResult.success();
//        }
        return AjaxResult.success();
    }
    @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);
@@ -1712,16 +1631,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<>();
@@ -1830,9 +1749,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);
@@ -1857,8 +1776,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());
@@ -1923,7 +1842,6 @@
                dto.setJzqk(9);
                controller.Outpinimpapply(dto);
            }*/
            return AjaxResult.success("签离成功!");
        } else {
            return getAjaxResult(tjNumber);
@@ -1934,10 +1852,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);
    }
@@ -1945,9 +1863,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();
        }
@@ -2114,15 +2032,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;
@@ -2187,11 +2105,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<>();
@@ -2250,8 +2168,8 @@
    }
    @PostMapping ("/tuanTiBingChart")
    @ApiOperation (value = "查询团体体检病种统计图")
    @PostMapping("/tuanTiBingChart")
    @ApiOperation(value = "查询团体体检病种统计图")
    public AjaxResult tuanTiBingChart(@RequestBody BingZhongVO bingZhongVO) {
        List<TjOrderDetailRules> res1 = new ArrayList<>();
@@ -2290,18 +2208,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)
@@ -2361,12 +2279,13 @@
    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());
            tjOrderDetailService.saveJSYTjOrderDetailsByCusId(tjCustomer.getCusIdcard(),
                    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")) {
@@ -2390,30 +2309,113 @@
            tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith());
            tjFlowingWater.setPayType(4L);
            tjFlowingWaterService.updateById(tjFlowingWater);
            asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser);
//            asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser);
        }
    }
    @PostMapping ("/heXiaoByIds/{orderIds}")
    @ApiOperation (value = "核收报告——————总检审核通过后可以核销,核收后才能打印")
    @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);
                    try {
                        shengchengbgmoban(byId.getTjNumber(), byId, tjCustomer, reportTemplate);
                        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) throws Exception {
        AjaxResult ajaxResult = hisPDFUtil.hisPDF(tjOrder, tjCustomer, reportTemplate);
        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 + "\\";
            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);
@@ -2433,8 +2435,8 @@
    }
    @GetMapping ("/getHistryTjOrderProByCusIdCard")
    @ApiOperation (value = "根据身份证号查看历史体检项目记录")
    @GetMapping("/getHistryTjOrderProByCusIdCard")
    @ApiOperation(value = "根据身份证号查看历史体检项目记录")
    @Transactional
    public AjaxResult getHistryTjOrderProByCusIdCard(@RequestParam String cusIdCard) {
        TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdCard);
@@ -2493,8 +2495,8 @@
    }
    @GetMapping ("/getHistryTjOrderByCusId")
    @ApiOperation (value = "根据客户id查看历史体检记录")
    @GetMapping("/getHistryTjOrderByCusId")
    @ApiOperation(value = "根据客户id查看历史体检记录")
    @Transactional
    public AjaxResult getHistryTjOrderByCusId(@RequestParam String cusId) {
        TjCustomer tjCustomer = tjCustomerService.getById(cusId);
@@ -2528,10 +2530,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) {
@@ -2567,7 +2569,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 {
@@ -2582,14 +2584,14 @@
    }
    @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);
@@ -2615,10 +2617,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);
@@ -2652,8 +2654,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);
@@ -2695,11 +2697,11 @@
    }
    @GetMapping ("/delTbBycusCardIdAndProId")
    @ApiOperation (value = "根据客户身份证号和项目父项id删除临时表数据")
    @GetMapping("/delTbBycusCardIdAndProId")
    @ApiOperation(value = "根据客户身份证号和项目父项id删除临时表数据")
    @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();
@@ -2708,12 +2710,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")) {
@@ -2733,7 +2737,7 @@
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                return AjaxResult.error("撤销失败,门诊患者费用清单信息不为空");
            } else {
                boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order);
                boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order,lisApiMethod.isUseLisAndPacsRegister(order));
                if (zfHisApiMethods) {
                    return AjaxResult.success("撤销成功", map);
                } else {
@@ -2746,10 +2750,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) {
@@ -2767,10 +2771,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) {
@@ -2801,8 +2805,8 @@
    }
    @PostMapping ("/revokeBlProByBldhAndTjh")
    @ApiOperation (value = "根据补录单号和体检号删除记录")
    @PostMapping("/revokeBlProByBldhAndTjh")
    @ApiOperation(value = "根据补录单号和体检号删除记录")
    @Transactional
    public AjaxResult revokeBlProByBldhAndTjh(@RequestBody TjProBlDto dto) {
@@ -2833,7 +2837,7 @@
                }
                boolean b = hisApiMethod.ZfBlXm(dto.getBldhs(), order);
                if(!b){
                if (!b) {
                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    return AjaxResult.error("撤销失败,调用作废出现失败");
                }
@@ -2851,15 +2855,15 @@
    }
    @PostMapping ("/addYaoPinShenQing")
    @ApiOperation (value = "药品信息申请")
    @PostMapping("/addYaoPinShenQing")
    @ApiOperation(value = "药品信息申请")
    @Transactional
    public AjaxResult addYaoPinShenQing(@RequestBody OutpinmedicapplyDto dto) {
        AjaxResult result = controller.Outpinmedicapply(dto);
        String result1 = getAjaxResult(result);
        JSONObject object = getJSONObject(result1);
        String code = object.getStr("ResultCode");
        if (null != code && code.equals("200")) {
        if (null != code && code.equals("0")) {
        }
        return AjaxResult.success();