| | |
| | | package com.ltkj.web.controller.system; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | | import io.swagger.annotations.Api; |
| | |
| | | /** |
| | | * 查询规则+病种列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('hosp:rules:list')") |
| | | //@PreAuthorize("@ss.hasPermi('hosp:rules:list')") |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询规则+病种列表") |
| | | public TableDataInfo list(TjRules tjRules) { |
| | | startPage(); |
| | | LambdaQueryWrapper<TjRules> wq=new LambdaQueryWrapper<>(); |
| | | if (tjRules.getProId()!=null){ |
| | | wq.eq(TjRules::getProId,tjRules.getProId()); |
| | | LambdaQueryWrapper<TjRules> wq = new LambdaQueryWrapper<>(); |
| | | if (tjRules.getProId() != null) { |
| | | wq.eq(TjRules::getProId, tjRules.getProId()); |
| | | } |
| | | if (tjRules.getProName()!=null){ |
| | | wq.like(TjRules::getProName,tjRules.getProName()); |
| | | if (tjRules.getProName() != null) { |
| | | wq.like(TjRules::getProName, tjRules.getProName()); |
| | | } |
| | | if (tjRules.getRuleType()!=null){ |
| | | wq.eq(TjRules::getRuleType,tjRules.getRuleType()); |
| | | if (tjRules.getRuleType() != null) { |
| | | wq.eq(TjRules::getRuleType, tjRules.getRuleType()); |
| | | } |
| | | if (tjRules.getRuleStr()!=null){ |
| | | wq.like(TjRules::getRuleStr,tjRules.getRuleStr()); |
| | | if (tjRules.getRuleStr() != null) { |
| | | wq.like(TjRules::getRuleStr, tjRules.getRuleStr()); |
| | | } |
| | | if (tjRules.getBingzhong()!=null){ |
| | | wq.like(TjRules::getBingzhong,tjRules.getBingzhong()); |
| | | if (tjRules.getBingzhong() != null) { |
| | | wq.like(TjRules::getBingzhong, tjRules.getBingzhong()); |
| | | } |
| | | if (tjRules.getBzPinyin()!=null){ |
| | | wq.like(TjRules::getBzPinyin,tjRules.getBzPinyin()); |
| | | if (tjRules.getBzPinyin() != null) { |
| | | wq.like(TjRules::getBzPinyin, tjRules.getBzPinyin()); |
| | | } |
| | | if (tjRules.getSex()!=null){ |
| | | wq.eq(TjRules::getSex,tjRules.getSex()); |
| | | if (tjRules.getSex() != null) { |
| | | wq.eq(TjRules::getSex, tjRules.getSex()); |
| | | } |
| | | wq.orderByAsc(TjRules::getSort); |
| | | List<TjRules> list = tjRulesService.list(wq); |
| | | if (list!=null){ |
| | | if (list != null) { |
| | | for (TjRules rules : list) { |
| | | LambdaQueryWrapper<TjRuleAdvice> wq1=new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjRuleAdvice::getBz,rules.getAid()); |
| | | LambdaQueryWrapper<TjRuleAdvice> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjRuleAdvice::getBz, rules.getAid()); |
| | | final List<TjRuleAdvice> list1 = tjRuleAdviceService.list(wq1); |
| | | rules.setRuleAdvices(list1); |
| | | } |
| | |
| | | @ApiParam(value = "体检号") @RequestParam String ruleStr) { |
| | | TjOrder one = orderService.getOrderByTjNum(tjNumber); |
| | | TjCustomer customer = customerService.getById(one.getUserId()); |
| | | LambdaQueryWrapper<TjRules> wq=new LambdaQueryWrapper<>(); |
| | | if (proId!=null){ |
| | | wq.eq(TjRules::getProId,proId); |
| | | LambdaQueryWrapper<TjRules> wq = new LambdaQueryWrapper<>(); |
| | | if (proId != null) { |
| | | wq.eq(TjRules::getProId, proId); |
| | | } |
| | | if (ruleStr!=null){ |
| | | wq.like(TjRules::getRuleStr,ruleStr); |
| | | if (ruleStr != null) { |
| | | wq.like(TjRules::getRuleStr, ruleStr); |
| | | } |
| | | if (customer.getCusSex()!=null){ |
| | | wq.eq(TjRules::getSex,customer.getCusSex()); |
| | | if (customer.getCusSex() != null) { |
| | | wq.eq(TjRules::getSex, customer.getCusSex()); |
| | | } |
| | | wq.orderByAsc(TjRules::getSort); |
| | | List<TjRules> list = tjRulesService.list(wq); |
| | | if (list!=null){ |
| | | if (list != null) { |
| | | for (TjRules rules : list) { |
| | | LambdaQueryWrapper<TjRuleAdvice> wq1=new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjRuleAdvice::getBz,rules.getAid()); |
| | | LambdaQueryWrapper<TjRuleAdvice> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjRuleAdvice::getBz, rules.getAid()); |
| | | final List<TjRuleAdvice> list1 = tjRuleAdviceService.list(wq1); |
| | | rules.setRuleAdvices(list1); |
| | | } |
| | |
| | | /** |
| | | * 导出规则+病种列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('hosp:rules:export')") |
| | | //@PreAuthorize("@ss.hasPermi('hosp:rules:export')") |
| | | @Log(title = "规则+病种", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @ApiOperation(value = "导出规则+病种列表") |
| | | public void export(HttpServletResponse response, TjRules tjRules) { |
| | | LambdaQueryWrapper<TjRules> wq=new LambdaQueryWrapper<>(); |
| | | if (tjRules.getProName()!=null){ |
| | | wq.like(TjRules::getProName,tjRules.getProName()); |
| | | LambdaQueryWrapper<TjRules> wq = new LambdaQueryWrapper<>(); |
| | | if (tjRules.getProName() != null) { |
| | | wq.like(TjRules::getProName, tjRules.getProName()); |
| | | } |
| | | if (tjRules.getRuleType()!=null){ |
| | | wq.eq(TjRules::getRuleType,tjRules.getRuleType()); |
| | | if (tjRules.getRuleType() != null) { |
| | | wq.eq(TjRules::getRuleType, tjRules.getRuleType()); |
| | | } |
| | | if (tjRules.getBingzhong()!=null){ |
| | | wq.like(TjRules::getBingzhong,tjRules.getBingzhong()); |
| | | if (tjRules.getBingzhong() != null) { |
| | | wq.like(TjRules::getBingzhong, tjRules.getBingzhong()); |
| | | } |
| | | if (tjRules.getBzPinyin()!=null){ |
| | | wq.like(TjRules::getBzPinyin,tjRules.getBzPinyin()); |
| | | if (tjRules.getBzPinyin() != null) { |
| | | wq.like(TjRules::getBzPinyin, tjRules.getBzPinyin()); |
| | | } |
| | | if (tjRules.getSex()!=null){ |
| | | wq.eq(TjRules::getSex,tjRules.getSex()); |
| | | if (tjRules.getSex() != null) { |
| | | wq.eq(TjRules::getSex, tjRules.getSex()); |
| | | } |
| | | List<TjRules> list = tjRulesService.list(wq); |
| | | ExcelUtil<TjRules> util = new ExcelUtil<TjRules>(TjRules.class); |
| | |
| | | /** |
| | | * 获取规则+病种详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('hosp:rules:query')") |
| | | //@PreAuthorize("@ss.hasPermi('hosp:rules:query')") |
| | | @GetMapping(value = "/{aid}") |
| | | @ApiOperation(value = "获取规则+病种详细信息") |
| | | public AjaxResult getInfo(@PathVariable("aid") String aid) { |
| | |
| | | /** |
| | | * 新增规则+病种 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('hosp:rules:add')") |
| | | // @PreAuthorize("@ss.hasPermi('hosp:rules:add')") |
| | | @Log(title = "规则+病种", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @ApiOperation(value = "新增规则+病种") |
| | |
| | | /** |
| | | * 修改规则+病种 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('hosp:rules:edit')") |
| | | //@PreAuthorize("@ss.hasPermi('hosp:rules:edit')") |
| | | @Log(title = "规则+病种", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | @ApiOperation(value = "修改规则+病种") |
| | |
| | | /** |
| | | * 删除规则+病种 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('hosp:rules:remove')") |
| | | //@PreAuthorize("@ss.hasPermi('hosp:rules:remove')") |
| | | @Log(title = "规则+病种", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{aids}") |
| | | @ApiOperation(value = "删除规则+病种") |
| | |
| | | } |
| | | return toAjax(true); |
| | | } |
| | | |
| | | /** |
| | | * 规则自动计算 |
| | | */ |
| | | @GetMapping("/AutoGetRule") |
| | | @ApiOperation(value = "规则自动计算") |
| | | public AjaxResult AutoGetRule(@ApiParam(value = "项目") @RequestParam String proId, |
| | | @ApiParam(value = "客户") @RequestParam String cusId, |
| | | @ApiParam(value = "关键字") @RequestParam(required = false) String keyWord, |
| | | @ApiParam(value = "结果值") @RequestParam(required = false) BigDecimal keyNum) { |
| | | |
| | | List<TjRules> res = new ArrayList<>(); |
| | | if (proId==null){ |
| | | return AjaxResult.success(res); |
| | | } |
| | | if (cusId==null){ |
| | | return AjaxResult.success(res); |
| | | } |
| | | TjCustomer byId = customerService.getById(cusId); |
| | | if(byId==null){ |
| | | return AjaxResult.success(res); |
| | | } |
| | | LambdaQueryWrapper<TjRules> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjRules::getProId, proId); |
| | | wq.lt(TjRules::getAgeLt, MatchUtils.getAgeByIdCard(byId.getCusIdcard())); |
| | | wq.gt(TjRules::getAgeGt, MatchUtils.getAgeByIdCard(byId.getCusIdcard())); |
| | | wq.in(TjRules::getSex, 0, byId.getCusSex()); |
| | | final List<TjRules> list = tjRulesService.list(wq); |
| | | if (list==null){ |
| | | return AjaxResult.success(res); |
| | | } |
| | | for (TjRules tjRules : list) { |
| | | //判断规则类型:数值/文字 |
| | | if ("2".equals(tjRules.getRuleType())) { |
| | | |
| | | if (new BigDecimal(0).equals(tjRules.getRuleLt()) && new BigDecimal(0).equals(tjRules.getRuleGt())) { |
| | | res.add(tjRules); |
| | | } else { |
| | | if (keyNum != null) { |
| | | if (tjRules.getRuleLt().compareTo(keyNum) < 0 && tjRules.getRuleGt().compareTo(keyNum) > 0) { |
| | | res.add(tjRules); |
| | | } |
| | | } |
| | | } |
| | | } else if ("1".equals(tjRules.getRuleType())) { |
| | | if (keyWord!=null){ |
| | | if (tjRules.getRuleStr().contains(keyWord)) { |
| | | res.add(tjRules); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | if (res!=null && res.size() > 0) { |
| | | //建议赋值 |
| | | for (TjRules re : res) { |
| | | LambdaQueryWrapper<TjRuleAdvice> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjRuleAdvice::getBz, re.getAid()); |
| | | final List<TjRuleAdvice> list1 = tjRuleAdviceService.list(wq1); |
| | | re.setRuleAdvices(list1); |
| | | } |
| | | } |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | |
| | | } |