| | |
| | | package com.ltkj.web.controller.service; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.druid.sql.visitor.functions.If; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ltkj.common.core.domain.AjaxResult; |
| | | 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.utils.IdUtils; |
| | | import com.ltkj.common.utils.StringUtils; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.framework.datasource.DynamicDataSourceContextHolder; |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.hisDto.*; |
| | | import com.ltkj.hosp.idutil.IdUtils; |
| | | import com.ltkj.hosp.mapper.TjSamplingMapper; |
| | | import com.ltkj.hosp.pacsDto.SavePacsApply; |
| | | import com.ltkj.hosp.service.*; |
| | |
| | | import com.ltkj.web.controller.lis.LisApiMethod; |
| | | import com.ltkj.web.controller.pacs.PacsApiMethodService; |
| | | import com.ltkj.web.controller.system.SamplingServiceApi; |
| | | import jodd.util.StringUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | |
| | | if (null != detailList && detailList1) { |
| | | String format = DateUtil.format(new Date(), "yyMMddHHmmssSSS"); |
| | | for (TjOrderDetail detail : detailList) { |
| | | int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId())); |
| | | if(i>0) continue; |
| | | TjSampling sampling = new TjSampling(); |
| | | if (null == projectService.getById(detail.getProId())) continue; |
| | | TjProject project = projectService.getById(detail.getProId()); |
| | |
| | | } else { |
| | | deptname = dept.getDeptName(); |
| | | } |
| | | String xb= tjCustomerService.getSexByTjh(order.getTjNumber()); |
| | | |
| | | StringBuilder ssyszys = new StringBuilder(); |
| | | StringBuilder ssyszyjgs = new StringBuilder(); |
| | |
| | | LambdaQueryWrapper<TjOrderYcxm> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrderYcxm::getTjh, order.getTjNumber()); |
| | | wq.eq(TjOrderYcxm::getJcxm, detail.getProName()); |
| | | ycxmService.remove(wq); |
| | | if (detail.getExceptionDesc() == 1) { |
| | | if(tjProject.getSfcyyc()==0){ |
| | | String replacedAll = detail.getProName().replaceAll("[((][^))]*[\u4e00-\u9fa5]+[^))]*[))]", "").replaceAll("[((][^))]*[))]", "") |
| | | .replaceAll("[ 测定检测]", "").replaceAll("\\[.*?\\]", "").replaceAll("◆", ""); |
| | | |
| | | if(!detail.getProName().contains("舒张压") && !detail.getProName().contains("收缩压")){ |
| | | List<Map<String, Object>> maps = rulesService.getyichangxiangmujianyiguize(detail.getProId().toString() |
| | | , detail.getProName().replaceAll("[((][^))]*[))]", "") |
| | | .replaceAll("[ 测定检测]", "").replaceAll("\\[.*?\\]", ""), "", order.getTjNumber() |
| | | , detail.getProName().replaceAll("[((][^))]*[\u4e00-\u9fa5]+[^))]*[))]", "") |
| | | .replaceAll("[ 测定检测]", "").replaceAll("\\[.*?\\]", "") |
| | | , detail.getProResult()); |
| | | if(!detail.getProName().contains("舒张压") && !detail.getProName().contains("收缩压")){ |
| | | |
| | | List<Map<String, Object>> maps = rulesService.getyichangxiangmujianyiguize(detail.getProId().toString(), replacedAll, "", order.getTjNumber() |
| | | , replacedAll, detail.getProResult()); |
| | | |
| | | |
| | | String[] split = detail.getProResult().split("。|,|,"); |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (String s : split) { |
| | | s = s.replaceAll("\n", ""); |
| | | // Map<String,Object> maps= rulesService.getyichangxiangmujianyiguizeJianCha(s); |
| | | Map<String, Object> mapss = tjProAdvicerulesService.getyichangxiangmujianyiguizeJianCha(deptname, s, "0"); |
| | | if (null != mapss && !mapss.isEmpty()) { |
| | | Object bt = mapss.get("bt"); |
| | | Object nr = mapss.get("nr"); |
| | | if (null != bt || null != nr) { |
| | | String[] split = detail.getProResult().split("[。,,::.\\s]+"); |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (String s : split) { |
| | | s = s.replaceAll("\n", "").replaceAll("[((][^))]*[))]", "").replaceAll(" ","") |
| | | .replaceAll("症","").replaceAll("[0-9]", ""); |
| | | Map<String, Object> mapss = tjProAdvicerulesService.getyichangxiangmujianyiguizeJianCha(deptname, s, "0",xb); |
| | | if (null != mapss && !mapss.isEmpty()) { |
| | | Object bt = mapss.get("bt"); |
| | | Object nr = mapss.get("nr"); |
| | | if (null != bt || null != nr) { |
| | | |
| | | } |
| | | mapList.add(mapss); |
| | | } |
| | | } |
| | | TjOrderYcxm ycxm = ycxmService.getOne(wq); |
| | | if (null != ycxm) { |
| | | ycxm.setJcjg(detail.getProResult()); |
| | | if (null != maps && !maps.isEmpty()) { |
| | | ycxm.setJynr(JSONUtil.toJsonStr(maps)); |
| | | } |
| | | if (!mapList.isEmpty()) { |
| | | ycxm.setJynr(JSONUtil.toJsonStr(mapList)); |
| | | } |
| | | ycxmService.updateById(ycxm); |
| | | }else { |
| | | TjOrderYcxm orderYcxm =new TjOrderYcxm(); |
| | | orderYcxm.setTjh(order.getTjNumber()); |
| | | orderYcxm.setParentName(tjProject.getProName()); |
| | | orderYcxm.setJcxm(detail.getProName()); |
| | | orderYcxm.setJcjg(detail.getProResult()); |
| | | if (null != maps && !maps.isEmpty()) { |
| | | orderYcxm.setJynr(JSONUtil.toJsonStr(maps)); |
| | | } |
| | | if (!mapList.isEmpty()) { |
| | | orderYcxm.setJynr(JSONUtil.toJsonStr(mapList)); |
| | | } |
| | | orderYcxm.setJyjc("0"); |
| | | ycxmService.save(orderYcxm); |
| | | } |
| | | }else { |
| | | } |
| | | mapList.add(mapss); |
| | | } |
| | | } |
| | | TjOrderYcxm ycxm = ycxmService.getOne(wq); |
| | | if (null != ycxm) { |
| | | ycxm.setJcjg(detail.getProResult()); |
| | | if (null != maps && !maps.isEmpty()) { |
| | | ycxm.setJynr(JSONUtil.toJsonStr(maps)); |
| | | } |
| | | if (!mapList.isEmpty()) { |
| | | ycxm.setJynr(JSONUtil.toJsonStr(mapList)); |
| | | } |
| | | ycxmService.updateById(ycxm); |
| | | }else { |
| | | TjOrderYcxm orderYcxm =new TjOrderYcxm(); |
| | | orderYcxm.setTjh(order.getTjNumber()); |
| | | orderYcxm.setParentName(tjProject.getProName()); |
| | | orderYcxm.setJcxm(detail.getProName()); |
| | | orderYcxm.setJcjg(detail.getProResult()); |
| | | if (null != maps && !maps.isEmpty()) { |
| | | orderYcxm.setJynr(JSONUtil.toJsonStr(maps)); |
| | | } |
| | | if (!mapList.isEmpty()) { |
| | | orderYcxm.setJynr(JSONUtil.toJsonStr(mapList)); |
| | | } |
| | | orderYcxm.setJyjc("0"); |
| | | ycxmService.save(orderYcxm); |
| | | } |
| | | }else { |
| | | |
| | | List<Map<String, Object>> maps = rulesService.getyichangxiangmujianyiguize(detail.getProId().toString() |
| | | , detail.getProName().replaceAll("[((][^))]*[))]", "") |
| | | .replaceAll("[ 测定检测]", "").replaceAll("\\[.*?\\]", ""), "", order.getTjNumber() |
| | | , detail.getProName().replaceAll("[((][^))]*[\u4e00-\u9fa5]+[^))]*[))]", "") |
| | | .replaceAll("[ 测定检测]", "").replaceAll("\\[.*?\\]", "") |
| | | , detail.getProResult()); |
| | | List<Map<String, Object>> maps = rulesService.getyichangxiangmujianyiguize(detail.getProId().toString() |
| | | , replacedAll, "", order.getTjNumber(), replacedAll, detail.getProResult()); |
| | | |
| | | |
| | | String[] split = detail.getProResult().split("。|,|,"); |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (String s : split) { |
| | | s = s.replaceAll("\n", ""); |
| | | // Map<String,Object> maps= rulesService.getyichangxiangmujianyiguizeJianCha(s); |
| | | Map<String, Object> mapss = tjProAdvicerulesService.getyichangxiangmujianyiguizeJianCha(deptname, s, "0"); |
| | | if (null != mapss && !mapss.isEmpty()) { |
| | | Object bt = mapss.get("bt"); |
| | | Object nr = mapss.get("nr"); |
| | | if (null != bt || null != nr) { |
| | | String[] split = detail.getProResult().split("[。,,::.\\s]+"); |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (String s : split) { |
| | | s = s.replaceAll("\n", "").replaceAll("[((][^))]*[))]", "");; |
| | | // Map<String,Object> maps= rulesService.getyichangxiangmujianyiguizeJianCha(s); |
| | | Map<String, Object> mapss = tjProAdvicerulesService.getyichangxiangmujianyiguizeJianCha(deptname, s, "0",xb); |
| | | if (null != mapss && !mapss.isEmpty()) { |
| | | Object bt = mapss.get("bt"); |
| | | Object nr = mapss.get("nr"); |
| | | if (null != bt || null != nr) { |
| | | |
| | | } |
| | | mapList.add(mapss); |
| | | } |
| | | } |
| | | } |
| | | mapList.add(mapss); |
| | | } |
| | | } |
| | | |
| | | if (null != maps && !maps.isEmpty()) { |
| | | jianyilis.addAll(maps); |
| | | } |
| | | if (!mapList.isEmpty()) { |
| | | jianyilis.addAll(mapList); |
| | | } |
| | | ssyszys.append(detail.getProName()).append("/"); |
| | | ssyszyjgs.append(detail.getProResult()).append("/"); |
| | | |
| | | } |
| | | }else { |
| | | if (null != maps && !maps.isEmpty()) { |
| | | jianyilis.addAll(maps); |
| | | } |
| | | if (!mapList.isEmpty()) { |
| | | jianyilis.addAll(mapList); |
| | | } |
| | | ssyszys.append(detail.getProName()).append("/"); |
| | | ssyszyjgs.append(detail.getProResult()).append("/"); |
| | | } |
| | | } |
| | | } else { |
| | | if(detail.getProName().contains("舒张压") || detail.getProName().contains("收缩压")){ |
| | | ssyszys.append(detail.getProName()).append("/"); |
| | | ssyszyjgs.append(detail.getProResult()).append("/"); |
| | | |
| | | } |
| | | ycxmService.remove(wq); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | Date date = new Date(); |
| | | String format = DateUtil.format(date, "yyMMddHHmmssSSS"); |
| | | for (TjOrderDetail detail : detailList) { |
| | | int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId())); |
| | | if(i>0) continue; |
| | | TjSampling sampling = new TjSampling(); |
| | | if (null == projectService.getById(detail.getProId())) continue; |
| | | TjProject project = projectService.getById(detail.getProId()); |
| | |
| | | wq2.eq(TjSampling::getTjNum, tjNum); |
| | | wq2.eq(TjSampling::getProId, refundPro.getProId()); |
| | | samplingService.remove(wq2); |
| | | redisCache.deleteCacheMapValue("getOrderDetailByProParentId" + tjNum, String.valueOf(refundPro.getProId())); |
| | | redisCache.deleteCacheMapValue("getOrderDetailByProParentId:" + tjNum, String.valueOf(refundPro.getProId())); |
| | | } |
| | | } |
| | | |
| | |
| | | td.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | td.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | discardInspectionService.save(td); |
| | | redisCache.deleteCacheMapValue("getOrderDetailByProParentId" + domainVo.getTjNumber(), String.valueOf(remark.getProId())); |
| | | redisCache.deleteCacheMapValue("getOrderDetailByProParentId:" + domainVo.getTjNumber(), String.valueOf(remark.getProId())); |
| | | } |
| | | |
| | | LambdaQueryWrapper<TjProject> wq1 = new LambdaQueryWrapper<>(); |
| | |
| | | @Override |
| | | //@Async("async") |
| | | public void updateCheckType(String tjNum) { |
| | | redisCache.setCacheMapValue("updateCheckType" + tjNum, tjNum, getAjaxResult(tjNum)); |
| | | redisCache.setHashKeyExpireTime("updateCheckType" + tjNum, 7L, TimeUnit.DAYS); |
| | | redisCache.setCacheMapValue("updateCheckType:" + tjNum, tjNum, getAjaxResult(tjNum)); |
| | | redisCache.setHashKeyExpireTime("updateCheckType:" + tjNum, 7L, TimeUnit.DAYS); |
| | | } |
| | | |
| | | @Override |
| | |
| | | //@Async("async") |
| | | public void getOrderDetailByProParentId(String tjNumber, Map<String, Object> map, String proParentId) { |
| | | if (null != map && !map.isEmpty()) { |
| | | redisCache.setCacheMapValue("getOrderDetailByProParentId" + tjNumber, proParentId, map); |
| | | redisCache.setCacheMapValue("getOrderDetailByProParentId:" + tjNumber, proParentId, map); |
| | | } else { |
| | | redisCache.setCacheMapValue("getOrderDetailByProParentId" + tjNumber, proParentId, getOrderDetailByProParentId(proParentId, tjNumber)); |
| | | redisCache.setCacheMapValue("getOrderDetailByProParentId:" + tjNumber, proParentId, getOrderDetailByProParentId(proParentId, tjNumber)); |
| | | } |
| | | redisCache.setHashKeyExpireTime("getOrderDetailByProParentId" + tjNumber, 7L, TimeUnit.DAYS); |
| | | redisCache.setHashKeyExpireTime("getOrderDetailByProParentId:" + tjNumber, 7L, TimeUnit.DAYS); |
| | | |
| | | } |
| | | |