lige
2023-12-07 eabf890be5718f5e22d03e3ce2b530da0568a8d0
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
@@ -4,6 +4,7 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.OffsetTime;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
@@ -25,9 +26,11 @@
import com.ltkj.common.core.redis.RedisCache;
import com.ltkj.common.utils.SecurityUtils;
import com.ltkj.framework.config.MatchUtils;
import com.ltkj.framework.config.UserHoder;
import com.ltkj.hosp.domain.*;
import com.ltkj.hosp.service.*;
import com.ltkj.hosp.vodomain.BingZhongVO;
import com.ltkj.hosp.vodomain.HistoryTjOrder;
import com.ltkj.hosp.vodomain.QjDomainVo;
import com.ltkj.mall.domain.MallCheckLog;
import com.ltkj.mall.domain.MallOrder;
@@ -63,7 +66,7 @@
 */
@RestController
@RequestMapping("/hosp/order")
@Api(tags = "体检记录接口")
@Api(tags = "PC端 ----体检记录接口")
@Slf4j
public class TjOrderController extends BaseController {
    @Resource
@@ -92,8 +95,6 @@
    private String value;
    @Resource
    private ITjOrderRemarkService remarkService;
    @Resource
    private ITjTeamSelectRecordService selectRecordService;
    @Resource
    private TjAsyncService asyncService;
    @Resource
@@ -131,6 +132,9 @@
    @Autowired
    private ITjAskMedicalHistoryService tjAskMedicalHistoryService;
    @Autowired
    private ITjReportGetAddressService tjReportGetAddressService;
    /**
@@ -432,6 +436,7 @@
                    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;
@@ -483,6 +488,7 @@
        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));
        }
@@ -841,11 +847,18 @@
        if (null == tjOrder.getPacId() && null != transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))) {
            tjOrder.setPacId(transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId())));
        }
        //判断小程序上预约是否付钱
        if (null != mallOrder) tjOrder.setMallOrderId(String.valueOf(mallOrder.getId()));
        tjOrder.setStatus(TjConstants.TJ_BEGIN);
        if (tjOrderService.save(tjOrder)) {
            //保存收货地址
            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);
@@ -1615,4 +1628,102 @@
        System.out.println("这段代码时间" + (System.currentTimeMillis() - l));
    }
    @PostMapping("/heXiaoByIds/{orderIds}")
    @ApiOperation(value = "核收报告——————总检审核通过后可以核销,核收后才能打印")
    @Transactional
    public AjaxResult heXiaoByIds(@PathVariable String[] orderIds) {
        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("核收失败");
            }
        }
        return AjaxResult.success("核收成功");
    }
    @GetMapping("/getHistryTjOrderByCusIdCard")
    @ApiOperation(value = "根据身份证号查看历史体检记录")
    @Transactional
    public AjaxResult getHistryTjOrderByCusIdCard(@RequestParam String cusIdCard) {
        TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdCard);
        List<HistoryTjOrder> list=new ArrayList<>();
        if(null !=tjCustomer){
            List<TjOrder> orderList = tjOrderService.getTjOrderListByCusId(tjCustomer.getCusId());
            for (TjOrder order : orderList) {
                HistoryTjOrder historyTjOrder=new HistoryTjOrder();
                historyTjOrder.setUserName(tjCustomer.getCusName());
                historyTjOrder.setTjNum(order.getTjNumber());
                historyTjOrder.setTjTime(order.getCreateTime());
                historyTjOrder.setTjProName(tjOrderService.getHistoryTjOrderProByTjNum(order.getTjNumber()));
                list.add(historyTjOrder);
            }
        }
        return AjaxResult.success(list);
    }
    @GetMapping("/getHistryTjOrderProByCusIdCard")
    @ApiOperation(value = "根据身份证号查看历史体检项目记录")
    @Transactional
    public AjaxResult getHistryTjOrderProByCusIdCard(@RequestParam String cusIdCard) {
        TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdCard);
        if(null !=tjCustomer){
            TjOrder order= tjOrderService.getLastTjOrderListByCusId(tjCustomer.getCusId());
            if(null !=order){
                List<Map<String, Object>> list = new ArrayList<>();
                if(order.getPacId().equals("o")){
                    List<Long> longList = remarkService.getTjProIdsByTjNum(order.getTjNumber());
                    for (Long aLong : longList) {
                        Map<String, Object> map = new HashMap<>();
                        map.put("pacName", "单项");
                        map.put("proId",aLong);
                        map.put("pacId",null);
                        map.put("parentName", projectService.getById(aLong).getProName());
                        map.put("list",projectService.getTjProjectListBySoneId(String.valueOf(aLong)));
                        BigDecimal proPrice = projectService.getById(aLong).getProPrice();
                        map.put("ordPrice", proPrice);
                        map.put("nowPrice", proPrice);
                        list.add(map);
                    }
                }
                if(!order.getPacId().equals("o")){
                    List<Long> longList = remarkService.getTjProIdsByTjNumAndPacIc(order.getTjNumber(),order.getPacId());
                    TjPackage aPackage = tjPackageService.getById(order.getPacId());
                    for (Long aLong : longList) {
                        Map<String, Object> map = new HashMap<>();
                        map.put("pacName",aPackage.getPacName());
                        map.put("pacId",aPackage.getPacId());
                        map.put("parentName", projectService.getById(aLong).getProName());
                        map.put("list",projectService.getTjProjectListBySoneId(String.valueOf(aLong)));
                        BigDecimal proPrice = projectService.getById(aLong).getProPrice();
                        map.put("ordPrice", proPrice);
                        map.put("nowPrice",tjPackageProjectService.getPacProPriceByPacIdAndPro(aLong,order.getPacId()));
                        list.add(map);
                    }
                    List<Long> longList1 = remarkService.getTjProIdsByTjNumAndPacIc(order.getTjNumber(),order.getPacId());
                    for (Long aLong : longList1) {
                        Map<String, Object> map = new HashMap<>();
                        map.put("pacName", "单项");
                        map.put("proId",aLong);
                        map.put("pacId",null);
                        map.put("parentName", projectService.getById(aLong).getProName());
                        map.put("list",projectService.getTjProjectListBySoneId(String.valueOf(aLong)));
                        BigDecimal proPrice = projectService.getById(aLong).getProPrice();
                        map.put("ordPrice", proPrice);
                        map.put("nowPrice", proPrice);
                        list.add(map);
                    }
                }
                return AjaxResult.success(list);
            }
        }
        return AjaxResult.success("暂无历史记录");
    }
}