|  |  |  | 
|---|
|  |  |  | import com.ruoyi.common.enums.BusinessType; | 
|---|
|  |  |  | import com.ruoyi.common.utils.poi.ExcelUtil; | 
|---|
|  |  |  | import com.smartor.domain.PatArchive; | 
|---|
|  |  |  | import com.smartor.domain.PatArchiveReq; | 
|---|
|  |  |  | import com.smartor.domain.PatImportInfoVO; | 
|---|
|  |  |  | import com.smartor.domain.PatUpInfoVO; | 
|---|
|  |  |  | import com.smartor.service.IPatArchiveService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import org.springframework.web.multipart.MultipartFile; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | * @author smartor | 
|---|
|  |  |  | * @date 2023-03-04 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Api("患者档案") | 
|---|
|  |  |  | @Api(description = "患者档案") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("/smartor/patarchive") | 
|---|
|  |  |  | public class PatArchiveController extends BaseController { | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("获取患者档案详细信息") | 
|---|
|  |  |  | @PreAuthorize("@ss.hasPermi('smartor:patarchive:query')") | 
|---|
|  |  |  | @GetMapping(value = "/{patid}") | 
|---|
|  |  |  | @ApiImplicitParam(name = "patid",value = "患者id") | 
|---|
|  |  |  | @ApiImplicitParam(name = "patid", value = "患者id") | 
|---|
|  |  |  | public AjaxResult getInfo(@PathVariable(name = "patid") Long patid) { | 
|---|
|  |  |  | return success(patArchiveService.selectPatArchiveByPatid(patid)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @PreAuthorize("@ss.hasPermi('smartor:patarchive:remove')") | 
|---|
|  |  |  | @Log(title = "患者档案", businessType = BusinessType.DELETE) | 
|---|
|  |  |  | @DeleteMapping("/{patids}") | 
|---|
|  |  |  | @ApiImplicitParam(name = "patids",value = "患者id集合", dataType = "long", dataTypeClass = Long.class) | 
|---|
|  |  |  | @ApiImplicitParam(name = "patids", value = "患者id集合", dataType = "long", dataTypeClass = Long.class) | 
|---|
|  |  |  | public AjaxResult remove(@PathVariable Long[] patids) { | 
|---|
|  |  |  | return toAjax(patArchiveService.deletePatArchiveByPatids(patids)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation("导入患者文件处理") | 
|---|
|  |  |  | @PostMapping("/importFilehandle") | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name = "tags", value = "标签"), | 
|---|
|  |  |  | @ApiImplicitParam(name = "multipartFile", value = "上传文件") | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @ApiImplicitParams({@ApiImplicitParam(name = "tags", value = "标签"), @ApiImplicitParam(name = "multipartFile", value = "上传文件")}) | 
|---|
|  |  |  | public AjaxResult importFilehandle(@RequestParam("tags") String tags, @RequestParam("multipartFile") MultipartFile multipartFile) { | 
|---|
|  |  |  | //获取当前登陆人 | 
|---|
|  |  |  | LoginUser loginUser = getLoginUser(); | 
|---|
|  |  |  | SysUser user = loginUser.getUser(); | 
|---|
|  |  |  | PatUpInfoVO patUpInfoVO = patArchiveService.importFilehandle(user, tags, multipartFile); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return success(patUpInfoVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 导入患者信息模板 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param response | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation("患者信息导入模板") | 
|---|
|  |  |  | @PostMapping("/patImportTemplate") | 
|---|
|  |  |  | public void patImportTemplate(HttpServletResponse response) { | 
|---|
|  |  |  | ExcelUtil<PatImportInfoVO> util = new ExcelUtil<PatImportInfoVO>(PatImportInfoVO.class); | 
|---|
|  |  |  | util.importTemplateExcel(response, "患者信息导入"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param patArchiveList | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation("导出患者错误信息") | 
|---|
|  |  |  | @PostMapping("/exportErrPatInfo") | 
|---|
|  |  |  | public AjaxResult exportErrPatInfo(@RequestBody List<PatArchive> patArchiveList) { | 
|---|
|  |  |  | @PostMapping(value = "/exportErrPatInfo") | 
|---|
|  |  |  | public void exportErrPatInfo(HttpServletResponse response, @RequestBody List<PatImportInfoVO> patArchiveList) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return success(patArchiveService.exportErrPatInfo(patArchiveList)); | 
|---|
|  |  |  | ExcelUtil<PatImportInfoVO> util = new ExcelUtil<PatImportInfoVO>(PatImportInfoVO.class); | 
|---|
|  |  |  | util.exportExcel(response, patArchiveList, "导出患者错误信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询患者列表 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation("查询患者列表") | 
|---|
|  |  |  | @PostMapping("/patInfoByContion") | 
|---|
|  |  |  | public TableDataInfo patInfoByCondition(@RequestBody PatArchiveReq patArchive) { | 
|---|
|  |  |  | startPage(); | 
|---|
|  |  |  | return getDataTable(patArchiveService.patInfoByContion(patArchive)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    /** | 
|---|
|  |  |  | //     * 患者标签管理 | 
|---|
|  |  |  | //     */ | 
|---|
|  |  |  | //    @ApiOperation("患者标签管理") | 
|---|
|  |  |  | //    @PostMapping("/patTagByContion") | 
|---|
|  |  |  | //    public TableDataInfo patTagByContion(@RequestBody List<Long> tagids) { | 
|---|
|  |  |  | //        startPage(); | 
|---|
|  |  |  | //        return getDataTable(patArchiveService.patTagByContion(tagids)); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 导出患者列表根据条件 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation("导出患者列表根据条件") | 
|---|
|  |  |  | @PostMapping("/exportPatInfo") | 
|---|
|  |  |  | public void exportPpatInfo(HttpServletResponse response, @RequestBody PatArchiveReq patArchive) { | 
|---|
|  |  |  | startPage(); | 
|---|
|  |  |  | List<PatArchive> patArchives = patArchiveService.patInfoByContion(patArchive); | 
|---|
|  |  |  | if (!CollectionUtils.isEmpty(patArchives)) { | 
|---|
|  |  |  | for (int i = 0; i < patArchives.size(); i++) { | 
|---|
|  |  |  | patArchives.get(i).setTag(patArchives.get(i).getTagList().toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ExcelUtil<PatArchive> util = new ExcelUtil<PatArchive>(PatArchive.class); | 
|---|
|  |  |  | util.exportExcel(response, patArchives, "患者档案数据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|