From 8f17edbe9290fe22909db00b4358471d911a5522 Mon Sep 17 00:00:00 2001 From: maotiantian Date: Thu, 15 Jan 2026 11:59:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=85=BD=E5=8C=BB=EF=BC=8C=E9=97=AE?= =?UTF-8?q?=E4=B8=93=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../muhu/MuhuConsultationFormsController.java | 104 ++++ .../SysExpertConsultationController.java | 104 ++++ .../controller/vet/VetCommentsController.java | 104 ++++ .../controller/vet/VetExpertsController.java | 104 ++++ .../vet/VetPersonalInfoController.java | 204 +++++--- .../muhu/domain/MuhuConsultationForms.java | 268 ++++++++++ .../mapper/MuhuConsultationFormsMapper.java | 61 +++ .../IMuhuConsultationFormsService.java | 61 +++ .../MuhuConsultationFormsServiceImpl.java | 237 +++++++++ .../system/domain/SysExpertConsultation.java | 299 ++++++++++++ .../mapper/SysExpertConsultationMapper.java | 61 +++ .../ISysExpertConsultationService.java | 61 +++ .../SysExpertConsultationServiceImpl.java | 93 ++++ .../service/impl/SysUserServiceImpl.java | 1 + .../com/chenhai/vet/domain/VetComments.java | 230 +++++++++ .../com/chenhai/vet/domain/VetExperts.java | 279 +++++++++++ .../chenhai/vet/domain/VetPersonalInfo.java | 103 +++- .../chenhai/vet/mapper/VetCommentsMapper.java | 70 +++ .../chenhai/vet/mapper/VetExpertsMapper.java | 62 +++ .../vet/service/IVetCommentsService.java | 61 +++ .../vet/service/IVetExpertsService.java | 61 +++ .../service/impl/VetCommentsServiceImpl.java | 450 +++++++++++++++++ .../service/impl/VetExpertsServiceImpl.java | 458 +++++++++++++++++ .../impl/VetPersonalInfoServiceImpl.java | 307 +++++++++--- .../muhu/MuhuConsultationFormsMapper.xml | 134 +++++ .../system/SysExpertConsultationMapper.xml | 136 ++++++ .../resources/mapper/system/SysUserMapper.xml | 234 ++++----- .../mapper/vet/VetCommentsMapper.xml | 143 ++++++ .../resources/mapper/vet/VetExpertsMapper.xml | 132 +++++ .../mapper/vet/VetPersonalInfoMapper.xml | 218 +++++---- chenhai-ui/src/api/muhu/consultation.js | 44 ++ chenhai-ui/src/api/system/consultation.js | 44 ++ chenhai-ui/src/api/vet/comments.js | 8 +- chenhai-ui/src/api/vet/experts.js | 44 ++ .../src/views/muhu/consultation/index.vue | 367 ++++++++++++++ .../src/views/system/consultation/index.vue | 460 ++++++++++++++++++ .../views/system/user/profile/userInfo.vue | 14 +- chenhai-ui/src/views/vet/comments/index.vue | 285 +++++++++++ chenhai-ui/src/views/vet/experts/index.vue | 317 ++++++++++++ chenhai-ui/src/views/vet/info/index.vue | 38 +- 40 files changed, 6075 insertions(+), 386 deletions(-) create mode 100644 chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuConsultationFormsController.java create mode 100644 chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysExpertConsultationController.java create mode 100644 chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCommentsController.java create mode 100644 chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExpertsController.java create mode 100644 chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuConsultationForms.java create mode 100644 chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuConsultationFormsMapper.java create mode 100644 chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuConsultationFormsService.java create mode 100644 chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuConsultationFormsServiceImpl.java create mode 100644 chenhai-system/src/main/java/com/chenhai/system/domain/SysExpertConsultation.java create mode 100644 chenhai-system/src/main/java/com/chenhai/system/mapper/SysExpertConsultationMapper.java create mode 100644 chenhai-system/src/main/java/com/chenhai/system/service/ISysExpertConsultationService.java create mode 100644 chenhai-system/src/main/java/com/chenhai/system/service/impl/SysExpertConsultationServiceImpl.java create mode 100644 chenhai-system/src/main/java/com/chenhai/vet/domain/VetComments.java create mode 100644 chenhai-system/src/main/java/com/chenhai/vet/domain/VetExperts.java create mode 100644 chenhai-system/src/main/java/com/chenhai/vet/mapper/VetCommentsMapper.java create mode 100644 chenhai-system/src/main/java/com/chenhai/vet/mapper/VetExpertsMapper.java create mode 100644 chenhai-system/src/main/java/com/chenhai/vet/service/IVetCommentsService.java create mode 100644 chenhai-system/src/main/java/com/chenhai/vet/service/IVetExpertsService.java create mode 100644 chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetCommentsServiceImpl.java create mode 100644 chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetExpertsServiceImpl.java create mode 100644 chenhai-system/src/main/resources/mapper/muhu/MuhuConsultationFormsMapper.xml create mode 100644 chenhai-system/src/main/resources/mapper/system/SysExpertConsultationMapper.xml create mode 100644 chenhai-system/src/main/resources/mapper/vet/VetCommentsMapper.xml create mode 100644 chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml create mode 100644 chenhai-ui/src/api/muhu/consultation.js create mode 100644 chenhai-ui/src/api/system/consultation.js create mode 100644 chenhai-ui/src/api/vet/experts.js create mode 100644 chenhai-ui/src/views/muhu/consultation/index.vue create mode 100644 chenhai-ui/src/views/system/consultation/index.vue create mode 100644 chenhai-ui/src/views/vet/comments/index.vue create mode 100644 chenhai-ui/src/views/vet/experts/index.vue diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuConsultationFormsController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuConsultationFormsController.java new file mode 100644 index 0000000..9256d78 --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuConsultationFormsController.java @@ -0,0 +1,104 @@ +package com.chenhai.web.controller.muhu; + +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; +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.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.muhu.domain.MuhuConsultationForms; +import com.chenhai.muhu.service.IMuhuConsultationFormsService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; + +/** + * 问诊单Controller + * + * @author ruoyi + * @date 2026-01-07 + */ +@RestController +@RequestMapping("/muhu/consultation") +public class MuhuConsultationFormsController extends BaseController +{ + @Autowired + private IMuhuConsultationFormsService muhuConsultationFormsService; + + /** + * 查询问诊单列表 + */ + @PreAuthorize("@ss.hasPermi('muhu:consultation:list') or @ss.hasRole('muhu')") + @GetMapping("/list") + public TableDataInfo list(MuhuConsultationForms muhuConsultationForms) + { + startPage(); + List list = muhuConsultationFormsService.selectMuhuConsultationFormsList(muhuConsultationForms); + return getDataTable(list); + } + + /** + * 导出问诊单列表 + */ + @PreAuthorize("@ss.hasPermi('muhu:consultation:export') or @ss.hasRole('muhu')") + @Log(title = "问诊单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MuhuConsultationForms muhuConsultationForms) + { + List list = muhuConsultationFormsService.selectMuhuConsultationFormsList(muhuConsultationForms); + ExcelUtil util = new ExcelUtil(MuhuConsultationForms.class); + util.exportExcel(response, list, "问诊单数据"); + } + + /** + * 获取问诊单详细信息 + */ + @PreAuthorize("@ss.hasPermi('muhu:consultation:query') or @ss.hasRole('muhu')") + @GetMapping(value = "/{formId}") + public AjaxResult getInfo(@PathVariable("formId") Long formId) + { + return success(muhuConsultationFormsService.selectMuhuConsultationFormsByFormId(formId)); + } + + /** + * 新增问诊单 + */ + @PreAuthorize("@ss.hasPermi('muhu:consultation:add') or @ss.hasRole('muhu')") + @Log(title = "问诊单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MuhuConsultationForms muhuConsultationForms) + { + return toAjax(muhuConsultationFormsService.insertMuhuConsultationForms(muhuConsultationForms)); + } + + /** + * 修改问诊单 + */ + @PreAuthorize("@ss.hasPermi('muhu:consultation:edit') or @ss.hasRole('muhu')") + @Log(title = "问诊单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MuhuConsultationForms muhuConsultationForms) + { + return toAjax(muhuConsultationFormsService.updateMuhuConsultationForms(muhuConsultationForms)); + } + + /** + * 删除问诊单 + */ + @PreAuthorize("@ss.hasPermi('muhu:consultation:remove') or @ss.hasRole('muhu')") + @Log(title = "问诊单", businessType = BusinessType.DELETE) + @DeleteMapping("/{formIds}") + public AjaxResult remove(@PathVariable Long[] formIds) + { + return toAjax(muhuConsultationFormsService.deleteMuhuConsultationFormsByFormIds(formIds)); + } +} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysExpertConsultationController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysExpertConsultationController.java new file mode 100644 index 0000000..2dc18d4 --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysExpertConsultationController.java @@ -0,0 +1,104 @@ +package com.chenhai.web.controller.system; + +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; +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.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.system.domain.SysExpertConsultation; +import com.chenhai.system.service.ISysExpertConsultationService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; + +/** + * 专家咨询Controller + * + * @author ruoyi + * @date 2026-01-12 + */ +@RestController +@RequestMapping("/system/consultation") +public class SysExpertConsultationController extends BaseController +{ + @Autowired + private ISysExpertConsultationService sysExpertConsultationService; + + /** + * 查询专家咨询列表 + */ + @PreAuthorize("@ss.hasPermi('system:consultation:list')") + @GetMapping("/list") + public TableDataInfo list(SysExpertConsultation sysExpertConsultation) + { + startPage(); + List list = sysExpertConsultationService.selectSysExpertConsultationList(sysExpertConsultation); + return getDataTable(list); + } + + /** + * 导出专家咨询列表 + */ + @PreAuthorize("@ss.hasPermi('system:consultation:export')") + @Log(title = "专家咨询", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysExpertConsultation sysExpertConsultation) + { + List list = sysExpertConsultationService.selectSysExpertConsultationList(sysExpertConsultation); + ExcelUtil util = new ExcelUtil(SysExpertConsultation.class); + util.exportExcel(response, list, "专家咨询数据"); + } + + /** + * 获取专家咨询详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:consultation:query')") + @GetMapping(value = "/{consultationId}") + public AjaxResult getInfo(@PathVariable("consultationId") Long consultationId) + { + return success(sysExpertConsultationService.selectSysExpertConsultationByConsultationId(consultationId)); + } + + /** + * 新增专家咨询 + */ + @PreAuthorize("@ss.hasPermi('system:consultation:add')") + @Log(title = "专家咨询", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysExpertConsultation sysExpertConsultation) + { + return toAjax(sysExpertConsultationService.insertSysExpertConsultation(sysExpertConsultation)); + } + + /** + * 修改专家咨询 + */ + @PreAuthorize("@ss.hasPermi('system:consultation:edit')") + @Log(title = "专家咨询", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysExpertConsultation sysExpertConsultation) + { + return toAjax(sysExpertConsultationService.updateSysExpertConsultation(sysExpertConsultation)); + } + + /** + * 删除专家咨询 + */ + @PreAuthorize("@ss.hasPermi('system:consultation:remove')") + @Log(title = "专家咨询", businessType = BusinessType.DELETE) + @DeleteMapping("/{consultationIds}") + public AjaxResult remove(@PathVariable Long[] consultationIds) + { + return toAjax(sysExpertConsultationService.deleteSysExpertConsultationByConsultationIds(consultationIds)); + } +} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCommentsController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCommentsController.java new file mode 100644 index 0000000..8c59456 --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCommentsController.java @@ -0,0 +1,104 @@ +package com.chenhai.web.controller.vet; + +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; +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.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.vet.domain.VetComments; +import com.chenhai.vet.service.IVetCommentsService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; + +/** + * 兽医回复Controller + * + * @author ruoyi + * @date 2026-01-07 + */ +@RestController +@RequestMapping("/vet/comments") +public class VetCommentsController extends BaseController +{ + @Autowired + private IVetCommentsService vetCommentsService; + + /** + * 查询兽医回复列表 + */ + @PreAuthorize("@ss.hasPermi('vet:comments:list') or @ss.hasRole('vetnotshenhe')") + @GetMapping("/list") + public TableDataInfo list(VetComments vetComments) + { + startPage(); + List list = vetCommentsService.selectVetCommentsList(vetComments); + return getDataTable(list); + } + + /** + * 导出兽医回复列表 + */ + @PreAuthorize("@ss.hasPermi('vet:comments:export') or @ss.hasRole('vetnotshenhe')") + @Log(title = "兽医回复", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, VetComments vetComments) + { + List list = vetCommentsService.selectVetCommentsList(vetComments); + ExcelUtil util = new ExcelUtil(VetComments.class); + util.exportExcel(response, list, "兽医回复数据"); + } + + /** + * 获取兽医回复详细信息 + */ + @PreAuthorize("@ss.hasPermi('vet:comments:query') or @ss.hasRole('vetnotshenhe')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(vetCommentsService.selectVetCommentsById(id)); + } + + /** + * 新增兽医回复 + */ + @PreAuthorize("@ss.hasPermi('vet:comments:add') or @ss.hasRole('vetnotshenhe')") + @Log(title = "兽医回复", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody VetComments vetComments) + { + return toAjax(vetCommentsService.insertVetComments(vetComments)); + } + + /** + * 修改兽医回复 + */ + @PreAuthorize("@ss.hasPermi('vet:comments:edit') or @ss.hasRole('vetnotshenhe')") + @Log(title = "兽医回复", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody VetComments vetComments) + { + return toAjax(vetCommentsService.updateVetComments(vetComments)); + } + + /** + * 删除兽医回复 + */ + @PreAuthorize("@ss.hasPermi('vet:comments:remove') or @ss.hasRole('vetnotshenhe')") + @Log(title = "兽医回复", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(vetCommentsService.deleteVetCommentsByIds(ids)); + } +} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExpertsController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExpertsController.java new file mode 100644 index 0000000..91553df --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExpertsController.java @@ -0,0 +1,104 @@ +package com.chenhai.web.controller.vet; + +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; +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.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.vet.domain.VetExperts; +import com.chenhai.vet.service.IVetExpertsService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; + +/** + * 专家信息Controller + * + * @author ruoyi + * @date 2026-01-08 + */ +@RestController +@RequestMapping("/vet/experts") +public class VetExpertsController extends BaseController +{ + @Autowired + private IVetExpertsService vetExpertsService; + + /** + * 查询专家信息列表 + */ + @PreAuthorize("@ss.hasPermi('vet:experts:list') or @ss.hasRole('muhu')") + @GetMapping("/list") + public TableDataInfo list(VetExperts vetExperts) + { + startPage(); + List list = vetExpertsService.selectVetExpertsList(vetExperts); + return getDataTable(list); + } + + /** + * 导出专家信息列表 + */ + @PreAuthorize("@ss.hasPermi('vet:experts:export') or @ss.hasRole('muhu')") + @Log(title = "专家信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, VetExperts vetExperts) + { + List list = vetExpertsService.selectVetExpertsList(vetExperts); + ExcelUtil util = new ExcelUtil(VetExperts.class); + util.exportExcel(response, list, "专家信息数据"); + } + + /** + * 获取专家信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('vet:experts:query') or @ss.hasRole('muhu')") + @GetMapping(value = "/{expertId}") + public AjaxResult getInfo(@PathVariable("expertId") Long expertId) + { + return success(vetExpertsService.selectVetExpertsByExpertId(expertId)); + } + + /** + * 新增专家信息 + */ + @PreAuthorize("@ss.hasPermi('vet:experts:add') or @ss.hasRole('muhu')") + @Log(title = "专家信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody VetExperts vetExperts) + { + return toAjax(vetExpertsService.insertVetExperts(vetExperts)); + } + + /** + * 修改专家信息 + */ + @PreAuthorize("@ss.hasPermi('vet:experts:edit') or @ss.hasRole('muhu')") + @Log(title = "专家信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody VetExperts vetExperts) + { + return toAjax(vetExpertsService.updateVetExperts(vetExperts)); + } + + /** + * 删除专家信息 + */ + @PreAuthorize("@ss.hasPermi('vet:experts:remove') or @ss.hasRole('muhu')") + @Log(title = "专家信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{expertIds}") + public AjaxResult remove(@PathVariable Long[] expertIds) + { + return toAjax(vetExpertsService.deleteVetExpertsByExpertIds(expertIds)); + } +} 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 015e999..e8d6ca9 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 @@ -1,35 +1,27 @@ package com.chenhai.web.controller.vet; -import java.lang.reflect.Method; -import java.util.List; - -import com.chenhai.common.core.domain.model.LoginUser; -import com.chenhai.common.utils.SecurityUtils; -import jakarta.servlet.http.HttpServletResponse; -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.chenhai.common.annotation.Log; import com.chenhai.common.core.controller.BaseController; import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.core.domain.model.LoginUser; +import com.chenhai.common.core.page.TableDataInfo; import com.chenhai.common.enums.BusinessType; +import com.chenhai.common.utils.SecurityUtils; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.system.service.ISysUserService; import com.chenhai.vet.domain.VetPersonalInfo; -import com.chenhai.vet.mapper.VetPersonalInfoMapper; import com.chenhai.vet.service.IVetPersonalInfoService; -import com.chenhai.common.utils.poi.ExcelUtil; -import com.chenhai.common.core.page.TableDataInfo; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; import java.util.Map; /** * 兽医个人信息Controller - * + * * @author ruoyi * @date 2025-12-31 */ @@ -39,16 +31,24 @@ public class VetPersonalInfoController extends BaseController { @Autowired private IVetPersonalInfoService vetPersonalInfoService; + + @Autowired + private ISysUserService userService; + /** - * 获取当前登录用户ID的辅助方法 + * 获取当前登录用户ID */ private Long getCurrentUserId() { - // 若依框架获取当前登录用户ID的方法 LoginUser loginUser = SecurityUtils.getLoginUser(); - if (loginUser != null) { - return loginUser.getUserId(); - } - return null; + return loginUser != null ? loginUser.getUserId() : null; + } + + /** + * 获取当前登录用户名 + */ + private String getCurrentUsername() { + LoginUser loginUser = SecurityUtils.getLoginUser(); + return loginUser != null ? loginUser.getUsername() : null; } /** @@ -63,7 +63,6 @@ public class VetPersonalInfoController extends BaseController return currentUserId != null && currentUserId.equals(userId); } - /** * 查询兽医个人信息列表 */ @@ -73,6 +72,7 @@ public class VetPersonalInfoController extends BaseController { Long currentUserId = getCurrentUserId(); + // 普通用户只能查看自己的信息 if (!SecurityUtils.isAdmin(currentUserId)) { vetPersonalInfo.setUserId(currentUserId); } @@ -82,14 +82,23 @@ public class VetPersonalInfoController extends BaseController return getDataTable(list); } - /** - * 获取兽医完整信息(包含证书详情) + * 获取兽医完整信息(包含证书详情和用户信息) */ @PreAuthorize("@ss.hasPermi('vet:info:view')") @GetMapping("/full/{id}") public AjaxResult getFullInfo(@PathVariable("id") Long id) { + // 权限验证:检查是否有权查看 + VetPersonalInfo info = vetPersonalInfoService.selectVetPersonalInfoById(id); + if (info == null) { + return error("兽医信息不存在"); + } + + if (!canAccessUserId(info.getUserId())) { + return error("无权查看他人信息"); + } + Map fullInfo = vetPersonalInfoService.getVetFullInfo(id); if (fullInfo == null || fullInfo.isEmpty()) { return error("兽医信息不存在"); @@ -104,6 +113,11 @@ public class VetPersonalInfoController extends BaseController @GetMapping("/full/byUserId/{userId}") public AjaxResult getFullInfoByUserId(@PathVariable("userId") Long userId) { + // 权限验证 + if (!canAccessUserId(userId)) { + return error("无权查看他人信息"); + } + Map fullInfo = vetPersonalInfoService.getVetFullInfoByUserId(userId); return success(fullInfo); } @@ -115,7 +129,6 @@ public class VetPersonalInfoController extends BaseController @GetMapping("/full/current") public AjaxResult getCurrentFullInfo() { - // 获取当前登录用户的ID(需要根据您的权限系统实现) Long userId = getCurrentUserId(); if (userId == null) { return error("用户未登录"); @@ -133,7 +146,6 @@ public class VetPersonalInfoController extends BaseController @PutMapping("/current") public AjaxResult updateCurrent(@RequestBody VetPersonalInfo vetPersonalInfo) { - // 获取当前登录用户ID Long userId = getCurrentUserId(); if (userId == null) { return error("用户未登录"); @@ -143,9 +155,10 @@ public class VetPersonalInfoController extends BaseController vetPersonalInfo.setUserId(userId); // 检查是否已存在记录 - VetPersonalInfo existing = getVetInfoByUserId(userId); + VetPersonalInfo existing = vetPersonalInfoService.selectVetPersonalInfoByUserId(userId); if (existing == null) { // 不存在则新增 + vetPersonalInfo.setCreateBy(getCurrentUsername()); return toAjax(vetPersonalInfoService.insertVetPersonalInfo(vetPersonalInfo)); } else { // 存在则更新 @@ -155,39 +168,42 @@ public class VetPersonalInfoController extends BaseController } /** - * 根据用户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; - } - - - - /** - * 导出兽医个人信息列表 - */ - @PreAuthorize("@ss.hasPermi('vet:info:export')") - @Log(title = "兽医个人信息", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, VetPersonalInfo vetPersonalInfo) + @PreAuthorize("@ss.hasPermi('vet:info:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + VetPersonalInfo info = vetPersonalInfoService.selectVetPersonalInfoById(id); + if (info == null) { + return error("兽医信息不存在"); + } - List list = vetPersonalInfoService.selectVetPersonalInfoList(vetPersonalInfo); - ExcelUtil util = new ExcelUtil(VetPersonalInfo.class); - util.exportExcel(response, list, "兽医个人信息数据"); + // 权限验证 + if (!canAccessUserId(info.getUserId())) { + return error("无权查看他人信息"); + } + + return success(info); } /** - * 获取兽医个人信息详细信息 + * 根据用户ID获取兽医信息 */ @PreAuthorize("@ss.hasPermi('vet:info:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) + @GetMapping(value = "/byUserId/{userId}") + public AjaxResult getInfoByUserId(@PathVariable("userId") Long userId) { - return success(vetPersonalInfoService.selectVetPersonalInfoById(id)); + // 权限验证 + if (!canAccessUserId(userId)) { + return error("无权查看他人信息"); + } + + VetPersonalInfo info = vetPersonalInfoService.selectVetPersonalInfoByUserId(userId); + if (info == null) { + return error("该用户没有兽医信息"); + } + return success(info); } /** @@ -212,23 +228,7 @@ public class VetPersonalInfoController extends BaseController // 自动设置用户ID和创建者 vetPersonalInfo.setUserId(currentUserId); - vetPersonalInfo.setCreateBy(getUsername()); - - // 自动设置兽医ID(如果有) -/* - */ -/* Long currentVetId = getCurrentVetId();*//* - - if (currentVetId != null) { - // 如果实体类有vetUserId字段 - try { - Method setVetUserId = vetPersonalInfo.getClass().getMethod("setVetUserId", Long.class); - setVetUserId.invoke(vetPersonalInfo, currentVetId); - } catch (Exception e) { - // 如果实体类没有vetUserId字段,忽略 - } - } -*/ + vetPersonalInfo.setCreateBy(getCurrentUsername()); return toAjax(vetPersonalInfoService.insertVetPersonalInfo(vetPersonalInfo)); } @@ -241,6 +241,14 @@ public class VetPersonalInfoController extends BaseController @PutMapping public AjaxResult edit(@RequestBody VetPersonalInfo vetPersonalInfo) { + // 权限验证:先查询原有信息 + if (vetPersonalInfo.getId() != null) { + VetPersonalInfo existing = vetPersonalInfoService.selectVetPersonalInfoById(vetPersonalInfo.getId()); + if (existing != null && !canAccessUserId(existing.getUserId())) { + return error("无权修改他人信息"); + } + } + return toAjax(vetPersonalInfoService.updateVetPersonalInfo(vetPersonalInfo)); } @@ -249,9 +257,55 @@ public class VetPersonalInfoController extends BaseController */ @PreAuthorize("@ss.hasPermi('vet:info:remove')") @Log(title = "兽医个人信息", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") + @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { + // 权限验证:检查是否有权删除这些记录 + for (Long id : ids) { + VetPersonalInfo info = vetPersonalInfoService.selectVetPersonalInfoById(id); + if (info != null && !canAccessUserId(info.getUserId())) { + return error("无权删除他人信息"); + } + } + return toAjax(vetPersonalInfoService.deleteVetPersonalInfoByIds(ids)); } -} + + /** + * 导出兽医个人信息列表 + */ + @PreAuthorize("@ss.hasPermi('vet:info:export')") + @Log(title = "兽医个人信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, VetPersonalInfo vetPersonalInfo) + { + // 普通用户只能导出自己的信息 + Long currentUserId = getCurrentUserId(); + if (!SecurityUtils.isAdmin(currentUserId)) { + vetPersonalInfo.setUserId(currentUserId); + } + + List list = vetPersonalInfoService.selectVetPersonalInfoList(vetPersonalInfo); + ExcelUtil util = new ExcelUtil(VetPersonalInfo.class); + util.exportExcel(response, list, "兽医个人信息数据"); + } + + /** + * 获取当前登录用户的兽医信息(快捷方法) + */ + @PreAuthorize("@ss.hasPermi('vet:info:query')") + @GetMapping("/current") + public AjaxResult getCurrentInfo() + { + Long userId = getCurrentUserId(); + if (userId == null) { + return error("用户未登录"); + } + + VetPersonalInfo info = vetPersonalInfoService.selectVetPersonalInfoByUserId(userId); + if (info == null) { + return error("您还没有创建兽医个人信息"); + } + return success(info); + } +} \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuConsultationForms.java b/chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuConsultationForms.java new file mode 100644 index 0000000..99b9f31 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuConsultationForms.java @@ -0,0 +1,268 @@ +package com.chenhai.muhu.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +import java.util.Date; +import java.util.List; + +/** + * 问诊单对象 muhu_consultation_forms + * + * @author ruoyi + * @date 2026-01-07 + */ +public class MuhuConsultationForms extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long formId; + + /** 发布者 */ + @Excel(name = "发布者") + private String farmerName; + + /** 用户ID */ + private Long userId; + + /** 问诊标题 */ + @Excel(name = "问诊标题") + private String title; + + /** 病情描述 */ + @Excel(name = "病情描述") + private String description; + + /** 牲畜种类 */ + @Excel(name = "牲畜种类") + private String animalType; + + /** 牲畜年龄 */ + @Excel(name = "牲畜年龄") + private String animalAge; + + /** 牲畜性别 */ + @Excel(name = "牲畜性别") + private String animalGender; + + /** 症状照片或视频 */ + @Excel(name = "症状照片或视频") + private String images; + + /** 回复状态 */ + @Excel(name = "回复状态") + private String status; + + /** 是否含敏感词 */ + @Excel(name = "是否含敏感词") + private Integer isSensitive; + + /** 检测到的敏感词列表 */ + @Excel(name = "检测到的敏感词列表") + private String sensitiveWords; + + /** 查看次数 */ + @Excel(name = "查看次数") + private Long viewCount; + + /** 回复数量 */ + @Excel(name = "回复数量") + private Long replyCount; + + /** 问诊时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "问诊时间") + private Date createdTime; + + /** 头像 */ + @Excel(name = "头像") + private String avatar; + + public void setFormId(Long formId) + { + this.formId = formId; + } + + public Long getFormId() + { + return formId; + } + + public void setFarmerName(String farmerName) + { + this.farmerName = farmerName; + } + + public String getFarmerName() + { + return farmerName; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + + public void setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getDescription() + { + return description; + } + + public void setAnimalType(String animalType) + { + this.animalType = animalType; + } + + public String getAnimalType() + { + return animalType; + } + + public void setAnimalAge(String animalAge) + { + this.animalAge = animalAge; + } + + public String getAnimalAge() + { + return animalAge; + } + + public void setAnimalGender(String animalGender) + { + this.animalGender = animalGender; + } + + public String getAnimalGender() + { + return animalGender; + } + + public void setImages(String images) + { + this.images = images; + } + + public String getImages() + { + return images; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + public void setIsSensitive(Integer isSensitive) + { + this.isSensitive = isSensitive; + } + + public Integer getIsSensitive() + { + return isSensitive; + } + + public void setSensitiveWords(String sensitiveWords) + { + this.sensitiveWords = sensitiveWords; + } + + public String getSensitiveWords() + { + return sensitiveWords; + } + + public void setViewCount(Long viewCount) + { + this.viewCount = viewCount; + } + + public Long getViewCount() + { + return viewCount; + } + + public void setReplyCount(Long replyCount) + { + this.replyCount = replyCount; + } + + public Long getReplyCount() + { + return replyCount; + } + + public void setCreatedTime(Date createdTime) + { + this.createdTime = createdTime; + } + + public Date getCreatedTime() + { + return createdTime; + } + + public void setAvatar(String avatar) + { + this.avatar = avatar; + } + + public String getAvatar() + { + return avatar; + } + + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("formId", getFormId()) + .append("farmerName", getFarmerName()) + .append("userId", getUserId()) + .append("title", getTitle()) + .append("description", getDescription()) + .append("animalType", getAnimalType()) + .append("animalAge", getAnimalAge()) + .append("animalGender", getAnimalGender()) + .append("images", getImages()) + .append("status", getStatus()) + .append("isSensitive", getIsSensitive()) + .append("sensitiveWords", getSensitiveWords()) + .append("viewCount", getViewCount()) + .append("replyCount", getReplyCount()) + .append("createdTime", getCreatedTime()) + .append("avatar", getAvatar()) + .toString(); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuConsultationFormsMapper.java b/chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuConsultationFormsMapper.java new file mode 100644 index 0000000..a887b21 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuConsultationFormsMapper.java @@ -0,0 +1,61 @@ +package com.chenhai.muhu.mapper; + +import java.util.List; +import com.chenhai.muhu.domain.MuhuConsultationForms; + +/** + * 问诊单Mapper接口 + * + * @author ruoyi + * @date 2026-01-07 + */ +public interface MuhuConsultationFormsMapper +{ + /** + * 查询问诊单 + * + * @param formId 问诊单主键 + * @return 问诊单 + */ + public MuhuConsultationForms selectMuhuConsultationFormsByFormId(Long formId); + + /** + * 查询问诊单列表 + * + * @param muhuConsultationForms 问诊单 + * @return 问诊单集合 + */ + public List selectMuhuConsultationFormsList(MuhuConsultationForms muhuConsultationForms); + + /** + * 新增问诊单 + * + * @param muhuConsultationForms 问诊单 + * @return 结果 + */ + public int insertMuhuConsultationForms(MuhuConsultationForms muhuConsultationForms); + + /** + * 修改问诊单 + * + * @param muhuConsultationForms 问诊单 + * @return 结果 + */ + public int updateMuhuConsultationForms(MuhuConsultationForms muhuConsultationForms); + + /** + * 删除问诊单 + * + * @param formId 问诊单主键 + * @return 结果 + */ + public int deleteMuhuConsultationFormsByFormId(Long formId); + + /** + * 批量删除问诊单 + * + * @param formIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMuhuConsultationFormsByFormIds(Long[] formIds); +} diff --git a/chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuConsultationFormsService.java b/chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuConsultationFormsService.java new file mode 100644 index 0000000..3e56502 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuConsultationFormsService.java @@ -0,0 +1,61 @@ +package com.chenhai.muhu.service; + +import java.util.List; +import com.chenhai.muhu.domain.MuhuConsultationForms; + +/** + * 问诊单Service接口 + * + * @author ruoyi + * @date 2026-01-07 + */ +public interface IMuhuConsultationFormsService +{ + /** + * 查询问诊单 + * + * @param formId 问诊单主键 + * @return 问诊单 + */ + public MuhuConsultationForms selectMuhuConsultationFormsByFormId(Long formId); + + /** + * 查询问诊单列表 + * + * @param muhuConsultationForms 问诊单 + * @return 问诊单集合 + */ + public List selectMuhuConsultationFormsList(MuhuConsultationForms muhuConsultationForms); + + /** + * 新增问诊单 + * + * @param muhuConsultationForms 问诊单 + * @return 结果 + */ + public int insertMuhuConsultationForms(MuhuConsultationForms muhuConsultationForms); + + /** + * 修改问诊单 + * + * @param muhuConsultationForms 问诊单 + * @return 结果 + */ + public int updateMuhuConsultationForms(MuhuConsultationForms muhuConsultationForms); + + /** + * 批量删除问诊单 + * + * @param formIds 需要删除的问诊单主键集合 + * @return 结果 + */ + public int deleteMuhuConsultationFormsByFormIds(Long[] formIds); + + /** + * 删除问诊单信息 + * + * @param formId 问诊单主键 + * @return 结果 + */ + public int deleteMuhuConsultationFormsByFormId(Long formId); +} diff --git a/chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuConsultationFormsServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuConsultationFormsServiceImpl.java new file mode 100644 index 0000000..32a3889 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuConsultationFormsServiceImpl.java @@ -0,0 +1,237 @@ +package com.chenhai.muhu.service.impl; + +import java.util.List; + +import com.chenhai.common.core.domain.model.LoginUser; +import com.chenhai.common.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.chenhai.muhu.mapper.MuhuConsultationFormsMapper; +import com.chenhai.muhu.domain.MuhuConsultationForms; +import com.chenhai.muhu.service.IMuhuConsultationFormsService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 问诊单Service业务层处理 + * + * @author ruoyi + * @date 2026-01-07 + */ +@Service +public class MuhuConsultationFormsServiceImpl implements IMuhuConsultationFormsService +{ + @Autowired + private MuhuConsultationFormsMapper muhuConsultationFormsMapper; + + @Autowired + private com.chenhai.vet.mapper.VetCommentsMapper vetCommentsMapper; + + /** + * 查询问诊单 + * + * @param formId 问诊单主键 + * @return 问诊单 + */ + @Override + public MuhuConsultationForms selectMuhuConsultationFormsByFormId(Long formId) { + MuhuConsultationForms form = muhuConsultationFormsMapper.selectMuhuConsultationFormsByFormId(formId); + if (form != null) { + // 修复回复数量 + fixReplyCountAndStatus(form); + } + return form; + } + + /** + * 查询问诊单列表 + * + * @param muhuConsultationForms 问诊单 + * @return 问诊单 + */ + @Override + public List selectMuhuConsultationFormsList(MuhuConsultationForms muhuConsultationForms) + { + // 检查是否有admin权限 + boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*"); + + if (SecurityUtils.hasRole("muhu") && !isAdmin && SecurityUtils.hasRole("vetnotshenhe")) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + // 如果是muhu用户且不是admin,只能查看自己的问诊单 + muhuConsultationForms.setUserId(loginUser.getUserId()); + } + } + + List list = muhuConsultationFormsMapper.selectMuhuConsultationFormsList(muhuConsultationForms); + + // 修复每个问诊单的回复数量和状态 + for (MuhuConsultationForms form : list) { + fixReplyCountAndStatus(form); + } + + return list; + } + + /** + * 新增问诊单 + * + * @param muhuConsultationForms 问诊单 + * @return 结果 + */ + @Override + @Transactional + public int insertMuhuConsultationForms(MuhuConsultationForms muhuConsultationForms) + { + // 获取当前登录用户信息 + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + // 设置用户ID + muhuConsultationForms.setUserId(loginUser.getUserId()); + // 设置发布者名称为用户昵称 + if (muhuConsultationForms.getFarmerName() == null || muhuConsultationForms.getFarmerName().isEmpty()) { + muhuConsultationForms.setFarmerName(loginUser.getUser().getNickName()); + } + // 设置用户头像 + if (muhuConsultationForms.getAvatar() == null || muhuConsultationForms.getAvatar().isEmpty()) { + muhuConsultationForms.setAvatar(loginUser.getUser().getAvatar()); + } + } + + // 设置默认状态为待回复 + if (muhuConsultationForms.getStatus() == null) { + muhuConsultationForms.setStatus("未回复"); + } + + return muhuConsultationFormsMapper.insertMuhuConsultationForms(muhuConsultationForms); + } + + /** + * 修改问诊单 + * + * @param muhuConsultationForms 问诊单 + * @return 结果 + */ + @Override + public int updateMuhuConsultationForms(MuhuConsultationForms muhuConsultationForms) + { + boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*"); + // muhu用户只能修改自己的问诊单 + if (SecurityUtils.hasRole("muhu") && !isAdmin) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + // 先查询原始数据 + MuhuConsultationForms originalForm = muhuConsultationFormsMapper.selectMuhuConsultationFormsByFormId(muhuConsultationForms.getFormId()); + if (originalForm != null && !originalForm.getUserId().equals(loginUser.getUserId())) { + throw new RuntimeException("只能修改自己的问诊单"); + } + } + } + + return muhuConsultationFormsMapper.updateMuhuConsultationForms(muhuConsultationForms); + } + + /** + * 批量删除问诊单 + * + * @param formIds 需要删除的问诊单主键 + * @return 结果 + */ + @Override + @Transactional + public int deleteMuhuConsultationFormsByFormIds(Long[] formIds) + { + boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*"); + // muhu用户只能删除自己的问诊单 + if (SecurityUtils.hasRole("muhu") && !isAdmin) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + for (Long formId : formIds) { + MuhuConsultationForms form = muhuConsultationFormsMapper.selectMuhuConsultationFormsByFormId(formId); + if (form != null && !form.getUserId().equals(loginUser.getUserId())) { + throw new RuntimeException("只能删除自己的问诊单"); + } + } + } + } + + return muhuConsultationFormsMapper.deleteMuhuConsultationFormsByFormIds(formIds); + } + + /** + * 删除问诊单信息 + * + * @param formId 问诊单主键 + * @return 结果 + */ + @Override + public int deleteMuhuConsultationFormsByFormId(Long formId) + { + boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*"); + // muhu用户只能删除自己的问诊单 + if (SecurityUtils.hasRole("muhu") && !isAdmin) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + MuhuConsultationForms form = muhuConsultationFormsMapper.selectMuhuConsultationFormsByFormId(formId); + if (form != null && !form.getUserId().equals(loginUser.getUserId())) { + throw new RuntimeException("只能删除自己的问诊单"); + } + } + } + + return muhuConsultationFormsMapper.deleteMuhuConsultationFormsByFormId(formId); + } + + /** + * 修复回复数量和状态(核心修复方法) + * 确保问诊单的回复数量和状态一致 + */ + private void fixReplyCountAndStatus(MuhuConsultationForms form) { + if (form == null) { + return; + } + + try { + // 查询实际的回复数量 + Long actualReplyCount = getActualReplyCount(form.getFormId()); + + // 如果数据库中的回复数和实际不符,修复它 + if (actualReplyCount != null && !actualReplyCount.equals(form.getReplyCount())) { + form.setReplyCount(actualReplyCount); + } + + // 修复状态:有回复就应该是"已回复" + if (actualReplyCount != null && actualReplyCount > 0 && !"已回复".equals(form.getStatus())) { + form.setStatus("已回复"); + } + // 如果实际没有回复但状态是"已回复",修复为"未回复" + else if ((actualReplyCount == null || actualReplyCount == 0) && "已回复".equals(form.getStatus())) { + form.setStatus("未回复"); + } + } catch (Exception e) { + // 忽略异常,不影响主流程 + e.printStackTrace(); + } + } + + /** + * 获取实际回复数量 + * @param formId 问诊单ID + * @return 回复数量 + */ + private Long getActualReplyCount(Long formId) { + try { + // 创建查询条件 + com.chenhai.vet.domain.VetComments query = new com.chenhai.vet.domain.VetComments(); + query.setConsultationId(formId); + + // 查询回复列表 + List replies = vetCommentsMapper.selectVetCommentsList(query); + + // 返回数量 + return replies != null ? (long) replies.size() : 0L; + } catch (Exception e) { + e.printStackTrace(); + return 0L; + } + } +} \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/system/domain/SysExpertConsultation.java b/chenhai-system/src/main/java/com/chenhai/system/domain/SysExpertConsultation.java new file mode 100644 index 0000000..cc76c76 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/domain/SysExpertConsultation.java @@ -0,0 +1,299 @@ +package com.chenhai.system.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.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +/** + * 专家咨询对象 sys_expert_consultation + * + * @author ruoyi + * @date 2026-01-12 + */ +public class SysExpertConsultation extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 咨询ID */ + private Long consultationId; + + /** 用户ID */ + @Excel(name = "用户ID") + private Long userId; + + /** 专家ID */ + @Excel(name = "专家ID") + private Long expertId; + + /** 关联问诊单ID */ + @Excel(name = "关联问诊单ID") + private Long formId; + + /** 咨询类型: 1-图文咨询, 2-电话咨询, 3-视频咨询 */ + @Excel(name = "咨询类型: 1-图文咨询, 2-电话咨询, 3-视频咨询") + private String consultationType; + + /** 咨询状态: 0-待接诊, 1-进行中, 2-已完成, 3-已取消 */ + @Excel(name = "咨询状态: 0-待接诊, 1-进行中, 2-已完成, 3-已取消") + private String consultationStatus; + + /** 咨询标题 */ + @Excel(name = "咨询标题") + private String consultationTitle; + + /** 用户初始咨询内容 */ + @Excel(name = "用户初始咨询内容") + private String initialContent; + + /** 用户初始附件(JSON数组) */ + @Excel(name = "用户初始附件(JSON数组)") + private String initialAttachments; + + /** 对话消息(JSON格式) */ + @Excel(name = "对话消息(JSON格式)") + private String messages; + + /** 用户评分(1-5分) */ + @Excel(name = "用户评分(1-5分)") + private Integer rating; + + /** 用户评价内容 */ + @Excel(name = "用户评价内容") + private String evaluation; + + /** 评价标签(JSON数组) */ + @Excel(name = "评价标签(JSON数组)") + private String evaluationTags; + + /** 评价时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "评价时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date evaluationTime; + + /** 咨询开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "咨询开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date startTime; + + /** 咨询结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "咨询结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date endTime; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdTime; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updatedTime; + + public void setConsultationId(Long consultationId) + { + this.consultationId = consultationId; + } + + public Long getConsultationId() + { + return consultationId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + + public void setExpertId(Long expertId) + { + this.expertId = expertId; + } + + public Long getExpertId() + { + return expertId; + } + + public void setFormId(Long formId) + { + this.formId = formId; + } + + public Long getFormId() + { + return formId; + } + + public void setConsultationType(String consultationType) + { + this.consultationType = consultationType; + } + + public String getConsultationType() + { + return consultationType; + } + + public void setConsultationStatus(String consultationStatus) + { + this.consultationStatus = consultationStatus; + } + + public String getConsultationStatus() + { + return consultationStatus; + } + + public void setConsultationTitle(String consultationTitle) + { + this.consultationTitle = consultationTitle; + } + + public String getConsultationTitle() + { + return consultationTitle; + } + + public void setInitialContent(String initialContent) + { + this.initialContent = initialContent; + } + + public String getInitialContent() + { + return initialContent; + } + + public void setInitialAttachments(String initialAttachments) + { + this.initialAttachments = initialAttachments; + } + + public String getInitialAttachments() + { + return initialAttachments; + } + + public void setMessages(String messages) + { + this.messages = messages; + } + + public String getMessages() + { + return messages; + } + + public void setRating(Integer rating) + { + this.rating = rating; + } + + public Integer getRating() + { + return rating; + } + + public void setEvaluation(String evaluation) + { + this.evaluation = evaluation; + } + + public String getEvaluation() + { + return evaluation; + } + + public void setEvaluationTags(String evaluationTags) + { + this.evaluationTags = evaluationTags; + } + + public String getEvaluationTags() + { + return evaluationTags; + } + + public void setEvaluationTime(Date evaluationTime) + { + this.evaluationTime = evaluationTime; + } + + public Date getEvaluationTime() + { + return evaluationTime; + } + + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getStartTime() + { + return startTime; + } + + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } + + public Date getEndTime() + { + return endTime; + } + + public void setCreatedTime(Date createdTime) + { + this.createdTime = createdTime; + } + + public Date getCreatedTime() + { + return createdTime; + } + + public void setUpdatedTime(Date updatedTime) + { + this.updatedTime = updatedTime; + } + + public Date getUpdatedTime() + { + return updatedTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("consultationId", getConsultationId()) + .append("userId", getUserId()) + .append("expertId", getExpertId()) + .append("formId", getFormId()) + .append("consultationType", getConsultationType()) + .append("consultationStatus", getConsultationStatus()) + .append("consultationTitle", getConsultationTitle()) + .append("initialContent", getInitialContent()) + .append("initialAttachments", getInitialAttachments()) + .append("messages", getMessages()) + .append("rating", getRating()) + .append("evaluation", getEvaluation()) + .append("evaluationTags", getEvaluationTags()) + .append("evaluationTime", getEvaluationTime()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) + .append("createdTime", getCreatedTime()) + .append("updatedTime", getUpdatedTime()) + .toString(); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysExpertConsultationMapper.java b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysExpertConsultationMapper.java new file mode 100644 index 0000000..d442511 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysExpertConsultationMapper.java @@ -0,0 +1,61 @@ +package com.chenhai.system.mapper; + +import java.util.List; +import com.chenhai.system.domain.SysExpertConsultation; + +/** + * 专家咨询Mapper接口 + * + * @author ruoyi + * @date 2026-01-12 + */ +public interface SysExpertConsultationMapper +{ + /** + * 查询专家咨询 + * + * @param consultationId 专家咨询主键 + * @return 专家咨询 + */ + public SysExpertConsultation selectSysExpertConsultationByConsultationId(Long consultationId); + + /** + * 查询专家咨询列表 + * + * @param sysExpertConsultation 专家咨询 + * @return 专家咨询集合 + */ + public List selectSysExpertConsultationList(SysExpertConsultation sysExpertConsultation); + + /** + * 新增专家咨询 + * + * @param sysExpertConsultation 专家咨询 + * @return 结果 + */ + public int insertSysExpertConsultation(SysExpertConsultation sysExpertConsultation); + + /** + * 修改专家咨询 + * + * @param sysExpertConsultation 专家咨询 + * @return 结果 + */ + public int updateSysExpertConsultation(SysExpertConsultation sysExpertConsultation); + + /** + * 删除专家咨询 + * + * @param consultationId 专家咨询主键 + * @return 结果 + */ + public int deleteSysExpertConsultationByConsultationId(Long consultationId); + + /** + * 批量删除专家咨询 + * + * @param consultationIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysExpertConsultationByConsultationIds(Long[] consultationIds); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/ISysExpertConsultationService.java b/chenhai-system/src/main/java/com/chenhai/system/service/ISysExpertConsultationService.java new file mode 100644 index 0000000..50d7153 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/ISysExpertConsultationService.java @@ -0,0 +1,61 @@ +package com.chenhai.system.service; + +import java.util.List; +import com.chenhai.system.domain.SysExpertConsultation; + +/** + * 专家咨询Service接口 + * + * @author ruoyi + * @date 2026-01-12 + */ +public interface ISysExpertConsultationService +{ + /** + * 查询专家咨询 + * + * @param consultationId 专家咨询主键 + * @return 专家咨询 + */ + public SysExpertConsultation selectSysExpertConsultationByConsultationId(Long consultationId); + + /** + * 查询专家咨询列表 + * + * @param sysExpertConsultation 专家咨询 + * @return 专家咨询集合 + */ + public List selectSysExpertConsultationList(SysExpertConsultation sysExpertConsultation); + + /** + * 新增专家咨询 + * + * @param sysExpertConsultation 专家咨询 + * @return 结果 + */ + public int insertSysExpertConsultation(SysExpertConsultation sysExpertConsultation); + + /** + * 修改专家咨询 + * + * @param sysExpertConsultation 专家咨询 + * @return 结果 + */ + public int updateSysExpertConsultation(SysExpertConsultation sysExpertConsultation); + + /** + * 批量删除专家咨询 + * + * @param consultationIds 需要删除的专家咨询主键集合 + * @return 结果 + */ + public int deleteSysExpertConsultationByConsultationIds(Long[] consultationIds); + + /** + * 删除专家咨询信息 + * + * @param consultationId 专家咨询主键 + * @return 结果 + */ + public int deleteSysExpertConsultationByConsultationId(Long consultationId); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysExpertConsultationServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysExpertConsultationServiceImpl.java new file mode 100644 index 0000000..fdae088 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysExpertConsultationServiceImpl.java @@ -0,0 +1,93 @@ +package com.chenhai.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.chenhai.system.mapper.SysExpertConsultationMapper; +import com.chenhai.system.domain.SysExpertConsultation; +import com.chenhai.system.service.ISysExpertConsultationService; + +/** + * 专家咨询Service业务层处理 + * + * @author ruoyi + * @date 2026-01-12 + */ +@Service +public class SysExpertConsultationServiceImpl implements ISysExpertConsultationService +{ + @Autowired + private SysExpertConsultationMapper sysExpertConsultationMapper; + + /** + * 查询专家咨询 + * + * @param consultationId 专家咨询主键 + * @return 专家咨询 + */ + @Override + public SysExpertConsultation selectSysExpertConsultationByConsultationId(Long consultationId) + { + return sysExpertConsultationMapper.selectSysExpertConsultationByConsultationId(consultationId); + } + + /** + * 查询专家咨询列表 + * + * @param sysExpertConsultation 专家咨询 + * @return 专家咨询 + */ + @Override + public List selectSysExpertConsultationList(SysExpertConsultation sysExpertConsultation) + { + return sysExpertConsultationMapper.selectSysExpertConsultationList(sysExpertConsultation); + } + + /** + * 新增专家咨询 + * + * @param sysExpertConsultation 专家咨询 + * @return 结果 + */ + @Override + public int insertSysExpertConsultation(SysExpertConsultation sysExpertConsultation) + { + return sysExpertConsultationMapper.insertSysExpertConsultation(sysExpertConsultation); + } + + /** + * 修改专家咨询 + * + * @param sysExpertConsultation 专家咨询 + * @return 结果 + */ + @Override + public int updateSysExpertConsultation(SysExpertConsultation sysExpertConsultation) + { + return sysExpertConsultationMapper.updateSysExpertConsultation(sysExpertConsultation); + } + + /** + * 批量删除专家咨询 + * + * @param consultationIds 需要删除的专家咨询主键 + * @return 结果 + */ + @Override + public int deleteSysExpertConsultationByConsultationIds(Long[] consultationIds) + { + return sysExpertConsultationMapper.deleteSysExpertConsultationByConsultationIds(consultationIds); + } + + /** + * 删除专家咨询信息 + * + * @param consultationId 专家咨询主键 + * @return 结果 + */ + @Override + public int deleteSysExpertConsultationByConsultationId(Long consultationId) + { + return sysExpertConsultationMapper.deleteSysExpertConsultationByConsultationId(consultationId); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysUserServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysUserServiceImpl.java index d18dab5..ab6fbe5 100644 --- a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysUserServiceImpl.java +++ b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysUserServiceImpl.java @@ -304,6 +304,7 @@ public class SysUserServiceImpl implements ISysUserService public int updateUser(SysUser user) { Long userId = user.getUserId(); + // 删除用户与角色关联 userRoleMapper.deleteUserRoleByUserId(userId); // 新增用户与角色管理 diff --git a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetComments.java b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetComments.java new file mode 100644 index 0000000..006cd62 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetComments.java @@ -0,0 +1,230 @@ +package com.chenhai.vet.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.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +/** + * 兽医回复对象 vet_comments + * + * @author ruoyi + * @date 2026-01-07 + */ +public class VetComments extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 问诊单ID */ + @Excel(name = "问诊单ID") + private Long consultationId; + + /** 回复者 */ + @Excel(name = "回复者") + private String replyName; + + /** 回复内容 */ + @Excel(name = "回复内容") + private String content; + + /** 评论图片 */ + @Excel(name = "评论图片") + private String images; + + /** 是否含敏感词 */ + @Excel(name = "是否含敏感词") + private Integer isSensitive; + + /** 敏感词列表 */ + @Excel(name = "敏感词列表") + private String sensitiveWords; + + /** 评论时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "评论时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updatedAt; + + /** 用户ID */ + @Excel(name = "用户ID") + private Long userId; + + /** 职称(从用户表关联) */ + @Excel(name = "职称") + private String title; + + /** 医院(从用户表关联) */ + @Excel(name = "医院") + private String hospital; + + /** 经验(从用户表关联) */ + @Excel(name = "经验") + private String experience; + + /** 头像 */ + @Excel(name = "头像") + private String avatar; + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getHospital() { + return hospital; + } + + public void setHospital(String hospital) { + this.hospital = hospital; + } + + public String getExperience() { + return experience; + } + + public void setExperience(String experience) { + this.experience = experience; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setConsultationId(Long consultationId) + { + this.consultationId = consultationId; + } + + public Long getConsultationId() + { + return consultationId; + } + + public void setReplyName(String replyName) + { + this.replyName = replyName; + } + + public String getReplyName() + { + return replyName; + } + + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + + public void setImages(String images) + { + this.images = images; + } + + public String getImages() + { + return images; + } + + public void setIsSensitive(Integer isSensitive) + { + this.isSensitive = isSensitive; + } + + public Integer getIsSensitive() + { + return isSensitive; + } + + public void setSensitiveWords(String sensitiveWords) + { + this.sensitiveWords = sensitiveWords; + } + + public String getSensitiveWords() + { + return sensitiveWords; + } + + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + + public void setUpdatedAt(Date updatedAt) + { + this.updatedAt = updatedAt; + } + + public Date getUpdatedAt() + { + return updatedAt; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + + public void setAvatar(String avatar) + { + this.avatar = avatar; + } + + public String getAvatar() + { + return avatar; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("consultationId", getConsultationId()) + .append("replyName", getReplyName()) + .append("content", getContent()) + .append("images", getImages()) + .append("isSensitive", getIsSensitive()) + .append("sensitiveWords", getSensitiveWords()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .append("userId", getUserId()) + .append("title", getTitle()) + .append("hospital", getHospital()) + .append("experience", getExperience()) + .append("avatar", getAvatar()) + .toString(); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetExperts.java b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetExperts.java new file mode 100644 index 0000000..349d2bc --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetExperts.java @@ -0,0 +1,279 @@ +package com.chenhai.vet.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.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +/** + * 专家信息对象 vet_experts + * + * @author ruoyi + * @date 2026-01-08 + */ +public class VetExperts extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 专家ID */ + private Long expertId; + + /** 关联用户ID */ + @Excel(name = "关联用户ID") + private Long userId; + + /** 头像 */ + @Excel(name = "头像") + private String avatar; + + /** 真实姓名 */ + @Excel(name = "真实姓名") + private String realName; + + /** 专业方向 */ + @Excel(name = "职称") + private String title; + + /** 手机号 */ + @Excel(name = "手机号") + private String iphone; + + /** 邮箱 */ + @Excel(name = "邮箱") + private String email; + + /** 地址 */ + @Excel(name = "地址") + private String address; + + /** 擅长领域 */ + @Excel(name = "擅长领域") + private String expertiseArea; + + /** 在线状态:0-离线 1-在线 */ + @Excel(name = "在线状态:0-离线 1-在线") + private String isOnline; + + /** 备注 */ + @Excel(name = "备注") + private String remark; + + /** 排序 */ + @Excel(name = "排序") + private Long sortOrder; + + /** 状态:0-正常 1-停用 */ + @Excel(name = "状态:0-正常 1-停用") + private String status; + + /** 专家类型 */ + @Excel(name = "专家类型") + private String expert; + + /** 从业经验 */ + @Excel(name = "从业经验") + private String workExperience; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private Date createdAt; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private Date updatedAt; + + public void setExpertId(Long expertId) + { + this.expertId = expertId; + } + + public Long getExpertId() + { + return expertId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + + public void setAvatar(String avatar) + { + this.avatar = avatar; + } + + public String getAvatar() + { + return avatar; + } + + public void setRealName(String realName) + { + this.realName = realName; + } + + public String getRealName() + { + return realName; + } + + public void setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + + public void setIphone(String iphone) + { + this.iphone = iphone; + } + + public String getIphone() + { + return iphone; + } + + public void setEmail(String email) + { + this.email = email; + } + + public String getEmail() + { + return email; + } + + public void setAddress(String address) + { + this.address = address; + } + + public String getAddress() + { + return address; + } + + public void setExpertiseArea(String expertiseArea) + { + this.expertiseArea = expertiseArea; + } + + public String getExpertiseArea() + { + return expertiseArea; + } + + public void setIsOnline(String isOnline) + { + this.isOnline = isOnline; + } + + public String getIsOnline() + { + return isOnline; + } + + public void setRemark(String remark) + { + this.remark = remark; + } + + public String getRemark() + { + return remark; + } + + public void setSortOrder(Long sortOrder) + { + this.sortOrder = sortOrder; + } + + public Long getSortOrder() + { + return sortOrder; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + + public void setUpdatedAt(Date updatedAt) + { + this.updatedAt = updatedAt; + } + + public Date getUpdatedAt() + { + return updatedAt; + } + + public void setExpert(String expert) + { + this.expert = expert; + } + + public String getExpert() + { + return expert; + } + + public void setWorkExperience(String workExperience) + { + this.workExperience = workExperience; + } + + public String getWorkExperience() + { + return workExperience; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("expertId", getExpertId()) + .append("userId", getUserId()) + .append("avatar", getAvatar()) + .append("realName", getRealName()) + .append("title", getTitle()) + .append("iphone", getIphone()) + .append("email", getEmail()) + .append("address", getAddress()) + .append("expertiseArea", getExpertiseArea()) + .append("isOnline", getIsOnline()) + .append("remark", getRemark()) + .append("sortOrder", getSortOrder()) + .append("status", getStatus()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .append("expert", getExpert()) + .append("workExperience", getWorkExperience()) + .toString(); + } +} \ No newline at end of file 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 fa3b74e..0e34191 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 @@ -2,6 +2,7 @@ package com.chenhai.vet.domain; import com.chenhai.common.annotation.Excel; import com.chenhai.common.core.domain.BaseEntity; +import com.chenhai.common.core.domain.entity.SysUser; import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -25,6 +26,9 @@ public class VetPersonalInfo extends BaseEntity @Excel(name = "用户ID", readConverterExp = "关=联sys_user") private Long userId; + /** 关联的用户对象 */ + private SysUser user; + /** 真实姓名 */ @Excel(name = "真实姓名") private String realName; @@ -66,30 +70,27 @@ public class VetPersonalInfo extends BaseEntity @Excel(name = "个人简介") private String introduction; - @Excel(name = "证书数量") - private Integer certCount; + /** 职称 */ + @Excel(name = "职称") + private String title; - /** 证书名称列表(逗号分隔,用于关联查询) */ - @Excel(name = "证书名称列表") - private String certNames; + /** 手机号 */ + @Excel(name = "手机号") + private String phone; - // 添加getter和setter - public Integer getCertCount() { - return certCount; - } + /** 专家类型 */ + @Excel(name = "专家类型") + private String expertType; - public void setCertCount(Integer certCount) { - this.certCount = certCount; - } + /** 电子邮件地址 */ + @Excel(name = "电子邮件地址") + private String email; - public String getCertNames() { - return certNames; - } - - public void setCertNames(String certNames) { - this.certNames = certNames; - } + /** 用户昵称 */ + @Excel(name = "用户昵称") + private String nickName; + // 添加getter和setter public void setId(Long id) { this.id = id; @@ -210,6 +211,64 @@ public class VetPersonalInfo extends BaseEntity return introduction; } + public void setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + + public void setPhone(String phone) + { + this.phone = phone; + } + + public String getPhone() + { + return phone; + } + + public void setExpertType(String expertType) + { + this.expertType = expertType; + } + + public String getExpertType() + { + return expertType; + } + + public void setEmail(String email) + { + this.email = email; + } + + public String getEmail() + { + return email; + } + + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + public String getNickName() + { + return nickName; + } + + public SysUser getUser() { + return user; + } + + public void setUser(SysUser user) { + this.user = user; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -229,6 +288,12 @@ public class VetPersonalInfo extends BaseEntity .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) + .append("title", getTitle()) + .append("phone", getPhone()) + .append("expertType", getExpertType()) + .append("email", getEmail()) + .append("nickName", getNickName()) + .append("user", getUser()) .toString(); } } \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetCommentsMapper.java b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetCommentsMapper.java new file mode 100644 index 0000000..5df91e2 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetCommentsMapper.java @@ -0,0 +1,70 @@ +package com.chenhai.vet.mapper; + +import java.util.List; +import com.chenhai.vet.domain.VetComments; +import org.apache.ibatis.annotations.Param; + +/** + * 兽医回复Mapper接口 + * + * @author ruoyi + * @date 2026-01-07 + */ +public interface VetCommentsMapper +{ + /** + * 查询兽医回复 + * + * @param id 兽医回复主键 + * @return 兽医回复 + */ + public VetComments selectVetCommentsById(Long id); + + /** + * 查询兽医回复列表 + * + * @param vetComments 兽医回复 + * @return 兽医回复集合 + */ + public List selectVetCommentsList(VetComments vetComments); + + /** + * 新增兽医回复 + * + * @param vetComments 兽医回复 + * @return 结果 + */ + public int insertVetComments(VetComments vetComments); + + /** + * 修改兽医回复 + * + * @param vetComments 兽医回复 + * @return 结果 + */ + public int updateVetComments(VetComments vetComments); + + /** + * 删除兽医回复 + * + * @param id 兽医回复主键 + * @return 结果 + */ + public int deleteVetCommentsById(Long id); + + /** + * 批量删除兽医回复 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteVetCommentsByIds(Long[] ids); + + /** + * 更新用户专业信息 + */ + public int updateUserProfessionalInfo(@Param("userId") Long userId, + @Param("title") String title, + @Param("hospital") String hospital, + @Param("experience") String experience); +} diff --git a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetExpertsMapper.java b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetExpertsMapper.java new file mode 100644 index 0000000..d00abc2 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetExpertsMapper.java @@ -0,0 +1,62 @@ +package com.chenhai.vet.mapper; + +import java.util.List; +import com.chenhai.vet.domain.VetExperts; + +/** + * 专家信息Mapper接口 + * + * @author ruoyi + * @date 2026-01-08 + */ +public interface VetExpertsMapper +{ + /** + * 查询专家信息 + * + * @param expertId 专家信息主键 + * @return 专家信息 + */ + public VetExperts selectVetExpertsByExpertId(Long expertId); + + /** + * 查询专家信息列表 + * + * @param vetExperts 专家信息 + * @return 专家信息集合 + */ + public List selectVetExpertsList(VetExperts vetExperts); + + /** + * 新增专家信息 + * + * @param vetExperts 专家信息 + * @return 结果 + */ + public int insertVetExperts(VetExperts vetExperts); + + /** + * 修改专家信息 + * + * @param vetExperts 专家信息 + * @return 结果 + */ + public int updateVetExperts(VetExperts vetExperts); + + /** + * 删除专家信息 + * + * @param expertId 专家信息主键 + * @return 结果 + */ + public int deleteVetExpertsByExpertId(Long expertId); + + /** + * 批量删除专家信息 + * + * @param expertIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteVetExpertsByExpertIds(Long[] expertIds); + +} diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetCommentsService.java b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetCommentsService.java new file mode 100644 index 0000000..e8cc45a --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetCommentsService.java @@ -0,0 +1,61 @@ +package com.chenhai.vet.service; + +import java.util.List; +import com.chenhai.vet.domain.VetComments; + +/** + * 兽医回复Service接口 + * + * @author ruoyi + * @date 2026-01-07 + */ +public interface IVetCommentsService +{ + /** + * 查询兽医回复 + * + * @param id 兽医回复主键 + * @return 兽医回复 + */ + public VetComments selectVetCommentsById(Long id); + + /** + * 查询兽医回复列表 + * + * @param vetComments 兽医回复 + * @return 兽医回复集合 + */ + public List selectVetCommentsList(VetComments vetComments); + + /** + * 新增兽医回复 + * + * @param vetComments 兽医回复 + * @return 结果 + */ + public int insertVetComments(VetComments vetComments); + + /** + * 修改兽医回复 + * + * @param vetComments 兽医回复 + * @return 结果 + */ + public int updateVetComments(VetComments vetComments); + + /** + * 批量删除兽医回复 + * + * @param ids 需要删除的兽医回复主键集合 + * @return 结果 + */ + public int deleteVetCommentsByIds(Long[] ids); + + /** + * 删除兽医回复信息 + * + * @param id 兽医回复主键 + * @return 结果 + */ + public int deleteVetCommentsById(Long id); +} diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetExpertsService.java b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetExpertsService.java new file mode 100644 index 0000000..f96ca41 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetExpertsService.java @@ -0,0 +1,61 @@ +package com.chenhai.vet.service; + +import java.util.List; +import com.chenhai.vet.domain.VetExperts; + +/** + * 专家信息Service接口 + * + * @author ruoyi + * @date 2026-01-08 + */ +public interface IVetExpertsService +{ + /** + * 查询专家信息 + * + * @param expertId 专家信息主键 + * @return 专家信息 + */ + public VetExperts selectVetExpertsByExpertId(Long expertId); + + /** + * 查询专家信息列表 + * + * @param vetExperts 专家信息 + * @return 专家信息集合 + */ + public List selectVetExpertsList(VetExperts vetExperts); + + /** + * 新增专家信息 + * + * @param vetExperts 专家信息 + * @return 结果 + */ + public int insertVetExperts(VetExperts vetExperts); + + /** + * 修改专家信息 + * + * @param vetExperts 专家信息 + * @return 结果 + */ + public int updateVetExperts(VetExperts vetExperts); + + /** + * 批量删除专家信息 + * + * @param expertIds 需要删除的专家信息主键集合 + * @return 结果 + */ + public int deleteVetExpertsByExpertIds(Long[] expertIds); + + /** + * 删除专家信息信息 + * + * @param expertId 专家信息主键 + * @return 结果 + */ + public int deleteVetExpertsByExpertId(Long expertId); +} diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetCommentsServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetCommentsServiceImpl.java new file mode 100644 index 0000000..41ddb89 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetCommentsServiceImpl.java @@ -0,0 +1,450 @@ +package com.chenhai.vet.service.impl; + +import java.util.List; + +import com.chenhai.common.core.domain.entity.SysUser; +import com.chenhai.common.core.domain.model.LoginUser; +import com.chenhai.common.utils.SecurityUtils; +import com.chenhai.common.utils.StringUtils; +import com.chenhai.muhu.domain.MuhuConsultationForms; +import com.chenhai.muhu.service.IMuhuConsultationFormsService; +import com.chenhai.vet.domain.VetPersonalInfo; +import com.chenhai.vet.service.IVetPersonalInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.chenhai.vet.mapper.VetCommentsMapper; +import com.chenhai.vet.domain.VetComments; +import com.chenhai.vet.service.IVetCommentsService; +import org.springframework.transaction.annotation.Transactional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 兽医回复Service业务层处理 + * + * @author ruoyi + * @date 2026-01-07 + */ +@Service +public class VetCommentsServiceImpl implements IVetCommentsService +{ + private static final Logger log = LoggerFactory.getLogger(VetCommentsServiceImpl.class); + + @Autowired + private VetCommentsMapper vetCommentsMapper; + + @Autowired + private IMuhuConsultationFormsService consultationFormsService; + + @Autowired + private IVetPersonalInfoService vetPersonalInfoService; + + + /** + * 查询兽医回复 + * + * @param id 兽医回复主键 + * @return 兽医回复 + */ + @Override + public VetComments selectVetCommentsById(Long id) + { + VetComments comment = vetCommentsMapper.selectVetCommentsById(id); + // 如果查询时字段为空,尝试填充兽医信息 + if (comment != null && (StringUtils.isEmpty(comment.getTitle()) || + StringUtils.isEmpty(comment.getHospital()) || + StringUtils.isEmpty(comment.getExperience()))) { + fillVetInfoToComment(comment); + } + return comment; + } + + /** + * 查询兽医回复列表 + * + * @param vetComments 兽医回复 + * @return 兽医回复 + */ + @Override + public List selectVetCommentsList(VetComments vetComments) + { + List list = vetCommentsMapper.selectVetCommentsList(vetComments); + // 为每个记录填充兽医信息 + if (list != null) { + list.forEach(this::fillVetInfoToComment); + } + return list; + } + + /** + * 新增兽医回复 + * + * @param vetComments 兽医回复 + * @return 结果 + */ + @Override + @Transactional + public int insertVetComments(VetComments vetComments) + { + // 获取当前登录用户信息 + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser currentUser = null; + + if (loginUser != null) { + currentUser = loginUser.getUser(); + + // 设置用户ID + vetComments.setUserId(loginUser.getUserId()); + + // 设置回复者为用户昵称 + if (vetComments.getReplyName() == null || vetComments.getReplyName().isEmpty()) { + vetComments.setReplyName(currentUser.getNickName()); + } + + // 设置用户头像 + if (vetComments.getAvatar() == null || vetComments.getAvatar().isEmpty()) { + vetComments.setAvatar(loginUser.getUser().getAvatar()); + } + + // 自动填充兽医职称、医院和经验信息到数据库字段中 + vetComments = autoFillVetInfoToFields(vetComments, loginUser.getUserId()); + + } + + // 设置默认值 + if (vetComments.getIsSensitive() == null) { + vetComments.setIsSensitive(0); + } + + int result = vetCommentsMapper.insertVetComments(vetComments); + + // 更新问诊单的回复数量和状态 + try { + MuhuConsultationForms consultation = + consultationFormsService.selectMuhuConsultationFormsByFormId(vetComments.getConsultationId()); + if (consultation != null) { + consultation.setStatus("已回复"); + consultationFormsService.updateMuhuConsultationForms(consultation); + + // 如果是首次回复,可以记录回复兽医信息(如果有相应字段) + // 注意:这里需要根据实际问诊单结构来调整 + recordVetInfoToConsultation(consultation, vetComments); + } + } catch (Exception e) { + log.error("更新问诊单状态失败", e); + } + + return result; + } + + /** + * 记录兽医信息到问诊单(可选) + */ + private void recordVetInfoToConsultation(MuhuConsultationForms consultation, VetComments vetComments) { + try { + // 方式1:使用反射检查字段是否存在 + try { + // 尝试检查是否有 vetUserId 字段 + java.lang.reflect.Method getVetUserId = consultation.getClass().getMethod("getVetUserId"); + java.lang.reflect.Method setVetUserId = consultation.getClass().getMethod("setVetUserId", Long.class); + java.lang.reflect.Method setVetName = consultation.getClass().getMethod("setVetName", String.class); + + // 如果方法存在且当前值为空,则设置 + Object vetUserIdValue = getVetUserId.invoke(consultation); + if (vetUserIdValue == null) { + setVetUserId.invoke(consultation, vetComments.getUserId()); + setVetName.invoke(consultation, vetComments.getReplyName()); + consultationFormsService.updateMuhuConsultationForms(consultation); + log.info("已记录兽医信息到问诊单,兽医ID:{},兽医姓名:{}", + vetComments.getUserId(), vetComments.getReplyName()); + } + } catch (NoSuchMethodException e) { + // 如果没有这些字段,忽略 + log.debug("问诊单没有兽医相关字段,跳过记录"); + } + + } catch (Exception e) { + log.warn("记录兽医信息到问诊单失败:{}", e.getMessage()); + } + } + + /** + * 自动填充兽医职称、医院和经验信息到数据库字段 + * 这是主要方法,将信息填充到实体的 title、hospital、experience 字段中 + * + * @param vetComments 兽医回复对象 + * @param userId 兽医用户ID + * @return 填充后的兽医回复对象 + */ + private VetComments autoFillVetInfoToFields(VetComments vetComments, Long userId) { + try { + // 获取兽医个人信息 + VetPersonalInfo vetInfo = vetPersonalInfoService.selectVetPersonalInfoByUserId(userId); + + if (vetInfo != null) { + // 直接设置到实体字段中 + if (StringUtils.isNotEmpty(vetInfo.getTitle())) { + vetComments.setTitle(vetInfo.getTitle()); + } + + if (StringUtils.isNotEmpty(vetInfo.getHospital())) { + vetComments.setHospital(vetInfo.getHospital()); + } + + if (StringUtils.isNotEmpty(vetInfo.getWorkExperience())) { + vetComments.setExperience(vetInfo.getWorkExperience()); + } + + log.info("已自动填充兽医信息到字段:职称={}, 医院={}, 经验={}", + vetInfo.getTitle(), vetInfo.getHospital(), vetInfo.getWorkExperience()); + + // 可选:同时在内容中追加兽医信息 + vetComments = appendVetInfoToContent(vetComments, vetInfo); + + } else { + log.warn("用户ID:{} 未找到兽医个人信息", userId); + } + + } catch (Exception e) { + log.error("自动填充兽医信息失败,用户ID:{}", userId, e); + } + + return vetComments; + } + + /** + * 可选方法:将兽医信息追加到回复内容末尾(如果需要) + */ + private VetComments appendVetInfoToContent(VetComments vetComments, VetPersonalInfo vetInfo) { + // 是否需要在内容中显示兽医信息的配置 + boolean showVetInfoInContent = true; // 可以从配置读取 + + if (showVetInfoInContent) { + StringBuilder vetSignature = new StringBuilder(); + + // 构建兽医信息签名 + if (StringUtils.isNotEmpty(vetInfo.getTitle())) { + vetSignature.append(vetInfo.getTitle()); + } + + if (StringUtils.isNotEmpty(vetInfo.getHospital())) { + if (vetSignature.length() > 0) { + vetSignature.append(" · "); + } + vetSignature.append(vetInfo.getHospital()); + } + + if (StringUtils.isNotEmpty(vetInfo.getWorkExperience())) { + if (vetSignature.length() > 0) { + vetSignature.append(" · "); + } + vetSignature.append("执业经验:").append(vetInfo.getWorkExperience()); + } + + // 如果有兽医信息,则添加到回复内容中 + if (vetSignature.length() > 0) { + String originalContent = vetComments.getContent(); + String vetInfoStr = "\n\n---\n" + vetSignature.toString(); + + // 检查是否已经包含兽医信息,避免重复添加 + if (originalContent != null && !originalContent.contains("---\n")) { + vetComments.setContent(originalContent + vetInfoStr); + log.info("已在回复内容中追加兽医信息:{}", vetSignature.toString()); + } else if (originalContent == null) { + vetComments.setContent(vetInfoStr.substring(2)); // 去掉开头的换行符 + } + } + } + + return vetComments; + } + + /** + * 为已有的评论记录填充兽医信息 + * 用于查询时,如果发现字段为空,从兽医表补充信息 + */ + private void fillVetInfoToComment(VetComments comment) { + if (comment == null || comment.getUserId() == null) { + return; + } + + try { + // 如果字段已经存在,跳过 + if (StringUtils.isNotEmpty(comment.getTitle()) && + StringUtils.isNotEmpty(comment.getHospital()) && + StringUtils.isNotEmpty(comment.getExperience())) { + return; + } + + // 获取兽医个人信息 + VetPersonalInfo vetInfo = vetPersonalInfoService.selectVetPersonalInfoByUserId(comment.getUserId()); + + if (vetInfo != null) { + boolean needUpdate = false; + + // 检查并填充缺失的字段 + if (StringUtils.isEmpty(comment.getTitle()) && StringUtils.isNotEmpty(vetInfo.getTitle())) { + comment.setTitle(vetInfo.getTitle()); + needUpdate = true; + } + + if (StringUtils.isEmpty(comment.getHospital()) && StringUtils.isNotEmpty(vetInfo.getHospital())) { + comment.setHospital(vetInfo.getHospital()); + needUpdate = true; + } + + if (StringUtils.isEmpty(comment.getExperience()) && StringUtils.isNotEmpty(vetInfo.getWorkExperience())) { + comment.setExperience(vetInfo.getWorkExperience()); + needUpdate = true; + } + + // 如果补充了信息,更新数据库 + if (needUpdate) { + VetComments updateData = new VetComments(); + updateData.setId(comment.getId()); + updateData.setTitle(comment.getTitle()); + updateData.setHospital(comment.getHospital()); + updateData.setExperience(comment.getExperience()); + + vetCommentsMapper.updateVetComments(updateData); + log.info("已为历史回复记录补充兽医信息,评论ID:{}", comment.getId()); + } + } + + } catch (Exception e) { + log.error("填充兽医信息到评论失败,评论ID:{},用户ID:{}", comment.getId(), comment.getUserId(), e); + } + } + + /** + * 获取兽医信息标签(用于前端显示) + */ + public String getVetInfoTags(Long userId) { + try { + VetPersonalInfo vetInfo = vetPersonalInfoService.selectVetPersonalInfoByUserId(userId); + + if (vetInfo != null) { + StringBuilder tags = new StringBuilder(); + + if (StringUtils.isNotEmpty(vetInfo.getTitle())) { + tags.append("").append(vetInfo.getTitle()).append(""); + } + + if (StringUtils.isNotEmpty(vetInfo.getHospital())) { + tags.append("").append(vetInfo.getHospital()).append(""); + } + + if (StringUtils.isNotEmpty(vetInfo.getWorkExperience())) { + tags.append("执业").append(vetInfo.getWorkExperience()).append(""); + } + + return tags.toString(); + } + } catch (Exception e) { + log.error("获取兽医信息标签失败,用户ID:{}", userId, e); + } + + return ""; + } + + /** + * 根据问诊单ID获取回复列表(包含兽医信息) + */ + public List getCommentsByConsultationId(Long consultationId) { + VetComments query = new VetComments(); + query.setConsultationId(consultationId); + return selectVetCommentsList(query); + } + + /** + * 检查用户是否为兽医 + */ + public boolean isUserVet(Long userId) { + if (userId == null) { + return false; + } + + try { + VetPersonalInfo vetInfo = vetPersonalInfoService.selectVetPersonalInfoByUserId(userId); + return vetInfo != null; + } catch (Exception e) { + log.error("检查用户是否为兽医失败,用户ID:{}", userId, e); + return false; + } + } + + /** + * 修改兽医回复 + * + * @param vetComments 兽医回复 + * @return 结果 + */ + @Override + public int updateVetComments(VetComments vetComments) + { + boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*"); + + if (SecurityUtils.hasRole("vetnotshenhe") && !isAdmin) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + // 先查询原始数据 + VetComments originalForm = vetCommentsMapper.selectVetCommentsById(vetComments.getId()); + if (originalForm != null && !originalForm.getUserId().equals(loginUser.getUserId())) { + throw new RuntimeException("只能修改自己的回复"); + } + } + } + + return vetCommentsMapper.updateVetComments(vetComments); + } + + /** + * 批量删除兽医回复 + * + * @param ids 需要删除的兽医回复主键 + * @return 结果 + */ + @Override + public int deleteVetCommentsByIds(Long[] ids) + { + boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*"); + + if (SecurityUtils.hasRole("vetnotshenhe") && !isAdmin) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + for (Long Id : ids) { + VetComments form = vetCommentsMapper.selectVetCommentsById(Id); + if (form != null && !form.getUserId().equals(loginUser.getUserId())) { + throw new RuntimeException("只能删除自己的回复"); + } + } + } + } + + return vetCommentsMapper.deleteVetCommentsByIds(ids); + } + + /** + * 删除兽医回复信息 + * + * @param id 兽医回复主键 + * @return 结果 + */ + @Override + public int deleteVetCommentsById(Long id) + { + boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*"); + + if (SecurityUtils.hasRole("vetnotshenhe") && !isAdmin) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + VetComments form = vetCommentsMapper.selectVetCommentsById(id); + if (form != null && !form.getUserId().equals(loginUser.getUserId())) { + throw new RuntimeException("只能删除自己的回复"); + } + } + } + + return vetCommentsMapper.deleteVetCommentsById(id); + } +} \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetExpertsServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetExpertsServiceImpl.java new file mode 100644 index 0000000..cc6e872 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetExpertsServiceImpl.java @@ -0,0 +1,458 @@ +package com.chenhai.vet.service.impl; + +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.chenhai.common.core.domain.model.LoginUser; +import com.chenhai.common.utils.SecurityUtils; +import com.chenhai.system.service.ISysUserService; +import com.chenhai.vet.mapper.VetExpertsMapper; +import com.chenhai.vet.mapper.VetPersonalInfoMapper; +import com.chenhai.vet.domain.VetExperts; +import com.chenhai.vet.domain.VetPersonalInfo; +import com.chenhai.vet.service.IVetExpertsService; + +/** + * 专家信息Service业务层处理 + * + * @author ruoyi + * @date 2026-01-08 + */ +@Service +public class VetExpertsServiceImpl implements IVetExpertsService +{ + @Autowired + private VetExpertsMapper vetExpertsMapper; + + @Autowired + private VetPersonalInfoMapper vetPersonalInfoMapper; + + @Autowired + private ISysUserService sysUserService; + + /** + * 查询专家信息 + * + * @param expertId 专家信息主键 + * @return 专家信息 + */ + @Override + public VetExperts selectVetExpertsByExpertId(Long expertId) + { + VetExperts expert = vetExpertsMapper.selectVetExpertsByExpertId(expertId); + if (expert != null) { + // 更新在线状态 + updateOnlineStatus(expert); + // 如果userId不为空,尝试从兽医表获取数据 + if (expert.getUserId() != null) { + autoFillFromVetInfo(expert); + } + // 确保显示默认值 + setDefaultValues(expert); + } + return expert; + } + + /** + * 查询专家信息列表(在线状态在前) + * + * @param vetExperts 专家信息 + * @return 专家信息 + */ + @Override + public List selectVetExpertsList(VetExperts vetExperts) + { + + List list = vetExpertsMapper.selectVetExpertsList(vetExperts); + if (list != null) { + for (VetExperts expert : list) { + // 更新在线状态 + updateOnlineStatus(expert); + // 如果userId不为空,尝试从兽医表获取数据 + if (expert.getUserId() != null) { + autoFillFromVetInfo(expert); + } + // 确保显示默认值 + setDefaultValues(expert); + } + } + return list; + } + + /** + * 新增专家信息 + * + * @param vetExperts 专家信息 + * @return 结果 + */ + @Override + @Transactional + public int insertVetExperts(VetExperts vetExperts) + { + // 1. 确保设置userId(优先使用传入的,其次使用当前登录用户) + ensureUserId(vetExperts); + + // 2. 设置在线状态(新增时默认为在线) + vetExperts.setIsOnline("在线"); // 改为汉字"在线" + + // 3. 设置排序值(在线排在前面) + vetExperts.setSortOrder(1L); // 在线专家排序值较高 + + // 4. 自动填充默认值(包含从兽医信息表获取数据) + autoFillDefaultValues(vetExperts); + + // 5. 设置默认值(如果从兽医表获取后仍然为空) + setDefaultValues(vetExperts); + + // 6. 设置创建时间和更新时间 + Date now = new Date(); + vetExperts.setCreatedAt(now); + vetExperts.setUpdatedAt(now); + + // 7. 设置操作人 + setAuditInfo(vetExperts); + + return vetExpertsMapper.insertVetExperts(vetExperts); + } + + /** + * 修改专家信息 + * + * @param vetExperts 专家信息 + * @return 结果 + */ + @Override + @Transactional + public int updateVetExperts(VetExperts vetExperts) + { + // 1. 确保userId不为空 + ensureUserId(vetExperts); + + // 2. 更新在线状态 + updateOnlineStatus(vetExperts); + + // 3. 自动填充默认值 + autoFillDefaultValues(vetExperts); + + // 4. 设置默认值(如果从兽医表获取后仍然为空) + setDefaultValues(vetExperts); + + // 5. 设置更新时间 + vetExperts.setUpdatedAt(new Date()); + + // 6. 设置更新人 + setUpdateAuditInfo(vetExperts); + + return vetExpertsMapper.updateVetExperts(vetExperts); + } + + /** + * 更新在线状态(如果当前登录用户是该专家,则设置为在线) + */ + private void updateOnlineStatus(VetExperts vetExperts) { + if (vetExperts == null || vetExperts.getUserId() == null) { + return; + } + + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + // 如果当前登录用户就是该专家,设置为在线 + if (loginUser.getUserId().equals(vetExperts.getUserId())) { + vetExperts.setIsOnline("在线"); + vetExperts.setSortOrder(1L); // 在线状态排序值高 + } else { + vetExperts.setIsOnline("离线"); + vetExperts.setSortOrder(0L); // 离线状态排序值低 + } + } else { + // 没有登录用户,设置为离线 + vetExperts.setIsOnline("离线"); + vetExperts.setSortOrder(0L); + } + } + + /** + * 确保设置userId + */ + private void ensureUserId(VetExperts vetExperts) { + if (vetExperts.getUserId() == null) { + // 尝试获取当前登录用户ID + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + vetExperts.setUserId(loginUser.getUserId()); + } + } + } + + /** + * 设置审计信息 + */ + private void setAuditInfo(VetExperts vetExperts) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + vetExperts.setCreateBy(loginUser.getUsername()); + vetExperts.setUpdateBy(loginUser.getUsername()); + } + } + + /** + * 设置更新审计信息 + */ + private void setUpdateAuditInfo(VetExperts vetExperts) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + vetExperts.setUpdateBy(loginUser.getUsername()); + } + } + + /** + * 自动填充默认值(智能填充) + */ + private void autoFillDefaultValues(VetExperts vetExperts) { + // 先尝试从兽医信息表获取数据 + if (vetExperts.getUserId() != null) { + fillFromVetPersonalInfo(vetExperts); + } + } + + /** + * 从兽医个人信息表获取数据 + */ + private void fillFromVetPersonalInfo(VetExperts vetExperts) { + if (vetExperts.getUserId() == null) { + return; + } + + VetPersonalInfo vetInfo = vetPersonalInfoMapper.selectVetPersonalInfoByUserId(vetExperts.getUserId()); + if (vetInfo == null) { + return; + } + + // 1. 真实姓名 + if (isFieldEmpty(vetExperts.getRealName()) && !isFieldEmpty(vetInfo.getRealName())) { + vetExperts.setRealName(vetInfo.getRealName()); + } + + // 2. 联系电话 + if (isFieldEmpty(vetExperts.getIphone())) { + if (!isFieldEmpty(vetInfo.getIphone())) { + vetExperts.setIphone(vetInfo.getIphone()); + } else if (!isFieldEmpty(vetInfo.getPhone())) { + vetExperts.setIphone(vetInfo.getPhone()); + } + } + + // 3. 电子邮箱 + if (isFieldEmpty(vetExperts.getEmail()) && !isFieldEmpty(vetInfo.getEmail())) { + vetExperts.setEmail(vetInfo.getEmail()); + } + + // 4. 职称 + if (isFieldEmpty(vetExperts.getTitle()) && !isFieldEmpty(vetInfo.getTitle())) { + vetExperts.setTitle(vetInfo.getTitle()); + } + + // 5. 从业经验 + if (isFieldEmpty(vetExperts.getWorkExperience()) && !isFieldEmpty(vetInfo.getWorkExperience())) { + vetExperts.setWorkExperience(vetInfo.getWorkExperience()); + } + + // 6. 专家类型 + if (isFieldEmpty(vetExperts.getExpert()) && !isFieldEmpty(vetInfo.getExpertType())) { + vetExperts.setExpert(vetInfo.getExpertType()); + } + + // 7. 擅长领域 + if (isFieldEmpty(vetExperts.getExpertiseArea()) && !isFieldEmpty(vetInfo.getSpecialty())) { + vetExperts.setExpertiseArea(vetInfo.getSpecialty()); + } + + // 8. 工作单位 + if (isFieldEmpty(vetExperts.getAddress())) { + if (!isFieldEmpty(vetInfo.getHospital())) { + vetExperts.setAddress(vetInfo.getHospital()); + } else if (!isFieldEmpty(vetInfo.getAddress())) { + vetExperts.setAddress(vetInfo.getAddress()); + } + } + + // 9. 头像(如果有的话) + if (isFieldEmpty(vetExperts.getAvatar()) && vetInfo.getUser() != null + && !isFieldEmpty(vetInfo.getUser().getAvatar())) { + vetExperts.setAvatar(vetInfo.getUser().getAvatar()); + } + } + + /** + * 从兽医信息补充数据(查询时使用) + */ + private void autoFillFromVetInfo(VetExperts expert) { + if (expert.getUserId() == null) { + return; + } + + // 如果专家信息中某些字段是默认值,尝试从兽医表获取 + VetPersonalInfo vetInfo = vetPersonalInfoMapper.selectVetPersonalInfoByUserId(expert.getUserId()); + if (vetInfo == null) { + return; + } + + // 真实姓名 + if ("未填写".equals(expert.getRealName()) && !isFieldEmpty(vetInfo.getRealName())) { + expert.setRealName(vetInfo.getRealName()); + } + + // 联系电话 + if ("未填写".equals(expert.getIphone())) { + if (!isFieldEmpty(vetInfo.getIphone())) { + expert.setIphone(vetInfo.getIphone()); + } else if (!isFieldEmpty(vetInfo.getPhone())) { + expert.setIphone(vetInfo.getPhone()); + } + } + + // 电子邮箱 + if ("未填写".equals(expert.getEmail()) && !isFieldEmpty(vetInfo.getEmail())) { + expert.setEmail(vetInfo.getEmail()); + } + + // 职称 + if ("未设置".equals(expert.getTitle()) && !isFieldEmpty(vetInfo.getTitle())) { + expert.setTitle(vetInfo.getTitle()); + } + + // 从业经验 + if ("暂无".equals(expert.getWorkExperience()) && !isFieldEmpty(vetInfo.getWorkExperience())) { + expert.setWorkExperience(vetInfo.getWorkExperience()); + } + + // 专家类型 + if ("普通专家".equals(expert.getExpert()) && !isFieldEmpty(vetInfo.getExpertType())) { + expert.setExpert(vetInfo.getExpertType()); + } + + // 擅长领域 + if ("待补充".equals(expert.getExpertiseArea()) && !isFieldEmpty(vetInfo.getSpecialty())) { + expert.setExpertiseArea(vetInfo.getSpecialty()); + } + + // 工作单位 + if ("待补充".equals(expert.getAddress())) { + if (!isFieldEmpty(vetInfo.getHospital())) { + expert.setAddress(vetInfo.getHospital()); + } else if (!isFieldEmpty(vetInfo.getAddress())) { + expert.setAddress(vetInfo.getAddress()); + } + } + } + + /** + * 设置默认值(修改了在线状态和排序的默认值) + */ + private void setDefaultValues(VetExperts vetExperts) { + // 1. 如果真实姓名为空 + if (isFieldEmpty(vetExperts.getRealName())) { + vetExperts.setRealName("未填写"); + } + + // 2. 如果联系电话为空 + if (isFieldEmpty(vetExperts.getIphone())) { + vetExperts.setIphone("未填写"); + } + + // 3. 如果电子邮箱为空 + if (isFieldEmpty(vetExperts.getEmail())) { + vetExperts.setEmail("未填写"); + } + + // 4. 如果职称为空 + if (isFieldEmpty(vetExperts.getTitle())) { + vetExperts.setTitle("未设置"); + } + + // 5. 如果从业经验为空 + if (isFieldEmpty(vetExperts.getWorkExperience())) { + vetExperts.setWorkExperience("暂无"); + } + + // 6. 如果专家类型为空 + if (isFieldEmpty(vetExperts.getExpert())) { + vetExperts.setExpert("普通专家"); + } + + // 7. 如果擅长领域为空 + if (isFieldEmpty(vetExperts.getExpertiseArea())) { + vetExperts.setExpertiseArea("待补充"); + } + + // 8. 如果工作单位为空 + if (isFieldEmpty(vetExperts.getAddress())) { + vetExperts.setAddress("待补充"); + } + + // 9. 如果头像为空,设置默认头像 + if (isFieldEmpty(vetExperts.getAvatar())) { + vetExperts.setAvatar("/profile/avatar/default.jpg"); + } + + // 10. 如果在线状态为空,需要根据登录状态设置 + if (isFieldEmpty(vetExperts.getIsOnline())) { + // 检查当前登录用户是否是该专家 + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null && vetExperts.getUserId() != null + && loginUser.getUserId().equals(vetExperts.getUserId())) { + vetExperts.setIsOnline("在线"); // 当前登录用户是在线 + } else { + vetExperts.setIsOnline("离线"); // 离线 + } + } + + // 11. 如果状态为空,设置默认正常 + if (isFieldEmpty(vetExperts.getStatus())) { + vetExperts.setStatus("0"); + } + + // 12. 如果排序为空,根据在线状态设置排序值 + if (vetExperts.getSortOrder() == null) { + if ("在线".equals(vetExperts.getIsOnline())) { + vetExperts.setSortOrder(1L); // 在线排在前面 + } else { + vetExperts.setSortOrder(0L); // 离线排在后面 + } + } + } + + /** + * 检查字段是否为空 + */ + private boolean isFieldEmpty(String field) { + return field == null || field.trim().isEmpty(); + } + + /** + * 批量删除专家信息 + * + * @param expertIds 需要删除的专家信息主键 + * @return 结果 + */ + @Override + public int deleteVetExpertsByExpertIds(Long[] expertIds) + { + return vetExpertsMapper.deleteVetExpertsByExpertIds(expertIds); + } + + /** + * 删除专家信息信息 + * + * @param expertId 专家信息主键 + * @return 结果 + */ + @Override + public int deleteVetExpertsByExpertId(Long expertId) + { + return vetExpertsMapper.deleteVetExpertsByExpertId(expertId); + } +} \ No newline at end of file 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 0e9d26e..6cbe08e 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.core.domain.entity.SysUser; +import com.chenhai.common.core.domain.model.LoginUser; import com.chenhai.common.utils.DateUtils; +import com.chenhai.common.utils.SecurityUtils; 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 com.chenhai.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; import java.util.List; @@ -16,101 +21,159 @@ import java.util.stream.Collectors; /** * 兽医个人信息Service业务层处理 - * + * * @author ruoyi * @date 2025-12-29 */ @Service -public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService -{ +public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService { @Autowired private VetPersonalInfoMapper vetPersonalInfoMapper; + @Autowired private VetCertificateMapper vetCertificateMapper; + @Autowired + private ISysUserService sysUserService; + /** - * 查询兽医个人信息 - * - * @param id 兽医个人信息主键 - * @return 兽医个人信息 + * 查询兽医个人信息(包含用户信息) */ @Override - public VetPersonalInfo selectVetPersonalInfoById(Long id) - { - return vetPersonalInfoMapper.selectVetPersonalInfoById(id); + public VetPersonalInfo selectVetPersonalInfoById(Long id) { + VetPersonalInfo info = vetPersonalInfoMapper.selectVetPersonalInfoById(id); + // 如果关联查询没有加载用户信息,手动加载 + fillUserInfo(info); + return info; } /** - * 查询兽医个人信息列表 - * - * @param vetPersonalInfo 兽医个人信息 - * @return 兽医个人信息 + * 查询兽医个人信息列表(包含用户信息) */ @Override - public List selectVetPersonalInfoList(VetPersonalInfo vetPersonalInfo) - { - return vetPersonalInfoMapper.selectVetPersonalInfoList(vetPersonalInfo); + public List selectVetPersonalInfoList(VetPersonalInfo vetPersonalInfo) { + List list = vetPersonalInfoMapper.selectVetPersonalInfoList(vetPersonalInfo); + // 为每个记录填充用户信息 + if (list != null) { + list.forEach(this::fillUserInfo); + } + return list; } /** * 新增兽医个人信息 - * - * @param vetPersonalInfo 兽医个人信息 - * @return 结果 */ @Override - public int insertVetPersonalInfo(VetPersonalInfo vetPersonalInfo) - { - vetPersonalInfo.setCreateTime(DateUtils.getNowDate()); - return vetPersonalInfoMapper.insertVetPersonalInfo(vetPersonalInfo); + @Transactional + public int insertVetPersonalInfo(VetPersonalInfo vetPersonalInfo) { + // 获取当前登录用户信息 + LoginUser loginUser = SecurityUtils.getLoginUser(); + + if (loginUser != null) { + // 1. 强制绑定当前登录用户ID + vetPersonalInfo.setUserId(loginUser.getUserId()); + + // 2. 设置创建者和更新者 + vetPersonalInfo.setCreateBy(loginUser.getUsername()); + vetPersonalInfo.setUpdateBy(loginUser.getUsername()); + + // 3. 从用户表获取其他信息 + SysUser currentUser = sysUserService.selectUserById(loginUser.getUserId()); + if (currentUser != null) { + // 如果昵称为空,使用用户昵称 + if ((vetPersonalInfo.getNickName() == null || vetPersonalInfo.getNickName().isEmpty()) + && currentUser.getNickName() != null) { + vetPersonalInfo.setNickName(currentUser.getNickName()); + } + + // 如果性别为空,使用用户性别 + if ((vetPersonalInfo.getGender() == null || vetPersonalInfo.getGender().isEmpty()) + && currentUser.getSex() != null) { + vetPersonalInfo.setGender(currentUser.getSex()); + } + + // 如果邮箱为空,使用用户邮箱 + if ((vetPersonalInfo.getEmail() == null || vetPersonalInfo.getEmail().isEmpty()) + && currentUser.getEmail() != null) { + vetPersonalInfo.setEmail(currentUser.getEmail()); + } + + // 如果电话为空,使用用户手机号 + if ((vetPersonalInfo.getPhone() == null || vetPersonalInfo.getPhone().isEmpty()) + && currentUser.getPhonenumber() != null) { + vetPersonalInfo.setPhone(currentUser.getPhonenumber()); + } + } + + // 4. 设置创建时间和更新时间 + vetPersonalInfo.setCreateTime(DateUtils.getNowDate()); + vetPersonalInfo.setUpdateTime(DateUtils.getNowDate()); + + // 5. 检查是否已存在该用户的兽医信息 + VetPersonalInfo existing = vetPersonalInfoMapper.selectVetPersonalInfoByUserId(vetPersonalInfo.getUserId()); + if (existing != null) { + throw new RuntimeException("该用户已存在兽医信息,请使用更新操作"); + } + + return vetPersonalInfoMapper.insertVetPersonalInfo(vetPersonalInfo); + } else { + throw new RuntimeException("用户未登录"); + } } /** * 修改兽医个人信息 - * - * @param vetPersonalInfo 兽医个人信息 - * @return 结果 */ @Override - public int updateVetPersonalInfo(VetPersonalInfo vetPersonalInfo) - { - vetPersonalInfo.setUpdateTime(DateUtils.getNowDate()); - return vetPersonalInfoMapper.updateVetPersonalInfo(vetPersonalInfo); - } + @Transactional + public int updateVetPersonalInfo(VetPersonalInfo vetPersonalInfo) { + LoginUser loginUser = SecurityUtils.getLoginUser(); - /** - * 批量删除兽医个人信息 - * - * @param ids 需要删除的兽医个人信息主键 - * @return 结果 - */ - @Override - public int deleteVetPersonalInfoByIds(Long[] ids) - { - return vetPersonalInfoMapper.deleteVetPersonalInfoByIds(ids); + if (loginUser != null) { + // 1. 验证权限:确保当前用户只能修改自己的信息 + VetPersonalInfo existing = vetPersonalInfoMapper.selectVetPersonalInfoById(vetPersonalInfo.getId()); + if (existing != null && !existing.getUserId().equals(loginUser.getUserId())) { + throw new RuntimeException("无权限修改其他用户的兽医信息"); + } + + // 2. 强制绑定当前登录用户ID + vetPersonalInfo.setUserId(loginUser.getUserId()); + + // 3. 设置更新者 + vetPersonalInfo.setUpdateBy(loginUser.getUsername()); + + // 4. 设置更新时间 + vetPersonalInfo.setUpdateTime(DateUtils.getNowDate()); + + return vetPersonalInfoMapper.updateVetPersonalInfo(vetPersonalInfo); + } else { + throw new RuntimeException("用户未登录"); + } } /** - * 删除兽医个人信息信息 - * - * @param id 兽医个人信息主键 - * @return 结果 + * 根据用户ID查询兽医个人信息 */ @Override - public int deleteVetPersonalInfoById(Long id) - { - return vetPersonalInfoMapper.deleteVetPersonalInfoById(id); + public VetPersonalInfo selectVetPersonalInfoByUserId(Long userId) { + if (userId == null) { + return null; + } + + VetPersonalInfo info = vetPersonalInfoMapper.selectVetPersonalInfoByUserId(userId); + fillUserInfo(info); + return info; } /** - * 获取兽医的完整信息(包含证书详情) + * 获取兽医的完整信息(包含证书详情和用户信息) */ @Override public Map getVetFullInfo(Long vetId) { Map result = new HashMap<>(); - // 1. 获取兽医个人信息 - VetPersonalInfo personalInfo = vetPersonalInfoMapper.selectVetPersonalInfoById(vetId); + // 1. 获取兽医个人信息(包含用户信息) + VetPersonalInfo personalInfo = this.selectVetPersonalInfoById(vetId); if (personalInfo == null) { return result; } @@ -148,31 +211,33 @@ public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService } /** - * 根据用户ID获取兽医信息(包含证书) + * 根据用户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()) { + // 1. 获取兽医个人信息(包含用户信息) + VetPersonalInfo personalInfo = this.selectVetPersonalInfoByUserId(userId); + if (personalInfo == null) { + // 如果没有兽医信息,只返回用户信息 + SysUser user = sysUserService.selectUserById(userId); + if (user != null) { + result.put("userInfo", user); + } return result; } - VetPersonalInfo personalInfo = personalInfos.get(0); result.put("personalInfo", personalInfo); + result.put("userInfo", personalInfo.getUser()); - // 获取证书列表 + // 2. 获取证书列表 VetCertificate certificateQuery = new VetCertificate(); certificateQuery.setUserId(userId); 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() @@ -186,18 +251,118 @@ public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService return result; } + /** + * 批量删除兽医个人信息 + */ + @Override + public int deleteVetPersonalInfoByIds(Long[] ids) { + return vetPersonalInfoMapper.deleteVetPersonalInfoByIds(ids); + } + + /** + * 删除兽医个人信息 + */ @Override - public VetPersonalInfo selectVetPersonalInfoByUserId(Long userId) { - if (userId == null) { - return null; - } + public int deleteVetPersonalInfoById(Long id) { + return vetPersonalInfoMapper.deleteVetPersonalInfoById(id); + } + + /** + * 填充用户信息到兽医信息中 + */ + private void fillUserInfo(VetPersonalInfo vetInfo) { + if (vetInfo != null && vetInfo.getUser() == null && vetInfo.getUserId() != null) { + try { + SysUser user = sysUserService.selectUserById(vetInfo.getUserId()); + vetInfo.setUser(user); + + // 检查是否需要同步到数据库 + boolean needUpdate = false; + + // 用户表 → 兽医表同步:如果兽医表的nickName与用户表不一致 + if (user.getNickName() != null && !user.getNickName().equals(vetInfo.getNickName())) { + vetInfo.setNickName(user.getNickName()); + needUpdate = true; + } - VetPersonalInfo query = new VetPersonalInfo(); - query.setUserId(userId); - List list = vetPersonalInfoMapper.selectVetPersonalInfoList(query); - return list != null && !list.isEmpty() ? list.get(0) : null; + // 如果邮箱为空,使用用户邮箱 + if ((vetInfo.getEmail() == null || vetInfo.getEmail().isEmpty()) && user.getEmail() != null) { + vetInfo.setEmail(user.getEmail()); + needUpdate = true; + } + + // 如果电话为空,使用用户手机号 + if ((vetInfo.getPhone() == null || vetInfo.getPhone().isEmpty()) && user.getPhonenumber() != null) { + vetInfo.setPhone(user.getPhonenumber()); + needUpdate = true; + } + + // 如果需要更新,同步到数据库 + if (needUpdate) { + syncVetInfoFromUser(vetInfo); + } + + } catch (Exception e) { + System.err.println("填充用户信息失败,用户ID: " + vetInfo.getUserId() + ", 错误: " + e.getMessage()); + } + } } -} + /** + * 从用户信息同步到兽医表 + */ + private void syncVetInfoFromUser(VetPersonalInfo vetInfo) { + if (vetInfo == null || vetInfo.getId() == null) { + return; + } + + try { + // 只更新需要同步的字段 + VetPersonalInfo updateInfo = new VetPersonalInfo(); + updateInfo.setId(vetInfo.getId()); + + if (vetInfo.getNickName() != null) { + updateInfo.setNickName(vetInfo.getNickName()); + } + if (vetInfo.getEmail() != null) { + updateInfo.setEmail(vetInfo.getEmail()); + } + if (vetInfo.getPhone() != null) { + updateInfo.setPhone(vetInfo.getPhone()); + } + + // 设置更新时间 + updateInfo.setUpdateTime(DateUtils.getNowDate()); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + updateInfo.setUpdateBy(loginUser.getUsername()); + } + vetPersonalInfoMapper.updateVetPersonalInfo(updateInfo); + System.out.println("已同步用户信息到兽医表,兽医ID: " + vetInfo.getId()); + } catch (Exception e) { + System.err.println("同步用户信息到兽医表失败,兽医ID: " + vetInfo.getId() + ", 错误: " + e.getMessage()); + } + } + + /** + * 同步更新用户昵称 + */ + private void syncUserNickName(Long userId, String realName) { + if (userId == null || realName == null) { + return; + } + + try { + SysUser user = sysUserService.selectUserById(userId); + if (user != null && !realName.equals(user.getNickName())) { + user.setNickName(realName); + sysUserService.updateUser(user); + } + } catch (Exception e) { + // 记录日志,但不要影响主流程 + System.err.println("同步用户昵称失败,用户ID: " + userId + ", 错误: " + e.getMessage()); + } + } +} \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/muhu/MuhuConsultationFormsMapper.xml b/chenhai-system/src/main/resources/mapper/muhu/MuhuConsultationFormsMapper.xml new file mode 100644 index 0000000..106bce4 --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/muhu/MuhuConsultationFormsMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select form_id, farmer_name, user_id, title, description, animal_type, animal_age, animal_gender, images, status, is_sensitive, sensitive_words, view_count, reply_count, created_time, avatar from muhu_consultation_forms + + + + + + + + insert into muhu_consultation_forms + + farmer_name, + user_id, + title, + description, + animal_type, + animal_age, + animal_gender, + status, + is_sensitive, + sensitive_words, + view_count, + reply_count, + avatar, + images, + created_time, + + + #{farmerName}, + #{userId}, + #{title}, + #{description}, + #{animalType}, + #{animalAge}, + #{animalGender}, + #{status}, + #{isSensitive}, + #{sensitiveWords}, + #{viewCount}, + #{replyCount}, + #{avatar}, + #{images}, + now(), + + + + + update muhu_consultation_forms + + farmer_name = #{farmerName}, + user_id = #{userId}, + title = #{title}, + description = #{description}, + animal_type = #{animalType}, + animal_age = #{animalAge}, + animal_gender = #{animalGender}, + status = #{status}, + is_sensitive = #{isSensitive}, + sensitive_words = #{sensitiveWords}, + view_count = #{viewCount}, + reply_count = #{replyCount}, + created_time = #{createdTime}, + avatar = #{avatar}, + images = #{images}, + + where form_id = #{formId} + + + + delete from muhu_consultation_forms where form_id = #{formId} + + + + delete from muhu_consultation_forms where form_id in + + #{formId} + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/system/SysExpertConsultationMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysExpertConsultationMapper.xml new file mode 100644 index 0000000..0093cb0 --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/system/SysExpertConsultationMapper.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select consultation_id, user_id, expert_id, form_id, consultation_type, consultation_status, consultation_title, initial_content, initial_attachments, messages, rating, evaluation, evaluation_tags, evaluation_time, start_time, end_time, created_time, updated_time from sys_expert_consultation + + + + + + + + insert into sys_expert_consultation + + user_id, + expert_id, + form_id, + consultation_type, + consultation_status, + consultation_title, + initial_content, + initial_attachments, + messages, + rating, + evaluation, + evaluation_tags, + evaluation_time, + start_time, + end_time, + created_time, + updated_time, + + + #{userId}, + #{expertId}, + #{formId}, + #{consultationType}, + #{consultationStatus}, + #{consultationTitle}, + #{initialContent}, + #{initialAttachments}, + #{messages}, + #{rating}, + #{evaluation}, + #{evaluationTags}, + #{evaluationTime}, + #{startTime}, + #{endTime}, + #{createdTime}, + #{updatedTime}, + + + + + update sys_expert_consultation + + user_id = #{userId}, + expert_id = #{expertId}, + form_id = #{formId}, + consultation_type = #{consultationType}, + consultation_status = #{consultationStatus}, + consultation_title = #{consultationTitle}, + initial_content = #{initialContent}, + initial_attachments = #{initialAttachments}, + messages = #{messages}, + rating = #{rating}, + evaluation = #{evaluation}, + evaluation_tags = #{evaluationTags}, + evaluation_time = #{evaluationTime}, + start_time = #{startTime}, + end_time = #{endTime}, + created_time = #{createdTime}, + updated_time = #{updatedTime}, + + where consultation_id = #{consultationId} + + + + delete from sys_expert_consultation where consultation_id = #{consultationId} + + + + delete from sys_expert_consultation where consultation_id in + + #{consultationId} + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/system/SysUserMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysUserMapper.xml index 6b04d1c..ace2a89 100644 --- a/chenhai-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/chenhai-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -64,17 +64,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.pwd_update_date, u.create_by, u.create_time, u.remark, - d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, - r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status - from sys_user u - left join sys_dept d on u.dept_id = d.dept_id - left join sys_user_role ur on u.user_id = ur.user_id - left join sys_role r on r.role_id = ur.role_id - - - + select u.user_id, u.dept_id, u.nick_name, u.user_name, + u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, + u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + d.dept_name, d.leader + from sys_user u left join sys_dept d on u.dept_id = d.dept_id where u.del_flag = '0' @@ -89,19 +95,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND u.phonenumber like concat('%', #{phonenumber}, '%') - + AND date_format(u.create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d') - + AND date_format(u.create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d') AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) - ${params.dataScope} + - + - + - + - + - + - + - + - + - insert into sys_user( - user_id, - dept_id, - user_name, - nick_name, - user_type, - email, - avatar, - phonenumber, - sex, - password, - status, - pwd_update_date, - create_by, - remark, - create_time - )values( - #{userId}, - #{deptId}, - #{userName}, - #{nickName}, - #{userType}, - #{email}, - #{avatar}, - #{phonenumber}, - #{sex}, - #{password}, - #{status}, - #{pwdUpdateDate}, - #{createBy}, - #{remark}, - sysdate() - ) + insert into sys_user( + user_id, + dept_id, + user_name, + nick_name, + user_type, + email, + avatar, + phonenumber, + sex, + password, + status, + pwd_update_date, + create_by, + remark, + create_time + )values( + #{userId}, + #{deptId}, + #{userName}, + #{nickName}, + #{userType}, + #{email}, + #{avatar}, + #{phonenumber}, + #{sex}, + #{password}, + #{status}, + #{pwdUpdateDate}, + #{createBy}, + #{remark}, + sysdate() + ) - + - update sys_user - - dept_id = #{deptId}, - nick_name = #{nickName}, - email = #{email}, - phonenumber = #{phonenumber}, - sex = #{sex}, - avatar = #{avatar}, - password = #{password}, - status = #{status}, - login_ip = #{loginIp}, - login_date = #{loginDate}, - update_by = #{updateBy}, - remark = #{remark}, - update_time = sysdate() - - where user_id = #{userId} + update sys_user + + dept_id = #{deptId}, + nick_name = #{nickName}, + email = #{email}, + phonenumber = #{phonenumber}, + sex = #{sex}, + avatar = #{avatar}, + password = #{password}, + status = #{status}, + login_ip = #{loginIp}, + login_date = #{loginDate}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + where user_id = #{userId} - + - update sys_user set status = #{status}, update_time = sysdate() where user_id = #{userId} + update sys_user set status = #{status}, update_time = sysdate() where user_id = #{userId} - + - update sys_user set avatar = #{avatar}, update_time = sysdate() where user_id = #{userId} + update sys_user set avatar = #{avatar}, update_time = sysdate() where user_id = #{userId} - - - update sys_user set login_ip = #{loginIp}, login_date = #{loginDate} where user_id = #{userId} + + + update sys_user set login_ip = #{loginIp}, login_date = #{loginDate} where user_id = #{userId} - + - update sys_user set pwd_update_date = sysdate(), password = #{password}, update_time = sysdate() where user_id = #{userId} + update sys_user set pwd_update_date = sysdate(), password = #{password}, update_time = sysdate() where user_id = #{userId} - + - update sys_user set del_flag = '2' where user_id = #{userId} - - - - update sys_user set del_flag = '2' where user_id in - - #{userId} - - - - \ No newline at end of file + update sys_user set del_flag = '2' where user_id = #{userId} + + + + update sys_user set del_flag = '2' where user_id in + + #{userId} + + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/vet/VetCommentsMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetCommentsMapper.xml new file mode 100644 index 0000000..0b5c227 --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/vet/VetCommentsMapper.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + select + id, + consultation_id, + reply_name, + content, + images, + is_sensitive, + sensitive_words, + created_at, + updated_at, + user_id, + + title, + hospital, + experience, + avatar + from vet_comments + + + + + + + + insert into vet_comments + + consultation_id, + reply_name, + content, + images, + is_sensitive, + sensitive_words, + created_at, + updated_at, + user_id, + title, + hospital, + experience, + avatar, + + + #{consultationId}, + #{replyName}, + #{content}, + #{images}, + #{isSensitive}, + #{sensitiveWords}, + #{createdAt}, + #{updatedAt}, + #{userId}, + #{title}, + #{hospital}, + #{experience}, + #{avatar}, + + + + + update vet_comments + + consultation_id = #{consultationId}, + reply_name = #{replyName}, + content = #{content}, + images = #{images}, + is_sensitive = #{isSensitive}, + sensitive_words = #{sensitiveWords}, + created_at = #{createdAt}, + updated_at = #{updatedAt}, + user_id = #{userId}, + title = #{title}, + hospital = #{hospital}, + experience = #{experience}, + avatar = #{avatar}, + + where id = #{id} + + + + delete from vet_comments where id = #{id} + + + + delete from vet_comments where id in + + #{id} + + + + + + UPDATE sys_user + SET + title = #{title}, + hospital = #{hospital}, + experience = #{experience}, + update_time = NOW() + WHERE user_id = #{userId} + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml new file mode 100644 index 0000000..08a8951 --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select expert_id, user_id, avatar, real_name, iphone, email, address, + expertise_area, is_online, remark, sort_order, status, created_at, updated_at, title, expert, work_experience + from vet_experts + + + + + + + + insert into vet_experts + + user_id, + avatar, + real_name, + iphone, + email, + address, + expertise_area, + is_online, + remark, + sort_order, + status, + created_at, + updated_at, + title, + expert, + work_experience, + + + #{userId}, + #{avatar}, + #{realName}, + #{iphone}, + #{email}, + #{address}, + #{expertiseArea}, + #{isOnline}, + #{remark}, + #{sortOrder}, + #{status}, + #{createdAt}, + #{updatedAt}, + #{title}, + #{expert}, + #{workExperience}, + + + + + update vet_experts + + user_id = #{userId}, + avatar = #{avatar}, + real_name = #{realName}, + iphone = #{iphone}, + email = #{email}, + address = #{address}, + expertise_area = #{expertiseArea}, + is_online = #{isOnline}, + remark = #{remark}, + sort_order = #{sortOrder}, + status = #{status}, + created_at = #{createdAt}, + updated_at = #{updatedAt}, + title = #{title}, + expert = #{expert}, + work_experience = #{workExperience}, + + where expert_id = #{expertId} + + + + delete from vet_experts where expert_id = #{expertId} + + + + delete from vet_experts where expert_id in + + #{expertId} + + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml index 99e4190..0560802 100644 --- a/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml +++ b/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml @@ -5,85 +5,129 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - select id, user_id, real_name, gender, birthday, id_card, specialty, work_experience, hospital, address, introduction, create_by, create_time, update_by, update_time + select id, user_id, real_name, gender, birthday, id_card, specialty, work_experience, + hospital, address, iphone, introduction, title, phone, + expert_type, email, nick_name, create_by, create_time, update_by, update_time from vet_personal_info + + + select + v.id, v.user_id, v.real_name, v.gender, v.birthday, v.id_card, v.specialty, v.work_experience, + v.hospital, v.address, v.iphone, v.introduction, v.title, v.phone, + v.expert_type, v.email, v.nick_name, v.create_by, v.create_time, v.update_by, v.update_time, + u.user_id as u_user_id, + u.nick_name as u_nick_name, + u.email as u_email + from vet_personal_info v + left join sys_user u on v.user_id = u.user_id + + + + + + + + insert into vet_personal_info user_id, - real_name, - gender, + real_name, + gender, birthday, - id_card, - specialty, - work_experience, - hospital, - address, - introduction, + id_card, + specialty, + work_experience, + hospital, + address, + iphone, + introduction, + title, + phone, + expert_type, + email, + nick_name, create_by, create_time, update_by, @@ -91,15 +135,21 @@ #{userId}, - #{realName}, - #{gender}, + #{realName}, + #{gender}, #{birthday}, - #{idCard}, - #{specialty}, - #{workExperience}, - #{hospital}, - #{address}, - #{introduction}, + #{idCard}, + #{specialty}, + #{workExperience}, + #{hospital}, + #{address}, + #{iphone}, + #{introduction}, + #{title}, + #{phone}, + #{expertType}, + #{email}, + #{nickName}, #{createBy}, #{createTime}, #{updateBy}, @@ -107,39 +157,41 @@ + update vet_personal_info user_id = #{userId}, - real_name = #{realName}, - gender = #{gender}, - iphone = #{iphone}, + real_name = #{realName}, + gender = #{gender}, birthday = #{birthday}, - id_card = #{idCard}, - specialty = #{specialty}, - work_experience = #{workExperience}, - address = #{address}, - introduction = #{introduction}, + id_card = #{idCard}, + specialty = #{specialty}, + work_experience = #{workExperience}, + hospital = #{hospital}, + address = #{address}, + iphone = #{iphone}, + introduction = #{introduction}, + title = #{title}, + phone = #{phone}, + expert_type = #{expertType}, + email = #{email}, + nick_name = #{nickName}, update_by = #{updateBy}, update_time = #{updateTime}, where id = #{id} + delete from vet_personal_info where id = #{id} - + delete from vet_personal_info where id in #{id} - - \ No newline at end of file diff --git a/chenhai-ui/src/api/muhu/consultation.js b/chenhai-ui/src/api/muhu/consultation.js new file mode 100644 index 0000000..f084e6d --- /dev/null +++ b/chenhai-ui/src/api/muhu/consultation.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询问诊单列表 +export function listConsultation(query) { + return request({ + url: '/muhu/consultation/list', + method: 'get', + params: query + }) +} + +// 查询问诊单详细 +export function getConsultation(formId) { + return request({ + url: '/muhu/consultation/' + formId, + method: 'get' + }) +} + +// 新增问诊单 +export function addConsultation(data) { + return request({ + url: '/muhu/consultation', + method: 'post', + data: data + }) +} + +// 修改问诊单 +export function updateConsultation(data) { + return request({ + url: '/muhu/consultation', + method: 'put', + data: data + }) +} + +// 删除问诊单 +export function delConsultation(formId) { + return request({ + url: '/muhu/consultation/' + formId, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/api/system/consultation.js b/chenhai-ui/src/api/system/consultation.js new file mode 100644 index 0000000..55c4222 --- /dev/null +++ b/chenhai-ui/src/api/system/consultation.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询专家咨询列表 +export function listConsultation(query) { + return request({ + url: '/system/consultation/list', + method: 'get', + params: query + }) +} + +// 查询专家咨询详细 +export function getConsultation(consultationId) { + return request({ + url: '/system/consultation/' + consultationId, + method: 'get' + }) +} + +// 新增专家咨询 +export function addConsultation(data) { + return request({ + url: '/system/consultation', + method: 'post', + data: data + }) +} + +// 修改专家咨询 +export function updateConsultation(data) { + return request({ + url: '/system/consultation', + method: 'put', + data: data + }) +} + +// 删除专家咨询 +export function delConsultation(consultationId) { + return request({ + url: '/system/consultation/' + consultationId, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/api/vet/comments.js b/chenhai-ui/src/api/vet/comments.js index 7ab2481..ec4139c 100644 --- a/chenhai-ui/src/api/vet/comments.js +++ b/chenhai-ui/src/api/vet/comments.js @@ -10,9 +10,9 @@ export function listComments(query) { } // 查询兽医回复详细 -export function getComments(commentId) { +export function getComments(id) { return request({ - url: '/vet/comments/' + commentId, + url: '/vet/comments/' + id, method: 'get' }) } @@ -36,9 +36,9 @@ export function updateComments(data) { } // 删除兽医回复 -export function delComments(commentId) { +export function delComments(id) { return request({ - url: '/vet/comments/' + commentId, + url: '/vet/comments/' + id, method: 'delete' }) } diff --git a/chenhai-ui/src/api/vet/experts.js b/chenhai-ui/src/api/vet/experts.js new file mode 100644 index 0000000..8cd38c3 --- /dev/null +++ b/chenhai-ui/src/api/vet/experts.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询专家信息列表 +export function listExperts(query) { + return request({ + url: '/vet/experts/list', + method: 'get', + params: query + }) +} + +// 查询专家信息详细 +export function getExperts(expertId) { + return request({ + url: '/vet/experts/' + expertId, + method: 'get' + }) +} + +// 新增专家信息 +export function addExperts(data) { + return request({ + url: '/vet/experts', + method: 'post', + data: data + }) +} + +// 修改专家信息 +export function updateExperts(data) { + return request({ + url: '/vet/experts', + method: 'put', + data: data + }) +} + +// 删除专家信息 +export function delExperts(expertId) { + return request({ + url: '/vet/experts/' + expertId, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/views/muhu/consultation/index.vue b/chenhai-ui/src/views/muhu/consultation/index.vue new file mode 100644 index 0000000..41b6a4b --- /dev/null +++ b/chenhai-ui/src/views/muhu/consultation/index.vue @@ -0,0 +1,367 @@ + + + diff --git a/chenhai-ui/src/views/system/consultation/index.vue b/chenhai-ui/src/views/system/consultation/index.vue new file mode 100644 index 0000000..b93cd82 --- /dev/null +++ b/chenhai-ui/src/views/system/consultation/index.vue @@ -0,0 +1,460 @@ + + + diff --git a/chenhai-ui/src/views/system/user/profile/userInfo.vue b/chenhai-ui/src/views/system/user/profile/userInfo.vue index 486adfc..2ec418a 100644 --- a/chenhai-ui/src/views/system/user/profile/userInfo.vue +++ b/chenhai-ui/src/views/system/user/profile/userInfo.vue @@ -2,7 +2,7 @@ - + @@ -62,7 +62,17 @@ export default { user: { handler(user) { if (user) { - this.form = { nickName: user.nickName, phonenumber: user.phonenumber, email: user.email, sex: user.sex } + this.form = { + nickName: user.nickName, + phonenumber: user.phonenumber, + email: user.email, + sex: user.sex, + title: user.title, + hospital: user.hospital, + experience: user.experience, + expertise: user.expertise, + contactAddress: user.contactAddress + } } }, immediate: true diff --git a/chenhai-ui/src/views/vet/comments/index.vue b/chenhai-ui/src/views/vet/comments/index.vue new file mode 100644 index 0000000..81f4e92 --- /dev/null +++ b/chenhai-ui/src/views/vet/comments/index.vue @@ -0,0 +1,285 @@ + + + diff --git a/chenhai-ui/src/views/vet/experts/index.vue b/chenhai-ui/src/views/vet/experts/index.vue new file mode 100644 index 0000000..16ac04d --- /dev/null +++ b/chenhai-ui/src/views/vet/experts/index.vue @@ -0,0 +1,317 @@ + + + diff --git a/chenhai-ui/src/views/vet/info/index.vue b/chenhai-ui/src/views/vet/info/index.vue index 03de008..cfde34b 100644 --- a/chenhai-ui/src/views/vet/info/index.vue +++ b/chenhai-ui/src/views/vet/info/index.vue @@ -2,14 +2,6 @@
- - - - - - - - - - - - - - - - - - + @@ -133,6 +116,10 @@ + + + + @@ -197,6 +184,20 @@ placeholder="请选择出生日期"> + + + + + + + + + + + + + + @@ -239,6 +240,7 @@ import Certificate from "../certificate/index.vue" export default { name: "Info", + dicts: ['expert_type'], components:{ Certificate, },