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.*;
|
import com.ltkj.hosp.service.*;
|
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.common.utils.poi.ExcelUtil;
|
import com.ltkj.common.core.page.TableDataInfo;
|
|
/**
|
* 体检心电图管理Controller
|
*
|
* @author ltkj_赵佳豪&李格
|
* @date 2023-04-11
|
*/
|
@RestController
|
@RequestMapping("/picture/picture")
|
@Api(tags = "体检心电图管理")
|
public class TjXdPictureController extends BaseController {
|
@Resource
|
private ITjXdPictureService tjXdPictureService;
|
@Resource
|
private ITjCustomerService customerService;
|
@Autowired
|
private ISysConfigService configService;
|
@Resource
|
private ITjOrderService orderService;
|
@Resource
|
private ITjOrderDetailService detailService;
|
@Resource
|
private ITjOrderRemarkService remarkService;
|
@Resource
|
private ITjProjectService projectService;
|
|
/**
|
* 查询体检心电图管理列表
|
*/
|
//@PreAuthorize("@ss.hasPermi('picture:picture:list')")
|
@GetMapping("/list")
|
@ApiOperation(value = "查询体检心电图管理列表(自带默认)")
|
public TableDataInfo list(TjXdPicture tjXdPicture) {
|
startPage();
|
List<TjXdPicture> list = tjXdPictureService.selectTjXdPictureList(tjXdPicture);
|
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<TjXdPicture>wq=new LambdaQueryWrapper<>();
|
if(null !=tjNum)wq.eq(TjXdPicture::getTjNum,tjNum);
|
if(null !=name)wq.like(TjXdPicture::getCusName,name);
|
wq.orderByDesc(TjXdPicture::getCreateTime);
|
List<TjXdPicture> list = tjXdPictureService.list(wq);
|
List<Map<String,Object>> arrayList=new ArrayList<>();
|
if(null !=list && !list.isEmpty()){
|
Map<String, List<TjXdPicture>> stringListMap = list.stream().collect(Collectors.groupingBy(TjXdPicture::getCusId));
|
for (Map.Entry<String, List<TjXdPicture>> 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("TjXdPicture"));
|
arrayList.add(map);
|
}
|
}
|
List<Map<String, Object>> collect =null;
|
Map<String,Object>map=new HashMap<>();
|
if(!arrayList.isEmpty()){
|
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('picture:picture:export')")
|
@Log(title = "体检心电图管理", businessType = BusinessType.EXPORT)
|
@PostMapping("/export")
|
@ApiOperation(value = "导出体检心电图管理列表")
|
public void export(HttpServletResponse response, TjXdPicture tjXdPicture) {
|
List<TjXdPicture> list = tjXdPictureService.selectTjXdPictureList(tjXdPicture);
|
ExcelUtil<TjXdPicture> util = new ExcelUtil<TjXdPicture>(TjXdPicture.class);
|
util.exportExcel(response, list, "体检心电图管理数据");
|
}
|
|
/**
|
* 获取体检心电图管理详细信息
|
*/
|
//@PreAuthorize("@ss.hasPermi('picture:picture:query')")
|
@GetMapping(value = "/{id}")
|
@ApiOperation(value = "获取体检心电图管理详细信息")
|
public AjaxResult getInfo(@PathVariable("id") String id) {
|
return success(tjXdPictureService.selectTjXdPictureById(id));
|
}
|
|
/**
|
* 新增体检心电图管理
|
*/
|
//@PreAuthorize("@ss.hasPermi('picture:picture:add')")
|
@Log(title = "体检心电图管理", businessType = BusinessType.INSERT)
|
@PostMapping
|
@ApiOperation(value = "新增体检心电图管理")
|
public AjaxResult add(@RequestBody TjXdPicture tjXdPicture) {
|
return toAjax(tjXdPictureService.insertTjXdPicture(tjXdPicture));
|
}
|
|
/**
|
* 修改体检心电图管理
|
*/
|
//@PreAuthorize("@ss.hasPermi('picture:picture:edit')")
|
@Log(title = "体检心电图管理", businessType = BusinessType.UPDATE)
|
@PutMapping
|
@ApiOperation(value = "修改体检心电图管理")
|
public AjaxResult edit(@RequestBody TjXdPicture tjXdPicture) {
|
if (tjXdPictureService.updateById(tjXdPicture)) {
|
TjOrder order = orderService.getOrderByTjNum(tjXdPicture.getTjNum());
|
LambdaQueryWrapper<TjOrderDetail>wq=new LambdaQueryWrapper<>();
|
wq.eq(TjOrderDetail::getOrderId,order.getOrderId());
|
wq.eq(TjOrderDetail::getProId,tjXdPicture.getProId());
|
TjOrderDetail detail = detailService.getOne(wq);
|
detail.setProResult(tjXdPicture.getProResult());
|
detail.setConclusion(tjXdPicture.getConclusion());
|
detail.setTjStatus(1L);
|
detailService.updateById(detail);
|
|
TjProject tjProject = projectService.getById(tjXdPicture.getProId());
|
TjProject tjProjectp = projectService.getById(tjProject.getProParentId());
|
|
LambdaQueryWrapper<TjOrderDetail>wq1=new LambdaQueryWrapper<>();
|
wq1.eq(TjOrderDetail::getOrderId,order.getOrderId());
|
wq1.eq(TjOrderDetail::getProId,tjProjectp.getProId());
|
TjOrderDetail detailp = detailService.getOne(wq);
|
detailp.setTjStatus(1L);
|
detailService.updateById(detailp);
|
|
LambdaQueryWrapper<TjOrderRemark> wq2=new LambdaQueryWrapper<>();
|
wq2.eq(TjOrderRemark::getTjNumber,tjXdPicture.getTjNum());
|
wq2.eq(TjOrderRemark::getProId,tjProjectp.getProId());
|
TjOrderRemark remark = remarkService.getOne(wq2);
|
remark.setType(1);
|
remark.setRemark(tjXdPicture.getConclusion());
|
remarkService.updateById(remark);
|
return AjaxResult.success();
|
}
|
return AjaxResult.error();
|
}
|
|
/**
|
* 删除体检心电图管理
|
*/
|
//@PreAuthorize("@ss.hasPermi('picture:picture:remove')")
|
@Log(title = "体检心电图管理", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
@ApiOperation(value = "删除体检心电图管理")
|
public AjaxResult remove(@PathVariable String[] ids) {
|
return toAjax(tjXdPictureService.deleteTjXdPictureByIds(ids));
|
}
|
}
|