| | |
| | | package com.ltkj.web.controller.system; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ltkj.common.core.redis.RedisCache; |
| | | import com.ltkj.common.utils.IdUtils; |
| | |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.web.controller.his.HisApiMethod; |
| | | import com.ltkj.web.controller.lis.LisApiMethod; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | private ISysConfigService configService; |
| | | @Autowired |
| | | private SamplingServiceApi samplingService; |
| | | @Autowired |
| | | private HisApiMethod hisApiMethod; |
| | | @Autowired |
| | | private LtkjJianchajianyanTreeService treeService; |
| | | @Autowired |
| | | private TbLisSqService tbLisSqService; |
| | | @Autowired |
| | | private LtkjJfxmgljyxmzdService jfxmgljyxmzdService; |
| | | |
| | | /** |
| | | * 查询体检采样管理列表 |
| | |
| | | if (tjNumber == null || StrUtil.isBlank(tjNumber)) |
| | | return AjaxResult.error("参数错误,未传参数"); |
| | | LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>(); |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (config.equals("Y")){ |
| | | // LambdaQueryWrapper<TjSampling> wrapper6 = new LambdaQueryWrapper<>(); |
| | | // wrapper6.eq(TjSampling::getTjNum, tjNumber); |
| | | // wrapper6.eq(TjSampling::getIsSignFor,isSignFor); |
| | | // wrapper6.and(i -> i.isNull(TjSampling::getParentId).or().eq(TjSampling::getIsMerge,1)); |
| | | // wrapper6.isNull(TjSampling::getJyxh); |
| | | // List<TjSampling> list1 = tjSamplingService.list(wrapper6); |
| | | // if (!list1.isEmpty()){ |
| | | if (true){ |
| | | LambdaQueryWrapper<TjOrder> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(TjOrder::getTjNumber,tjNumber); |
| | | TjOrder tjOrder = orderService.getOne(wrapper1); |
| | | hisApiMethod.Getlabreginfoinfo(tjOrder.getCardId(),new SimpleDateFormat("yyyy-MM-dd").format(tjOrder.getCreateTime())); |
| | | LambdaQueryWrapper<TbLisSq> wrapper2 = new LambdaQueryWrapper<>(); |
| | | wrapper2.eq(TbLisSq::getCardId,tjOrder.getCardId()); |
| | | List<TbLisSq> list = tbLisSqService.list(wrapper2); |
| | | for (TbLisSq lisSq : list) { |
| | | if (!lisSq.getSqdbh().contains("jk")) |
| | | continue; |
| | | String jyxmdm = lisSq.getJyxmdm(); |
| | | LambdaQueryWrapper<TjProject> wrapper4 = new LambdaQueryWrapper<>(); |
| | | wrapper4.eq(TjProject::getLisXmbm,jyxmdm); |
| | | TjProject project = projectService.getOne(wrapper4); |
| | | if (project != null){ |
| | | LambdaUpdateWrapper<TjSampling> wrapper5 = new LambdaUpdateWrapper<>(); |
| | | String jyxh = ""; |
| | | if (StrUtil.isNotBlank(lisSq.getJyxhHb())) |
| | | jyxh = lisSq.getJyxhHb(); |
| | | else jyxh = lisSq.getJyxh(); |
| | | wrapper5.set(TjSampling::getJyxh,jyxh); |
| | | wrapper5.set(TjSampling::getJyxmdm,lisSq.getJyxmdm()); |
| | | wrapper5.eq(TjSampling::getProId,project.getProParentId()); |
| | | wrapper5.eq(TjSampling::getTjNum,tjNumber); |
| | | tjSamplingService.update(wrapper5); |
| | | } |
| | | } |
| | | |
| | | // JSONArray array = hisApiMethod.Getlabreginfoinfo(tjOrder.getCardId()); |
| | | // if (array != null && !array.isEmpty()){ |
| | | // for (Object o : array) { |
| | | // JSONObject jsonObject = (JSONObject) o; |
| | | // String sqdh = jsonObject.getStr("sqdh"); |
| | | // String jyxh = jsonObject.getStr("jyxh"); |
| | | // LambdaQueryWrapper<LtkjJianchajianyanTree> wrapper2 = new LambdaQueryWrapper<>(); |
| | | // wrapper2.eq(LtkjJianchajianyanTree::getCardId,tjOrder.getCardId()); |
| | | // wrapper2.eq(LtkjJianchajianyanTree::getType,"检验"); |
| | | // wrapper2.eq(LtkjJianchajianyanTree::getSqdh,sqdh); |
| | | // List<LtkjJianchajianyanTree> list = treeService.list(wrapper2); |
| | | // List<String> hisXms = list.stream().map(LtkjJianchajianyanTree::getHisXmdm).collect(Collectors.toList()); |
| | | // LambdaQueryWrapper<TjProject> wrapper3 = new LambdaQueryWrapper<>(); |
| | | // wrapper3.in(TjProject::getHisXmbm,hisXms); |
| | | // wrapper3.ne(TjProject::getProParentId,0); |
| | | // wrapper3.groupBy(TjProject::getProParentId); |
| | | // List<Long> proParentIds = projectService.list(wrapper3).stream().map(TjProject::getProParentId).collect(Collectors.toList()); |
| | | // LambdaQueryWrapper<TjProject> wrapper4 = new LambdaQueryWrapper<>(); |
| | | // wrapper4.in(TjProject::getProId,proParentIds); |
| | | // List<Long> proIds = projectService.list(wrapper4).stream().map(TjProject::getProId).collect(Collectors.toList()); |
| | | // LambdaUpdateWrapper<TjSampling> wrapper5 = new LambdaUpdateWrapper<>(); |
| | | // wrapper5.set(TjSampling::getJyxh,jyxh); |
| | | // wrapper5.in(TjSampling::getProId,proIds); |
| | | // wrapper5.eq(TjSampling::getTjNum,tjNumber); |
| | | // tjSamplingService.update(wrapper5); |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | |
| | | // if (config.equals("Y")) |
| | | // wrapper.eq(TjSampling::getJyxh,""); |
| | | wrapper.eq(TjSampling::getTjNum, tjNumber); |
| | | wrapper.eq(TjSampling::getIsSignFor,isSignFor); |
| | | wrapper.and(i -> i.isNull(TjSampling::getParentId).or().eq(TjSampling::getIsMerge,1)); |
| | | // wrapper.eq(TjSampling::getIsPay,1); |
| | | // if (isSignFor == 1) |
| | | // wrapper.eq(TjSampling::getIsApply,0); |
| | | wrapper.orderByDesc(TjSampling::getIsMerge); |
| | | |
| | | List<TjSampling> list = tjSamplingService.list(wrapper); |
| | | if (list.isEmpty()){ |
| | | logger.info("jtNum ->{}",tjNumber); |
| | | // return AjaxResult.error("未查询到数据,人员未缴费或没有未采样项目"); |
| | | return AjaxResult.error("参数错误,未查询到数据"); |
| | | } |
| | | // for (TjSampling sampling : list) { |
| | |
| | | list.removeIf(item -> Objects.equals(item.getId(), s)); |
| | | } |
| | | } |
| | | String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | Map<String, List<TjSampling>> map = list.stream().filter(i->StrUtil.isNotBlank(i.getSpecimenTypeCode())).collect(Collectors.groupingBy(item -> item.getSpecimenTypeCode())); |
| | | for (Map.Entry<String, List<TjSampling>> entry : map.entrySet()) { |
| | | List<TjSampling> entryValue = entry.getValue(); |
| | | tjSamplingService.mergeCaiYangTran(entryValue.stream().map(TjSampling::getId).collect(Collectors.toList())); |
| | | tjSamplingService.mergeCaiYangTran(entryValue.stream().map(TjSampling::getId).collect(Collectors.toList()),lis_tmh_prefix); |
| | | } |
| | | } |
| | | wrapper = new LambdaQueryWrapper<>(); |
| | |
| | | @PostMapping("/mergeCaiYang") |
| | | @ApiOperation(value = "采样登记合并项目接口") |
| | | public AjaxResult mergeCaiYang(@RequestBody List<String> ids) { |
| | | return tjSamplingService.mergeCaiYangTran(ids); |
| | | String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | return tjSamplingService.mergeCaiYangTran(ids,lis_tmh_prefix); |
| | | } |
| | | |
| | | |
| | |
| | | public AjaxResult confirmSampling(@RequestBody List<String> ids) { |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | String mergeRequest = configService.selectConfigByKey("use_lis_pacs_is_auto_merge_request"); |
| | | return samplingService.confirm(ids,config,mergeRequest); |
| | | return samplingService.confirmApi(ids,config,mergeRequest); |
| | | } |
| | | } |