| | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.itextpdf.text.Element; |
| | | import com.itextpdf.text.Paragraph; |
| | | import com.ltkj.common.core.domain.AjaxResult; |
| | | import com.ltkj.hosp.domain.TjCustomer; |
| | | import com.ltkj.hosp.domain.TjOrder; |
| | | import com.ltkj.hosp.domain.TjOrderYcxm; |
| | | import com.ltkj.hosp.mapper.TjCustomerMapper; |
| | | import com.ltkj.hosp.service.ITjOrderDetailService; |
| | | import com.ltkj.hosp.service.ITjOrderService; |
| | | import com.ltkj.hosp.service.TjOrderYcxmService; |
| | | import com.ltkj.hosp.vodomain.ShenGaoTiZhongVo; |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.web.config.pdfutils.PdfUtils; |
| | | import com.ltkj.web.controller.system.TjCheckController; |
| | | import com.ltkj.web.controller.system.TjReportController; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ltkj.framework.datasource.DynamicDataSourceContextHolder.log; |
| | | |
| | |
| | | private ITjOrderService tjOrderService; |
| | | @Autowired |
| | | private ITjOrderDetailService detailService; |
| | | @Autowired |
| | | private ISysConfigService sysConfigService; |
| | | @Autowired |
| | | private TjOrderYcxmService tjOrderYcxmService; |
| | | |
| | | /** |
| | | * 提供给三方调用的报告查看接口 |
| | |
| | | return AjaxResult.error("暂无数据!!"); |
| | | } |
| | | JSONObject entries = JSONUtil.parseObj(tjCheckController.updateCheckType(tjNum)); |
| | | |
| | | LambdaQueryWrapper<TjOrderYcxm> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrderYcxm::getTjh, tjNum); |
| | | List<TjOrderYcxm> ycxms = tjOrderYcxmService.list(wq); |
| | | Map<String, List<TjOrderYcxm>> stringListMap = ycxms.stream().collect(Collectors.groupingBy(TjOrderYcxm::getParentName)); |
| | | int xmXh = 1; |
| | | JSONArray jczs = JSONUtil.createArray(); |
| | | for (Map.Entry<String, List<TjOrderYcxm>> entry : stringListMap.entrySet()) { |
| | | List<TjOrderYcxm> details = entry.getValue(); |
| | | String xmmc = entry.getKey(); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | JSONObject object = JSONUtil.createObj(); |
| | | for (TjOrderYcxm detail : details) { |
| | | if (!isXmWrite) { |
| | | object.putOpt("xh",xmXh); |
| | | object.putOpt("xmmc",xmmc); |
| | | xmXh++; |
| | | } |
| | | String result = detail.getJcjg(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | result = result.replaceAll("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查", ""); |
| | | StringBuilder builder = new StringBuilder(); |
| | | if (StrUtil.isBlank(result.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index).append(")").append(detail.getJcxm()).append(": ").append(result).append("\n"); |
| | | index++; |
| | | result = builder.toString(); |
| | | } |
| | | object.putOpt("result",result); |
| | | } |
| | | jczs.add(object); |
| | | } |
| | | entries.putOpt("jczs",jczs); |
| | | |
| | | xmXh = 1; |
| | | JSONArray ysjy = JSONUtil.createArray(); |
| | | for (Map.Entry<String, List<TjOrderYcxm>> entry : stringListMap.entrySet()) { |
| | | List<TjOrderYcxm> details = entry.getValue(); |
| | | if(null !=details && !details.isEmpty()){ |
| | | details= details.stream() |
| | | .sorted(Comparator.comparing(TjOrderYcxm::getJcxm)) |
| | | .collect(Collectors.toList()); |
| | | boolean isXmWrite = false; |
| | | int index1 = 1; |
| | | for (TjOrderYcxm detail : details) { |
| | | JSONObject obj = JSONUtil.createObj(); |
| | | String xmmc = entry.getKey().toString(); |
| | | if (!isXmWrite) { |
| | | isXmWrite = true; |
| | | obj.putOpt("xh",xmXh); |
| | | obj.putOpt("xmmc",xmmc); |
| | | xmXh++; |
| | | } |
| | | String result = detail.getJcjg(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | StringBuilder builder = new StringBuilder(); |
| | | if (StrUtil.isBlank(result.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index1).append(")").append(detail.getJcxm()).append(": ").append(result).append("\n"); |
| | | index1++; |
| | | result = builder.toString(); |
| | | } |
| | | if (StrUtil.isNotBlank(result)) { |
| | | obj.putOpt("result",result); |
| | | } else { |
| | | obj.putOpt("result","建议定期复查"); |
| | | } |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | |
| | | String jynr = detail.getJynr(); |
| | | JSONArray array = JSONUtil.parseArray(jynr); |
| | | for (Object object : array) { |
| | | Map<String,Object> objectMap=new HashMap<>(); |
| | | JSONObject jsonObject = (JSONObject) object; |
| | | String bt = jsonObject.getStr("bt"); |
| | | String nr = jsonObject.getStr("nr"); |
| | | objectMap.put("bt",bt); |
| | | objectMap.put("nr",nr); |
| | | if(null !=bt || null !=nr) maps.add(objectMap); |
| | | } |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | List<Map<String, Object>> collect1 = maps.stream().distinct().collect(Collectors.toList()); |
| | | for (Map<String, Object> objectMap : collect1) { |
| | | String content = str + objectMap.get("bt").toString() + objectMap.get("nr").toString(); |
| | | if (StrUtil.isBlank(content)) content = " "; |
| | | strings.add(content); |
| | | } |
| | | obj.putOpt("contents",strings); |
| | | ysjy.add(obj); |
| | | } |
| | | } |
| | | } |
| | | |
| | | entries.putOpt("ysjy",ysjy); |
| | | |
| | | removeNullFields(entries); |
| | | return JSONUtil.toBean(entries, AjaxResult.class); |
| | | } |
| | |
| | | JSONObject entries = JSONUtil.parseObj(json); |
| | | String card = entries.getStr("card"); |
| | | // TjCustomer customer = tjCustomerMapper.getCusInfo(card); |
| | | List<Map<String ,Object>> customer = tjCustomerMapper.getCusInfoList(card); |
| | | return AjaxResult.success(customer); |
| | | String key = sysConfigService.selectConfigByKey("h5OrXcxQueryDate"); |
| | | if (StrUtil.isBlank(key)){ |
| | | key = "2025-05-01"; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | Date date = sdf.parse(key); |
| | | List<Map<String ,Object>> customer = tjCustomerMapper.getCusInfoList(card,date); |
| | | return AjaxResult.success(customer); |
| | | } catch (ParseException e) { |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | | |
| | | /** |