| | |
| | | package com.ruoyi.web.controller.project; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.ruoyi.common.annotation.NotRepeatCommit; |
| | | import com.ruoyi.project.common.CalculateDateUtils; |
| | | import com.ruoyi.project.domain.ServiceDonationwitness; |
| | | import com.ruoyi.project.domain.vo.MedicalEvaluationVO; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.annotation.UniqueCheck; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.project.domain.ServiceMedicalevaluation; |
| | | import com.ruoyi.project.domain.dto.MedicalevaluationBaseInfoDTO; |
| | | import com.ruoyi.project.domain.vo.MedicalEvaluationWithBaseInfoVO; |
| | | import com.ruoyi.project.domain.vo.ServiceMedicalevaluationVO; |
| | | import com.ruoyi.project.service.IServiceDonationwitnessService; |
| | | import com.ruoyi.project.service.IServiceMedicalevaluationService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.annotation.RepeatSubmit; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.project.domain.ServiceMedicalevaluation; |
| | | import com.ruoyi.project.service.IServiceMedicalevaluationService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 医学评估Controller |
| | |
| | | * @date 2021-11-19 |
| | | */ |
| | | @Slf4j |
| | | @Api("医疗评估管理") |
| | | @Api(description = "医疗评估管理") |
| | | @RestController |
| | | @RequestMapping("/project/medicalevaluation") |
| | | public class ServiceMedicalevaluationController extends BaseController { |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @ApiOperation("获取医疗评估列表新") |
| | | @GetMapping("/listnew") |
| | | public TableDataInfo listnew(MedicalEvaluationVO medicalEvaluationVO) { |
| | | startPage(); |
| | | List<MedicalEvaluationVO> list = serviceMedicalevaluationService.selectVOList(medicalEvaluationVO); |
| | | for (MedicalEvaluationVO medicalEvaluationVO1 : list) { |
| | | //先给个年龄默认值(因为age是数字类型,不能放横杠,所以就所横扛放到单位上) |
| | | medicalEvaluationVO1.setAgeunit("-"); |
| | | medicalEvaluationVO1.setAge(null); |
| | | medicalEvaluationVO1.setAge2(null); |
| | | //获取死亡时间,如果获取见证里有死亡时间,则进行计算他的年龄 |
| | | ServiceDonationwitness sdw = new ServiceDonationwitness(); |
| | | sdw.setInfoid(medicalEvaluationVO1.getInfoid()); |
| | | List<ServiceDonationwitness> serviceDonationwitnessList = serviceDonationwitnessService.selectServiceDonationwitnessList(sdw); |
| | | if (!CollectionUtils.isEmpty(serviceDonationwitnessList) && medicalEvaluationVO1.getBirthday() != null) { |
| | | Date deathtime = serviceDonationwitnessList.get(0).getDeathtime(); |
| | | if (ObjectUtils.isNotEmpty(deathtime)) { |
| | | Map<String, String> map = CalculateDateUtils.calculateAge(medicalEvaluationVO1.getBirthday().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), deathtime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); |
| | | if (ObjectUtils.isEmpty(map)) { |
| | | log.error("MedicalEvaluationVO出生日期:{},MedicalEvaluationVO死亡日期:{}", medicalEvaluationVO1.getBirthday(), deathtime); |
| | | continue; |
| | | } |
| | | medicalEvaluationVO1.setAge(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); |
| | | medicalEvaluationVO1.setAgeunit(map.get("ageUnit")); |
| | | medicalEvaluationVO1.setAge2(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); |
| | | medicalEvaluationVO1.setAgeunit2(map.get("ageUnit2")); |
| | | } |
| | | } |
| | | /** |
| | | * 获取医疗评估患者基本信息列表 |
| | | */ |
| | | @ApiOperation("获取医疗评估患者基本信息列表") |
| | | //// @PreAuthorize("@ss.hasPermi('project:medicalevaluation:list')") |
| | | @PostMapping("/medevaluateBaseInfolist") |
| | | public Map<String, Object> medevaluateBaseInfolist(@RequestBody MedicalEvaluationWithBaseInfoVO medicalEvaluationWithBaseInfoVO) { |
| | | Integer offset = PageUtils.getOffset(medicalEvaluationWithBaseInfoVO.getPageNum(), medicalEvaluationWithBaseInfoVO.getPageSize()); |
| | | medicalEvaluationWithBaseInfoVO.setPageNum(offset); |
| | | List<MedicalevaluationBaseInfoDTO> medicalEvaluationWithBaseInfoVOS = serviceMedicalevaluationService.medevaluateBaseInfolist(medicalEvaluationWithBaseInfoVO); |
| | | |
| | | } |
| | | return getDataTable(list); |
| | | //获取总数 |
| | | medicalEvaluationWithBaseInfoVO.setPageNum(null); |
| | | medicalEvaluationWithBaseInfoVO.setPageSize(null); |
| | | Integer totalCount = 0; |
| | | List<MedicalevaluationBaseInfoDTO> total = serviceMedicalevaluationService.medevaluateBaseInfolist(medicalEvaluationWithBaseInfoVO); |
| | | if (!CollectionUtils.isEmpty(total)) totalCount = total.size(); |
| | | return getDataTable(medicalEvaluationWithBaseInfoVOS, totalCount); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出医学评估列表 |
| | |
| | | * 新增医学评估 |
| | | */ |
| | | @ApiOperation("新增医学评估") |
| | | //// @PreAuthorize("@ss.hasPermi('project:medicalevaluation:add')") |
| | | @Log(title = "医学评估", businessType = BusinessType.INSERT) |
| | | @UniqueCheck( |
| | | fields = {"infoid"}, |
| | | entityClass = ServiceMedicalevaluation.class, |
| | | serviceClass = IServiceMedicalevaluationService.class, |
| | | message = "新增医学评估的infoid已存在,无法保存!" |
| | | ) |
| | | @PostMapping("/add") |
| | | // @NotRepeatCommit(key = "param:arg[1]", value = 30000) |
| | | public AjaxResult add(@RequestBody ServiceMedicalevaluation serviceMedicalevaluation) { |
| | | boolean save = serviceMedicalevaluationService.save(serviceMedicalevaluation); |
| | | return AjaxResult.success(serviceMedicalevaluation); |
| | | public AjaxResult add(@RequestBody ServiceMedicalevaluationVO serviceMedicalevaluationVO) { |
| | | log.info("新增医学评估的infoid为:{}",serviceMedicalevaluationVO.getInfoid()); |
| | | boolean save = serviceMedicalevaluationService.add(serviceMedicalevaluationVO); |
| | | return AjaxResult.success(save); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "医学评估", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | // @NotRepeatCommit(key = "param:arg[1]", value = 30000) |
| | | public AjaxResult edit(@RequestBody ServiceMedicalevaluation serviceMedicalevaluation) { |
| | | List<ServiceMedicalevaluation> list = serviceMedicalevaluationService.queryList(serviceMedicalevaluation); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return error("医学评估数据不存在,请检查后再次修改"); |
| | | } |
| | | serviceMedicalevaluation.setId(list.get(0).getId()); |
| | | return toAjax(serviceMedicalevaluationService.updateById(serviceMedicalevaluation)); |
| | | public AjaxResult edit(@RequestBody ServiceMedicalevaluationVO serviceMedicalevaluationVO) { |
| | | log.info("修改医学评估的主键为:{}",serviceMedicalevaluationVO.getId()); |
| | | Boolean edit = serviceMedicalevaluationService.edit(serviceMedicalevaluationVO); |
| | | return toAjax(edit); |
| | | } |
| | | |
| | | /** |