diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/patientinfo/PatientArchivesInfoController.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/patientinfo/PatientArchivesInfoController.java new file mode 100644 index 0000000..8f11448 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/patientinfo/PatientArchivesInfoController.java @@ -0,0 +1,130 @@ +package com.xinelu.manage.controller.patientinfo; + +import com.xinelu.common.annotation.Log; +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.common.enums.BusinessType; +import com.xinelu.common.utils.poi.ExcelUtil; +import com.xinelu.manage.domain.patientinfo.PatientInfo; +import com.xinelu.manage.dto.cancelpicture.CancelPictureDTO; +import com.xinelu.manage.service.patientinfo.IPatientInfoService; +import com.xinelu.manage.vo.patientinfo.PatientInfoVO; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Objects; + +/** + * 被护理人基本信息Controller + * + * @author xinyilu + * @date 2022-09-02 + */ +@RestController +@RequestMapping("/system/patientArchives") +public class PatientArchivesInfoController extends BaseController { + + @Resource + private IPatientInfoService patientInfoService; + + /** + * 查询被护理人基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:list')") + @GetMapping("/list") + public TableDataInfo list(PatientInfoVO patientInfo) { + startPage(); + List list = patientInfoService.selectPatientInfoList(patientInfo); + return getDataTable(list); + } + + /** + * 导出被护理人基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:export')") + @Log(title = "被护理人基本信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PatientInfoVO patientInfo) { + List list = patientInfoService.selectPatientInfoList(patientInfo); + ExcelUtil util = new ExcelUtil<>(PatientInfoVO.class); + util.exportExcel(response, list, "被护理人基本信息数据"); + } + + /** + * 获取被护理人基本信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(patientInfoService.selectPatientInfoById(id)); + } + + /** + * 新增被护理人基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:add')") + @Log(title = "被护理人基本信息", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody PatientInfo patientInfo) { + return toAjax(patientInfoService.insertPatientInfo(patientInfo)); + } + + /** + * 修改被护理人基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:edit')") + @Log(title = "被护理人基本信息", businessType = BusinessType.UPDATE) + @PostMapping(value = "edit") + public AjaxResult edit(@RequestBody PatientInfo patientInfo) { + return patientInfoService.updatePatientInfo(patientInfo); + } + + /** + * 删除被护理人基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:remove')") + @Log(title = "被护理人基本信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(patientInfoService.deletePatientInfoByIds(ids)); + } + + /** + * 删除旧图片 + * + * @param cancelPictureDTO 路径参数 + * @return 结果 + */ + @PostMapping("/updatePicture") + public AjaxResult updatePicture(@RequestBody CancelPictureDTO cancelPictureDTO) { + if (CollectionUtils.isEmpty(cancelPictureDTO.getPictureUrlList())) { + return AjaxResult.success(); + } + return patientInfoService.updatePicture(cancelPictureDTO.getPictureUrlList()); + } + + /** + * PC端重置密码 + * + * @param id 会员id + * @param password 密码 + * @return AjaxResult + */ + @PostMapping("/updatePassword") + public AjaxResult updatePassword(Long id, String password) { + if (Objects.isNull(id)) { + return AjaxResult.error("用户信息有误,请联系管理员!"); + } + if (StringUtils.isBlank(password)) { + return AjaxResult.error("请输入密码!"); + } + return patientInfoService.updatePasswordById(id, password); + } +} + diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/cancelpicture/CancelPictureDTO.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/cancelpicture/CancelPictureDTO.java new file mode 100644 index 0000000..9803cfe --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/cancelpicture/CancelPictureDTO.java @@ -0,0 +1,21 @@ +package com.xinelu.manage.dto.cancelpicture; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 取消图片参数实体类 + * @Author 纪寒 + * @Date 2022-11-09 14:26:28 + * @Version 1.0 + */ +@Data +public class CancelPictureDTO implements Serializable { + private static final long serialVersionUID = 3470954431511861546L; + /** + * 图片集合 + */ + private List pictureUrlList; +} \ No newline at end of file