From e975b2b18607732086feefe522c93b4b8d3391a5 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期二, 06 六月 2023 14:44:30 +0800 Subject: [PATCH] 患者信息批量上传 --- smartor/src/main/java/com/smartor/service/IPatArchivetagService.java | 61 ++ smartor/src/main/java/com/smartor/service/impl/BaseTagServiceImpl.java | 90 +++ smartor/src/main/java/com/smartor/service/IBaseTagService.java | 61 ++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/DingTalkService.java | 4 smartor/src/main/java/com/smartor/service/impl/PatArchivetagServiceImpl.java | 95 +++ smartor/src/main/java/com/smartor/domain/PatUpInfoVO.java | 36 + smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java | 20 smartor/src/main/java/com/smartor/domain/PatientManageDto.java | 4 smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java | 201 +++++++ ruoyi-common/pom.xml | 5 smartor/src/main/java/com/smartor/domain/PatArchivetag.java | 141 +++++ smartor/src/main/java/com/smartor/domain/PatArchive.java | 2 smartor/src/main/resources/mapper/smartor/PatArchivetagMapper.xml | 117 ++++ ruoyi-common/src/main/java/com/ruoyi/common/utils/DtoConversionUtils.java | 64 ++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/BaseTagController.java | 98 +++ smartor/src/main/java/com/smartor/mapper/BaseTagMapper.java | 63 ++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java | 64 + smartor/src/main/resources/mapper/smartor/BaseTagMapper.xml | 106 ++++ smartor/src/main/java/com/smartor/mapper/PatArchivetagMapper.java | 63 ++ smartor/src/main/java/com/smartor/domain/BaseTag.java | 149 +++++ smartor/src/main/java/com/smartor/service/IPatArchiveService.java | 29 21 files changed, 1,404 insertions(+), 69 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/BaseTagController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/BaseTagController.java new file mode 100644 index 0000000..cfc29df --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/BaseTagController.java @@ -0,0 +1,98 @@ +package com.ruoyi.web.controller.smartor; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.smartor.domain.BaseTag; +import com.smartor.service.IBaseTagService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +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.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 鏍囩Controller + * + * @author ruoyi + * @date 2023-06-06 + */ +@RestController +@RequestMapping("/base/tag") +public class BaseTagController extends BaseController { + @Autowired + private IBaseTagService baseTagService; + + /** + * 鏌ヨ鏍囩鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('system:tag:list')") + @GetMapping("/list") + public TableDataInfo list(BaseTag baseTag) { + startPage(); + List<BaseTag> list = baseTagService.selectBaseTagList(baseTag); + return getDataTable(list); + } + + /** + * 瀵煎嚭鏍囩鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('system:tag:export')") + @Log(title = "鏍囩", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BaseTag baseTag) { + List<BaseTag> list = baseTagService.selectBaseTagList(baseTag); + ExcelUtil<BaseTag> util = new ExcelUtil<BaseTag>(BaseTag.class); + util.exportExcel(response, list, "鏍囩鏁版嵁"); + } + + /** + * 鑾峰彇鏍囩璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('system:tag:query')") + @GetMapping(value = "/{tagid}") + public AjaxResult getInfo(@PathVariable("tagid") Long tagid) { + return success(baseTagService.selectBaseTagByTagid(tagid)); + } + + /** + * 鏂板鏍囩 + */ + @PreAuthorize("@ss.hasPermi('system:tag:add')") + @Log(title = "鏍囩", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BaseTag baseTag) { + return toAjax(baseTagService.insertBaseTag(baseTag)); + } + + /** + * 淇敼鏍囩 + */ + @PreAuthorize("@ss.hasPermi('system:tag:edit')") + @Log(title = "鏍囩", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BaseTag baseTag) { + return toAjax(baseTagService.updateBaseTag(baseTag)); + } + + /** + * 鍒犻櫎鏍囩 + */ + @PreAuthorize("@ss.hasPermi('system:tag:remove')") + @Log(title = "鏍囩", businessType = BusinessType.DELETE) + @DeleteMapping("/{tagids}") + public AjaxResult remove(@PathVariable Long[] tagids) { + return toAjax(baseTagService.deleteBaseTagByTagids(tagids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/DingTalkService.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/DingTalkService.java index d491ece..342afa6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/DingTalkService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/DingTalkService.java @@ -6,17 +6,13 @@ import com.dingtalk.api.DingTalkClient; import com.dingtalk.api.request.OapiGettokenRequest; import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request; -import com.dingtalk.api.request.OapiUserGetByMobileRequest; import com.dingtalk.api.request.OapiUserListidRequest; import com.dingtalk.api.response.*; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import com.taobao.api.ApiException; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.List; -import java.util.Map; public class DingTalkService { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java index 33fdfa9..20ced08 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java @@ -1,17 +1,20 @@ package com.smartor.controller; +import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.smartor.domain.PatUpInfoVO; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -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 org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -20,17 +23,17 @@ import com.smartor.service.IPatArchiveService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; /** * 鎮h�呮。妗圕ontroller - * + * * @author smartor * @date 2023-03-04 */ @RestController @RequestMapping("/smartor/patarchive") -public class PatArchiveController extends BaseController -{ +public class PatArchiveController extends BaseController { @Autowired private IPatArchiveService patArchiveService; @@ -39,8 +42,7 @@ */ @PreAuthorize("@ss.hasPermi('smartor:patarchive:list')") @GetMapping("/list") - public TableDataInfo list(PatArchive patArchive) - { + public TableDataInfo list(PatArchive patArchive) { startPage(); List<PatArchive> list = patArchiveService.selectPatArchiveList(patArchive); return getDataTable(list); @@ -52,8 +54,7 @@ @PreAuthorize("@ss.hasPermi('smartor:patarchive:export')") @Log(title = "鎮h�呮。妗�", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, PatArchive patArchive) - { + public void export(HttpServletResponse response, PatArchive patArchive) { List<PatArchive> list = patArchiveService.selectPatArchiveList(patArchive); ExcelUtil<PatArchive> util = new ExcelUtil<PatArchive>(PatArchive.class); util.exportExcel(response, list, "鎮h�呮。妗堟暟鎹�"); @@ -64,8 +65,7 @@ */ @PreAuthorize("@ss.hasPermi('smartor:patarchive:query')") @GetMapping(value = "/{patid}") - public AjaxResult getInfo(@PathVariable("patid") Long patid) - { + public AjaxResult getInfo(@PathVariable("patid") Long patid) { return success(patArchiveService.selectPatArchiveByPatid(patid)); } @@ -75,8 +75,7 @@ @PreAuthorize("@ss.hasPermi('smartor:patarchive:add')") @Log(title = "鎮h�呮。妗�", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody PatArchive patArchive) - { + public AjaxResult add(@RequestBody PatArchive patArchive) { return toAjax(patArchiveService.insertPatArchive(patArchive)); } @@ -86,8 +85,7 @@ @PreAuthorize("@ss.hasPermi('smartor:patarchive:edit')") @Log(title = "鎮h�呮。妗�", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody PatArchive patArchive) - { + public AjaxResult edit(@RequestBody PatArchive patArchive) { return toAjax(patArchiveService.updatePatArchive(patArchive)); } @@ -96,9 +94,27 @@ */ @PreAuthorize("@ss.hasPermi('smartor:patarchive:remove')") @Log(title = "鎮h�呮。妗�", businessType = BusinessType.DELETE) - @DeleteMapping("/{patids}") - public AjaxResult remove(@PathVariable Long[] patids) - { + @DeleteMapping("/{patids}") + public AjaxResult remove(@PathVariable Long[] patids) { return toAjax(patArchiveService.deletePatArchiveByPatids(patids)); } + + + /** + * 鎮h�呮枃浠跺鐞� + * + * @param title + * @param multipartFile + */ + @PostMapping("/filehandle") + public AjaxResult fileHandle(@RequestParam("multipartFile") MultipartFile multipartFile) { + //鑾峰彇褰撳墠鐧婚檰浜� + LoginUser loginUser = getLoginUser(); + SysUser user = loginUser.getUser(); + String userName = user.getUserName(); + + PatUpInfoVO patUpInfoVO = patArchiveService.fileHandle(userName, multipartFile); + + return success(patUpInfoVO); + } } diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index eafd491..0ee06f4 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -159,7 +159,10 @@ <artifactId>alibaba-dingtalk-service-sdk</artifactId> <version>2.0.0</version> </dependency> - + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-websocket</artifactId> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DtoConversionUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DtoConversionUtils.java new file mode 100644 index 0000000..d9b3300 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DtoConversionUtils.java @@ -0,0 +1,64 @@ +package com.ruoyi.common.utils; + +import org.springframework.beans.BeanUtils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * DTO鍜宔ntity鐩镐簰杞寲宸ュ叿绫� + * + * @author liusheng + * @date 2023/5/06 + */ +public class DtoConversionUtils { + + /** + * entity杞寲涓篋TO + * + * @param source 瀹炰綋绫籩ntity + * @param target 鐩爣绫籇TO + * @return 杞寲鍚庣殑DTO + */ + public static <T> T sourceToTarget(Object source, Class<T> target){ + if(source == null){ + return null; + } + T targetObject = null; + try { + targetObject = target.newInstance(); + BeanUtils.copyProperties(source, targetObject); + } catch (Exception e) { + e.printStackTrace(); + } + + return targetObject; + } + + /** + * List<entity>杞寲涓篖ist<DTO> + * + * @param sourceList 瀹炰綋绫婚泦鍚圕ollection<entity> + * @param target 鐩爣绫籇TO + * @return 杞寲鍚庣殑Collection<DTO> + */ + public static <T> List<T> sourceToTarget(Collection<?> sourceList, Class<T> target){ + if(sourceList == null){ + return null; + } + + ArrayList<T> targetList = new ArrayList<>(sourceList.size()); + try { + for(Object source : sourceList){ + T targetObject = target.newInstance(); + BeanUtils.copyProperties(source, targetObject); + targetList.add(targetObject); + } + } catch (Exception e) { + e.printStackTrace(); + } + + return targetList; + } +} diff --git a/smartor/src/main/java/com/smartor/domain/BaseTag.java b/smartor/src/main/java/com/smartor/domain/BaseTag.java new file mode 100644 index 0000000..aff43d5 --- /dev/null +++ b/smartor/src/main/java/com/smartor/domain/BaseTag.java @@ -0,0 +1,149 @@ +package com.smartor.domain; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 鏍囩瀵硅薄 base_tag + * + * @author ruoyi + * @date 2023-06-02 + */ +public class BaseTag extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 鑷ID + */ + private Long tagid; + + /** + * 鏍囩鍒嗙被ID + */ + @Excel(name = " 鏍囩鍒嗙被ID ") + private Long tagcategoryid; + + /** + * 鏍囩鍚嶇О + */ + @Excel(name = " 鏍囩鍚嶇О ") + private String tagname; + + /** + * 鏍囩鎻忚堪 + */ + @Excel(name = " 鏍囩鎻忚堪 ") + private String tagdescription; + + /** + * 鏈烘瀯ID + */ + @Excel(name = " 鏈烘瀯ID ") + private String orgid; + + /** + * 鍒犻櫎鏍囪 + */ + private String delFlag; + + /** + * 涓婁紶鏍囪 + */ + @Excel(name = " 涓婁紶鏍囪 ") + private Long isupload; + + /** + * 涓婁紶鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = " 涓婁紶鏃堕棿 ", width = 30, dateFormat = "yyyy-MM-dd") + private Date uploadTime; + + /** + * 鏄惁寮�鍚� + */ + @Excel(name = " 鏄惁寮�鍚� ") + private Long isenable; + + public void setTagid(Long tagid) { + this.tagid = tagid; + } + + public Long getTagid() { + return tagid; + } + + public void setTagcategoryid(Long tagcategoryid) { + this.tagcategoryid = tagcategoryid; + } + + public Long getTagcategoryid() { + return tagcategoryid; + } + + public void setTagname(String tagname) { + this.tagname = tagname; + } + + public String getTagname() { + return tagname; + } + + public void setTagdescription(String tagdescription) { + this.tagdescription = tagdescription; + } + + public String getTagdescription() { + return tagdescription; + } + + public void setOrgid(String orgid) { + this.orgid = orgid; + } + + public String getOrgid() { + return orgid; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlag() { + return delFlag; + } + + public void setIsupload(Long isupload) { + this.isupload = isupload; + } + + public Long getIsupload() { + return isupload; + } + + public void setUploadTime(Date uploadTime) { + this.uploadTime = uploadTime; + } + + public Date getUploadTime() { + return uploadTime; + } + + public void setIsenable(Long isenable) { + this.isenable = isenable; + } + + public Long getIsenable() { + return isenable; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("tagid", getTagid()).append("tagcategoryid", getTagcategoryid()).append("tagname", getTagname()).append("tagdescription", getTagdescription()).append("orgid", getOrgid()).append("delFlag", getDelFlag()).append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("createBy", getCreateBy()).append("createTime", getCreateTime()).append("isupload", getIsupload()).append("uploadTime", getUploadTime()).append("isenable", getIsenable()).toString(); + } +} diff --git a/smartor/src/main/java/com/smartor/domain/PatArchive.java b/smartor/src/main/java/com/smartor/domain/PatArchive.java index 5b8a41a..e493974 100644 --- a/smartor/src/main/java/com/smartor/domain/PatArchive.java +++ b/smartor/src/main/java/com/smartor/domain/PatArchive.java @@ -24,7 +24,7 @@ @Excel(name = " 濮撳悕 ") private String name; - /** 鎬у埆 */ + /** 鎬у埆 1:鐢� 2:濂�*/ @Excel(name = " 鎬у埆 ") private Long sex; diff --git a/smartor/src/main/java/com/smartor/domain/PatArchivetag.java b/smartor/src/main/java/com/smartor/domain/PatArchivetag.java new file mode 100644 index 0000000..ef685d0 --- /dev/null +++ b/smartor/src/main/java/com/smartor/domain/PatArchivetag.java @@ -0,0 +1,141 @@ +package com.smartor.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 鎮h�呮。妗堟爣绛惧璞� pat_archivetag + * + * @author ruoyi + * @date 2023-06-02 + */ +public class PatArchivetag extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 鑷ID */ + private Long id; + + /** 鏍囩鍒嗙被ID */ + @Excel(name = " 鏍囩鍒嗙被ID ") + private Long tagcategoryid; + + /** 鏍囩ID */ + @Excel(name = " 鏍囩ID ") + private Long tagid; + + /** 鏈烘瀯ID */ + @Excel(name = " 鏈烘瀯ID ") + private String orgid; + + /** 鍒犻櫎鏍囪 */ + private String delFlag; + + /** 涓婁紶鏍囪 */ + @Excel(name = " 涓婁紶鏍囪 ") + private Long isupload; + + /** 涓婁紶鏃堕棿 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = " 涓婁紶鏃堕棿 ", width = 30, dateFormat = "yyyy-MM-dd") + private Date uploadTime; + + /** 妗fID */ + @Excel(name = " 妗fID ") + private Long patid; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setTagcategoryid(Long tagcategoryid) + { + this.tagcategoryid = tagcategoryid; + } + + public Long getTagcategoryid() + { + return tagcategoryid; + } + public void setTagid(Long tagid) + { + this.tagid = tagid; + } + + public Long getTagid() + { + return tagid; + } + public void setOrgid(String orgid) + { + this.orgid = orgid; + } + + public String getOrgid() + { + return orgid; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + public void setIsupload(Long isupload) + { + this.isupload = isupload; + } + + public Long getIsupload() + { + return isupload; + } + public void setUploadTime(Date uploadTime) + { + this.uploadTime = uploadTime; + } + + public Date getUploadTime() + { + return uploadTime; + } + public void setPatid(Long patid) + { + this.patid = patid; + } + + public Long getPatid() + { + return patid; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("tagcategoryid", getTagcategoryid()) + .append("tagid", getTagid()) + .append("orgid", getOrgid()) + .append("delFlag", getDelFlag()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("isupload", getIsupload()) + .append("uploadTime", getUploadTime()) + .append("patid", getPatid()) + .toString(); + } +} diff --git a/smartor/src/main/java/com/smartor/domain/PatUpInfoVO.java b/smartor/src/main/java/com/smartor/domain/PatUpInfoVO.java new file mode 100644 index 0000000..f810b4a --- /dev/null +++ b/smartor/src/main/java/com/smartor/domain/PatUpInfoVO.java @@ -0,0 +1,36 @@ +package com.smartor.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; +import java.util.List; + +/** + * 鎮h�呴敊璇俊鎭繑鍥� + * + * @author 鍒樼渷 + * @date 2023-06-06 + */ +@Data +public class PatUpInfoVO { + + /** + * 鎴愬姛鏁伴噺 + */ + private Integer successNum; + + /** + * 澶辫触鏁伴噺 + */ + private Integer failNum; + + /** + * 澶辫触鎮h�呴泦鍚� + */ + private List<PatArchive> patArchiveList; +} diff --git a/smartor/src/main/java/com/smartor/domain/PatientManageDto.java b/smartor/src/main/java/com/smartor/domain/PatientManageDto.java new file mode 100644 index 0000000..8632b9b --- /dev/null +++ b/smartor/src/main/java/com/smartor/domain/PatientManageDto.java @@ -0,0 +1,4 @@ +package com.smartor.domain; + +public class PatientManageDto { +} diff --git a/smartor/src/main/java/com/smartor/mapper/BaseTagMapper.java b/smartor/src/main/java/com/smartor/mapper/BaseTagMapper.java new file mode 100644 index 0000000..baf8532 --- /dev/null +++ b/smartor/src/main/java/com/smartor/mapper/BaseTagMapper.java @@ -0,0 +1,63 @@ +package com.smartor.mapper; + +import java.util.List; + +import com.smartor.domain.BaseTag; +import org.apache.ibatis.annotations.Mapper; + +/** + * 鏍囩Mapper鎺ュ彛 + * + * @author ruoyi + * @date 2023-06-02 + */ +@Mapper +public interface BaseTagMapper { + /** + * 鏌ヨ鏍囩 + * + * @param tagid 鏍囩涓婚敭 + * @return 鏍囩 + */ + public BaseTag selectBaseTagByTagid(Long tagid); + + /** + * 鏌ヨ鏍囩鍒楄〃 + * + * @param baseTag 鏍囩 + * @return 鏍囩闆嗗悎 + */ + public List<BaseTag> selectBaseTagList(BaseTag baseTag); + + /** + * 鏂板鏍囩 + * + * @param baseTag 鏍囩 + * @return 缁撴灉 + */ + public int insertBaseTag(BaseTag baseTag); + + /** + * 淇敼鏍囩 + * + * @param baseTag 鏍囩 + * @return 缁撴灉 + */ + public int updateBaseTag(BaseTag baseTag); + + /** + * 鍒犻櫎鏍囩 + * + * @param tagid 鏍囩涓婚敭 + * @return 缁撴灉 + */ + public int deleteBaseTagByTagid(Long tagid); + + /** + * 鎵归噺鍒犻櫎鏍囩 + * + * @param tagids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteBaseTagByTagids(Long[] tagids); +} diff --git a/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java b/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java index 298f6b9..c10017e 100644 --- a/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java +++ b/smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java @@ -1,19 +1,21 @@ package com.smartor.mapper; import java.util.List; + import com.smartor.domain.PatArchive; +import org.apache.ibatis.annotations.Mapper; /** * 鎮h�呮。妗圡apper鎺ュ彛 - * + * * @author smartor * @date 2023-03-04 */ -public interface PatArchiveMapper -{ +@Mapper +public interface PatArchiveMapper { /** * 鏌ヨ鎮h�呮。妗� - * + * * @param patid 鎮h�呮。妗堜富閿� * @return 鎮h�呮。妗� */ @@ -21,7 +23,7 @@ /** * 鏌ヨ鎮h�呮。妗堝垪琛� - * + * * @param patArchive 鎮h�呮。妗� * @return 鎮h�呮。妗堥泦鍚� */ @@ -29,7 +31,7 @@ /** * 鏂板鎮h�呮。妗� - * + * * @param patArchive 鎮h�呮。妗� * @return 缁撴灉 */ @@ -37,7 +39,7 @@ /** * 淇敼鎮h�呮。妗� - * + * * @param patArchive 鎮h�呮。妗� * @return 缁撴灉 */ @@ -45,7 +47,7 @@ /** * 鍒犻櫎鎮h�呮。妗� - * + * * @param patid 鎮h�呮。妗堜富閿� * @return 缁撴灉 */ @@ -53,7 +55,7 @@ /** * 鎵归噺鍒犻櫎鎮h�呮。妗� - * + * * @param patids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 * @return 缁撴灉 */ diff --git a/smartor/src/main/java/com/smartor/mapper/PatArchivetagMapper.java b/smartor/src/main/java/com/smartor/mapper/PatArchivetagMapper.java new file mode 100644 index 0000000..8e08f03 --- /dev/null +++ b/smartor/src/main/java/com/smartor/mapper/PatArchivetagMapper.java @@ -0,0 +1,63 @@ +package com.smartor.mapper; + +import java.util.List; + +import com.smartor.domain.PatArchivetag; +import org.apache.ibatis.annotations.Mapper; + +/** + * 鎮h�呮。妗堟爣绛綧apper鎺ュ彛 + * + * @author ruoyi + * @date 2023-06-02 + */ +@Mapper +public interface PatArchivetagMapper { + /** + * 鏌ヨ鎮h�呮。妗堟爣绛� + * + * @param id 鎮h�呮。妗堟爣绛句富閿� + * @return 鎮h�呮。妗堟爣绛� + */ + public PatArchivetag selectPatArchivetagById(Long id); + + /** + * 鏌ヨ鎮h�呮。妗堟爣绛惧垪琛� + * + * @param patArchivetag 鎮h�呮。妗堟爣绛� + * @return 鎮h�呮。妗堟爣绛鹃泦鍚� + */ + public List<PatArchivetag> selectPatArchivetagList(PatArchivetag patArchivetag); + + /** + * 鏂板鎮h�呮。妗堟爣绛� + * + * @param patArchivetag 鎮h�呮。妗堟爣绛� + * @return 缁撴灉 + */ + public int insertPatArchivetag(PatArchivetag patArchivetag); + + /** + * 淇敼鎮h�呮。妗堟爣绛� + * + * @param patArchivetag 鎮h�呮。妗堟爣绛� + * @return 缁撴灉 + */ + public int updatePatArchivetag(PatArchivetag patArchivetag); + + /** + * 鍒犻櫎鎮h�呮。妗堟爣绛� + * + * @param id 鎮h�呮。妗堟爣绛句富閿� + * @return 缁撴灉 + */ + public int deletePatArchivetagById(Long id); + + /** + * 鎵归噺鍒犻櫎鎮h�呮。妗堟爣绛� + * + * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deletePatArchivetagByIds(Long[] ids); +} diff --git a/smartor/src/main/java/com/smartor/service/IBaseTagService.java b/smartor/src/main/java/com/smartor/service/IBaseTagService.java new file mode 100644 index 0000000..1f2c984 --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/IBaseTagService.java @@ -0,0 +1,61 @@ +package com.smartor.service; + +import java.util.List; +import com.smartor.domain.BaseTag; + +/** + * 鏍囩Service鎺ュ彛 + * + * @author ruoyi + * @date 2023-06-02 + */ +public interface IBaseTagService +{ + /** + * 鏌ヨ鏍囩 + * + * @param tagid 鏍囩涓婚敭 + * @return 鏍囩 + */ + public BaseTag selectBaseTagByTagid(Long tagid); + + /** + * 鏌ヨ鏍囩鍒楄〃 + * + * @param baseTag 鏍囩 + * @return 鏍囩闆嗗悎 + */ + public List<BaseTag> selectBaseTagList(BaseTag baseTag); + + /** + * 鏂板鏍囩 + * + * @param baseTag 鏍囩 + * @return 缁撴灉 + */ + public int insertBaseTag(BaseTag baseTag); + + /** + * 淇敼鏍囩 + * + * @param baseTag 鏍囩 + * @return 缁撴灉 + */ + public int updateBaseTag(BaseTag baseTag); + + /** + * 鎵归噺鍒犻櫎鏍囩 + * + * @param tagids 闇�瑕佸垹闄ょ殑鏍囩涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteBaseTagByTagids(Long[] tagids); + + /** + * 鍒犻櫎鏍囩淇℃伅 + * + * @param tagid 鏍囩涓婚敭 + * @return 缁撴灉 + */ + public int deleteBaseTagByTagid(Long tagid); +} diff --git a/smartor/src/main/java/com/smartor/service/IPatArchiveService.java b/smartor/src/main/java/com/smartor/service/IPatArchiveService.java index 8bd0358..1deee9f 100644 --- a/smartor/src/main/java/com/smartor/service/IPatArchiveService.java +++ b/smartor/src/main/java/com/smartor/service/IPatArchiveService.java @@ -1,19 +1,22 @@ package com.smartor.service; import java.util.List; + import com.smartor.domain.PatArchive; +import com.smartor.domain.PatUpInfoVO; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; /** * 鎮h�呮。妗圫ervice鎺ュ彛 - * + * * @author smartor * @date 2023-03-04 */ -public interface IPatArchiveService -{ +public interface IPatArchiveService { /** * 鏌ヨ鎮h�呮。妗� - * + * * @param patid 鎮h�呮。妗堜富閿� * @return 鎮h�呮。妗� */ @@ -21,7 +24,7 @@ /** * 鏌ヨ鎮h�呮。妗堝垪琛� - * + * * @param patArchive 鎮h�呮。妗� * @return 鎮h�呮。妗堥泦鍚� */ @@ -29,7 +32,7 @@ /** * 鏂板鎮h�呮。妗� - * + * * @param patArchive 鎮h�呮。妗� * @return 缁撴灉 */ @@ -37,7 +40,7 @@ /** * 淇敼鎮h�呮。妗� - * + * * @param patArchive 鎮h�呮。妗� * @return 缁撴灉 */ @@ -45,7 +48,7 @@ /** * 鎵归噺鍒犻櫎鎮h�呮。妗� - * + * * @param patids 闇�瑕佸垹闄ょ殑鎮h�呮。妗堜富閿泦鍚� * @return 缁撴灉 */ @@ -53,9 +56,17 @@ /** * 鍒犻櫎鎮h�呮。妗堜俊鎭� - * + * * @param patid 鎮h�呮。妗堜富閿� * @return 缁撴灉 */ public int deletePatArchiveByPatid(Long patid); + + /** + * 鎮h�呬俊鎭壒閲忔彃鍏� + * + * @param title + * @param file + */ + public PatUpInfoVO fileHandle( String username, MultipartFile file); } diff --git a/smartor/src/main/java/com/smartor/service/IPatArchivetagService.java b/smartor/src/main/java/com/smartor/service/IPatArchivetagService.java new file mode 100644 index 0000000..59e93b0 --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/IPatArchivetagService.java @@ -0,0 +1,61 @@ +package com.smartor.service; + +import java.util.List; + +import com.smartor.domain.PatArchivetag; + +/** + * 鎮h�呮。妗堟爣绛維ervice鎺ュ彛 + * + * @author ruoyi + * @date 2023-06-02 + */ +public interface IPatArchivetagService { + /** + * 鏌ヨ鎮h�呮。妗堟爣绛� + * + * @param id 鎮h�呮。妗堟爣绛句富閿� + * @return 鎮h�呮。妗堟爣绛� + */ + public PatArchivetag selectPatArchivetagById(Long id); + + /** + * 鏌ヨ鎮h�呮。妗堟爣绛惧垪琛� + * + * @param patArchivetag 鎮h�呮。妗堟爣绛� + * @return 鎮h�呮。妗堟爣绛鹃泦鍚� + */ + public List<PatArchivetag> selectPatArchivetagList(PatArchivetag patArchivetag); + + /** + * 鏂板鎮h�呮。妗堟爣绛� + * + * @param patArchivetag 鎮h�呮。妗堟爣绛� + * @return 缁撴灉 + */ + public int insertPatArchivetag(PatArchivetag patArchivetag); + + /** + * 淇敼鎮h�呮。妗堟爣绛� + * + * @param patArchivetag 鎮h�呮。妗堟爣绛� + * @return 缁撴灉 + */ + public int updatePatArchivetag(PatArchivetag patArchivetag); + + /** + * 鎵归噺鍒犻櫎鎮h�呮。妗堟爣绛� + * + * @param ids 闇�瑕佸垹闄ょ殑鎮h�呮。妗堟爣绛句富閿泦鍚� + * @return 缁撴灉 + */ + public int deletePatArchivetagByIds(Long[] ids); + + /** + * 鍒犻櫎鎮h�呮。妗堟爣绛句俊鎭� + * + * @param id 鎮h�呮。妗堟爣绛句富閿� + * @return 缁撴灉 + */ + public int deletePatArchivetagById(Long id); +} diff --git a/smartor/src/main/java/com/smartor/service/impl/BaseTagServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/BaseTagServiceImpl.java new file mode 100644 index 0000000..e80520a --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/impl/BaseTagServiceImpl.java @@ -0,0 +1,90 @@ +package com.smartor.service.impl; + +import java.util.List; + +import com.ruoyi.common.utils.DateUtils; +import com.smartor.domain.BaseTag; +import com.smartor.mapper.BaseTagMapper; +import com.smartor.service.IBaseTagService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 鏍囩Service涓氬姟灞傚鐞� + * + * @author ruoyi + * @date 2023-06-02 + */ +@Service +public class BaseTagServiceImpl implements IBaseTagService { + @Autowired + private BaseTagMapper baseTagMapper; + + /** + * 鏌ヨ鏍囩 + * + * @param tagid 鏍囩涓婚敭 + * @return 鏍囩 + */ + @Override + public BaseTag selectBaseTagByTagid(Long tagid) { + return baseTagMapper.selectBaseTagByTagid(tagid); + } + + /** + * 鏌ヨ鏍囩鍒楄〃 + * + * @param baseTag 鏍囩 + * @return 鏍囩 + */ + @Override + public List<BaseTag> selectBaseTagList(BaseTag baseTag) { + return baseTagMapper.selectBaseTagList(baseTag); + } + + /** + * 鏂板鏍囩 + * + * @param baseTag 鏍囩 + * @return 缁撴灉 + */ + @Override + public int insertBaseTag(BaseTag baseTag) { + baseTag.setCreateTime(DateUtils.getNowDate()); + return baseTagMapper.insertBaseTag(baseTag); + } + + /** + * 淇敼鏍囩 + * + * @param baseTag 鏍囩 + * @return 缁撴灉 + */ + @Override + public int updateBaseTag(BaseTag baseTag) { + baseTag.setUpdateTime(DateUtils.getNowDate()); + return baseTagMapper.updateBaseTag(baseTag); + } + + /** + * 鎵归噺鍒犻櫎鏍囩 + * + * @param tagids 闇�瑕佸垹闄ょ殑鏍囩涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteBaseTagByTagids(Long[] tagids) { + return baseTagMapper.deleteBaseTagByTagids(tagids); + } + + /** + * 鍒犻櫎鏍囩淇℃伅 + * + * @param tagid 鏍囩涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteBaseTagByTagid(Long tagid) { + return baseTagMapper.deleteBaseTagByTagid(tagid); + } +} diff --git a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java index e7dd825..714d832 100644 --- a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java @@ -1,96 +1,255 @@ package com.smartor.service.impl; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; import java.util.List; + import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DtoConversionUtils; +import com.ruoyi.common.utils.StringUtils; +import com.smartor.domain.BaseTag; +import com.smartor.domain.PatArchivetag; +import com.smartor.domain.PatUpInfoVO; +import com.smartor.mapper.BaseTagMapper; +import com.smartor.mapper.PatArchivetagMapper; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.smartor.mapper.PatArchiveMapper; import com.smartor.domain.PatArchive; import com.smartor.service.IPatArchiveService; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; /** * 鎮h�呮。妗圫ervice涓氬姟灞傚鐞� - * + * * @author smartor * @date 2023-03-04 */ @Service -public class PatArchiveServiceImpl implements IPatArchiveService -{ +public class PatArchiveServiceImpl implements IPatArchiveService { @Autowired private PatArchiveMapper patArchiveMapper; + @Autowired + private BaseTagMapper baseTagMapper; + + @Autowired + private PatArchivetagMapper patArchivetagMapper; + + /** * 鏌ヨ鎮h�呮。妗� - * + * * @param patid 鎮h�呮。妗堜富閿� * @return 鎮h�呮。妗� */ @Override - public PatArchive selectPatArchiveByPatid(Long patid) - { + public PatArchive selectPatArchiveByPatid(Long patid) { return patArchiveMapper.selectPatArchiveByPatid(patid); } /** * 鏌ヨ鎮h�呮。妗堝垪琛� - * + * * @param patArchive 鎮h�呮。妗� * @return 鎮h�呮。妗� */ @Override - public List<PatArchive> selectPatArchiveList(PatArchive patArchive) - { + public List<PatArchive> selectPatArchiveList(PatArchive patArchive) { return patArchiveMapper.selectPatArchiveList(patArchive); } /** * 鏂板鎮h�呮。妗� - * + * * @param patArchive 鎮h�呮。妗� * @return 缁撴灉 */ @Override - public int insertPatArchive(PatArchive patArchive) - { + public int insertPatArchive(PatArchive patArchive) { patArchive.setCreateTime(DateUtils.getNowDate()); return patArchiveMapper.insertPatArchive(patArchive); } /** * 淇敼鎮h�呮。妗� - * + * * @param patArchive 鎮h�呮。妗� * @return 缁撴灉 */ @Override - public int updatePatArchive(PatArchive patArchive) - { + public int updatePatArchive(PatArchive patArchive) { patArchive.setUpdateTime(DateUtils.getNowDate()); return patArchiveMapper.updatePatArchive(patArchive); } /** * 鎵归噺鍒犻櫎鎮h�呮。妗� - * + * * @param patids 闇�瑕佸垹闄ょ殑鎮h�呮。妗堜富閿� * @return 缁撴灉 */ @Override - public int deletePatArchiveByPatids(Long[] patids) - { + public int deletePatArchiveByPatids(Long[] patids) { return patArchiveMapper.deletePatArchiveByPatids(patids); } /** * 鍒犻櫎鎮h�呮。妗堜俊鎭� - * + * * @param patid 鎮h�呮。妗堜富閿� * @return 缁撴灉 */ @Override - public int deletePatArchiveByPatid(Long patid) - { + public int deletePatArchiveByPatid(Long patid) { return patArchiveMapper.deletePatArchiveByPatid(patid); } + + @Override + @Transactional + public PatUpInfoVO fileHandle(String username, MultipartFile file) { + PatUpInfoVO patUpInfoVO = new PatUpInfoVO(); + Integer successNum = 0; + Integer failNum = 0; + + List<PatArchive> errorpatArchiveList = new ArrayList<>(); + try { + Workbook workbook = new XSSFWorkbook(file.getInputStream()); + Sheet sheet = workbook.getSheetAt(0); + + for (int i = sheet.getFirstRowNum() + 1; i < sheet.getLastRowNum(); i++) { + Row row = sheet.getRow(i); + //濡傛灉琛屼负绌猴紝杩涜涓嬩竴娆″惊鐜� + if (ObjectUtils.isEmpty(row)) { + continue; + } + PatArchive patArchive = new PatArchive(); + if (ObjectUtils.isEmpty(row.getCell(3))) { + patArchive.setRemark("韬唤璇佸彿涓虹┖"); + } else { + patArchive.setIccardno(row.getCell(3).toString()); + //鏍规嵁韬唤璇侊紝鍏堝幓鎮h�呯鐞嗚〃閲岀湅鐪嬫湁娌℃湁杩欎釜浜�,濡傛灉鏈夎繖涓汉锛屼篃涓嶉渶瑕佹彃鍏ユ偅鑰呰〃 + List<PatArchive> patArchiveList1 = patArchiveMapper.selectPatArchiveList(patArchive); + if (patArchiveList1.size() > 0) { + patArchive.setRemark("璇ユ偅鑰呭凡瀛樺湪"); + } + } + + //鍒ゆ柇濮撳悕鏄惁涓虹┖ + if (ObjectUtils.isEmpty(row.getCell(0))) { + patArchive.setRemark(patArchive.getRemark() + "," + "濮撳悕涓虹┖"); + errorpatArchiveList.add(patArchive); + } else { + patArchive.setName(row.getCell(0).toString()); + } + + //鍒ゆ柇鎬у埆鏄惁涓虹┖ + + if (ObjectUtils.isEmpty(row.getCell(1))) { + patArchive.setRemark(patArchive.getRemark() + "," + "鎬у埆涓虹┖"); + } else { + patArchive.setSex(row.getCell(1).toString().equals("鐢�") ? 1L : 2L); + } + + //鍒ゆ柇璇佷欢绫诲瀷鏄惁涓虹┖ + if (ObjectUtils.isEmpty(row.getCell(2))) { + patArchive.setRemark("璇佷欢绫诲瀷涓虹┖"); + } else { + patArchive.setIccardtype(row.getCell(2).toString()); + } + + //鍒ゆ柇鍑虹敓鏃ユ湡鏄惁涓虹┖ + if (ObjectUtils.isEmpty(row.getCell(4))) { + patArchive.setRemark("鍑虹敓鏃ユ湡涓虹┖"); + } else { + //鏍煎紡杞崲锛岃浆鎴愭棩鏈� + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); + Date javaDate = new Date(); + if (row.getCell(4).getCellType().toString().equals("NUMERIC")) { + javaDate = HSSFDateUtil.getJavaDate(row.getCell(4).getNumericCellValue()); + } else { + javaDate = new Date(row.getCell(4).toString()); + } + dateFormat.format(javaDate); + patArchive.setBirthdate(javaDate); + } + + //鍒ゆ柇鏈汉鑱旂郴鏄惁涓虹┖锛屽拰闀垮害鏄惁姝g‘ + if (ObjectUtils.isEmpty(row.getCell(5))) { + patArchive.setRemark("鏈汉鑱旂郴鐢佃瘽涓虹┖"); + } else { + //鏍煎紡杞崲锛岃浆鎴愭枃鏈� + if (row.getCell(5).getCellType().toString().equals("NUMERIC")) { + String cellData = String.valueOf((long) row.getCell(5).getNumericCellValue()); + patArchive.setTelcode(cellData); + } else { + DataFormatter dataFormatter = new DataFormatter(); + String cellValue = dataFormatter.formatCellValue(row.getCell(5)); + patArchive.setTelcode(cellValue); + } + } + + //鍒ゆ柇浜插睘鑱旂郴鏂瑰紡鏄惁涓虹┖锛岄暱搴︽槸鍚︽纭� + if (ObjectUtils.isEmpty(row.getCell(6))) { + patArchive.setRemark("鏈汉鑱旂郴鐢佃瘽涓虹┖"); + } else { + //鏍煎紡杞崲锛岃浆鎴愭枃鏈� + if (row.getCell(6).getCellType().toString().equals("NUMERIC")) { + String cellData = String.valueOf((long) row.getCell(6).getNumericCellValue()); + patArchive.setRelativetelcode(cellData); + } else { + DataFormatter dataFormatter = new DataFormatter(); + String cellValue = dataFormatter.formatCellValue(row.getCell(6)); + patArchive.setRelativetelcode(cellValue); + } + } + + //鎮i兘鏍囩鏄惁涓虹┖ + if (ObjectUtils.isEmpty(row.getCell(7))) { + patArchive.setRemark("鎮h�呮爣绛句负绌�"); + } + + //鍒ゆ柇澶囨敞鏄惁涓虹┖ + if (!StringUtils.isEmpty(patArchive.getRemark())) { + //濡傛灉澶囨敞瀛楁涓嶄负绌猴紝璇存湁璇ユ偅鑰呭~鍐欐湁闂 + errorpatArchiveList.add(patArchive); + failNum = failNum + 1; + continue; + } + + //寰�鎮h�呰〃閲屾柊澧�,骞惰幏鍙栧埌鏂板ID + patArchiveMapper.insertPatArchive(patArchive); + + //鏍规嵁鏍囩鍚嶆煡璇㈠嚭鏍囩淇℃伅 + BaseTag baseTag = new BaseTag(); + baseTag.setTagname(row.getCell(7).toString()); + List<BaseTag> baseTags = baseTagMapper.selectBaseTagList(baseTag); + BaseTag baseTag1 = baseTags.get(0); + + // 鏂板鎮h�呮。妗堟爣绛� + PatArchivetag patArchivetag = DtoConversionUtils.sourceToTarget(baseTag1, PatArchivetag.class); + patArchivetag.setUpdateBy(username); + patArchivetag.setCreateTime(new Date()); + patArchivetag.setPatid(patArchive.getPatid()); + patArchivetagMapper.insertPatArchivetag(patArchivetag); + successNum = successNum + 1; + } + + } catch (Exception e) { + e.printStackTrace(); + } + + patUpInfoVO.setFailNum(failNum); + patUpInfoVO.setSuccessNum(successNum); + patUpInfoVO.setPatArchiveList(errorpatArchiveList); + return patUpInfoVO; + } + } + diff --git a/smartor/src/main/java/com/smartor/service/impl/PatArchivetagServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatArchivetagServiceImpl.java new file mode 100644 index 0000000..c610be5 --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/impl/PatArchivetagServiceImpl.java @@ -0,0 +1,95 @@ +package com.smartor.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.smartor.domain.PatArchivetag; +import com.smartor.mapper.PatArchivetagMapper; +import com.smartor.service.IPatArchivetagService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +/** + * 鎮h�呮。妗堟爣绛維ervice涓氬姟灞傚鐞� + * + * @author ruoyi + * @date 2023-06-02 + */ +@Service +public class PatArchivetagServiceImpl implements IPatArchivetagService +{ + @Autowired + private PatArchivetagMapper patArchivetagMapper; + + /** + * 鏌ヨ鎮h�呮。妗堟爣绛� + * + * @param id 鎮h�呮。妗堟爣绛句富閿� + * @return 鎮h�呮。妗堟爣绛� + */ + @Override + public PatArchivetag selectPatArchivetagById(Long id) + { + return patArchivetagMapper.selectPatArchivetagById(id); + } + + /** + * 鏌ヨ鎮h�呮。妗堟爣绛惧垪琛� + * + * @param patArchivetag 鎮h�呮。妗堟爣绛� + * @return 鎮h�呮。妗堟爣绛� + */ + @Override + public List<PatArchivetag> selectPatArchivetagList(PatArchivetag patArchivetag) + { + return patArchivetagMapper.selectPatArchivetagList(patArchivetag); + } + + /** + * 鏂板鎮h�呮。妗堟爣绛� + * + * @param patArchivetag 鎮h�呮。妗堟爣绛� + * @return 缁撴灉 + */ + @Override + public int insertPatArchivetag(PatArchivetag patArchivetag) + { + patArchivetag.setCreateTime(DateUtils.getNowDate()); + return patArchivetagMapper.insertPatArchivetag(patArchivetag); + } + + /** + * 淇敼鎮h�呮。妗堟爣绛� + * + * @param patArchivetag 鎮h�呮。妗堟爣绛� + * @return 缁撴灉 + */ + @Override + public int updatePatArchivetag(PatArchivetag patArchivetag) + { + patArchivetag.setUpdateTime(DateUtils.getNowDate()); + return patArchivetagMapper.updatePatArchivetag(patArchivetag); + } + + /** + * 鎵归噺鍒犻櫎鎮h�呮。妗堟爣绛� + * + * @param ids 闇�瑕佸垹闄ょ殑鎮h�呮。妗堟爣绛句富閿� + * @return 缁撴灉 + */ + @Override + public int deletePatArchivetagByIds(Long[] ids) + { + return patArchivetagMapper.deletePatArchivetagByIds(ids); + } + + /** + * 鍒犻櫎鎮h�呮。妗堟爣绛句俊鎭� + * + * @param id 鎮h�呮。妗堟爣绛句富閿� + * @return 缁撴灉 + */ + @Override + public int deletePatArchivetagById(Long id) + { + return patArchivetagMapper.deletePatArchivetagById(id); + } +} diff --git a/smartor/src/main/resources/mapper/smartor/BaseTagMapper.xml b/smartor/src/main/resources/mapper/smartor/BaseTagMapper.xml new file mode 100644 index 0000000..f966209 --- /dev/null +++ b/smartor/src/main/resources/mapper/smartor/BaseTagMapper.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.smartor.mapper.BaseTagMapper"> + + <resultMap type="com.smartor.domain.BaseTag" id="BaseTagResult"> + <result property="tagid" column="tagid" /> + <result property="tagcategoryid" column="tagcategoryid" /> + <result property="tagname" column="tagname" /> + <result property="tagdescription" column="tagdescription" /> + <result property="orgid" column="orgid" /> + <result property="delFlag" column="del_flag" /> + <result property="updateBy" column="update_by" /> + <result property="updateTime" column="update_time" /> + <result property="createBy" column="create_by" /> + <result property="createTime" column="create_time" /> + <result property="isupload" column="isupload" /> + <result property="uploadTime" column="upload_time" /> + <result property="isenable" column="isenable" /> + </resultMap> + + <sql id="selectBaseTagVo"> + select tagid, tagcategoryid, tagname, tagdescription, orgid, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, isenable from base_tag + </sql> + + <select id="selectBaseTagList" parameterType="com.smartor.domain.BaseTag" resultMap="BaseTagResult"> + <include refid="selectBaseTagVo"/> + <where> + <if test="tagcategoryid != null "> and tagcategoryid = #{tagcategoryid}</if> + <if test="tagname != null and tagname != ''"> and tagname like concat('%', #{tagname}, '%')</if> + <if test="tagdescription != null and tagdescription != ''"> and tagdescription = #{tagdescription}</if> + <if test="orgid != null and orgid != ''"> and orgid = #{orgid}</if> + <if test="isupload != null "> and isupload = #{isupload}</if> + <if test="uploadTime != null "> and upload_time = #{uploadTime}</if> + <if test="isenable != null "> and isenable = #{isenable}</if> + </where> + </select> + + <select id="selectBaseTagByTagid" parameterType="Long" resultMap="BaseTagResult"> + <include refid="selectBaseTagVo"/> + where tagid = #{tagid} + </select> + + <insert id="insertBaseTag" parameterType="com.smartor.domain.BaseTag" useGeneratedKeys="true" keyProperty="tagid"> + insert into base_tag + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="tagcategoryid != null">tagcategoryid,</if> + <if test="tagname != null">tagname,</if> + <if test="tagdescription != null">tagdescription,</if> + <if test="orgid != null">orgid,</if> + <if test="delFlag != null and delFlag != ''">del_flag,</if> + <if test="updateBy != null">update_by,</if> + <if test="updateTime != null">update_time,</if> + <if test="createBy != null">create_by,</if> + <if test="createTime != null">create_time,</if> + <if test="isupload != null">isupload,</if> + <if test="uploadTime != null">upload_time,</if> + <if test="isenable != null">isenable,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="tagcategoryid != null">#{tagcategoryid},</if> + <if test="tagname != null">#{tagname},</if> + <if test="tagdescription != null">#{tagdescription},</if> + <if test="orgid != null">#{orgid},</if> + <if test="delFlag != null and delFlag != ''">#{delFlag},</if> + <if test="updateBy != null">#{updateBy},</if> + <if test="updateTime != null">#{updateTime},</if> + <if test="createBy != null">#{createBy},</if> + <if test="createTime != null">#{createTime},</if> + <if test="isupload != null">#{isupload},</if> + <if test="uploadTime != null">#{uploadTime},</if> + <if test="isenable != null">#{isenable},</if> + </trim> + </insert> + + <update id="updateBaseTag" parameterType="com.smartor.domain.BaseTag"> + update base_tag + <trim prefix="SET" suffixOverrides=","> + <if test="tagcategoryid != null">tagcategoryid = #{tagcategoryid},</if> + <if test="tagname != null">tagname = #{tagname},</if> + <if test="tagdescription != null">tagdescription = #{tagdescription},</if> + <if test="orgid != null">orgid = #{orgid},</if> + <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> + <if test="updateBy != null">update_by = #{updateBy},</if> + <if test="updateTime != null">update_time = #{updateTime},</if> + <if test="createBy != null">create_by = #{createBy},</if> + <if test="createTime != null">create_time = #{createTime},</if> + <if test="isupload != null">isupload = #{isupload},</if> + <if test="uploadTime != null">upload_time = #{uploadTime},</if> + <if test="isenable != null">isenable = #{isenable},</if> + </trim> + where tagid = #{tagid} + </update> + + <delete id="deleteBaseTagByTagid" parameterType="Long"> + delete from base_tag where tagid = #{tagid} + </delete> + + <delete id="deleteBaseTagByTagids" parameterType="String"> + delete from base_tag where tagid in + <foreach item="tagid" collection="array" open="(" separator="," close=")"> + #{tagid} + </foreach> + </delete> +</mapper> \ No newline at end of file diff --git a/smartor/src/main/resources/mapper/smartor/PatArchivetagMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchivetagMapper.xml new file mode 100644 index 0000000..b417d17 --- /dev/null +++ b/smartor/src/main/resources/mapper/smartor/PatArchivetagMapper.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.smartor.mapper.PatArchivetagMapper"> + + <resultMap type="com.smartor.domain.PatArchivetag" id="PatArchivetagResult"> + <result property="id" column="id"/> + <result property="tagcategoryid" column="tagcategoryid"/> + <result property="tagid" column="tagid"/> + <result property="orgid" column="orgid"/> + <result property="delFlag" column="del_flag"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="isupload" column="isupload"/> + <result property="uploadTime" column="upload_time"/> + <result property="patid" column="patid"/> + </resultMap> + + <sql id="selectPatArchivetagVo"> + select id, + tagcategoryid, + tagid, + orgid, + del_flag, + update_by, + update_time, + create_by, + create_time, + isupload, + upload_time, + patid + from pat_archivetag + </sql> + + <select id="selectPatArchivetagList" parameterType="com.smartor.domain.PatArchivetag" + resultMap="PatArchivetagResult"> + <include refid="selectPatArchivetagVo"/> + <where> + <if test="tagcategoryid != null ">and tagcategoryid = #{tagcategoryid}</if> + <if test="tagid != null ">and tagid = #{tagid}</if> + <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> + <if test="isupload != null ">and isupload = #{isupload}</if> + <if test="uploadTime != null ">and upload_time = #{uploadTime}</if> + <if test="patid != null ">and patid = #{patid}</if> + </where> + </select> + + <select id="selectPatArchivetagById" parameterType="Long" resultMap="PatArchivetagResult"> + <include refid="selectPatArchivetagVo"/> + where id = #{id} + </select> + + <insert id="insertPatArchivetag" parameterType="com.smartor.domain.PatArchivetag" useGeneratedKeys="true" + keyProperty="id"> + insert into pat_archivetag + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="tagcategoryid != null">tagcategoryid,</if> + <if test="tagid != null">tagid,</if> + <if test="orgid != null">orgid,</if> + <if test="delFlag != null and delFlag != ''">del_flag,</if> + <if test="updateBy != null">update_by,</if> + <if test="updateTime != null">update_time,</if> + <if test="createBy != null">create_by,</if> + <if test="createTime != null">create_time,</if> + <if test="isupload != null">isupload,</if> + <if test="uploadTime != null">upload_time,</if> + <if test="patid != null">patid,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="tagcategoryid != null">#{tagcategoryid},</if> + <if test="tagid != null">#{tagid},</if> + <if test="orgid != null">#{orgid},</if> + <if test="delFlag != null and delFlag != ''">#{delFlag},</if> + <if test="updateBy != null">#{updateBy},</if> + <if test="updateTime != null">#{updateTime},</if> + <if test="createBy != null">#{createBy},</if> + <if test="createTime != null">#{createTime},</if> + <if test="isupload != null">#{isupload},</if> + <if test="uploadTime != null">#{uploadTime},</if> + <if test="patid != null">#{patid},</if> + </trim> + </insert> + + <update id="updatePatArchivetag" parameterType="com.smartor.domain.PatArchivetag"> + update pat_archivetag + <trim prefix="SET" suffixOverrides=","> + <if test="tagcategoryid != null">tagcategoryid = #{tagcategoryid},</if> + <if test="tagid != null">tagid = #{tagid},</if> + <if test="orgid != null">orgid = #{orgid},</if> + <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> + <if test="updateBy != null">update_by = #{updateBy},</if> + <if test="updateTime != null">update_time = #{updateTime},</if> + <if test="createBy != null">create_by = #{createBy},</if> + <if test="createTime != null">create_time = #{createTime},</if> + <if test="isupload != null">isupload = #{isupload},</if> + <if test="uploadTime != null">upload_time = #{uploadTime},</if> + <if test="patid != null">patid = #{patid},</if> + </trim> + where id = #{id} + </update> + + <delete id="deletePatArchivetagById" parameterType="Long"> + delete + from pat_archivetag + where id = #{id} + </delete> + + <delete id="deletePatArchivetagByIds" parameterType="String"> + delete from pat_archivetag where id in + <foreach item="id" collection="array" open="(" separator="," close=")"> + #{id} + </foreach> + </delete> +</mapper> \ No newline at end of file -- Gitblit v1.9.3