package com.ltkj.web.controller.system;
|
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.stream.Collectors;
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletResponse;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.ltkj.common.core.redis.RedisCache;
|
import com.ltkj.framework.config.MatchUtils;
|
import com.ltkj.hosp.domain.TjCustomer;
|
import com.ltkj.hosp.domain.TjXdPicture;
|
import com.ltkj.hosp.service.ITjCustomerService;
|
import com.ltkj.hosp.service.ITjProjectService;
|
import com.ltkj.hosp.service.TjAsyncService;
|
import com.ltkj.system.service.ISysConfigService;
|
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.hosp.domain.TjPureToneTest;
|
import com.ltkj.hosp.service.ITjPureToneTestService;
|
import com.ltkj.common.utils.poi.ExcelUtil;
|
import com.ltkj.common.core.page.TableDataInfo;
|
|
/**
|
* 纯音听阈测试Controller
|
*
|
* @author ltkj_赵佳豪&李格
|
* @date 2023-04-12
|
*/
|
@RestController
|
@RequestMapping("/pureToneTest/pureToneTest")
|
@Api(tags = "纯音听阈测试")
|
public class TjPureToneTestController extends BaseController {
|
@Resource
|
private ITjPureToneTestService tjPureToneTestService;
|
@Resource
|
private ITjCustomerService customerService;
|
@Autowired
|
private ISysConfigService configService;
|
|
|
/**
|
* 查询纯音听阈测试列表
|
*/
|
@PreAuthorize("@ss.hasPermi('pureToneTest:pureToneTest:list')")
|
@GetMapping("/list")
|
@ApiOperation(value = "纯音听阈查询(默认自带)")
|
public TableDataInfo list(TjPureToneTest tjPureToneTest) {
|
startPage();
|
List<TjPureToneTest> list = tjPureToneTestService.selectTjPureToneTestList(tjPureToneTest);
|
return getDataTable(list);
|
}
|
|
|
@GetMapping("/getList")
|
@ApiOperation(value = "纯音听阈查询(非自带)")
|
public AjaxResult getList(@RequestParam(required = false) @ApiParam(value = "体检号") String tjNum,
|
@RequestParam(required = false) @ApiParam(value = "客户姓名") String name,
|
@ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum,
|
@ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize)
|
{
|
LambdaQueryWrapper<TjPureToneTest> wq=new LambdaQueryWrapper<>();
|
if(null !=tjNum)wq.eq(TjPureToneTest::getTjNum,tjNum);
|
if(null !=name)wq.like(TjPureToneTest::getCusName,name);
|
wq.orderByDesc(TjPureToneTest::getCreateTime);
|
List<TjPureToneTest> list = tjPureToneTestService.list(wq);
|
List<Map<String,Object>> arrayList=new ArrayList<>();
|
if(null !=list && list.size()>0){
|
Map<String, List<TjPureToneTest>> stringListMap = list.stream().collect(Collectors.groupingBy(TjPureToneTest::getCusId));
|
for (Map.Entry<String, List<TjPureToneTest>> entry : stringListMap.entrySet()) {
|
Map<String,Object>map=new HashMap<>();
|
TjCustomer customer = customerService.getById(entry.getKey());
|
customer.setCusName(MatchUtils.hideCusName(customer.getCusName()));
|
customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
|
customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
|
customer.setTjNumber(entry.getValue().get(0).getTjNum());
|
map.put("list",entry.getValue());
|
map.put("customer",customer);
|
map.put("picturePath",configService.selectConfigByKey("TjPureToneTest"));
|
arrayList.add(map);
|
}
|
}
|
List<Map<String, Object>> collect =null;
|
Map<String,Object>map=new HashMap<>();
|
if(arrayList.size()>0){
|
collect = arrayList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
|
}
|
map.put("list",collect);
|
map.put("total",arrayList.size());
|
return AjaxResult.success(map);
|
}
|
|
|
/**
|
* 导出纯音听阈测试列表
|
*/
|
@PreAuthorize("@ss.hasPermi('pureToneTest:pureToneTest:export')")
|
@Log(title = "纯音听阈测试", businessType = BusinessType.EXPORT)
|
@PostMapping("/export")
|
@ApiOperation(value = "导出纯音听阈测试列表")
|
public void export(HttpServletResponse response, TjPureToneTest tjPureToneTest) {
|
List<TjPureToneTest> list = tjPureToneTestService.selectTjPureToneTestList(tjPureToneTest);
|
ExcelUtil<TjPureToneTest> util = new ExcelUtil<TjPureToneTest>(TjPureToneTest.class);
|
util.exportExcel(response, list, "纯音听阈测试数据");
|
}
|
|
/**
|
* 获取纯音听阈测试详细信息
|
*/
|
@PreAuthorize("@ss.hasPermi('pureToneTest:pureToneTest:query')")
|
@GetMapping(value = "/{id}")
|
@ApiOperation(value = "获取纯音听阈测试详细信息")
|
public AjaxResult getInfo(@PathVariable("id") String id) {
|
return success(tjPureToneTestService.selectTjPureToneTestById(id));
|
}
|
|
/**
|
* 新增纯音听阈测试
|
*/
|
@PreAuthorize("@ss.hasPermi('pureToneTest:pureToneTest:add')")
|
@Log(title = "纯音听阈测试", businessType = BusinessType.INSERT)
|
@PostMapping
|
@ApiOperation(value = "新增纯音听阈测试")
|
public AjaxResult add(@RequestBody TjPureToneTest tjPureToneTest) {
|
return toAjax(tjPureToneTestService.insertTjPureToneTest(tjPureToneTest));
|
}
|
|
/**
|
* 修改纯音听阈测试
|
*/
|
@PreAuthorize("@ss.hasPermi('pureToneTest:pureToneTest:edit')")
|
@Log(title = "纯音听阈测试", businessType = BusinessType.UPDATE)
|
@PutMapping
|
@ApiOperation(value = "修改纯音听阈测试")
|
public AjaxResult edit(@RequestBody TjPureToneTest tjPureToneTest) {
|
return toAjax(tjPureToneTestService.updateTjPureToneTest(tjPureToneTest));
|
}
|
|
/**
|
* 删除纯音听阈测试
|
*/
|
@PreAuthorize("@ss.hasPermi('pureToneTest:pureToneTest:remove')")
|
@Log(title = "纯音听阈测试", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
@ApiOperation(value = "删除纯音听阈测试")
|
public AjaxResult remove(@PathVariable String[] ids) {
|
return toAjax(tjPureToneTestService.deleteTjPureToneTestByIds(ids));
|
}
|
}
|