zjh
5 天以前 92db9e7f8e1f79f5b61266382149843159907157
ltkj-admin/src/main/java/com/ltkj/web/controller/app/ReportController.java
@@ -4,15 +4,11 @@
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
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.ltkj.common.core.controller.BaseController;
import com.ltkj.common.core.domain.AjaxResult;
import com.ltkj.common.core.page.TableDataInfo;
import com.ltkj.common.utils.SecurityUtils;
import com.ltkj.common.utils.StringUtils;
import com.ltkj.framework.config.UserHoder;
import com.ltkj.hosp.domain.*;
import com.ltkj.hosp.service.*;
import com.ltkj.hosp.sqlDomain.LtkjExamJcbgd;
@@ -20,20 +16,16 @@
import com.ltkj.hosp.sqlDomain.LtkjHybgd;
import com.ltkj.hosp.sqlDomain.LtkjHysqd;
import com.ltkj.hosp.vodomain.ShenGaoTiZhongVo;
import com.ltkj.mall.mallOrderUtils.TjConstants;
import com.ltkj.system.service.ISysConfigService;
import com.ltkj.web.config.pdfutils.PDFBinaryUtil;
import com.ltkj.web.controller.system.TjReportController;
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.ibatis.annotations.One;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTJcImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.session.InMemoryWebSessionStore;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@@ -42,7 +34,6 @@
import java.net.URL;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
 * @Author: 西安路泰科技有限公司/lige
@@ -75,8 +66,8 @@
    private IDictCompService compService;
    @Resource
    private ITjReportTemplateService reportTemplateService;
    @Value("${path.filePath}")
    private String value;
//    @Value("${path.filePath}")
//    private String value;
    @Resource
    private LtkjHybgdService ltkjHybgdService;
    @Resource
@@ -85,6 +76,10 @@
    private LtkjExamJcbgdService jcbgdService;
    @Resource
    private LtkjExamJcsqdService jcsqdService;
    @Autowired
    private ISysConfigService configService;
    @Autowired
    private TjReportController tjReportController;
    /**
@@ -101,7 +96,7 @@
        LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjCustomer::getCusPhone, cusPhone);
        List<TjCustomer> list1 = customerService.list(wq1);
        if (list1.size() != 0) {
        if (null != list1 && !list1.isEmpty()) {
            for (TjCustomer tjCustomer : list1) {
                Map<String, Object> map = new HashMap<>();
                QueryWrapper<TjOrder> wq2 = new QueryWrapper<>();
@@ -110,7 +105,7 @@
                wq2.isNotNull("finish_time");
                wq2.orderByDesc("finish_time");
                List<TjOrder> list = orderService.list(wq2);
                if (null != list && list.size() > 0) {
                if (null != list && !list.isEmpty()) {
                    TjOrder tjOrder = orderService.list(wq2).get(0);
                    map.put("report", tjOrder);
                    map.put("customer", tjCustomer);
@@ -412,20 +407,11 @@
    @GetMapping("/preview/{flag}/{TjNumber}")
    @ApiOperation(value = "下载体检报告")
    public void preview(HttpServletResponse response, @PathVariable("flag") boolean flag, @PathVariable("TjNumber") String tjNumber) {
        //修改order表中的下载报告时间为当前时间
//        LambdaUpdateWrapper<TjOrder> updateWrapper = new LambdaUpdateWrapper<>();
//        updateWrapper.eq(TjOrder::getTjNumber, tjNumber);
//        updateWrapper.set(TjOrder::getPrintLastTime, new Date());
//        updateWrapper.set(TjOrder::getDownloadLastTime, new Date());
//        updateWrapper.set(TjOrder::getStatus, TjConstants.TJ_END);
//        orderService.update(updateWrapper);
        LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjOrder::getTjNumber, tjNumber);
        TjOrder tjOrder = orderService.getOne(wq1);
        String value = configService.selectConfigByKey("path_filePath");
        LambdaQueryWrapper<TjCustomer> wq2 = new LambdaQueryWrapper<>();
        wq2.eq(TjCustomer::getCusId, tjOrder.getUserId());
        TjCustomer tjCustomer = customerService.getOne(wq2);
@@ -529,4 +515,58 @@
        }
        return AjaxResult.success("您还没有体检记录!");
    }
    @PostMapping("/tijianjilu")
    @ApiOperation("小程序体检记录")
    public AjaxResult tijianjilu(@RequestBody String json) {
        cn.hutool.json.JSONObject entries = JSONUtil.parseObj(json);
        String idCard = entries.getStr("idCard");
        String kssj = entries.getStr("kssj");
        String jssj = entries.getStr("jssj");
        TjCustomer tjCustomer = customerService.getTjCustomerByCusIdCard(idCard);
        if (null != tjCustomer) {
            List<Map<String, Object>> mapList = new ArrayList<>();
            LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
            wq.eq(TjOrder::getUserId, tjCustomer.getCusId());
            wq.eq(TjOrder::getCheckStatus, 1);
            wq.eq(TjOrder::getHeshouStatus, 1);
            wq.isNotNull(TjOrder::getReportTime);
            wq.isNotNull(TjOrder::getHeshouTime);
            if(StringUtil.isNotBlank(kssj) && StringUtil.isNotBlank(jssj)){
                wq.between(TjOrder::getCreateTime, kssj, jssj);
            }else {
                DateTime start = DateUtil.beginOfMonth(DateUtil.date());
                DateTime end = DateUtil.beginOfMonth(DateUtil.offsetMonth(DateUtil.date(), 1));
                wq.between(TjOrder::getCreateTime, start, end);
            }
            List<TjOrder> list = orderService.list(wq);
            if (null != list && !list.isEmpty()) {
                for (TjOrder order : list) {
                    Map<String, Object> map = new HashMap<>();
                    map.put("tjNumber", order.getTjNumber());
                    map.put("status", "已完成");
                    map.put("cusName", tjCustomer.getCusName());
                    map.put("cusSex", tjCustomer.getCusSex());
                    map.put("age", tjCustomer.getAge());
                    map.put("tjTime",order.getCreateTime());
                    mapList.add(map);
                }
                return AjaxResult.success(mapList);
            }
        }
        return AjaxResult.error("暂无体检记录");
    }
    @PostMapping("/preview")
    @ApiOperation(value = "下载体检报告")
    public void preview(HttpServletResponse response,@RequestBody String json) {
        cn.hutool.json.JSONObject entries = JSONUtil.parseObj(json);
        String tjNumber = entries.getStr("tjNumber");
        tjReportController.preview(response, true, tjNumber);
    }
}