package com.ltkj.web.controller.system;
|
|
import java.util.HashSet;
|
import java.util.List;
|
import java.util.Set;
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletResponse;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.ltkj.hosp.domain.*;
|
import com.ltkj.hosp.service.*;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import com.ltkj.common.annotation.Log;
|
import com.ltkj.common.core.controller.BaseController;
|
import com.ltkj.common.core.domain.AjaxResult;
|
import com.ltkj.common.enums.BusinessType;
|
import com.ltkj.common.utils.poi.ExcelUtil;
|
import com.ltkj.common.core.page.TableDataInfo;
|
|
/**
|
* 规则+病种Controller
|
*
|
* @author ltkj_赵佳豪&李格
|
* @date 2023-08-30
|
*/
|
@RestController
|
@RequestMapping("/hosp/rules")
|
@Api(tags = "规则+病种接口")
|
public class TjRulesController extends BaseController {
|
@Autowired
|
private ITjRulesService tjRulesService;
|
|
@Autowired
|
private ITjRuleAdviceService tjRuleAdviceService;
|
|
@Resource
|
private ITjOrderService orderService;
|
|
@Resource
|
private ITjCustomerService customerService;
|
|
@Autowired
|
private ITjGroupingProService groupingProService;
|
@Resource
|
private ITjProjectService projectService;
|
|
/**
|
* 查询规则+病种列表
|
*/
|
//@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());
|
}
|
if (tjRules.getProName()!=null){
|
wq.like(TjRules::getProName,tjRules.getProName());
|
}
|
if (tjRules.getRuleType()!=null){
|
wq.eq(TjRules::getRuleType,tjRules.getRuleType());
|
}
|
if (tjRules.getRuleStr()!=null){
|
wq.like(TjRules::getRuleStr,tjRules.getRuleStr());
|
}
|
if (tjRules.getBingzhong()!=null){
|
wq.like(TjRules::getBingzhong,tjRules.getBingzhong());
|
}
|
if (tjRules.getBzPinyin()!=null){
|
wq.like(TjRules::getBzPinyin,tjRules.getBzPinyin());
|
}
|
if (tjRules.getSex()!=null){
|
wq.eq(TjRules::getSex,tjRules.getSex());
|
}
|
wq.orderByAsc(TjRules::getSort);
|
List<TjRules> list = tjRulesService.list(wq);
|
if (list!=null){
|
for (TjRules rules : list) {
|
LambdaQueryWrapper<TjRuleAdvice> wq1=new LambdaQueryWrapper<>();
|
wq1.eq(TjRuleAdvice::getBz,rules.getAid());
|
final List<TjRuleAdvice> list1 = tjRuleAdviceService.list(wq1);
|
rules.setRuleAdvices(list1);
|
}
|
}
|
return getDataTable(list);
|
}
|
|
|
/**
|
* 查询规则+病种列表
|
*/
|
@GetMapping("/listByRuleStr")
|
@ApiOperation(value = "查询规则+病种列表")
|
public TableDataInfo listByRuleStr(@ApiParam(value = "项目id") @RequestParam String proId,
|
@ApiParam(value = "体检号") @RequestParam String tjNumber,
|
@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);
|
}
|
if (ruleStr!=null){
|
wq.like(TjRules::getRuleStr,ruleStr);
|
}
|
if (customer.getCusSex()!=null){
|
wq.eq(TjRules::getSex,customer.getCusSex());
|
}
|
wq.orderByAsc(TjRules::getSort);
|
List<TjRules> list = tjRulesService.list(wq);
|
if (list!=null){
|
for (TjRules rules : list) {
|
LambdaQueryWrapper<TjRuleAdvice> wq1=new LambdaQueryWrapper<>();
|
wq1.eq(TjRuleAdvice::getBz,rules.getAid());
|
final List<TjRuleAdvice> list1 = tjRuleAdviceService.list(wq1);
|
rules.setRuleAdvices(list1);
|
}
|
}
|
return getDataTable(list);
|
}
|
|
/**
|
* 导出规则+病种列表
|
*/
|
//@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());
|
}
|
if (tjRules.getRuleType()!=null){
|
wq.eq(TjRules::getRuleType,tjRules.getRuleType());
|
}
|
if (tjRules.getBingzhong()!=null){
|
wq.like(TjRules::getBingzhong,tjRules.getBingzhong());
|
}
|
if (tjRules.getBzPinyin()!=null){
|
wq.like(TjRules::getBzPinyin,tjRules.getBzPinyin());
|
}
|
if (tjRules.getSex()!=null){
|
wq.eq(TjRules::getSex,tjRules.getSex());
|
}
|
List<TjRules> list = tjRulesService.list(wq);
|
ExcelUtil<TjRules> util = new ExcelUtil<TjRules>(TjRules.class);
|
util.exportExcel(response, list, "规则+病种数据");
|
}
|
|
/**
|
* 获取规则+病种详细信息
|
*/
|
//@PreAuthorize("@ss.hasPermi('hosp:rules:query')")
|
@GetMapping(value = "/{aid}")
|
@ApiOperation(value = "获取规则+病种详细信息")
|
public AjaxResult getInfo(@PathVariable("aid") String aid) {
|
return success(tjRulesService.getById(aid));
|
}
|
|
/**
|
* 新增规则+病种
|
*/
|
// @PreAuthorize("@ss.hasPermi('hosp:rules:add')")
|
@Log(title = "规则+病种", businessType = BusinessType.INSERT)
|
@PostMapping
|
@ApiOperation(value = "新增规则+病种")
|
public AjaxResult add(@RequestBody TjRules tjRules) {
|
return toAjax(tjRulesService.save(tjRules));
|
}
|
|
/**
|
* 修改规则+病种
|
*/
|
//@PreAuthorize("@ss.hasPermi('hosp:rules:edit')")
|
@Log(title = "规则+病种", businessType = BusinessType.UPDATE)
|
@PutMapping
|
@ApiOperation(value = "修改规则+病种")
|
public AjaxResult edit(@RequestBody TjRules tjRules) {
|
return toAjax(tjRulesService.saveOrUpdate(tjRules));
|
}
|
|
/**
|
* 删除规则+病种
|
*/
|
//@PreAuthorize("@ss.hasPermi('hosp:rules:remove')")
|
@Log(title = "规则+病种", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{aids}")
|
@ApiOperation(value = "删除规则+病种")
|
public AjaxResult remove(@PathVariable String[] aids) {
|
for (String aid : aids) {
|
tjRulesService.removeById(aid);
|
}
|
return toAjax(true);
|
}
|
}
|