From 2dc63e7cf7e5c7beded66eb862ae57a6e184394d Mon Sep 17 00:00:00 2001 From: ChaiNingQi <2032830459@qq.com> Date: Wed, 31 Dec 2025 15:26:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BD=E5=8C=BB=E4=BF=A1=E6=81=AF=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vet/VetPersonalInfoController.java | 123 ++++++ .../src/main/resources/application.yml | 3 + .../chenhai/vet/domain/VetPersonalInfo.java | 30 +- .../vet/mapper/VetPersonalInfoMapper.java | 1 + .../vet/service/IVetPersonalInfoService.java | 12 + .../impl/VetPersonalInfoServiceImpl.java | 97 +++++ .../mapper/vet/VetCertificateMapper.xml | 2 +- .../mapper/vet/VetPersonalInfoMapper.xml | 80 +++- .../mapper/vet/VetQualificationMapper.xml | 2 +- chenhai-ui/src/api/vet/certificate.js | 44 ++ chenhai-ui/src/api/vet/info.js | 44 ++ .../src/views/vet/certificate/index.vue | 393 ++++++++++++++++++ chenhai-ui/src/views/vet/info/index.vue | 371 +++++++++++++++++ 13 files changed, 1174 insertions(+), 28 deletions(-) create mode 100644 chenhai-ui/src/api/vet/certificate.js create mode 100644 chenhai-ui/src/api/vet/info.js create mode 100644 chenhai-ui/src/views/vet/certificate/index.vue create mode 100644 chenhai-ui/src/views/vet/info/index.vue diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java index b919ad8..5e1fdf0 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java @@ -7,6 +7,7 @@ import com.chenhai.common.core.page.TableDataInfo; import com.chenhai.common.enums.BusinessType; import com.chenhai.common.utils.poi.ExcelUtil; import com.chenhai.vet.domain.VetPersonalInfo; +import com.chenhai.vet.mapper.VetPersonalInfoMapper; import com.chenhai.vet.service.IVetPersonalInfoService; import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; @@ -14,6 +15,7 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; /** * 兽医个人信息Controller @@ -40,6 +42,126 @@ public class VetPersonalInfoController extends BaseController return getDataTable(list); } + /** + * 查询兽医个人信息列表(包含证书信息) + */ + @PreAuthorize("@ss.hasPermi('vet:info:list')") + @GetMapping("/listWithCertificates") + public TableDataInfo listWithCertificates(VetPersonalInfo vetPersonalInfo) { + startPage(); + List list = vetPersonalInfoService.selectVetPersonalInfoWithCertificates(vetPersonalInfo); + return getDataTable(list); + } + /** + * 导出兽医个人信息列表(包含证书信息) + */ + @PreAuthorize("@ss.hasPermi('vet:info:export')") + @Log(title = "兽医个人信息(含证书)", businessType = BusinessType.EXPORT) + @PostMapping("/exportWithCertificates") + public void exportWithCertificates(HttpServletResponse response, VetPersonalInfo vetPersonalInfo) { + List list = vetPersonalInfoService.selectVetPersonalInfoWithCertificates(vetPersonalInfo); + ExcelUtil util = new ExcelUtil(VetPersonalInfo.class); + util.exportExcel(response, list, "兽医个人信息及证书数据"); + } + + /** + * 获取兽医完整信息(包含证书详情) + */ + @PreAuthorize("@ss.hasPermi('vet:info:query')") + @GetMapping("/full/{id}") + public AjaxResult getFullInfo(@PathVariable("id") Long id) + { + Map fullInfo = vetPersonalInfoService.getVetFullInfo(id); + if (fullInfo == null || fullInfo.isEmpty()) { + return error("兽医信息不存在"); + } + return success(fullInfo); + } + + /** + * 根据用户ID获取兽医完整信息 + */ + @PreAuthorize("@ss.hasPermi('vet:info:query')") + @GetMapping("/full/byUserId/{userId}") + public AjaxResult getFullInfoByUserId(@PathVariable("userId") Long userId) + { + Map fullInfo = vetPersonalInfoService.getVetFullInfoByUserId(userId); + return success(fullInfo); + } + + /** + * 获取当前登录用户的兽医完整信息 + */ + @PreAuthorize("@ss.hasPermi('vet:info:query')") + @GetMapping("/full/current") + public AjaxResult getCurrentFullInfo() + { + // 获取当前登录用户的ID(需要根据您的权限系统实现) + Long userId = getCurrentUserId(); + if (userId == null) { + return error("用户未登录"); + } + + Map fullInfo = vetPersonalInfoService.getVetFullInfoByUserId(userId); + return success(fullInfo); + } + + /** + * 更新当前登录用户的兽医信息 + */ + @PreAuthorize("@ss.hasPermi('vet:info:edit')") + @Log(title = "兽医个人信息", businessType = BusinessType.UPDATE) + @PutMapping("/current") + public AjaxResult updateCurrent(@RequestBody VetPersonalInfo vetPersonalInfo) + { + // 获取当前登录用户ID + Long userId = getCurrentUserId(); + if (userId == null) { + return error("用户未登录"); + } + + // 设置当前用户ID + vetPersonalInfo.setUserId(userId); + + // 检查是否已存在记录 + VetPersonalInfo existing = getVetInfoByUserId(userId); + if (existing == null) { + // 不存在则新增 + return toAjax(vetPersonalInfoService.insertVetPersonalInfo(vetPersonalInfo)); + } else { + // 存在则更新 + vetPersonalInfo.setId(existing.getId()); + return toAjax(vetPersonalInfoService.updateVetPersonalInfo(vetPersonalInfo)); + } + } + + /** + * 根据用户ID获取兽医信息的辅助方法 + */ + private VetPersonalInfo getVetInfoByUserId(Long userId) { + VetPersonalInfo query = new VetPersonalInfo(); + query.setUserId(userId); + List list = vetPersonalInfoService.selectVetPersonalInfoList(query); + return list != null && !list.isEmpty() ? list.get(0) : null; + } + + /** + * 获取当前登录用户ID的辅助方法 + */ + private Long getCurrentUserId() { + // 这里需要根据您的权限系统获取当前登录用户的ID + // 示例实现(具体实现取决于您的权限框架) + /* + Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + if (principal instanceof UserDetails) { + // 根据您的用户信息获取userId + return ((UserDetails) principal).getUserId(); + } + */ + return 1L; // 临时返回1,用于测试 + } + + /** * 导出兽医个人信息列表 */ @@ -48,6 +170,7 @@ public class VetPersonalInfoController extends BaseController @PostMapping("/export") public void export(HttpServletResponse response, VetPersonalInfo vetPersonalInfo) { + List list = vetPersonalInfoService.selectVetPersonalInfoList(vetPersonalInfo); ExcelUtil util = new ExcelUtil(VetPersonalInfo.class); util.exportExcel(response, list, "兽医个人信息数据"); diff --git a/chenhai-admin/src/main/resources/application.yml b/chenhai-admin/src/main/resources/application.yml index 7a17ed1..1bffa1e 100644 --- a/chenhai-admin/src/main/resources/application.yml +++ b/chenhai-admin/src/main/resources/application.yml @@ -88,6 +88,9 @@ spring: max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms + web: + resources: + add-mappings: false # token配置 token: diff --git a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetPersonalInfo.java b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetPersonalInfo.java index 91592fa..4762684 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetPersonalInfo.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetPersonalInfo.java @@ -48,7 +48,7 @@ public class VetPersonalInfo extends BaseEntity /** 工作经验(年) */ @Excel(name = "工作经验", readConverterExp = "年=") - private Long workExperience; + private String workExperience; /** 所属医院 */ @Excel(name = "所属医院") @@ -62,6 +62,30 @@ public class VetPersonalInfo extends BaseEntity @Excel(name = "个人简介") private String introduction; + @Excel(name = "证书数量") + private Integer certCount; + + /** 证书名称列表(逗号分隔,用于关联查询) */ + @Excel(name = "证书名称列表") + private String certNames; + + // 添加getter和setter + public Integer getCertCount() { + return certCount; + } + + public void setCertCount(Integer certCount) { + this.certCount = certCount; + } + + public String getCertNames() { + return certNames; + } + + public void setCertNames(String certNames) { + this.certNames = certNames; + } + public void setId(Long id) { this.id = id; @@ -132,12 +156,12 @@ public class VetPersonalInfo extends BaseEntity return specialty; } - public void setWorkExperience(Long workExperience) + public void setWorkExperience(String workExperience) { this.workExperience = workExperience; } - public Long getWorkExperience() + public String getWorkExperience() { return workExperience; } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java index d687dd8..395e5df 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java @@ -59,4 +59,5 @@ public interface VetPersonalInfoMapper * @return 结果 */ public int deleteVetPersonalInfoByIds(Long[] ids); + public List selectWithCertificates(VetPersonalInfo vetPersonalInfo); } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java index 73962d1..36a4dee 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java @@ -3,6 +3,7 @@ package com.chenhai.vet.service; import com.chenhai.vet.domain.VetPersonalInfo; import java.util.List; +import java.util.Map; /** * 兽医个人信息Service接口 @@ -59,6 +60,17 @@ public interface IVetPersonalInfoService * @return 结果 */ public int deleteVetPersonalInfoById(Long id); + List selectVetPersonalInfoWithCertificates(VetPersonalInfo vetPersonalInfo); + + /** + * 获取兽医的完整信息(包含证书详情) + */ + Map getVetFullInfo(Long vetId); + + /** + * 根据用户ID获取兽医信息(包含证书) + */ + Map getVetFullInfoByUserId(Long userId); } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java index 568917b..6df677e 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java @@ -1,13 +1,18 @@ package com.chenhai.vet.service.impl; import com.chenhai.common.utils.DateUtils; +import com.chenhai.vet.domain.VetCertificate; import com.chenhai.vet.domain.VetPersonalInfo; import com.chenhai.vet.mapper.VetPersonalInfoMapper; +import com.chenhai.vet.mapper.VetCertificateMapper; import com.chenhai.vet.service.IVetPersonalInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 兽医个人信息Service业务层处理 @@ -20,6 +25,8 @@ public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService { @Autowired private VetPersonalInfoMapper vetPersonalInfoMapper; + @Autowired + private VetCertificateMapper vetCertificateMapper; /** * 查询兽医个人信息 @@ -95,5 +102,95 @@ public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService return vetPersonalInfoMapper.deleteVetPersonalInfoById(id); } + @Override + public List selectVetPersonalInfoWithCertificates(VetPersonalInfo vetPersonalInfo) { + return vetPersonalInfoMapper.selectWithCertificates(vetPersonalInfo); + } + + /** + * 获取兽医的完整信息(包含证书详情) + */ + @Override + public Map getVetFullInfo(Long vetId) { + Map result = new HashMap<>(); + + // 1. 获取兽医个人信息 + VetPersonalInfo personalInfo = vetPersonalInfoMapper.selectVetPersonalInfoById(vetId); + if (personalInfo == null) { + return result; + } + result.put("personalInfo", personalInfo); + + // 2. 获取证书列表 + VetCertificate certificateQuery = new VetCertificate(); + certificateQuery.setUserId(personalInfo.getUserId()); + List certificates = vetCertificateMapper.selectVetCertificateList(certificateQuery); + result.put("certificates", certificates); + + // 3. 证书统计信息 + if (certificates != null && !certificates.isEmpty()) { + result.put("certificateCount", certificates.size()); + result.put("certificateNames", certificates.stream() + .map(VetCertificate::getCertName) + .collect(Collectors.joining(", "))); + + // 按状态统计 + long validCount = certificates.stream().filter(cert -> "0".equals(cert.getStatus())).count(); + long expiringCount = certificates.stream().filter(cert -> "1".equals(cert.getStatus())).count(); + long expiredCount = certificates.stream().filter(cert -> "2".equals(cert.getStatus())).count(); + + Map statusStats = new HashMap<>(); + statusStats.put("valid", validCount); + statusStats.put("expiring", expiringCount); + statusStats.put("expired", expiredCount); + result.put("statusStats", statusStats); + } else { + result.put("certificateCount", 0); + result.put("certificateNames", ""); + } + + return result; + } + /** + * 根据用户ID获取兽医信息(包含证书) + */ + @Override + public Map getVetFullInfoByUserId(Long userId) { + Map result = new HashMap<>(); + + // 根据user_id查询兽医信息 + VetPersonalInfo query = new VetPersonalInfo(); + query.setUserId(userId); + List personalInfos = vetPersonalInfoMapper.selectVetPersonalInfoList(query); + + if (personalInfos == null || personalInfos.isEmpty()) { + return result; + } + + VetPersonalInfo personalInfo = personalInfos.get(0); + result.put("personalInfo", personalInfo); + + // 获取证书列表 + VetCertificate certificateQuery = new VetCertificate(); + certificateQuery.setUserId(userId); + List certificates = vetCertificateMapper.selectVetCertificateList(certificateQuery); + result.put("certificates", certificates); + + // 证书统计信息 + if (certificates != null && !certificates.isEmpty()) { + result.put("certificateCount", certificates.size()); + result.put("certificateNames", certificates.stream() + .map(VetCertificate::getCertName) + .collect(Collectors.joining(", "))); + } else { + result.put("certificateCount", 0); + result.put("certificateNames", ""); + } + + return result; + } } + + + diff --git a/chenhai-system/src/main/resources/mapper/vet/VetCertificateMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetCertificateMapper.xml index eb0d1e7..9e72876 100644 --- a/chenhai-system/src/main/resources/mapper/vet/VetCertificateMapper.xml +++ b/chenhai-system/src/main/resources/mapper/vet/VetCertificateMapper.xml @@ -2,7 +2,7 @@ - + diff --git a/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml index d908c95..e175c5f 100644 --- a/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml +++ b/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml @@ -1,9 +1,9 @@ - - + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + @@ -20,33 +20,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select id, user_id, real_name, gender, birthday, id_card, specialty, work_experience, hospital, address, introduction, create_by, create_time, update_by, update_time from vet_personal_info + select id, user_id, real_name, gender, birthday, id_card, specialty, work_experience, hospital, address, introduction, create_by, create_time, update_by, update_time + from vet_personal_info - + + + + insert into vet_personal_info @@ -64,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, update_by, update_time, - + #{userId}, #{realName}, @@ -80,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{updateBy}, #{updateTime}, - + @@ -96,8 +132,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" hospital = #{hospital}, address = #{address}, introduction = #{introduction}, - create_by = #{createBy}, - create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, @@ -108,8 +142,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from vet_personal_info where id = #{id} - - delete from vet_personal_info where id in + + delete from vet_personal_info where id in #{id} diff --git a/chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml index 406c392..2e623fb 100644 --- a/chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml +++ b/chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml @@ -2,7 +2,7 @@ - + diff --git a/chenhai-ui/src/api/vet/certificate.js b/chenhai-ui/src/api/vet/certificate.js new file mode 100644 index 0000000..1d6e7f4 --- /dev/null +++ b/chenhai-ui/src/api/vet/certificate.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询兽医执业证书列表 +export function listCertificate(query) { + return request({ + url: '/vet/certificate/list', + method: 'get', + params: query + }) +} + +// 查询兽医执业证书详细 +export function getCertificate(id) { + return request({ + url: '/vet/certificate/' + id, + method: 'get' + }) +} + +// 新增兽医执业证书 +export function addCertificate(data) { + return request({ + url: '/vet/certificate', + method: 'post', + data: data + }) +} + +// 修改兽医执业证书 +export function updateCertificate(data) { + return request({ + url: '/vet/certificate', + method: 'put', + data: data + }) +} + +// 删除兽医执业证书 +export function delCertificate(id) { + return request({ + url: '/vet/certificate/' + id, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/api/vet/info.js b/chenhai-ui/src/api/vet/info.js new file mode 100644 index 0000000..e2d9d76 --- /dev/null +++ b/chenhai-ui/src/api/vet/info.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询兽医个人信息列表 +export function listInfo(query) { + return request({ + url: '/vet/info/list', + method: 'get', + params: query + }) +} + +// 查询兽医个人信息详细 +export function getInfo(id) { + return request({ + url: '/vet/info/' + id, + method: 'get' + }) +} + +// 新增兽医个人信息 +export function addInfo(data) { + return request({ + url: '/vet/info', + method: 'post', + data: data + }) +} + +// 修改兽医个人信息 +export function updateInfo(data) { + return request({ + url: '/vet/info', + method: 'put', + data: data + }) +} + +// 删除兽医个人信息 +export function delInfo(id) { + return request({ + url: '/vet/info/' + id, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/views/vet/certificate/index.vue b/chenhai-ui/src/views/vet/certificate/index.vue new file mode 100644 index 0000000..72e7482 --- /dev/null +++ b/chenhai-ui/src/views/vet/certificate/index.vue @@ -0,0 +1,393 @@ + + + diff --git a/chenhai-ui/src/views/vet/info/index.vue b/chenhai-ui/src/views/vet/info/index.vue new file mode 100644 index 0000000..f5454c7 --- /dev/null +++ b/chenhai-ui/src/views/vet/info/index.vue @@ -0,0 +1,371 @@ + + +