Browse Source

问兽医,问专家

master
maotiantian 1 month ago
parent
commit
8f17edbe92
  1. 104
      chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuConsultationFormsController.java
  2. 104
      chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysExpertConsultationController.java
  3. 104
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCommentsController.java
  4. 104
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExpertsController.java
  5. 194
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java
  6. 268
      chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuConsultationForms.java
  7. 61
      chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuConsultationFormsMapper.java
  8. 61
      chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuConsultationFormsService.java
  9. 237
      chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuConsultationFormsServiceImpl.java
  10. 299
      chenhai-system/src/main/java/com/chenhai/system/domain/SysExpertConsultation.java
  11. 61
      chenhai-system/src/main/java/com/chenhai/system/mapper/SysExpertConsultationMapper.java
  12. 61
      chenhai-system/src/main/java/com/chenhai/system/service/ISysExpertConsultationService.java
  13. 93
      chenhai-system/src/main/java/com/chenhai/system/service/impl/SysExpertConsultationServiceImpl.java
  14. 1
      chenhai-system/src/main/java/com/chenhai/system/service/impl/SysUserServiceImpl.java
  15. 230
      chenhai-system/src/main/java/com/chenhai/vet/domain/VetComments.java
  16. 279
      chenhai-system/src/main/java/com/chenhai/vet/domain/VetExperts.java
  17. 103
      chenhai-system/src/main/java/com/chenhai/vet/domain/VetPersonalInfo.java
  18. 70
      chenhai-system/src/main/java/com/chenhai/vet/mapper/VetCommentsMapper.java
  19. 62
      chenhai-system/src/main/java/com/chenhai/vet/mapper/VetExpertsMapper.java
  20. 61
      chenhai-system/src/main/java/com/chenhai/vet/service/IVetCommentsService.java
  21. 61
      chenhai-system/src/main/java/com/chenhai/vet/service/IVetExpertsService.java
  22. 450
      chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetCommentsServiceImpl.java
  23. 458
      chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetExpertsServiceImpl.java
  24. 293
      chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java
  25. 134
      chenhai-system/src/main/resources/mapper/muhu/MuhuConsultationFormsMapper.xml
  26. 136
      chenhai-system/src/main/resources/mapper/system/SysExpertConsultationMapper.xml
  27. 24
      chenhai-system/src/main/resources/mapper/system/SysUserMapper.xml
  28. 143
      chenhai-system/src/main/resources/mapper/vet/VetCommentsMapper.xml
  29. 132
      chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml
  30. 218
      chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml
  31. 44
      chenhai-ui/src/api/muhu/consultation.js
  32. 44
      chenhai-ui/src/api/system/consultation.js
  33. 8
      chenhai-ui/src/api/vet/comments.js
  34. 44
      chenhai-ui/src/api/vet/experts.js
  35. 367
      chenhai-ui/src/views/muhu/consultation/index.vue
  36. 460
      chenhai-ui/src/views/system/consultation/index.vue
  37. 12
      chenhai-ui/src/views/system/user/profile/userInfo.vue
  38. 285
      chenhai-ui/src/views/vet/comments/index.vue
  39. 317
      chenhai-ui/src/views/vet/experts/index.vue
  40. 38
      chenhai-ui/src/views/vet/info/index.vue

104
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<MuhuConsultationForms> 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<MuhuConsultationForms> list = muhuConsultationFormsService.selectMuhuConsultationFormsList(muhuConsultationForms);
ExcelUtil<MuhuConsultationForms> util = new ExcelUtil<MuhuConsultationForms>(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));
}
}

104
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<SysExpertConsultation> 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<SysExpertConsultation> list = sysExpertConsultationService.selectSysExpertConsultationList(sysExpertConsultation);
ExcelUtil<SysExpertConsultation> util = new ExcelUtil<SysExpertConsultation>(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));
}
}

104
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<VetComments> 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<VetComments> list = vetCommentsService.selectVetCommentsList(vetComments);
ExcelUtil<VetComments> util = new ExcelUtil<VetComments>(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));
}
}

104
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<VetExperts> 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<VetExperts> list = vetExpertsService.selectVetExpertsList(vetExperts);
ExcelUtil<VetExperts> util = new ExcelUtil<VetExperts>(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));
}
}

194
chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java

@ -1,30 +1,22 @@
package com.chenhai.web.controller.vet; 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.annotation.Log;
import com.chenhai.common.core.controller.BaseController; import com.chenhai.common.core.controller.BaseController;
import com.chenhai.common.core.domain.AjaxResult; 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.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.domain.VetPersonalInfo;
import com.chenhai.vet.mapper.VetPersonalInfoMapper;
import com.chenhai.vet.service.IVetPersonalInfoService; 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; import java.util.Map;
/** /**
@ -39,16 +31,24 @@ public class VetPersonalInfoController extends BaseController
{ {
@Autowired @Autowired
private IVetPersonalInfoService vetPersonalInfoService; private IVetPersonalInfoService vetPersonalInfoService;
@Autowired
private ISysUserService userService;
/** /**
* 获取当前登录用户ID的辅助方法
* 获取当前登录用户ID
*/ */
private Long getCurrentUserId() { private Long getCurrentUserId() {
// 若依框架获取当前登录用户ID的方法
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
return loginUser.getUserId();
return loginUser != null ? loginUser.getUserId() : null;
} }
return 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); return currentUserId != null && currentUserId.equals(userId);
} }
/** /**
* 查询兽医个人信息列表 * 查询兽医个人信息列表
*/ */
@ -73,6 +72,7 @@ public class VetPersonalInfoController extends BaseController
{ {
Long currentUserId = getCurrentUserId(); Long currentUserId = getCurrentUserId();
// 普通用户只能查看自己的信息
if (!SecurityUtils.isAdmin(currentUserId)) { if (!SecurityUtils.isAdmin(currentUserId)) {
vetPersonalInfo.setUserId(currentUserId); vetPersonalInfo.setUserId(currentUserId);
} }
@ -82,14 +82,23 @@ public class VetPersonalInfoController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 获取兽医完整信息包含证书详情
* 获取兽医完整信息包含证书详情和用户信息
*/ */
@PreAuthorize("@ss.hasPermi('vet:info:view')") @PreAuthorize("@ss.hasPermi('vet:info:view')")
@GetMapping("/full/{id}") @GetMapping("/full/{id}")
public AjaxResult getFullInfo(@PathVariable("id") Long 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<String, Object> fullInfo = vetPersonalInfoService.getVetFullInfo(id); Map<String, Object> fullInfo = vetPersonalInfoService.getVetFullInfo(id);
if (fullInfo == null || fullInfo.isEmpty()) { if (fullInfo == null || fullInfo.isEmpty()) {
return error("兽医信息不存在"); return error("兽医信息不存在");
@ -104,6 +113,11 @@ public class VetPersonalInfoController extends BaseController
@GetMapping("/full/byUserId/{userId}") @GetMapping("/full/byUserId/{userId}")
public AjaxResult getFullInfoByUserId(@PathVariable("userId") Long userId) public AjaxResult getFullInfoByUserId(@PathVariable("userId") Long userId)
{ {
// 权限验证
if (!canAccessUserId(userId)) {
return error("无权查看他人信息");
}
Map<String, Object> fullInfo = vetPersonalInfoService.getVetFullInfoByUserId(userId); Map<String, Object> fullInfo = vetPersonalInfoService.getVetFullInfoByUserId(userId);
return success(fullInfo); return success(fullInfo);
} }
@ -115,7 +129,6 @@ public class VetPersonalInfoController extends BaseController
@GetMapping("/full/current") @GetMapping("/full/current")
public AjaxResult getCurrentFullInfo() public AjaxResult getCurrentFullInfo()
{ {
// 获取当前登录用户的ID需要根据您的权限系统实现
Long userId = getCurrentUserId(); Long userId = getCurrentUserId();
if (userId == null) { if (userId == null) {
return error("用户未登录"); return error("用户未登录");
@ -133,7 +146,6 @@ public class VetPersonalInfoController extends BaseController
@PutMapping("/current") @PutMapping("/current")
public AjaxResult updateCurrent(@RequestBody VetPersonalInfo vetPersonalInfo) public AjaxResult updateCurrent(@RequestBody VetPersonalInfo vetPersonalInfo)
{ {
// 获取当前登录用户ID
Long userId = getCurrentUserId(); Long userId = getCurrentUserId();
if (userId == null) { if (userId == null) {
return error("用户未登录"); return error("用户未登录");
@ -143,9 +155,10 @@ public class VetPersonalInfoController extends BaseController
vetPersonalInfo.setUserId(userId); vetPersonalInfo.setUserId(userId);
// 检查是否已存在记录 // 检查是否已存在记录
VetPersonalInfo existing = getVetInfoByUserId(userId);
VetPersonalInfo existing = vetPersonalInfoService.selectVetPersonalInfoByUserId(userId);
if (existing == null) { if (existing == null) {
// 不存在则新增 // 不存在则新增
vetPersonalInfo.setCreateBy(getCurrentUsername());
return toAjax(vetPersonalInfoService.insertVetPersonalInfo(vetPersonalInfo)); return toAjax(vetPersonalInfoService.insertVetPersonalInfo(vetPersonalInfo));
} else { } else {
// 存在则更新 // 存在则更新
@ -155,39 +168,42 @@ public class VetPersonalInfoController extends BaseController
} }
/** /**
* 根据用户ID获取兽医信息的辅助方法
* 获取兽医个人信息详细信息带用户信息
*/ */
private VetPersonalInfo getVetInfoByUserId(Long userId) {
VetPersonalInfo query = new VetPersonalInfo();
query.setUserId(userId);
List<VetPersonalInfo> list = vetPersonalInfoService.selectVetPersonalInfoList(query);
return list != null && !list.isEmpty() ? list.get(0) : null;
@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("兽医信息不存在");
} }
// 权限验证
if (!canAccessUserId(info.getUserId())) {
return error("无权查看他人信息");
}
/**
* 导出兽医个人信息列表
*/
@PreAuthorize("@ss.hasPermi('vet:info:export')")
@Log(title = "兽医个人信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, VetPersonalInfo vetPersonalInfo)
{
List<VetPersonalInfo> list = vetPersonalInfoService.selectVetPersonalInfoList(vetPersonalInfo);
ExcelUtil<VetPersonalInfo> util = new ExcelUtil<VetPersonalInfo>(VetPersonalInfo.class);
util.exportExcel(response, list, "兽医个人信息数据");
return success(info);
} }
/** /**
* 获取兽医个人信息详细信息
* 根据用户ID获取兽医信息
*/ */
@PreAuthorize("@ss.hasPermi('vet:info:query')") @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和创建者 // 自动设置用户ID和创建者
vetPersonalInfo.setUserId(currentUserId); 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)); return toAjax(vetPersonalInfoService.insertVetPersonalInfo(vetPersonalInfo));
} }
@ -241,6 +241,14 @@ public class VetPersonalInfoController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody VetPersonalInfo vetPersonalInfo) 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)); return toAjax(vetPersonalInfoService.updateVetPersonalInfo(vetPersonalInfo));
} }
@ -252,6 +260,52 @@ public class VetPersonalInfoController extends BaseController
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] 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)); 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<VetPersonalInfo> list = vetPersonalInfoService.selectVetPersonalInfoList(vetPersonalInfo);
ExcelUtil<VetPersonalInfo> util = new ExcelUtil<VetPersonalInfo>(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);
}
} }

268
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();
}
}

61
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<MuhuConsultationForms> 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);
}

61
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<MuhuConsultationForms> 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);
}

237
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<MuhuConsultationForms> 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<MuhuConsultationForms> 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<com.chenhai.vet.domain.VetComments> replies = vetCommentsMapper.selectVetCommentsList(query);
// 返回数量
return replies != null ? (long) replies.size() : 0L;
} catch (Exception e) {
e.printStackTrace();
return 0L;
}
}
}

299
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();
}
}

61
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<SysExpertConsultation> 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);
}

61
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<SysExpertConsultation> 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);
}

93
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<SysExpertConsultation> 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);
}
}

1
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) public int updateUser(SysUser user)
{ {
Long userId = user.getUserId(); Long userId = user.getUserId();
// 删除用户与角色关联 // 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId); userRoleMapper.deleteUserRoleByUserId(userId);
// 新增用户与角色管理 // 新增用户与角色管理

230
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();
}
}

279
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();
}
}

103
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.annotation.Excel;
import com.chenhai.common.core.domain.BaseEntity; import com.chenhai.common.core.domain.BaseEntity;
import com.chenhai.common.core.domain.entity.SysUser;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -25,6 +26,9 @@ public class VetPersonalInfo extends BaseEntity
@Excel(name = "用户ID", readConverterExp = "关=联sys_user") @Excel(name = "用户ID", readConverterExp = "关=联sys_user")
private Long userId; private Long userId;
/** 关联的用户对象 */
private SysUser user;
/** 真实姓名 */ /** 真实姓名 */
@Excel(name = "真实姓名") @Excel(name = "真实姓名")
private String realName; private String realName;
@ -66,30 +70,27 @@ public class VetPersonalInfo extends BaseEntity
@Excel(name = "个人简介") @Excel(name = "个人简介")
private String introduction; 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) public void setId(Long id)
{ {
this.id = id; this.id = id;
@ -210,6 +211,64 @@ public class VetPersonalInfo extends BaseEntity
return introduction; 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 @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -229,6 +288,12 @@ public class VetPersonalInfo extends BaseEntity
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("title", getTitle())
.append("phone", getPhone())
.append("expertType", getExpertType())
.append("email", getEmail())
.append("nickName", getNickName())
.append("user", getUser())
.toString(); .toString();
} }
} }

70
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<VetComments> 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);
}

62
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<VetExperts> 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);
}

61
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<VetComments> 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);
}

61
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<VetExperts> 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);
}

450
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<VetComments> selectVetCommentsList(VetComments vetComments)
{
List<VetComments> 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());
}
}
/**
* 自动填充兽医职称医院和经验信息到数据库字段
* 这是主要方法将信息填充到实体的 titlehospitalexperience 字段中
*
* @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("<span class='vet-tag vet-title'>").append(vetInfo.getTitle()).append("</span>");
}
if (StringUtils.isNotEmpty(vetInfo.getHospital())) {
tags.append("<span class='vet-tag vet-hospital'>").append(vetInfo.getHospital()).append("</span>");
}
if (StringUtils.isNotEmpty(vetInfo.getWorkExperience())) {
tags.append("<span class='vet-tag vet-experience'>执业").append(vetInfo.getWorkExperience()).append("</span>");
}
return tags.toString();
}
} catch (Exception e) {
log.error("获取兽医信息标签失败,用户ID:{}", userId, e);
}
return "";
}
/**
* 根据问诊单ID获取回复列表包含兽医信息
*/
public List<VetComments> 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);
}
}

458
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<VetExperts> selectVetExpertsList(VetExperts vetExperts)
{
List<VetExperts> 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);
}
}

293
chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java

@ -1,13 +1,18 @@
package com.chenhai.vet.service.impl; 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.DateUtils;
import com.chenhai.common.utils.SecurityUtils;
import com.chenhai.vet.domain.VetCertificate; import com.chenhai.vet.domain.VetCertificate;
import com.chenhai.vet.domain.VetPersonalInfo; import com.chenhai.vet.domain.VetPersonalInfo;
import com.chenhai.vet.mapper.VetPersonalInfoMapper; import com.chenhai.vet.mapper.VetPersonalInfoMapper;
import com.chenhai.vet.mapper.VetCertificateMapper; import com.chenhai.vet.mapper.VetCertificateMapper;
import com.chenhai.vet.service.IVetPersonalInfoService; import com.chenhai.vet.service.IVetPersonalInfoService;
import com.chenhai.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -21,96 +26,154 @@ import java.util.stream.Collectors;
* @date 2025-12-29 * @date 2025-12-29
*/ */
@Service @Service
public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService
{
public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService {
@Autowired @Autowired
private VetPersonalInfoMapper vetPersonalInfoMapper; private VetPersonalInfoMapper vetPersonalInfoMapper;
@Autowired @Autowired
private VetCertificateMapper vetCertificateMapper; private VetCertificateMapper vetCertificateMapper;
@Autowired
private ISysUserService sysUserService;
/** /**
* 查询兽医个人信息
*
* @param id 兽医个人信息主键
* @return 兽医个人信息
* 查询兽医个人信息包含用户信息
*/ */
@Override @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 @Override
public List<VetPersonalInfo> selectVetPersonalInfoList(VetPersonalInfo vetPersonalInfo)
{
return vetPersonalInfoMapper.selectVetPersonalInfoList(vetPersonalInfo);
public List<VetPersonalInfo> selectVetPersonalInfoList(VetPersonalInfo vetPersonalInfo) {
List<VetPersonalInfo> list = vetPersonalInfoMapper.selectVetPersonalInfoList(vetPersonalInfo);
// 为每个记录填充用户信息
if (list != null) {
list.forEach(this::fillUserInfo);
}
return list;
} }
/** /**
* 新增兽医个人信息 * 新增兽医个人信息
*
* @param vetPersonalInfo 兽医个人信息
* @return 结果
*/ */
@Override @Override
public int insertVetPersonalInfo(VetPersonalInfo 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.setCreateTime(DateUtils.getNowDate());
vetPersonalInfo.setUpdateTime(DateUtils.getNowDate());
// 5. 检查是否已存在该用户的兽医信息
VetPersonalInfo existing = vetPersonalInfoMapper.selectVetPersonalInfoByUserId(vetPersonalInfo.getUserId());
if (existing != null) {
throw new RuntimeException("该用户已存在兽医信息,请使用更新操作");
}
return vetPersonalInfoMapper.insertVetPersonalInfo(vetPersonalInfo); return vetPersonalInfoMapper.insertVetPersonalInfo(vetPersonalInfo);
} else {
throw new RuntimeException("用户未登录");
}
} }
/** /**
* 修改兽医个人信息 * 修改兽医个人信息
*
* @param vetPersonalInfo 兽医个人信息
* @return 结果
*/ */
@Override @Override
public int updateVetPersonalInfo(VetPersonalInfo vetPersonalInfo)
{
@Transactional
public int updateVetPersonalInfo(VetPersonalInfo vetPersonalInfo) {
LoginUser loginUser = SecurityUtils.getLoginUser();
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()); vetPersonalInfo.setUpdateTime(DateUtils.getNowDate());
return vetPersonalInfoMapper.updateVetPersonalInfo(vetPersonalInfo); return vetPersonalInfoMapper.updateVetPersonalInfo(vetPersonalInfo);
} else {
throw new RuntimeException("用户未登录");
}
} }
/** /**
* 批量删除兽医个人信息
*
* @param ids 需要删除的兽医个人信息主键
* @return 结果
* 根据用户ID查询兽医个人信息
*/ */
@Override @Override
public int deleteVetPersonalInfoByIds(Long[] ids)
{
return vetPersonalInfoMapper.deleteVetPersonalInfoByIds(ids);
public VetPersonalInfo selectVetPersonalInfoByUserId(Long userId) {
if (userId == null) {
return null;
} }
/**
* 删除兽医个人信息信息
*
* @param id 兽医个人信息主键
* @return 结果
*/
@Override
public int deleteVetPersonalInfoById(Long id)
{
return vetPersonalInfoMapper.deleteVetPersonalInfoById(id);
VetPersonalInfo info = vetPersonalInfoMapper.selectVetPersonalInfoByUserId(userId);
fillUserInfo(info);
return info;
} }
/** /**
* 获取兽医的完整信息包含证书详情
* 获取兽医的完整信息包含证书详情和用户信息
*/ */
@Override @Override
public Map<String, Object> getVetFullInfo(Long vetId) { public Map<String, Object> getVetFullInfo(Long vetId) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
// 1. 获取兽医个人信息
VetPersonalInfo personalInfo = vetPersonalInfoMapper.selectVetPersonalInfoById(vetId);
// 1. 获取兽医个人信息包含用户信息
VetPersonalInfo personalInfo = this.selectVetPersonalInfoById(vetId);
if (personalInfo == null) { if (personalInfo == null) {
return result; return result;
} }
@ -148,31 +211,33 @@ public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService
} }
/** /**
* 根据用户ID获取兽医信息包含证书
* 根据用户ID获取兽医信息包含证书和用户信息
*/ */
@Override @Override
public Map<String, Object> getVetFullInfoByUserId(Long userId) { public Map<String, Object> getVetFullInfoByUserId(Long userId) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
// 根据user_id查询兽医信息
VetPersonalInfo query = new VetPersonalInfo();
query.setUserId(userId);
List<VetPersonalInfo> 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; return result;
} }
VetPersonalInfo personalInfo = personalInfos.get(0);
result.put("personalInfo", personalInfo); result.put("personalInfo", personalInfo);
result.put("userInfo", personalInfo.getUser());
// 获取证书列表
// 2. 获取证书列表
VetCertificate certificateQuery = new VetCertificate(); VetCertificate certificateQuery = new VetCertificate();
certificateQuery.setUserId(userId); certificateQuery.setUserId(userId);
List<VetCertificate> certificates = vetCertificateMapper.selectVetCertificateList(certificateQuery); List<VetCertificate> certificates = vetCertificateMapper.selectVetCertificateList(certificateQuery);
result.put("certificates", certificates); result.put("certificates", certificates);
// 证书统计信息
// 3. 证书统计信息
if (certificates != null && !certificates.isEmpty()) { if (certificates != null && !certificates.isEmpty()) {
result.put("certificateCount", certificates.size()); result.put("certificateCount", certificates.size());
result.put("certificateNames", certificates.stream() result.put("certificateNames", certificates.stream()
@ -186,18 +251,118 @@ public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService
return result; return result;
} }
/**
* 批量删除兽医个人信息
*/
@Override @Override
public VetPersonalInfo selectVetPersonalInfoByUserId(Long userId) {
if (userId == null) {
return null;
public int deleteVetPersonalInfoByIds(Long[] ids) {
return vetPersonalInfoMapper.deleteVetPersonalInfoByIds(ids);
} }
VetPersonalInfo query = new VetPersonalInfo();
query.setUserId(userId);
List<VetPersonalInfo> list = vetPersonalInfoMapper.selectVetPersonalInfoList(query);
return list != null && !list.isEmpty() ? list.get(0) : null;
/**
* 删除兽医个人信息
*/
@Override
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;
}
// 如果邮箱为空使用用户邮箱
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());
}
}
}

134
chenhai-system/src/main/resources/mapper/muhu/MuhuConsultationFormsMapper.xml

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chenhai.muhu.mapper.MuhuConsultationFormsMapper">
<resultMap type="MuhuConsultationForms" id="MuhuConsultationFormsResult">
<result property="formId" column="form_id" />
<result property="farmerName" column="farmer_name" />
<result property="userId" column="user_id" />
<result property="title" column="title" />
<result property="description" column="description" />
<result property="animalType" column="animal_type" />
<result property="animalAge" column="animal_age" />
<result property="animalGender" column="animal_gender" />
<result property="status" column="status" />
<result property="isSensitive" column="is_sensitive" />
<result property="sensitiveWords" column="sensitive_words" />
<result property="viewCount" column="view_count" />
<result property="replyCount" column="reply_count" />
<result property="createdTime" column="created_time" />
<result property="avatar" column="avatar" />
<result property="images" column="images" />
</resultMap>
<sql id="selectMuhuConsultationFormsVo">
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
</sql>
<select id="selectMuhuConsultationFormsList" parameterType="MuhuConsultationForms" resultMap="MuhuConsultationFormsResult">
SELECT
cf.*,
(SELECT COUNT(*) FROM vet_comments vc WHERE vc.consultation_id = cf.form_id) as reply_count
FROM muhu_consultation_forms cf
<where>
<if test="farmerName != null "> and cf.farmer_name = #{farmerName}</if>
<if test="userId != null "> and cf.user_id = #{userId}</if>
<if test="title != null and title != ''">
<bind name="titleLike" value="'%' + title + '%'" />
and cf.title like #{titleLike}
</if>
<if test="description != null and description != ''">
<bind name="descriptionLike" value="'%' + description + '%'" />
and cf.description like #{descriptionLike}
</if>
<if test="animalType != null and animalType != ''"> and cf.animal_type = #{animalType}</if>
<if test="animalAge != null and animalAge != ''"> and cf.animal_age = #{animalAge}</if>
<if test="animalGender != null and animalGender != ''"> and cf.animal_gender = #{animalGender}</if>
<if test="status != null and status != ''"> and cf.status = #{status}</if>
<if test="isSensitive != null "> and cf.is_sensitive = #{isSensitive}</if>
<if test="avatar != null and avatar != ''"> and cf.avatar = #{avatar}</if>
</where>
ORDER BY cf.created_time DESC
</select>
<select id="selectMuhuConsultationFormsByFormId" parameterType="Long" resultMap="MuhuConsultationFormsResult">
SELECT
cf.*,
(SELECT COUNT(*) FROM vet_comments vc WHERE vc.consultation_id = cf.form_id) as reply_count
FROM muhu_consultation_forms cf
WHERE cf.form_id = #{formId}
</select>
<insert id="insertMuhuConsultationForms" parameterType="MuhuConsultationForms" useGeneratedKeys="true" keyProperty="formId">
insert into muhu_consultation_forms
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="farmerName != null">farmer_name,</if>
<if test="userId != null">user_id,</if>
<if test="title != null and title != ''">title,</if>
<if test="description != null and description != ''">description,</if>
<if test="animalType != null">animal_type,</if>
<if test="animalAge != null and animalAge != ''">animal_age,</if>
<if test="animalGender != null and animalGender != ''">animal_gender,</if>
<if test="status != null">status,</if>
<if test="isSensitive != null and isSensitive != ''">is_sensitive,</if>
<if test="sensitiveWords != null and sensitiveWords != ''">sensitive_words,</if>
<if test="viewCount != null and viewCount != ''">view_count,</if>
<if test="replyCount != null and replyCount != ''">reply_count,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="images != null and images != ''">images,</if>
created_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="farmerName != null">#{farmerName},</if>
<if test="userId != null">#{userId},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="description != null and description != ''">#{description},</if>
<if test="animalType != null">#{animalType},</if>
<if test="animalAge != null and animalAge != ''">#{animalAge},</if>
<if test="animalGender != null and animalGender != ''">#{animalGender},</if>
<if test="status != null">#{status},</if>
<if test="isSensitive != null and isSensitive != ''">#{isSensitive},</if>
<if test="sensitiveWords != null and sensitiveWords != ''">#{sensitiveWords},</if>
<if test="viewCount != null and viewCount != ''">#{viewCount},</if>
<if test="replyCount != null and replyCount != ''">#{replyCount},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="images != null and images != ''">#{images},</if>
now(),
</trim>
</insert>
<update id="updateMuhuConsultationForms" parameterType="MuhuConsultationForms">
update muhu_consultation_forms
<trim prefix="SET" suffixOverrides=",">
<if test="farmerName != null">farmer_name = #{farmerName},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="description != null and description != ''">description = #{description},</if>
<if test="animalType != null">animal_type = #{animalType},</if>
<if test="animalAge != null and animalAge != ''">animal_age = #{animalAge},</if>
<if test="animalGender != null and animalGender != ''">animal_gender = #{animalGender},</if>
<if test="status != null">status = #{status},</if>
<if test="isSensitive != null">is_sensitive = #{isSensitive},</if>
<if test="sensitiveWords != null">sensitive_words = #{sensitiveWords},</if>
<if test="viewCount != null">view_count = #{viewCount},</if>
<if test="replyCount != null">reply_count = #{replyCount},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="images != null and images != ''">images = #{images},</if>
</trim>
where form_id = #{formId}
</update>
<delete id="deleteMuhuConsultationFormsByFormId" parameterType="Long">
delete from muhu_consultation_forms where form_id = #{formId}
</delete>
<delete id="deleteMuhuConsultationFormsByFormIds" parameterType="String">
delete from muhu_consultation_forms where form_id in
<foreach item="formId" collection="array" open="(" separator="," close=")">
#{formId}
</foreach>
</delete>
</mapper>

136
chenhai-system/src/main/resources/mapper/system/SysExpertConsultationMapper.xml

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chenhai.system.mapper.SysExpertConsultationMapper">
<resultMap type="SysExpertConsultation" id="SysExpertConsultationResult">
<result property="consultationId" column="consultation_id" />
<result property="userId" column="user_id" />
<result property="expertId" column="expert_id" />
<result property="formId" column="form_id" />
<result property="consultationType" column="consultation_type" />
<result property="consultationStatus" column="consultation_status" />
<result property="consultationTitle" column="consultation_title" />
<result property="initialContent" column="initial_content" />
<result property="initialAttachments" column="initial_attachments" />
<result property="messages" column="messages" />
<result property="rating" column="rating" />
<result property="evaluation" column="evaluation" />
<result property="evaluationTags" column="evaluation_tags" />
<result property="evaluationTime" column="evaluation_time" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="createdTime" column="created_time" />
<result property="updatedTime" column="updated_time" />
</resultMap>
<sql id="selectSysExpertConsultationVo">
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
</sql>
<select id="selectSysExpertConsultationList" parameterType="SysExpertConsultation" resultMap="SysExpertConsultationResult">
<include refid="selectSysExpertConsultationVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="expertId != null "> and expert_id = #{expertId}</if>
<if test="formId != null "> and form_id = #{formId}</if>
<if test="consultationType != null and consultationType != ''"> and consultation_type = #{consultationType}</if>
<if test="consultationStatus != null and consultationStatus != ''"> and consultation_status = #{consultationStatus}</if>
<if test="consultationTitle != null and consultationTitle != ''"> and consultation_title = #{consultationTitle}</if>
<if test="initialContent != null and initialContent != ''"> and initial_content = #{initialContent}</if>
<if test="initialAttachments != null and initialAttachments != ''"> and initial_attachments = #{initialAttachments}</if>
<if test="messages != null and messages != ''"> and messages = #{messages}</if>
<if test="rating != null "> and rating = #{rating}</if>
<if test="evaluation != null and evaluation != ''"> and evaluation = #{evaluation}</if>
<if test="evaluationTags != null and evaluationTags != ''"> and evaluation_tags = #{evaluationTags}</if>
<if test="evaluationTime != null "> and evaluation_time = #{evaluationTime}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectSysExpertConsultationByConsultationId" parameterType="Long" resultMap="SysExpertConsultationResult">
<include refid="selectSysExpertConsultationVo"/>
where consultation_id = #{consultationId}
</select>
<insert id="insertSysExpertConsultation" parameterType="SysExpertConsultation" useGeneratedKeys="true" keyProperty="consultationId">
insert into sys_expert_consultation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="expertId != null">expert_id,</if>
<if test="formId != null">form_id,</if>
<if test="consultationType != null">consultation_type,</if>
<if test="consultationStatus != null">consultation_status,</if>
<if test="consultationTitle != null">consultation_title,</if>
<if test="initialContent != null">initial_content,</if>
<if test="initialAttachments != null">initial_attachments,</if>
<if test="messages != null">messages,</if>
<if test="rating != null">rating,</if>
<if test="evaluation != null">evaluation,</if>
<if test="evaluationTags != null">evaluation_tags,</if>
<if test="evaluationTime != null">evaluation_time,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="expertId != null">#{expertId},</if>
<if test="formId != null">#{formId},</if>
<if test="consultationType != null">#{consultationType},</if>
<if test="consultationStatus != null">#{consultationStatus},</if>
<if test="consultationTitle != null">#{consultationTitle},</if>
<if test="initialContent != null">#{initialContent},</if>
<if test="initialAttachments != null">#{initialAttachments},</if>
<if test="messages != null">#{messages},</if>
<if test="rating != null">#{rating},</if>
<if test="evaluation != null">#{evaluation},</if>
<if test="evaluationTags != null">#{evaluationTags},</if>
<if test="evaluationTime != null">#{evaluationTime},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateSysExpertConsultation" parameterType="SysExpertConsultation">
update sys_expert_consultation
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="expertId != null">expert_id = #{expertId},</if>
<if test="formId != null">form_id = #{formId},</if>
<if test="consultationType != null">consultation_type = #{consultationType},</if>
<if test="consultationStatus != null">consultation_status = #{consultationStatus},</if>
<if test="consultationTitle != null">consultation_title = #{consultationTitle},</if>
<if test="initialContent != null">initial_content = #{initialContent},</if>
<if test="initialAttachments != null">initial_attachments = #{initialAttachments},</if>
<if test="messages != null">messages = #{messages},</if>
<if test="rating != null">rating = #{rating},</if>
<if test="evaluation != null">evaluation = #{evaluation},</if>
<if test="evaluationTags != null">evaluation_tags = #{evaluationTags},</if>
<if test="evaluationTime != null">evaluation_time = #{evaluationTime},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where consultation_id = #{consultationId}
</update>
<delete id="deleteSysExpertConsultationByConsultationId" parameterType="Long">
delete from sys_expert_consultation where consultation_id = #{consultationId}
</delete>
<delete id="deleteSysExpertConsultationByConsultationIds" parameterType="String">
delete from sys_expert_consultation where consultation_id in
<foreach item="consultationId" collection="array" open="(" separator="," close=")">
#{consultationId}
</foreach>
</delete>
</mapper>

24
chenhai-system/src/main/resources/mapper/system/SysUserMapper.xml

@ -64,7 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectUserVo"> <sql id="selectUserVo">
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,
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, 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 r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u from sys_user u
@ -74,7 +76,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
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
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 left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0' where u.del_flag = '0'
<if test="userId != null and userId != 0"> <if test="userId != null and userId != 0">
@ -89,19 +95,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phonenumber != null and phonenumber != ''"> <if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%') AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
<if test="params.beginTime != null and params.beginTime != ''">
AND date_format(u.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d') AND date_format(u.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if> </if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
<if test="params.endTime != null and params.endTime != ''">
AND date_format(u.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d') AND date_format(u.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if> </if>
<if test="deptId != null and deptId != 0"> <if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if> </if>
<!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectUserListByAreaCode" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUserListByAreaCode" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_type, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date,u.area_code, u.create_by, u.create_time, u.remark, a.id as sys_area_id, a.name as sys_area_name, a.code as sys_area_code from sys_user u select u.user_id, u.dept_id, u.nick_name, u.user_type, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date,u.area_code, u.create_by, u.create_time, u.remark, a.id as sys_area_id, a.name as sys_area_name, a.code as sys_area_code from sys_user u
left join sys_area a on u.area_code = a.code left join sys_area a on u.area_code = a.code
@ -132,7 +138,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name,
u.email, u.phonenumber, u.status, u.create_time
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id 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_user_role ur on u.user_id = ur.user_id
@ -144,12 +151,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phonenumber != null and phonenumber != ''"> <if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%') AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if> </if>
<!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name,
u.email, u.phonenumber, u.status, u.create_time
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id 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_user_role ur on u.user_id = ur.user_id
@ -162,7 +169,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phonenumber != null and phonenumber != ''"> <if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%') AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if> </if>
<!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>

143
chenhai-system/src/main/resources/mapper/vet/VetCommentsMapper.xml

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chenhai.vet.mapper.VetCommentsMapper">
<resultMap type="VetComments" id="VetCommentsResult">
<result property="id" column="id" />
<result property="consultationId" column="consultation_id" />
<result property="replyName" column="reply_name" />
<result property="content" column="content" />
<result property="images" column="images" />
<result property="isSensitive" column="is_sensitive" />
<result property="sensitiveWords" column="sensitive_words" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<result property="userId" column="user_id" />
<result property="title" column="title" />
<result property="hospital" column="hospital" />
<result property="experience" column="experience" />
<result property="avatar" column="avatar" />
</resultMap>
<sql id="selectVetCommentsVo">
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
</sql>
<select id="selectVetCommentsList" parameterType="VetComments" resultMap="VetCommentsResult">
<include refid="selectVetCommentsVo"/>
<where>
<if test="consultationId != null "> and consultation_id = #{consultationId}</if>
<if test="replyName != null "> and reply_name like concat('%', #{replyName}, '%')</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="images != null and images != ''"> and images = #{images}</if>
<if test="isSensitive != null "> and is_sensitive = #{isSensitive}</if>
<if test="sensitiveWords != null and sensitiveWords != ''"> and sensitive_words = #{sensitiveWords}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="avatar != null and avatar != ''"> and cf.avatar = #{avatar}</if>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="hospital != null and hospital != ''"> and hospital like concat('%', #{hospital}, '%')</if>
<if test="experience != null and experience != ''"> and experience like concat('%', #{experience}, '%')</if>
</where>
</select>
<select id="selectVetCommentsById" parameterType="Long" resultMap="VetCommentsResult">
<include refid="selectVetCommentsVo"/>
where id = #{id}
</select>
<insert id="insertVetComments" parameterType="VetComments" useGeneratedKeys="true" keyProperty="id">
insert into vet_comments
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="consultationId != null">consultation_id,</if>
<if test="replyName != null">reply_name,</if>
<if test="content != null">content,</if>
<if test="images != null">images,</if>
<if test="isSensitive != null">is_sensitive,</if>
<if test="sensitiveWords != null">sensitive_words,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="userId != null">user_id,</if>
<if test="title != null">title,</if>
<if test="hospital != null">hospital,</if>
<if test="experience != null">experience,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consultationId != null">#{consultationId},</if>
<if test="replyName != null">#{replyName},</if>
<if test="content != null">#{content},</if>
<if test="images != null">#{images},</if>
<if test="isSensitive != null">#{isSensitive},</if>
<if test="sensitiveWords != null">#{sensitiveWords},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="userId != null">#{userId},</if>
<if test="title != null">#{title},</if>
<if test="hospital != null">#{hospital},</if>
<if test="experience != null">#{experience},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
</trim>
</insert>
<update id="updateVetComments" parameterType="VetComments">
update vet_comments
<trim prefix="SET" suffixOverrides=",">
<if test="consultationId != null">consultation_id = #{consultationId},</if>
<if test="replyName != null">reply_name = #{replyName},</if>
<if test="content != null">content = #{content},</if>
<if test="images != null">images = #{images},</if>
<if test="isSensitive != null">is_sensitive = #{isSensitive},</if>
<if test="sensitiveWords != null">sensitive_words = #{sensitiveWords},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="title != null">title = #{title},</if>
<if test="hospital != null">hospital = #{hospital},</if>
<if test="experience != null">experience = #{experience},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteVetCommentsById" parameterType="Long">
delete from vet_comments where id = #{id}
</delete>
<delete id="deleteVetCommentsByIds" parameterType="String">
delete from vet_comments where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 新增:更新用户专业信息的SQL -->
<update id="updateUserProfessionalInfo">
UPDATE sys_user
SET
title = #{title},
hospital = #{hospital},
experience = #{experience},
update_time = NOW()
WHERE user_id = #{userId}
</update>
</mapper>

132
chenhai-system/src/main/resources/mapper/vet/VetExpertsMapper.xml

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chenhai.vet.mapper.VetExpertsMapper">
<resultMap type="VetExperts" id="VetExpertsResult">
<result property="expertId" column="expert_id" />
<result property="userId" column="user_id" />
<result property="avatar" column="avatar" />
<result property="realName" column="real_name" />
<result property="title" column="title" />
<result property="iphone" column="iphone" />
<result property="email" column="email" />
<result property="address" column="address" />
<result property="expertiseArea" column="expertise_area" />
<result property="isOnline" column="is_online" />
<result property="remark" column="remark" />
<result property="sortOrder" column="sort_order" />
<result property="status" column="status" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<result property="expert" column="expert" />
<result property="workExperience" column="work_experience" />
</resultMap>
<sql id="selectVetExpertsVo">
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
</sql>
<select id="selectVetExpertsList" parameterType="VetExperts" resultMap="VetExpertsResult">
<include refid="selectVetExpertsVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
<if test="iphone != null and iphone != ''"> and iphone = #{iphone}</if>
<if test="email != null and email != ''"> and email = #{email}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="expertiseArea != null and expertiseArea != ''"> and expertise_area = #{expertiseArea}</if>
<if test="isOnline != null "> and is_online = #{isOnline}</if>
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
<if test="sortOrder != null "> and sort_order = #{sortOrder}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="expert != null and expert != ''"> and expert = #{expert}</if>
<if test="workExperience != null and workExperience != ''"> and work_experience = #{workExperience})</if>
</where>
</select>
<select id="selectVetExpertsByExpertId" parameterType="Long" resultMap="VetExpertsResult">
<include refid="selectVetExpertsVo"/>
where expert_id = #{expertId}
</select>
<insert id="insertVetExperts" parameterType="VetExperts" useGeneratedKeys="true" keyProperty="expertId">
insert into vet_experts
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="avatar != null">avatar,</if>
<if test="realName != null">real_name,</if>
<if test="iphone != null">iphone,</if>
<if test="email != null">email,</if>
<if test="address != null">address,</if>
<if test="expertiseArea != null">expertise_area,</if>
<if test="isOnline != null">is_online,</if>
<if test="remark != null">remark,</if>
<if test="sortOrder != null">sort_order,</if>
<if test="status != null">status,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="title != null">title,</if>
<if test="expert != null">expert,</if>
<if test="workExperience != null">work_experience,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="avatar != null">#{avatar},</if>
<if test="realName != null">#{realName},</if>
<if test="iphone != null">#{iphone},</if>
<if test="email != null">#{email},</if>
<if test="address != null">#{address},</if>
<if test="expertiseArea != null">#{expertiseArea},</if>
<if test="isOnline != null">#{isOnline},</if>
<if test="remark != null">#{remark},</if>
<if test="sortOrder != null">#{sortOrder},</if>
<if test="status != null">#{status},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="title != null">#{title},</if>
<if test="expert != null">#{expert},</if>
<if test="workExperience != null">#{workExperience},</if>
</trim>
</insert>
<update id="updateVetExperts" parameterType="VetExperts">
update vet_experts
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="realName != null">real_name = #{realName},</if>
<if test="iphone != null">iphone = #{iphone},</if>
<if test="email != null">email = #{email},</if>
<if test="address != null">address = #{address},</if>
<if test="expertiseArea != null">expertise_area = #{expertiseArea},</if>
<if test="isOnline != null">is_online = #{isOnline},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
<if test="status != null">status = #{status},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="title != null">title = #{title},</if>
<if test="expert != null">expert = #{expert},</if>
<if test="workExperience != null">work_experience = #{workExperience},</if>
</trim>
where expert_id = #{expertId}
</update>
<delete id="deleteVetExpertsByExpertId" parameterType="Long">
delete from vet_experts where expert_id = #{expertId}
</delete>
<delete id="deleteVetExpertsByExpertIds" parameterType="String">
delete from vet_experts where expert_id in
<foreach item="expertId" collection="array" open="(" separator="," close=")">
#{expertId}
</foreach>
</delete>
</mapper>

218
chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml

@ -5,85 +5,129 @@
<mapper namespace="com.chenhai.vet.mapper.VetPersonalInfoMapper"> <mapper namespace="com.chenhai.vet.mapper.VetPersonalInfoMapper">
<resultMap type="VetPersonalInfo" id="VetPersonalInfoResult"> <resultMap type="VetPersonalInfo" id="VetPersonalInfoResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="realName" column="real_name" />
<result property="gender" column="gender" />
<result property="birthday" column="birthday" />
<result property="idCard" column="id_card" />
<result property="specialty" column="specialty" />
<result property="workExperience" column="work_experience" />
<result property="hospital" column="hospital" />
<result property="address" column="address" />
<result property="introduction" column="introduction" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="certCount" column="certCount" />
<result property="certNames" column="certNames" />
<!-- 基础字段映射 -->
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="realName" column="real_name"/>
<result property="gender" column="gender"/>
<result property="birthday" column="birthday"/>
<result property="idCard" column="id_card"/>
<result property="specialty" column="specialty"/>
<result property="workExperience" column="work_experience"/>
<result property="hospital" column="hospital"/>
<result property="address" column="address"/>
<result property="iphone" column="iphone"/>
<result property="introduction" column="introduction"/>
<result property="title" column="title"/>
<result property="phone" column="phone"/>
<result property="expertType" column="expert_type"/>
<result property="email" column="email"/>
<result property="nickName" column="nick_name"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<!-- 关联 SysUser 对象 -->
<association property="user" javaType="SysUser">
<result property="userId" column="u_user_id"/>
<result property="nickName" column="u_nick_name"/>
<result property="email" column="u_email"/>
</association>
</resultMap> </resultMap>
<!-- 基础查询SQL -->
<sql id="selectVetPersonalInfoVo"> <sql id="selectVetPersonalInfoVo">
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 from vet_personal_info
</sql> </sql>
<!-- 带用户信息的查询SQL(简化版) -->
<sql id="selectVetPersonalInfoWithUserVo">
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
</sql>
<!-- 列表查询(带用户信息) -->
<select id="selectVetPersonalInfoList" parameterType="VetPersonalInfo" resultMap="VetPersonalInfoResult"> <select id="selectVetPersonalInfoList" parameterType="VetPersonalInfo" resultMap="VetPersonalInfoResult">
SELECT
vpi.id,
vpi.user_id,
vpi.real_name,
vpi.gender,
vpi.birthday,
vpi.id_card,
vpi.specialty,
vpi.work_experience,
vpi.hospital,
vpi.address,
vpi.introduction,
vpi.create_by,
vpi.create_time,
vpi.update_by,
vpi.update_time,
<!-- 证书统计信息 -->
COUNT(vc.id) as certCount,
GROUP_CONCAT(vc.cert_name) as certNames
FROM vet_personal_info vpi
LEFT JOIN vet_certificate vc ON vpi.user_id = vc.user_id
<include refid="selectVetPersonalInfoWithUserVo"/>
<where> <where>
<if test="userId != null"> and vpi.user_id = #{userId}</if>
<if test="realName != null and realName != ''"> and vpi.real_name like concat('%', #{realName}, '%')</if>
<if test="gender != null and gender != ''"> and vpi.gender = #{gender}</if>
<if test="idCard != null and idCard != ''"> and vpi.id_card = #{idCard}</if>
<if test="specialty != null and specialty != ''"> and vpi.specialty = #{specialty}</if>
<if test="workExperience != null"> and vpi.work_experience = #{workExperience}</if>
<if test="hospital != null and hospital != ''"> and vpi.hospital = #{hospital}</if>
<if test="iphone != null and iphone != ''">and vpi.iphone = #{iphone}</if>
<if test="address != null and address != ''"> and vpi.address = #{address}</if>
<if test="introduction != null and introduction != ''"> and vpi.introduction = #{introduction}</if>
<!-- 兽医表条件 -->
<if test="id != null "> and v.id = #{id}</if>
<if test="userId != null "> and v.user_id = #{userId}</if>
<if test="realName != null and realName != ''"> and v.real_name like concat('%', #{realName}, '%')</if>
<if test="gender != null and gender != ''"> and v.gender = #{gender}</if>
<if test="idCard != null and idCard != ''"> and v.id_card = #{idCard}</if>
<if test="specialty != null and specialty != ''"> and v.specialty like concat('%', #{specialty}, '%')</if>
<if test="hospital != null and hospital != ''"> and v.hospital like concat('%', #{hospital}, '%')</if>
<if test="phone != null and phone != ''"> and v.phone like concat('%', #{phone}, '%')</if>
<if test="iphone != null and iphone != ''"> and v.iphone like concat('%', #{iphone}, '%')</if>
<if test="expertType != null and expertType != ''"> and v.expert_type = #{expertType}</if>
<if test="email != null and email != ''"> and v.email = #{email}</if>
<!-- 用户表条件 -->
<if test="user != null">
<if test="user.userName != null and user.userName != ''">
and u.user_name like concat('%', #{user.userName}, '%')
</if>
<if test="user.nickName != null and user.nickName != ''">
and u.nick_name like concat('%', #{user.nickName}, '%')
</if>
<if test="user.userType != null and user.userType != ''">
and u.user_type = #{user.userType}
</if>
<if test="user.status != null and user.status != ''">
and u.status = #{user.status}
</if>
<if test="user.deptId != null">
and u.dept_id = #{user.deptId}
</if>
</if>
</where> </where>
GROUP BY vpi.id
order by v.create_time desc
</select> </select>
<!-- 根据ID查询(带用户信息) -->
<select id="selectVetPersonalInfoById" parameterType="Long" resultMap="VetPersonalInfoResult"> <select id="selectVetPersonalInfoById" parameterType="Long" resultMap="VetPersonalInfoResult">
<include refid="selectVetPersonalInfoVo"/>
where id = #{id}
<include refid="selectVetPersonalInfoWithUserVo"/>
where v.id = #{id}
</select> </select>
<!-- 根据用户ID查询 -->
<select id="selectVetPersonalInfoByUserId" parameterType="Long" resultMap="VetPersonalInfoResult">
<include refid="selectVetPersonalInfoWithUserVo"/>
where v.user_id = #{userId}
</select>
<!-- 新增兽医个人信息 -->
<insert id="insertVetPersonalInfo" parameterType="VetPersonalInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertVetPersonalInfo" parameterType="VetPersonalInfo" useGeneratedKeys="true" keyProperty="id">
insert into vet_personal_info insert into vet_personal_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
<if test="realName != null">real_name,</if>
<if test="gender != null">gender,</if>
<if test="realName != null and realName != ''">real_name,</if>
<if test="gender != null and gender != ''">gender,</if>
<if test="birthday != null">birthday,</if> <if test="birthday != null">birthday,</if>
<if test="idCard != null">id_card,</if>
<if test="specialty != null">specialty,</if>
<if test="workExperience != null">work_experience,</if>
<if test="hospital != null">hospital,</if>
<if test="address != null">address,</if>
<if test="introduction != null">introduction,</if>
<if test="idCard != null and idCard != ''">id_card,</if>
<if test="specialty != null and specialty != ''">specialty,</if>
<if test="workExperience != null and workExperience != ''">work_experience,</if>
<if test="hospital != null and hospital != ''">hospital,</if>
<if test="address != null and address != ''">address,</if>
<if test="iphone != null and iphone != ''">iphone,</if>
<if test="introduction != null and introduction != ''">introduction,</if>
<if test="title != null and title != ''">title,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="expertType != null and expertType != ''">expert_type,</if>
<if test="email != null and email != ''">email,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
@ -91,15 +135,21 @@
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if> <if test="userId != null">#{userId},</if>
<if test="realName != null">#{realName},</if>
<if test="gender != null">#{gender},</if>
<if test="realName != null and realName != ''">#{realName},</if>
<if test="gender != null and gender != ''">#{gender},</if>
<if test="birthday != null">#{birthday},</if> <if test="birthday != null">#{birthday},</if>
<if test="idCard != null">#{idCard},</if>
<if test="specialty != null">#{specialty},</if>
<if test="workExperience != null">#{workExperience},</if>
<if test="hospital != null">#{hospital},</if>
<if test="address != null">#{address},</if>
<if test="introduction != null">#{introduction},</if>
<if test="idCard != null and idCard != ''">#{idCard},</if>
<if test="specialty != null and specialty != ''">#{specialty},</if>
<if test="workExperience != null and workExperience != ''">#{workExperience},</if>
<if test="hospital != null and hospital != ''">#{hospital},</if>
<if test="address != null and address != ''">#{address},</if>
<if test="iphone != null and iphone != ''">#{iphone},</if>
<if test="introduction != null and introduction != ''">#{introduction},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="expertType != null and expertType != ''">#{expertType},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
@ -107,39 +157,41 @@
</trim> </trim>
</insert> </insert>
<!-- 更新兽医个人信息 -->
<update id="updateVetPersonalInfo" parameterType="VetPersonalInfo"> <update id="updateVetPersonalInfo" parameterType="VetPersonalInfo">
update vet_personal_info update vet_personal_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if> <if test="userId != null">user_id = #{userId},</if>
<if test="realName != null">real_name = #{realName},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="iphone != null">iphone = #{iphone},</if>
<if test="realName != null and realName != ''">real_name = #{realName},</if>
<if test="gender != null and gender != ''">gender = #{gender},</if>
<if test="birthday != null">birthday = #{birthday},</if> <if test="birthday != null">birthday = #{birthday},</if>
<if test="idCard != null">id_card = #{idCard},</if>
<if test="specialty != null">specialty = #{specialty},</if>
<if test="workExperience != null">work_experience = #{workExperience},</if>
<if test="address != null">address = #{address},</if>
<if test="introduction != null">introduction = #{introduction},</if>
<if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
<if test="specialty != null and specialty != ''">specialty = #{specialty},</if>
<if test="workExperience != null and workExperience != ''">work_experience = #{workExperience},</if>
<if test="hospital != null and hospital != ''">hospital = #{hospital},</if>
<if test="address != null and address != ''">address = #{address},</if>
<if test="iphone != null and iphone != ''">iphone = #{iphone},</if>
<if test="introduction != null and introduction != ''">introduction = #{introduction},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="expertType != null and expertType != ''">expert_type = #{expertType},</if>
<if test="email != null and email != ''">email = #{email},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<!-- 删除操作保持不变 -->
<delete id="deleteVetPersonalInfoById" parameterType="Long"> <delete id="deleteVetPersonalInfoById" parameterType="Long">
delete from vet_personal_info where id = #{id} delete from vet_personal_info where id = #{id}
</delete> </delete>
<delete id="deleteVetPersonalInfoByIds" parameterType="Long">
<delete id="deleteVetPersonalInfoByIds" parameterType="String">
delete from vet_personal_info where id in delete from vet_personal_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="selectVetPersonalInfoByUserId" parameterType="Long" resultMap="VetPersonalInfoResult">
<include refid="selectVetPersonalInfoVo"/>
WHERE user_id = #{userId}
LIMIT 1
</select>
</mapper> </mapper>

44
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'
})
}

44
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'
})
}

8
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({ return request({
url: '/vet/comments/' + commentId,
url: '/vet/comments/' + id,
method: 'get' method: 'get'
}) })
} }
@ -36,9 +36,9 @@ export function updateComments(data) {
} }
// 删除兽医回复 // 删除兽医回复
export function delComments(commentId) {
export function delComments(id) {
return request({ return request({
url: '/vet/comments/' + commentId,
url: '/vet/comments/' + id,
method: 'delete' method: 'delete'
}) })
} }

44
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'
})
}

367
chenhai-ui/src/views/muhu/consultation/index.vue

@ -0,0 +1,367 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="问诊标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入问诊标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否含敏感词" prop="isSensitive">
<el-input
v-model="queryParams.isSensitive"
placeholder="请输入是否含敏感词"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="查看次数" prop="viewCount">
<el-input
v-model="queryParams.viewCount"
placeholder="请输入查看次数"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="回复数量" prop="replyCount">
<el-input
v-model="queryParams.replyCount"
placeholder="请输入回复数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['muhu:consultation:add']"
>发布</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['muhu:consultation:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['muhu:consultation:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['muhu:consultation:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="consultationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="头像" align="center" prop="avatar" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.avatar" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="发布者" align="center" prop="farmerName" />
<el-table-column label="问诊标题" align="center" prop="title" />
<el-table-column label="病情描述" align="center" prop="description" />
<el-table-column label="牲畜种类" align="center" prop="animalType" />
<el-table-column label="牲畜年龄" align="center" prop="animalAge" />
<el-table-column label="牲畜性别" align="center" prop="animalGender" />
<el-table-column label="症状照片" align="center" prop="images" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.images" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="回复状态" align="center" prop="status" />
<el-table-column label="回复条数" align="center" prop="replyCount" />
<el-table-column label="问诊时间" align="center" prop="createdTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-chat-dot-round"
@click="handleReply(scope.row)"
v-hasPermi="['vet:comments:list']"
>回复</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['muhu:consultation:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['muhu:consultation:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改问诊单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="问诊标题" prop="title">
<el-input v-model="form.title" placeholder="请输入问诊标题" />
</el-form-item>
<el-form-item label="病情描述" prop="description">
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="牲畜种类" prop="animalType">
<el-input v-model="form.animalType" placeholder="请输入牲畜种类" />
</el-form-item>
<el-form-item label="牲畜年龄" prop="animalAge">
<el-input v-model="form.animalAge" placeholder="请输入牲畜年龄" />
</el-form-item>
<el-form-item label="牲畜性别" prop="animalGender">
<el-input v-model="form.animalGender" placeholder="请输入牲畜性别" />
</el-form-item>
<el-form-item label="症状照片" prop="images">
<image-upload v-model="form.images" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 回复管理对话框 -->
<el-dialog
title="回复"
:visible.sync="replyOpen"
width="1000px"
append-to-body
:close-on-click-modal="false"
>
<comments-list
:consultation-id="currentConsultationId"
v-if="replyOpen"
/>
</el-dialog>
</div>
</template>
<script>
import { listConsultation, getConsultation, delConsultation, addConsultation, updateConsultation } from "@/api/muhu/consultation"
import CommentsList from '@/views/vet/comments/index.vue';
export default {
name: "Consultation",
components: {
CommentsList
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
consultationList: [],
// ID
currentConsultationId: null,
//
replyOpen: false,
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
farmerId: null,
title: null,
description: null,
animalType: null,
images: null,
status: null,
isSensitive: null,
sensitiveWords: null,
viewCount: null,
replyCount: null
},
//
form: {},
//
rules: {
farmerId: [
{ required: true, message: "发布者ID不能为空", trigger: "blur" }
],
title: [
{ required: true, message: "问诊标题不能为空", trigger: "blur" }
],
description: [
{ required: true, message: "病情描述不能为空", trigger: "blur" }
],
}
}
},
created() {
this.getList()
},
methods: {
/** 查询问诊单列表 */
getList() {
this.loading = true
listConsultation(this.queryParams).then(response => {
this.consultationList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
formId: null,
farmerId: null,
title: null,
description: null,
animalType: null,
images: null,
status: null,
isSensitive: null,
sensitiveWords: null,
viewCount: null,
replyCount: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.formId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 回复按钮操作 */
handleReply(row) {
this.currentRow = row
this.currentConsultationId = row.formId
this.replyOpen = true
//
console.log('点击回复,问诊单ID:', row.formId)
console.log('当前currentConsultationId:', this.currentConsultationId)
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加问诊单"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const formId = row.formId || this.ids
getConsultation(formId).then(response => {
this.form = response.data
this.open = true
this.title = "修改问诊单"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.formId != null) {
updateConsultation(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addConsultation(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const formIds = row.formId || this.ids
this.$modal.confirm('是否确认删除问诊单编号为"' + formIds + '"的数据项?').then(function() {
return delConsultation(formIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('muhu/consultation/export', {
...this.queryParams
}, `consultation_${new Date().getTime()}.xlsx`)
}
}
}
</script>

460
chenhai-ui/src/views/system/consultation/index.vue

@ -0,0 +1,460 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户ID" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="专家ID" prop="expertId">
<el-input
v-model="queryParams.expertId"
placeholder="请输入专家ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="关联问诊单ID" prop="formId">
<el-input
v-model="queryParams.formId"
placeholder="请输入关联问诊单ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="咨询标题" prop="consultationTitle">
<el-input
v-model="queryParams.consultationTitle"
placeholder="请输入咨询标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户评分(1-5分)" prop="rating">
<el-input
v-model="queryParams.rating"
placeholder="请输入用户评分(1-5分)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户评价内容" prop="evaluation">
<el-input
v-model="queryParams.evaluation"
placeholder="请输入用户评价内容"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="评价时间" prop="evaluationTime">
<el-date-picker clearable
v-model="queryParams.evaluationTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择评价时间">
</el-date-picker>
</el-form-item>
<el-form-item label="咨询开始时间" prop="startTime">
<el-date-picker clearable
v-model="queryParams.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择咨询开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="咨询结束时间" prop="endTime">
<el-date-picker clearable
v-model="queryParams.endTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择咨询结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="创建时间" prop="createdTime">
<el-date-picker clearable
v-model="queryParams.createdTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="更新时间" prop="updatedTime">
<el-date-picker clearable
v-model="queryParams.updatedTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择更新时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:consultation:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:consultation:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:consultation:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:consultation:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="consultationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="咨询ID" align="center" prop="consultationId" />
<el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="专家ID" align="center" prop="expertId" />
<el-table-column label="关联问诊单ID" align="center" prop="formId" />
<el-table-column label="咨询类型: 1-图文咨询, 2-电话咨询, 3-视频咨询" align="center" prop="consultationType" />
<el-table-column label="咨询状态: 0-待接诊, 1-进行中, 2-已完成, 3-已取消" align="center" prop="consultationStatus" />
<el-table-column label="咨询标题" align="center" prop="consultationTitle" />
<el-table-column label="用户初始咨询内容" align="center" prop="initialContent" />
<el-table-column label="用户初始附件(JSON数组)" align="center" prop="initialAttachments" />
<el-table-column label="对话消息(JSON格式)" align="center" prop="messages" />
<el-table-column label="用户评分(1-5分)" align="center" prop="rating" />
<el-table-column label="用户评价内容" align="center" prop="evaluation" />
<el-table-column label="评价标签(JSON数组)" align="center" prop="evaluationTags" />
<el-table-column label="评价时间" align="center" prop="evaluationTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.evaluationTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="咨询开始时间" align="center" prop="startTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="咨询结束时间" align="center" prop="endTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createdTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updatedTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:consultation:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:consultation:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改专家咨询对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="专家ID" prop="expertId">
<el-input v-model="form.expertId" placeholder="请输入专家ID" />
</el-form-item>
<el-form-item label="关联问诊单ID" prop="formId">
<el-input v-model="form.formId" placeholder="请输入关联问诊单ID" />
</el-form-item>
<el-form-item label="咨询标题" prop="consultationTitle">
<el-input v-model="form.consultationTitle" placeholder="请输入咨询标题" />
</el-form-item>
<el-form-item label="用户初始咨询内容">
<editor v-model="form.initialContent" :min-height="192"/>
</el-form-item>
<el-form-item label="对话消息(JSON格式)" prop="messages">
<el-input v-model="form.messages" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="用户评分(1-5分)" prop="rating">
<el-input v-model="form.rating" placeholder="请输入用户评分(1-5分)" />
</el-form-item>
<el-form-item label="用户评价内容" prop="evaluation">
<el-input v-model="form.evaluation" placeholder="请输入用户评价内容" />
</el-form-item>
<el-form-item label="评价时间" prop="evaluationTime">
<el-date-picker clearable
v-model="form.evaluationTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择评价时间">
</el-date-picker>
</el-form-item>
<el-form-item label="咨询开始时间" prop="startTime">
<el-date-picker clearable
v-model="form.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择咨询开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="咨询结束时间" prop="endTime">
<el-date-picker clearable
v-model="form.endTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择咨询结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="创建时间" prop="createdTime">
<el-date-picker clearable
v-model="form.createdTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="更新时间" prop="updatedTime">
<el-date-picker clearable
v-model="form.updatedTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择更新时间">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listConsultation, getConsultation, delConsultation, addConsultation, updateConsultation } from "@/api/system/consultation"
export default {
name: "Consultation",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
consultationList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
expertId: null,
formId: null,
consultationType: null,
consultationStatus: null,
consultationTitle: null,
initialContent: null,
initialAttachments: null,
messages: null,
rating: null,
evaluation: null,
evaluationTags: null,
evaluationTime: null,
startTime: null,
endTime: null,
createdTime: null,
updatedTime: null
},
//
form: {},
//
rules: {
userId: [
{ required: true, message: "用户ID不能为空", trigger: "blur" }
],
expertId: [
{ required: true, message: "专家ID不能为空", trigger: "blur" }
],
}
}
},
created() {
this.getList()
},
methods: {
/** 查询专家咨询列表 */
getList() {
this.loading = true
listConsultation(this.queryParams).then(response => {
this.consultationList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
consultationId: null,
userId: null,
expertId: null,
formId: null,
consultationType: null,
consultationStatus: null,
consultationTitle: null,
initialContent: null,
initialAttachments: null,
messages: null,
rating: null,
evaluation: null,
evaluationTags: null,
evaluationTime: null,
startTime: null,
endTime: null,
createdTime: null,
updatedTime: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.consultationId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加专家咨询"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const consultationId = row.consultationId || this.ids
getConsultation(consultationId).then(response => {
this.form = response.data
this.open = true
this.title = "修改专家咨询"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.consultationId != null) {
updateConsultation(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addConsultation(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const consultationIds = row.consultationId || this.ids
this.$modal.confirm('是否确认删除专家咨询编号为"' + consultationIds + '"的数据项?').then(function() {
return delConsultation(consultationIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('system/consultation/export', {
...this.queryParams
}, `consultation_${new Date().getTime()}.xlsx`)
}
}
}
</script>

12
chenhai-ui/src/views/system/user/profile/userInfo.vue

@ -62,7 +62,17 @@ export default {
user: { user: {
handler(user) { handler(user) {
if (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 immediate: true

285
chenhai-ui/src/views/vet/comments/index.vue

@ -0,0 +1,285 @@
<template>
<div class="app-container">
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">-->
<!-- <el-form-item>-->
<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['vet:comments:add']"
>新增</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['vet:comments:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['vet:comments:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['vet:comments:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="commentsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="头像" align="center" prop="avatar" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.avatar" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="回复者" align="center" prop="replyName" />
<el-table-column label="职称" align="center" prop="title" />
<el-table-column label="从属医院" align="center" prop="hospital" />
<el-table-column label="从业经验" align="center" prop="experience" />
<el-table-column label="回复内容" align="center" prop="content" />
<el-table-column label="回复图片" align="center" prop="images" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.images" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="回复时间" align="center" prop="updatedAt" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['vet:comments:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['vet:comments:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改兽医回复对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="回复内容" prop="content">
<el-input v-model="form.content" placeholder="请输入回复内容" />
</el-form-item>
<el-form-item label="回复图片" prop="images">
<image-upload v-model="form.images" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listComments, getComments, delComments, addComments, updateComments } from "@/api/vet/comments"
export default {
name: "Comments",
props: {
// ID
consultationId: {
type: Number,
required: true
}
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
commentsList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
consultationId: null,
replyName: null,
content: null,
images: null,
isSensitive: null,
sensitiveWords: null,
createdAt: null,
updatedAt: null,
userId: null
},
//
form: {
consultationId: null
},
//
rules: {
}
}
},
created() {
this.queryParams.consultationId = Number(this.consultationId)
this.getList()
},
methods: {
/** 查询兽医回复列表 */
getList() {
this.loading = true
listComments(this.queryParams).then(response => {
this.commentsList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
id: null,
consultationId: this.consultationId,
replyName: null,
content: null,
images: null,
isSensitive: null,
sensitiveWords: null,
createdAt: null,
updatedAt: null,
userId: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加兽医回复"
this.form.consultationId = this.consultationId;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getComments(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改兽医回复"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateComments(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addComments(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除兽医回复编号为"' + ids + '"的数据项?').then(function() {
return delComments(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('vet/comments/export', {
...this.queryParams
}, `comments_${new Date().getTime()}.xlsx`)
}
}
}
</script>

317
chenhai-ui/src/views/vet/experts/index.vue

@ -0,0 +1,317 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['vet:experts:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['vet:experts:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['vet:experts:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['vet:experts:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="expertsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="真实姓名" align="center" prop="realName" />
<el-table-column label="联系电话" align="center" prop="iphone" />
<el-table-column label="电子邮箱" align="center" prop="email" />
<el-table-column label="职称" align="center" prop="title" />
<el-table-column label="从业经验" align="center" prop="workExperience" />
<el-table-column label="专家类型" align="center" prop="expert" />
<el-table-column label="擅长领域" align="center" prop="expertiseArea" />
<el-table-column label="工作单位" align="center" prop="address" />
<el-table-column label="在线状态" align="center" prop="isOnline" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-chat-dot-round"
@click="handleConsultation(scope.row)"
v-hasPermi="['system:consultation:view']"
>咨询</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['vet:experts:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['vet:experts:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改专家信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="真实姓名" prop="realName">
<el-input v-model="form.realName" placeholder="请输入真实姓名" />
</el-form-item>
<el-form-item label="擅长领域" prop="expertiseArea">
<el-input v-model="form.expertiseArea" placeholder="请输入擅长领域" />
</el-form-item>
<el-form-item label="联系方式" prop="contactInfo">
<el-input v-model="form.contactInfo" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="在线状态" prop="isOnline">
<el-select v-model="form.isOnline" placeholder="请选择在线状态" clearable>
<el-option v-for="dict in dict.type.is_online" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 专家咨询对话框 -->
<el-dialog
:title="`专家咨询 - ${selectedExpertName}`"
:visible.sync="consultationDialogVisible"
width="90%"
top="5vh"
append-to-body>
<consultation-component
:expert-id="selectedExpertId"
:expert-name="selectedExpertName"
v-if="consultationDialogVisible"
/>
<div slot="footer" class="dialog-footer">
<el-button @click="consultationDialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listExperts, getExperts, delExperts, addExperts, updateExperts } from "@/api/vet/experts"
import ConsultationComponent from '@/views/system/consultation/index.vue'
export default {
name: "Experts",
dicts: ['is_online'],
components: {
ConsultationComponent
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
expertsList: [],
//
title: "",
//
open: false,
//
consultationDialogVisible: false,
// ID
selectedExpertId: null,
//
selectedExpertName: '',
//
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
realName: null,
expertiseArea: null,
contactInfo: null,
isOnline: null,
sortOrder: null,
status: null,
createdAt: null,
updatedAt: null
},
//
form: {},
//
rules: {
userId: [
{ required: true, message: "关联用户ID不能为空", trigger: "blur" }
],
}
}
},
created() {
this.getList()
},
methods: {
/** 查询专家信息列表 */
getList() {
this.loading = true
listExperts(this.queryParams).then(response => {
this.expertsList = response.rows.map(item => {
// 使线
const onlineStatus = this.dict.type.is_online.find(dict => dict.value === item.isOnline)
return {
...item,
isOnlineText: onlineStatus ? onlineStatus.label : item.isOnline
}
})
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
expertId: null,
userId: null,
realName: null,
expertiseArea: null,
contactInfo: null,
isOnline: null,
sortOrder: null,
status: null,
createdAt: null,
updatedAt: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.expertId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加专家信息"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const expertId = row.expertId || this.ids
getExperts(expertId).then(response => {
this.form = response.data
this.open = true
this.title = "修改专家信息"
})
},
/** 咨询按钮操作 */
handleConsultation(row) {
this.selectedExpertId = row.expertId
this.selectedExpertName = row.realName
this.consultationDialogVisible = true
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.expertId != null) {
updateExperts(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addExperts(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const expertIds = row.expertId || this.ids
this.$modal.confirm('是否确认删除专家信息编号为"' + expertIds + '"的数据项?').then(function() {
return delExperts(expertIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('vet/experts/export', {
...this.queryParams
}, `experts_${new Date().getTime()}.xlsx`)
}
}
}
</script>

38
chenhai-ui/src/views/vet/info/index.vue

@ -2,14 +2,6 @@
<div class="app-container"> <div class="app-container">
<!-- 搜索部分 --> <!-- 搜索部分 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
<!-- <el-form-item label="用户ID" prop="userId">-->
<!-- <el-input-->
<!-- v-model="queryParams.userId"-->
<!-- placeholder="请输入用户ID"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="真实姓名" prop="realName"> <el-form-item label="真实姓名" prop="realName">
<el-input <el-input
v-model="queryParams.realName" v-model="queryParams.realName"
@ -26,14 +18,6 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<!-- <el-form-item label="出生日期" prop="birthday">-->
<!-- <el-date-picker clearable-->
<!-- v-model="queryParams.birthday"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择出生日期">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<el-form-item label="身份证号" prop="idCard"> <el-form-item label="身份证号" prop="idCard">
<el-input <el-input
v-model="queryParams.idCard" v-model="queryParams.idCard"
@ -121,8 +105,7 @@
<!-- 表格部分 --> <!-- 表格部分 -->
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键ID" align="center" prop="id" />-->
<!-- <el-table-column label="用户ID" align="center" prop="userId" />-->
<el-table-column label="用户昵称" align="center" prop="nickName" />
<el-table-column label="真实姓名" align="center" prop="realName" /> <el-table-column label="真实姓名" align="center" prop="realName" />
<el-table-column label="性别" align="center" prop="gender" /> <el-table-column label="性别" align="center" prop="gender" />
<el-table-column label="出生日期" align="center" prop="birthday"> <el-table-column label="出生日期" align="center" prop="birthday">
@ -133,6 +116,10 @@
<el-table-column label="身份证号" align="center" prop="idCard" width="180"/> <el-table-column label="身份证号" align="center" prop="idCard" width="180"/>
<el-table-column label="擅长领域" align="center" prop="specialty" /> <el-table-column label="擅长领域" align="center" prop="specialty" />
<el-table-column label="工作经验" align="center" prop="workExperience"/> <el-table-column label="工作经验" align="center" prop="workExperience"/>
<el-table-column label="职称" align="center" prop="title"/>
<el-table-column label="联系电话" align="center" prop="phone"/>
<el-table-column label="电子邮箱" align="center" prop="email"/>
<el-table-column label="专家类型" align="center" prop="expertType"/>
<el-table-column label="所属医院" align="center" prop="hospital" /> <el-table-column label="所属医院" align="center" prop="hospital" />
<el-table-column label="联系地址" align="center" prop="address" /> <el-table-column label="联系地址" align="center" prop="address" />
<el-table-column label="个人简介" align="center" prop="introduction" /> <el-table-column label="个人简介" align="center" prop="introduction" />
@ -197,6 +184,20 @@
placeholder="请选择出生日期"> placeholder="请选择出生日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="职称" prop="title">
<el-input v-model="form.title" placeholder="请输入职称" />
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="电子邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入电子邮箱" />
</el-form-item>
<el-form-item label="专家类型" prop="expertType">
<el-select v-model="form.expertType" placeholder="请选择专家类型" clearable>
<el-option v-for="dict in dict.type.expert_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="身份证号" prop="idCard"> <el-form-item label="身份证号" prop="idCard">
<el-input v-model="form.idCard" placeholder="请输入身份证号" /> <el-input v-model="form.idCard" placeholder="请输入身份证号" />
</el-form-item> </el-form-item>
@ -239,6 +240,7 @@ import Certificate from "../certificate/index.vue"
export default { export default {
name: "Info", name: "Info",
dicts: ['expert_type'],
components:{ components:{
Certificate, Certificate,
}, },

Loading…
Cancel
Save