| | |
| | | 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; |
| | | import com.ltkj.hosp.sqlDomain.LtkjExamJcsqd; |
| | | import com.ltkj.hosp.sqlDomain.LtkjHybgd; |
| | | import com.ltkj.hosp.sqlDomain.LtkjHysqd; |
| | | import com.ltkj.mall.mallOrderUtils.TjConstants; |
| | | import com.ltkj.hosp.vodomain.ShenGaoTiZhongVo; |
| | | 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; |
| | |
| | | import java.net.URL; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * @Author: 西安路泰科技有限公司/lige |
| | |
| | | private IDictCompService compService; |
| | | @Resource |
| | | private ITjReportTemplateService reportTemplateService; |
| | | @Value("${path.filePath}") |
| | | private String value; |
| | | // @Value("${path.filePath}") |
| | | // private String value; |
| | | @Resource |
| | | private LtkjHybgdService ltkjHybgdService; |
| | | @Resource |
| | |
| | | private LtkjExamJcbgdService jcbgdService; |
| | | @Resource |
| | | private LtkjExamJcsqdService jcsqdService; |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | @Autowired |
| | | private TjReportController tjReportController; |
| | | |
| | | |
| | | /** |
| | |
| | | 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<>(); |
| | |
| | | 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); |
| | |
| | | if (jyjgval.compareTo(min) < 0) { |
| | | // jyjg 小于范围最小值,添加下箭头 |
| | | jyjg = jyjg + " ↓"; |
| | | hybgd.setYcbz("1"); |
| | | } else if (jyjgval.compareTo(max) > 0) { |
| | | // jyjg 大于范围最大值,添加上箭头 |
| | | jyjg = jyjg + " ↑"; |
| | | hybgd.setYcbz("1"); |
| | | }else { |
| | | hybgd.setYcbz("0"); |
| | | } |
| | | hybgd.setJyjg(jyjg); |
| | | } catch (Exception ignored) {} |
| | |
| | | @GetMapping("/getShenGaoTiZhong") |
| | | @ApiOperation(value = "小程序-体检报告查询详情") |
| | | public AjaxResult getShenGaoTiZhong(@RequestParam @ApiParam(value = "体检号") String tjNumber) { |
| | | Map<String, Object> objectMap = new HashMap<>(); |
| | | // Map<String, Object> objectMap = new HashMap<>(); |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjOrder::getTjNumber, tjNumber); |
| | | wq1.eq(TjOrder::getCheckStatus, 1); |
| | |
| | | return AjaxResult.success("体检暂未完成!!"); |
| | | } |
| | | |
| | | List<Map<String, Object>> maps = detailService.getShenGaoTiZhongList(one.getTjNumber()); |
| | | List<ShenGaoTiZhongVo> maps = detailService.getShenGaoTiZhongList(one.getTjNumber()); |
| | | // if(null !=maps && maps.size()>0){ |
| | | // for (Map<String, Object> map : maps) { |
| | | // if (map.get("") == null) { |
| | |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | log.info("ltkj {}的体检报告查询详情"+maps,tjNumber); |
| | | return AjaxResult.success(maps); |
| | | |
| | | } |
| | |
| | | @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); |
| | |
| | | final String substring = uuid.toString().substring(0, 5); |
| | | |
| | | // String userId = SecurityUtils.getLoginUser().getUsername(); |
| | | PDFBinaryUtil.base64StringToPDF(one.getReport(), FileUtil.mkdir(value).getPath() + "\\" + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"); |
| | | PDFBinaryUtil.base64StringToPDF(one.getReport(), FileUtil.mkdir(value).getPath() + File.separator + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"); |
| | | //String filePath = one.getPath(); |
| | | String filePath = value + "\\" + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"; |
| | | String filePath = value + File.separator + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"; |
| | | File f = new File(filePath); |
| | | if (filePath.isEmpty()) { |
| | | System.out.println("文件不存在!"); |
| | |
| | | } |
| | | 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); |
| | | } |
| | | |
| | | |
| | | } |