Browse Source

接口优化

master
maotiantian 1 month ago
parent
commit
04ded6e78a
  1. 12
      chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuFeedbackController.java
  2. 20
      chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuUserController.java
  3. 12
      chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysDictDataController.java
  4. 21
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/TreatmentPlanController.java
  5. 2
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExperienceArticleController.java
  6. 4
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetKnowledgeController.java
  7. 14
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetTrainingVideoController.java
  8. 1
      chenhai-framework/src/main/java/com/chenhai/framework/web/service/SysLoginService.java
  9. 31
      chenhai-system/src/main/java/com/chenhai/vet/domain/TreatmentPlan.java
  10. 39
      chenhai-system/src/main/java/com/chenhai/vet/domain/VetKnowledge.java
  11. 23
      chenhai-system/src/main/java/com/chenhai/vet/service/impl/TreatmentPlanServiceImpl.java
  12. 79
      chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetKnowledgeServiceImpl.java
  13. 65
      chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetTrainingVideoServiceImpl.java
  14. 11
      chenhai-system/src/main/resources/mapper/vet/TreatmentPlanMapper.xml
  15. 26
      chenhai-system/src/main/resources/mapper/vet/VetKnowledgeMapper.xml
  16. 1
      chenhai-ui/src/api/login.js
  17. 187
      chenhai-ui/src/views/muhu/consultation/index.vue
  18. 15
      chenhai-ui/src/views/muhu/feedback/index.vue
  19. 164
      chenhai-ui/src/views/vet/comments/index.vue
  20. 66
      chenhai-ui/src/views/vet/knowledge/index.vue
  21. 113
      chenhai-ui/src/views/vet/plan/index.vue
  22. 44
      chenhai-ui/src/views/vet/training/index.vue

12
chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuFeedbackController.java

@ -37,7 +37,7 @@ public class MuhuFeedbackController extends BaseController
/**
* 查询反馈建议列表
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:list') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('muhu:feedback:list') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping("/list")
public TableDataInfo list(MuhuFeedback muhuFeedback)
{
@ -49,7 +49,7 @@ public class MuhuFeedbackController extends BaseController
/**
* 导出反馈建议列表
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:export') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('muhu:feedback:export') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "反馈建议", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MuhuFeedback muhuFeedback)
@ -62,7 +62,7 @@ public class MuhuFeedbackController extends BaseController
/**
* 获取反馈建议详细信息
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:query') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('muhu:feedback:query') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
@ -72,7 +72,7 @@ public class MuhuFeedbackController extends BaseController
/**
* 新增反馈建议
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:add') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('muhu:feedback:add') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "反馈建议", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MuhuFeedback muhuFeedback)
@ -83,7 +83,7 @@ public class MuhuFeedbackController extends BaseController
/**
* 修改反馈建议
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:edit') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('muhu:feedback:edit') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "反馈建议", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MuhuFeedback muhuFeedback)
@ -94,7 +94,7 @@ public class MuhuFeedbackController extends BaseController
/**
* 删除反馈建议
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:remove') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('muhu:feedback:remove') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "反馈建议", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)

20
chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuUserController.java

@ -57,7 +57,7 @@ public class MuhuUserController extends BaseController
/**
* 查询牧户用户列表
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:list') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:list') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping("/list")
public TableDataInfo list(SysMuhuUser sysMuhuUser)
{
@ -69,7 +69,7 @@ public class MuhuUserController extends BaseController
/**
* 导出牧户用户列表
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:export') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:export') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "牧户用户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysMuhuUser sysMuhuUser)
@ -82,7 +82,7 @@ public class MuhuUserController extends BaseController
/**
* 获取牧户用户详细信息
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:query') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:query') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable("userId") Long userId)
{
@ -92,7 +92,7 @@ public class MuhuUserController extends BaseController
/**
* 新增牧户用户
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:add') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:add') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "牧户用户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysMuhuUser sysMuhuUser)
@ -118,7 +118,7 @@ public class MuhuUserController extends BaseController
/**
* 修改牧户用户
*/
@PreAuthorize("@ss.hasRole('muhu')")
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "牧户个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user) {
@ -180,7 +180,7 @@ public class MuhuUserController extends BaseController
/**
* 删除牧户用户
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:remove') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:remove') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "牧户用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds)
@ -191,7 +191,7 @@ public class MuhuUserController extends BaseController
/**
* 提交实名认证新增
*/
@PreAuthorize("@ss.hasRole('muhu')")
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')")
@PostMapping("/auth/submit")
public AjaxResult submitAuth(@RequestBody AuthRequest request)
{
@ -241,7 +241,7 @@ public class MuhuUserController extends BaseController
/**
* 获取区域子节点
*/
@PreAuthorize("@ss.hasRole('muhu')")
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping("/areaChildren")
public AjaxResult getAreaChildren(@RequestParam(value = "parentCode", required = false, defaultValue = "152900") String parentCode) {
SysArea query = new SysArea();
@ -254,7 +254,7 @@ public class MuhuUserController extends BaseController
/**
* 获取用户信息
*/
@PreAuthorize("@ss.hasRole('muhu')")
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping("/getUserInfo")
public AjaxResult getUserInfo() {
try {
@ -305,7 +305,7 @@ public class MuhuUserController extends BaseController
/**
* 保存用户区域代码
*/
@PreAuthorize("@ss.hasRole('muhu')")
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')")
@PutMapping("/saveUserAreaCode/{areaCode}")
public AjaxResult getArea(@PathVariable("areaCode") String areaCode) {
Long userId = getUserId();

12
chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysDictDataController.java

@ -40,7 +40,7 @@ public class SysDictDataController extends BaseController
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:dict:list') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
@ -50,7 +50,7 @@ public class SysDictDataController extends BaseController
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:dict:export') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictData dictData)
{
@ -62,7 +62,7 @@ public class SysDictDataController extends BaseController
/**
* 查询字典数据详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:dict:query') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode)
{
@ -86,7 +86,7 @@ public class SysDictDataController extends BaseController
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:dict:add') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict)
@ -98,7 +98,7 @@ public class SysDictDataController extends BaseController
/**
* 修改保存字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:dict:edit') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
@ -110,7 +110,7 @@ public class SysDictDataController extends BaseController
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove') or @ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('system:dict:remove') or @ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes)

21
chenhai-admin/src/main/java/com/chenhai/web/controller/vet/TreatmentPlanController.java

@ -40,7 +40,7 @@ public class TreatmentPlanController extends BaseController {
/**
* 查询治疗方案列表
*/
@PreAuthorize("@ss.hasPermi('vet:plan:list')")
@PreAuthorize("@ss.hasPermi('vet:plan:list') or @ss.hasRole('vet') or @ss.hasRole('muhu')")
@GetMapping("/list")
public TableDataInfo list(TreatmentPlan treatmentPlan) {
startPage();
@ -49,14 +49,7 @@ public class TreatmentPlanController extends BaseController {
}
@GetMapping("/listByConsultationId")
public TableDataInfo listByConsultationId(@RequestParam(required = false) Long consultationId) {
TreatmentPlan treatmentPlan = new TreatmentPlan();
// 如果传了consultationId就按ID查询
if (consultationId != null) {
treatmentPlan.setConsultationId(consultationId);
}
public TableDataInfo listByConsultationId(TreatmentPlan treatmentPlan) {
startPage();
List<TreatmentPlan> list = treatmentPlanService.selectTreatmentPlanList(treatmentPlan);
return getDataTable(list);
@ -64,7 +57,7 @@ public class TreatmentPlanController extends BaseController {
/**
* 导出治疗方案列表
*/
@PreAuthorize("@ss.hasPermi('vet:plan:export')")
@PreAuthorize("@ss.hasPermi('vet:plan:export') or @ss.hasRole('vet') or @ss.hasRole('muhu')")
@Log(title = "治疗方案", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TreatmentPlan treatmentPlan) {
@ -76,7 +69,7 @@ public class TreatmentPlanController extends BaseController {
/**
* 获取治疗方案详细信息
*/
@PreAuthorize("@ss.hasPermi('vet:plan:query')")
@PreAuthorize("@ss.hasPermi('vet:plan:query') or @ss.hasRole('vet') or @ss.hasRole('muhu')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(treatmentPlanService.selectTreatmentPlanById(id));
@ -85,7 +78,7 @@ public class TreatmentPlanController extends BaseController {
/**
* 新增治疗方案
*/
@PreAuthorize("@ss.hasPermi('vet:plan:add')")
@PreAuthorize("@ss.hasPermi('vet:plan:add') or @ss.hasRole('vet') or @ss.hasRole('muhu')")
@Log(title = "治疗方案", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TreatmentPlan treatmentPlan) {
@ -95,7 +88,7 @@ public class TreatmentPlanController extends BaseController {
/**
* 修改治疗方案
*/
@PreAuthorize("@ss.hasPermi('vet:plan:edit')")
@PreAuthorize("@ss.hasPermi('vet:plan:edit') or @ss.hasRole('vet')")
@Log(title = "治疗方案", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TreatmentPlan treatmentPlan) {
@ -105,7 +98,7 @@ public class TreatmentPlanController extends BaseController {
/**
* 删除治疗方案
*/
@PreAuthorize("@ss.hasPermi('vet:plan:remove')")
@PreAuthorize("@ss.hasPermi('vet:plan:remove') or @ss.hasRole('vet') or @ss.hasRole('muhu')")
@Log(title = "治疗方案", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {

2
chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExperienceArticleController.java

@ -302,7 +302,7 @@ public class VetExperienceArticleController extends BaseController {
* 发布新文章论坛发布
*/
@SensitiveCheck
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')")
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')")
@Log(title = "发布经验文章", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody VetExperienceArticle article) {

4
chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetKnowledgeController.java

@ -175,7 +175,7 @@ public class VetKnowledgeController extends BaseController
* 查询已发布且审核通过的兽医文章列表公开接口无需权限
* 用于前端展示给用户只显示可公开的文章
*/
@PreAuthorize("@ss.hasRole('muhu')")
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping("/published/list")
public TableDataInfo publishedList(VetKnowledge vetKnowledge)
{
@ -188,7 +188,7 @@ public class VetKnowledgeController extends BaseController
/**
* 获取已发布文章的详细信息公开接口
*/
@PreAuthorize("@ss.hasRole('muhu')")
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')")
@GetMapping("/published/{id}")
public AjaxResult getPublishedInfo(@PathVariable("id") Long id)
{

14
chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetTrainingVideoController.java

@ -206,7 +206,7 @@ public class VetTrainingVideoController extends BaseController
/**
* 批量提交审核
*/
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')")
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')")
@PostMapping("/batch-submit-audit")
public AjaxResult batchSubmitForAudit(@RequestBody List<Long> videoIds) {
Long userId = getCurrentUserId();
@ -217,7 +217,7 @@ public class VetTrainingVideoController extends BaseController
/**
* 批量审核管理员接口
*/
@PreAuthorize("@ss.hasPermi('vet:training:audit') or @ss.hasRole('muhu')or @ss.hasRole('manger')")
@PreAuthorize("@ss.hasPermi('vet:training:audit') or @ss.hasRole('muhu')or @ss.hasRole('manger')or @ss.hasRole('vet')")
@PostMapping("/batch-audit")
public AjaxResult batchAuditVideo(@RequestBody Map<String, Object> batchAuditData) {
@SuppressWarnings("unchecked")
@ -241,7 +241,7 @@ public class VetTrainingVideoController extends BaseController
/**
* 批量上架
*/
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')or @ss.hasRole('manger')")
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')or @ss.hasRole('manger')or @ss.hasRole('vet')")
@PostMapping("/batch-publish")
public AjaxResult batchPublishVideo(@RequestBody List<Long> videoIds) {
Long userId = getCurrentUserId();
@ -252,7 +252,7 @@ public class VetTrainingVideoController extends BaseController
/**
* 批量下架
*/
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')or @ss.hasRole('manger')")
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')or @ss.hasRole('manger')or @ss.hasRole('vet')")
@PostMapping("/batch-offline")
public AjaxResult batchOfflineVideo(@RequestBody List<Long> videoIds) {
Long userId = getCurrentUserId();
@ -263,7 +263,7 @@ public class VetTrainingVideoController extends BaseController
/**
* 审核单个视频管理员接口
*/
@PreAuthorize("@ss.hasPermi('vet:training:audit') or@ss.hasRole('muhu')")
@PreAuthorize("@ss.hasPermi('vet:training:audit') or@ss.hasRole('muhu')or @ss.hasRole('vet')")
@PostMapping("/audit/{videoId}")
public AjaxResult auditVideo(@PathVariable Long videoId,
@RequestBody Map<String, String> auditData) {
@ -289,7 +289,7 @@ public class VetTrainingVideoController extends BaseController
/**
* 上架单个视频审核通过后才能上架
*/
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')or @ss.hasRole('manger')")
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')or @ss.hasRole('manger')or @ss.hasRole('vet')")
@PostMapping("/publish/{videoId}")
public AjaxResult publishVideo(@PathVariable Long videoId) {
Long userId = getCurrentUserId();
@ -304,7 +304,7 @@ public class VetTrainingVideoController extends BaseController
/**
* 下架单个视频
*/
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')or @ss.hasRole('manger')")
@PreAuthorize("@ss.hasRole('muhu')or @ss.hasRole('vet')or @ss.hasRole('manger')or @ss.hasRole('vet')")
@PostMapping("/offline/{videoId}")
public AjaxResult offlineVideo(@PathVariable Long videoId) {
Long userId = getCurrentUserId();

1
chenhai-framework/src/main/java/com/chenhai/framework/web/service/SysLoginService.java

@ -238,6 +238,7 @@ public class SysLoginService
Map<String, Object> result = new HashMap<>();
result.put("token", token);
result.put("needBind", false);
result.put("userType", loginUser.getUser().getUserType()); // 返回用户类型
return result;
} catch (WechatNeedBindException e) {

31
chenhai-system/src/main/java/com/chenhai/vet/domain/TreatmentPlan.java

@ -89,6 +89,14 @@ public class TreatmentPlan extends BaseEntity
/** 删除标志(0正常 1已删除) */
private String delFlag;
/** 兽医昵称(新增) */
@Excel(name = "兽医昵称")
private String vetNickName;
/** 兽医头像(新增) */
@Excel(name = "兽医头像")
private String vetAvatar;
public void setId(Long id)
{
this.id = id;
@ -244,6 +252,23 @@ public class TreatmentPlan extends BaseEntity
return delFlag;
}
public String getVetNickName() {
return vetNickName;
}
public void setVetNickName(String vetNickName) {
this.vetNickName = vetNickName;
}
public String getVetAvatar() {
return vetAvatar;
}
public void setVetAvatar(String vetAvatar) {
this.vetAvatar = vetAvatar;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -260,12 +285,14 @@ public class TreatmentPlan extends BaseEntity
.append("precautions", getPrecautions())
.append("status", getStatus())
.append("userId", getUserId())
.append("consultationId", getConsultationId())
.append("consultationId", getConsultationId())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.append("medicineList", getMedicineList())
.append("medicineList", getMedicineList())
.append("vetNickName", getVetNickName())
.append("vetAvatar", getVetAvatar())
.toString();
}
}

39
chenhai-system/src/main/java/com/chenhai/vet/domain/VetKnowledge.java

@ -77,6 +77,18 @@ public class VetKnowledge extends BaseEntity
private String expertName;
private String expertAvatar;
/** 用户ID(关联sys_user表) */
@Excel(name = "用户ID")
private Long userId;
/** 用户昵称(关联sys_user表) */
@Excel(name = "用户昵称")
private String nickName;
/** 用户头像(关联sys_user表) */
@Excel(name = "用户头像")
private String avatar;
public void setId(Long id)
{
this.id = id;
@ -217,6 +229,30 @@ public class VetKnowledge extends BaseEntity
this.searchKey = searchKey;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -239,6 +275,9 @@ public class VetKnowledge extends BaseEntity
.append("coverImage", getCoverImage())
.append("subtitle", getSubtitle())
.append("searchKey", getSearchKey())
.append("userId", getUserId())
.append("nickName", getNickName())
.append("avatar", getAvatar())
.toString();
}
}

23
chenhai-system/src/main/java/com/chenhai/vet/service/impl/TreatmentPlanServiceImpl.java

@ -4,10 +4,13 @@ import java.util.List;
import java.util.ArrayList;
import java.util.stream.Collectors;
import com.chenhai.common.core.domain.entity.SysUser;
import com.chenhai.common.core.domain.model.LoginUser;
import com.chenhai.common.exception.ServiceException;
import com.chenhai.common.utils.DateUtils;
import com.chenhai.common.utils.SecurityUtils;
import com.chenhai.common.utils.StringUtils;
import com.chenhai.system.mapper.SysUserMapper;
import com.chenhai.vet.domain.TreatmentPlan;
import com.chenhai.vet.domain.TreatmentPlanMedicine;
import com.chenhai.vet.domain.VetProduct;
@ -42,6 +45,9 @@ public class TreatmentPlanServiceImpl implements ITreatmentPlanService
@Autowired
private VetQualificationMapper vetQualificationMapper;
@Autowired
private SysUserMapper sysUserMapper;
/**
* 查询治疗方案
*/
@ -85,9 +91,22 @@ public class TreatmentPlanServiceImpl implements ITreatmentPlanService
@Transactional(rollbackFor = Exception.class)
public int insertTreatmentPlan(TreatmentPlan treatmentPlan)
{
// 设置当前兽医ID
Long userId = SecurityUtils.getUserId();
// 获取当前登录用户信息
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserId();
// 查询用户详细信息获取昵称和头像
SysUser sysUser = sysUserMapper.selectUserById(userId);
// 设置兽医信息
treatmentPlan.setUserId(userId);
// 设置兽医昵称优先使用nickName如果没有则使用userName
if (sysUser != null) {
treatmentPlan.setVetNickName(StringUtils.isNotEmpty(sysUser.getNickName())
? sysUser.getNickName() : sysUser.getUserName());
treatmentPlan.setVetAvatar(sysUser.getAvatar());
}
treatmentPlan.setCreateTime(DateUtils.getNowDate());
// 生成方案编号如果没有提供

79
chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetKnowledgeServiceImpl.java

@ -4,8 +4,11 @@ import java.util.ArrayList;
import java.util.List;
import com.chenhai.common.core.domain.AjaxResult;
import com.chenhai.common.core.domain.entity.SysUser;
import com.chenhai.common.core.domain.model.LoginUser;
import com.chenhai.common.utils.DateUtils;
import com.chenhai.common.utils.SecurityUtils;
import com.chenhai.system.service.ISysUserService;
import com.chenhai.vet.domain.VetExperts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -26,6 +29,9 @@ public class VetKnowledgeServiceImpl implements IVetKnowledgeService
@Autowired
private VetKnowledgeMapper vetKnowledgeMapper;
@Autowired
private ISysUserService userService;
/**
* 查询兽医文章
*/
@ -55,8 +61,79 @@ public class VetKnowledgeServiceImpl implements IVetKnowledgeService
vetKnowledge.setArticleStatus("0"); // 草稿
}
if (vetKnowledge.getAuditStatus() == null) {
vetKnowledge.setAuditStatus("1"); // 待审核
vetKnowledge.setAuditStatus("0"); // 待审核
}
try {
// 1. 获取当前登录用户ID
Long currentUserId = SecurityUtils.getUserId();
System.out.println("当前登录用户ID: " + currentUserId);
if (currentUserId != null) {
// 2. 设置用户ID
vetKnowledge.setUserId(currentUserId);
// 3. 获取当前登录用户的详细信息
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUser() != null) {
SysUser currentUser = loginUser.getUser();
// 4. 设置用户昵称优先使用昵称如果没有则使用用户名
String nickName = currentUser.getNickName();
if (nickName != null && !nickName.isEmpty()) {
vetKnowledge.setNickName(nickName);
} else {
vetKnowledge.setNickName(currentUser.getUserName());
}
// 5. 设置用户头像
String avatar = currentUser.getAvatar();
if (avatar != null && !avatar.isEmpty()) {
vetKnowledge.setAvatar(avatar);
}
System.out.println("设置用户信息成功 - userId: " + currentUserId +
", nickName: " + vetKnowledge.getNickName() +
", avatar: " + vetKnowledge.getAvatar());
} else {
// 如果无法从LoginUser获取尝试从数据库查询
SysUser user = userService.selectUserById(currentUserId);
if (user != null) {
vetKnowledge.setNickName(user.getNickName() != null ? user.getNickName() : user.getUserName());
vetKnowledge.setAvatar(user.getAvatar());
System.out.println("从数据库获取用户信息成功 - nickName: " + vetKnowledge.getNickName());
}
}
// 6. 根据用户ID查询专家信息保持原有逻辑
VetExperts expert = vetKnowledgeMapper.selectExpertByUserId(currentUserId);
if (expert != null) {
System.out.println("找到专家信息 - expertId: " + expert.getExpertId());
vetKnowledge.setExpertId(expert.getExpertId());
if (expert.getRealName() != null && !expert.getRealName().isEmpty()) {
vetKnowledge.setExpertName(expert.getRealName());
}
if (expert.getAvatar() != null && !expert.getAvatar().isEmpty()) {
vetKnowledge.setExpertAvatar(expert.getAvatar());
}
System.out.println("设置专家信息成功 - expertId: " + vetKnowledge.getExpertId() +
", expertName: " + vetKnowledge.getExpertName() +
", expertAvatar: " + vetKnowledge.getExpertAvatar());
} else {
System.out.println("未找到专家信息,用户ID: " + currentUserId + " 不是专家");
}
} else {
System.out.println("用户未登录");
}
} catch (Exception e) {
System.out.println("获取用户/专家信息异常: " + e.getMessage());
e.printStackTrace();
}
return vetKnowledgeMapper.insertVetKnowledge(vetKnowledge);
}

65
chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetTrainingVideoServiceImpl.java

@ -72,7 +72,7 @@ public class VetTrainingVideoServiceImpl implements IVetTrainingVideoService
vetTrainingVideo.setUserId(userId); // 确保设置用户ID
vetTrainingVideo.setStatus("0"); // 草稿原私有
vetTrainingVideo.setAuditStatus("0"); // 待审核
vetTrainingVideo.setAuditStatus("1"); // 待审核
vetTrainingVideo.setDelFlag("0"); // 正常
vetTrainingVideo.setCreateTime(DateUtils.getNowDate());
@ -461,37 +461,68 @@ public class VetTrainingVideoServiceImpl implements IVetTrainingVideoService
@Override
public boolean publishVideo(Long videoId, Long userId) {
try {
VetTrainingVideo video = vetTrainingVideoMapper.selectVetTrainingVideoById(videoId);
if (video == null) {
logger.warn("发布失败:视频不存在,ID: {}", videoId);
return false;
}
// 验证权限只能操作自己的视频
if (!userId.equals(video.getUserId())) {
// 检查是否是管理员
boolean isAdmin = checkUserIsAdmin(userId);
boolean isOwner = userId.equals(video.getUserId());
if (!isAdmin && !isOwner) {
logger.warn("发布失败:用户 {} 无权限操作视频 {}", userId, videoId);
return false;
}
// 状态验证只有审核通过(2)且为草稿状态(0)的视频才能发布
if (!"2".equals(video.getAuditStatus())) {
// 步骤4: 检查审核状态
String auditStatus = video.getAuditStatus();
if (!"2".equals(auditStatus)) {
logger.warn("发布失败:视频 {} 未通过审核,当前审核状态: '{}', 需要状态: '2'",
videoId, auditStatus);
return false;
}
if (!"0".equals(video.getStatus())) {
// 步骤5: 检查上架状态
String currentStatus = video.getStatus();
if (!"0".equals(currentStatus)) {
logger.warn("发布失败:视频 {} 当前状态不能发布,当前状态: '{}', 需要状态: '0'",
videoId, currentStatus);
return false;
}
// 更新为已发布状态
// 步骤6: 更新状态
video.setStatus("1"); // 已发布
video.setPublishTime(DateUtils.getNowDate());
video.setUpdateTime(DateUtils.getNowDate());
return vetTrainingVideoMapper.updateVetTrainingVideo(video) > 0;
int result = vetTrainingVideoMapper.updateVetTrainingVideo(video);
return result > 0;
} catch (Exception e) {
logger.error("发布视频失败,视频ID: {}", videoId, e);
return false;
}
}
/**
* 检查用户是否是管理员
*/
private boolean checkUserIsAdmin(Long userId) {
try {
// 使用 RuoYi SecurityUtils 检查
return SecurityUtils.isAdmin(userId);
} catch (Exception e) {
logger.error("检查管理员权限失败", e);
return false;
}
}
@Override
public boolean offlineVideo(Long videoId, Long userId) {
try {
@ -501,10 +532,10 @@ public class VetTrainingVideoServiceImpl implements IVetTrainingVideoService
return false;
}
// 验证权限只能操作自己的视频
if (!userId.equals(video.getUserId())) {
return false;
}
// // 验证权限只能操作自己的视频
// if (!userId.equals(video.getUserId())) {
// return false;
// }
// 状态验证只有已发布状态(1)的视频才能下架
if (!"1".equals(video.getStatus())) {
@ -585,16 +616,6 @@ public class VetTrainingVideoServiceImpl implements IVetTrainingVideoService
}
}
/**
* 检查用户是否是管理员
*/
private boolean checkUserIsAdmin(Long userId) {
// 这里需要根据你的权限系统来实现
// 例如查询用户角色
// 暂时返回false你需要根据实际情况实现
return false;
}
@Override
public boolean resubmitForAudit(Long videoId, Long userId) {
// 重新提交审核和提交审核逻辑相同

11
chenhai-system/src/main/resources/mapper/vet/TreatmentPlanMapper.xml

@ -24,6 +24,8 @@
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="del_flag"/>
<result property="vetNickName" column="vet_nick_name"/>
<result property="vetAvatar" column="vet_avatar"/>
</resultMap>
<!-- 带农牧户信息的 resultMap -->
@ -35,7 +37,8 @@
<sql id="selectTreatmentPlanVo">
select id, plan_no, title, farmer_id, farmer_name, farmer_phone, animal_type,
symptoms, diagnosis, treatment_method, treatment_desc, precautions,
status, user_id, consultation_id, create_time, update_time, remark, del_flag
status, user_id, vet_nick_name, vet_avatar, consultation_id,
create_time, update_time, remark, del_flag
from treatment_plan
</sql>
@ -97,6 +100,8 @@
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
<if test="vetNickName != null">vet_nick_name,</if>
<if test="vetAvatar != null">vet_avatar,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planNo != null">#{planNo},</if>
@ -117,6 +122,8 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="vetNickName != null">#{vetNickName},</if>
<if test="vetAvatar != null">#{vetAvatar},</if>
</trim>
</insert>
@ -139,6 +146,8 @@
<if test="consultationId != null">consultation_id = #{consultationId},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="vetNickName != null">vet_nick_name = #{vetNickName},</if>
<if test="vetAvatar != null">vet_avatar = #{vetAvatar},</if>
</trim>
where id = #{id}
</update>

26
chenhai-system/src/main/resources/mapper/vet/VetKnowledgeMapper.xml

@ -25,6 +25,10 @@
<result property="expertAvatar" column="expert_avatar"/>
<result property="coverImage" column="cover_image" />
<result property="subtitle" column="subtitle" />
<!-- 新增用户信息字段 -->
<result property="userId" column="user_id" />
<result property="nickName" column="nick_name" />
<result property="avatar" column="avatar" />
</resultMap>
<select id="selectExpertByUsername" parameterType="String" resultType="VetExperts">
@ -36,7 +40,7 @@
SELECT * FROM vet_experts WHERE user_id = #{userId}
</select>
<!-- 修改查询语句,关联专家表 -->
<!-- 修改查询语句,关联专家表和用户表 -->
<sql id="selectVetKnowledgeVo">
select
vk.id,
@ -57,7 +61,10 @@
vk.cover_image,
vk.subtitle,
vk.expert_id,
ve.real_name as expert_name, <!-- 添加专家姓名 -->
vk.user_id, <!-- 新增用户ID -->
vk.nick_name, <!-- 新增用户昵称 -->
vk.avatar, <!-- 新增用户头像 -->
ve.real_name as expert_name,
ve.avatar as expert_avatar
from vet_knowledge vk
left join vet_experts ve on vk.expert_id = ve.expert_id
@ -84,6 +91,9 @@
or ve.real_name like concat('%', #{searchKey}, '%')
)
</if>
<!-- 新增用户信息查询条件 -->
<if test="userId != null"> and user_id = #{userId}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
</where>
</select>
@ -112,6 +122,10 @@
<if test="expertId != null">expert_id,</if>
<if test="coverImage != null">cover_image,</if>
<if test="subtitle != null and subtitle != ''">subtitle,</if>
<!-- 新增用户信息字段 -->
<if test="userId != null">user_id,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">#{title},</if>
@ -131,6 +145,10 @@
<if test="expertId != null">#{expertId},</if>
<if test="coverImage != null">#{coverImage},</if>
<if test="subtitle != null and subtitle != ''">#{subtitle},</if>
<!-- 新增用户信息字段值 -->
<if test="userId != null">#{userId},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
</trim>
</insert>
@ -154,6 +172,10 @@
<if test="expertId != null">expert_id = #{expertId},</if>
<if test="coverImage != null">cover_image = #{coverImage},</if>
<if test="subtitle != null and subtitle != ''">subtitle = #{subtitle},</if>
<!-- 新增用户信息字段更新 -->
<if test="userId != null">user_id = #{userId},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
</trim>
where id = #{id}
</update>

1
chenhai-ui/src/api/login.js

@ -25,6 +25,7 @@ export function login(phone, password) {
const data = {
phone,
password,
clientType: 'wechat_vet'
// code,
// uuid
}

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

@ -142,7 +142,33 @@
</div>
</el-dialog>
<!-- 回复弹窗 -->
<!-- 回复管理对话框 - 直接显示列表 -->
<el-dialog
title="回复"
:visible.sync="replyOpen"
width="80%"
append-to-body
:close-on-click-modal="false"
>
<!-- 新增回复按钮 -->
<div style="margin-bottom: 15px; text-align: right;">
<el-button
type="primary"
icon="el-icon-plus"
size="small"
@click="showAddReplyForm"
v-hasPermi="['vet:comments:add']"
>新增回复</el-button>
</div>
<comments-list
:consultation-id="currentConsultationId"
v-if="replyOpen"
ref="commentsList"
/>
</el-dialog>
<!-- 回复表单弹窗 -->
<el-dialog
title="回复问题"
:visible.sync="replyFormOpen"
@ -188,7 +214,6 @@
<span>牲畜信息</span>
</div>
<div class="reply-card-content reply-animal-attributes">
<!-- 种类单独占一行 -->
<div class="reply-attribute-item full-width">
<span class="reply-attr-label">种类</span>
<span class="reply-attr-value">{{ currentRow.animalType || '未填写' }}</span>
@ -244,20 +269,6 @@
</div>
</el-dialog>
<!-- 回复管理对话框 -->
<el-dialog
title="回复"
:visible.sync="replyOpen"
width="80%"
append-to-body
:close-on-click-modal="false"
>
<comments-list
:consultation-id="currentConsultationId"
v-if="replyOpen"
/>
</el-dialog>
<!-- 详情弹窗 -->
<el-dialog
title="详情"
@ -361,7 +372,33 @@
</div>
</el-dialog>
<!-- 方案制定弹窗 -->
<!-- 方案制定管理对话框 -->
<el-dialog
title="方案"
:visible.sync="planOpen"
width="80%"
append-to-body
:close-on-click-modal="false"
>
<!-- 新增方案按钮 -->
<div style="margin-bottom: 15px; text-align: right;">
<el-button
type="primary"
icon="el-icon-plus"
size="small"
@click="showAddPlanForm"
v-hasPermi="['vet:plan:add']"
>新增方案</el-button>
</div>
<plan-list
:consultation-id="currentConsultationId"
v-if="planOpen"
ref="planList"
/>
</el-dialog>
<!-- 方案制定表单弹窗 -->
<el-dialog
title="方案制定"
:visible.sync="planFormOpen"
@ -396,7 +433,6 @@
<span>牲畜信息</span>
</div>
<div class="plan-card-content plan-animal-attributes">
<!-- 种类单独占一行 -->
<div class="plan-attribute-item full-width">
<span class="plan-attr-label">种类</span>
<span class="plan-attr-value">{{ currentRow.animalType || '未填写' }}</span>
@ -466,20 +502,6 @@
<el-button @click="cancelPlan"> </el-button>
</div>
</el-dialog>
<!-- 方案制定管理对话框 -->
<el-dialog
title="方案"
:visible.sync="planOpen"
width="80%"
append-to-body
:close-on-click-modal="false"
>
<plan-list
:consultation-id="currentConsultationId"
v-if="planOpen"
/>
</el-dialog>
</div>
</template>
@ -513,18 +535,18 @@ export default {
total: 0,
//
consultationList: [],
// ID
// ID
currentConsultationId: null,
//
currentRow: null,
//
replyFormOpen: false,
//
//
replyOpen: false,
//
planFormOpen: false,
//
//
replyFormOpen: false,
//
planOpen: false,
//
planFormOpen: false,
//
title: "",
//
@ -668,16 +690,26 @@ export default {
this.multiple = !selection.length
},
/** 回复按钮操作 */
// ==================== ====================
/** 回复按钮操作 - 直接打开回复列表 */
handleReply(row) {
this.currentRow = row
this.currentConsultationId = row.formId
this.replyFormOpen = true
this.replyForm = {
consultationId: row.formId,
content: null,
images: null
}
this.replyOpen = true //
},
//
showAddReplyForm() {
this.replyOpen = false //
this.$nextTick(() => {
//
this.replyForm = {
consultationId: this.currentConsultationId,
content: null,
images: null
}
this.replyFormOpen = true //
})
},
//
@ -687,7 +719,13 @@ export default {
addComments(this.replyForm).then(response => {
this.$modal.msgSuccess("回复成功")
this.replyFormOpen = false
this.replyOpen = true
this.replyOpen = true //
//
this.$nextTick(() => {
if (this.$refs.commentsList) {
this.$refs.commentsList.getList()
}
})
}).catch(() => {
this.$modal.msgError("回复失败")
})
@ -698,33 +736,43 @@ export default {
//
cancelReply() {
this.replyFormOpen = false
this.replyOpen = true //
this.replyForm = {
consultationId: null,
content: null,
images: null
}
this.currentRow = null
this.resetForm("replyForm")
},
//
// ==================== ====================
// -
planFormulation(row) {
this.currentRow = row
this.currentConsultationId = row.formId
this.planFormOpen = true
this.planForm = {
consultationId: row.formId,
planNo: '',
title: '',
farmerName: row.farmerName || '',
animalType: row.animalType || '',
symptoms: row.description || '',
diagnosis: '',
treatmentMethod: '',
treatmentDesc: '',
precautions: '',
userId: '',
}
this.currentRow = row
this.planOpen = true //
},
//
showAddPlanForm() {
this.planOpen = false //
this.$nextTick(() => {
//
this.planForm = {
consultationId: this.currentConsultationId,
planNo: '',
title: '',
farmerName: this.currentRow?.farmerName || '',
animalType: this.currentRow?.animalType || '',
symptoms: this.currentRow?.description || '',
diagnosis: '',
treatmentMethod: '',
treatmentDesc: '',
precautions: '',
userId: '',
}
this.planFormOpen = true //
})
},
//
@ -734,7 +782,13 @@ export default {
addPlan(this.planForm).then(response => {
this.$modal.msgSuccess("方案提交成功")
this.planFormOpen = false
this.planOpen = true
this.planOpen = true //
//
this.$nextTick(() => {
if (this.$refs.planList) {
this.$refs.planList.getList()
}
})
}).catch(() => {
this.$modal.msgError("方案提交失败")
})
@ -745,6 +799,7 @@ export default {
//
cancelPlan() {
this.planFormOpen = false
this.planOpen = true //
this.planForm = {
consultationId: null,
planNo: null,
@ -758,7 +813,6 @@ export default {
precautions: null,
userId: null,
}
this.currentRow = null
this.resetForm("planForm")
},
@ -841,6 +895,7 @@ export default {
}
</script>
<!-- 样式部分保持不变 -->
<style scoped>
::v-deep .el-descriptions-item__cell {
width: 90px;

15
chenhai-ui/src/views/muhu/feedback/index.vue

@ -65,7 +65,12 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="昵称" align="center" prop="nickName" />
<el-table-column label="反馈内容" align="left" prop="content" min-width="200">
<el-table-column label="类型" align="center" prop="type">
<template slot-scope="scope">
<dict-tag :options="dict.type.feedback_type" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="内容" align="left" prop="content" min-width="200">
<template slot-scope="scope">
<div class="content-preview" v-html="scope.row.content"></div>
</template>
@ -101,7 +106,12 @@
<!-- 添加或修改反馈建议对话框 -->
<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-form-item label="类型" prop="type">
<el-select v-model="form.type" placeholder="请选择类型" clearable>
<el-option v-for="dict in dict.type.feedback_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="内容" prop="content">
<editor v-model="form.content" :min-height="192" />
</el-form-item>
</el-form>
@ -118,6 +128,7 @@ import { listFeedback, getFeedback, delFeedback, addFeedback, updateFeedback } f
export default {
name: "Feedback",
dicts: ['feedback_type'],
data() {
return {
//

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

@ -1,58 +1,29 @@
<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-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>
<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">
@ -70,13 +41,6 @@
<image-preview :src="scope.row.images" :width="50" :height="50" />
</template>
</el-table-column>
<!-- <el-table-column label="回复图片" align="center" prop="images" width="100">-->
<!-- <template slot-scope="scope">-->
<!-- <div v-for="(item,index) in JSON.parse(scope.row.images)">-->
<!-- <image-preview :src="item" :width="50" :height="50" />-->
<!-- </div>-->
<!-- </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>
@ -106,6 +70,7 @@
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagestyle">
<pagination
v-show="total>0"
@ -120,7 +85,7 @@
<el-dialog :title="title" :visible.sync="open" width="80%" 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-input v-model="form.content" type="textarea" :rows="4" placeholder="请输入回复内容" />
</el-form-item>
<el-form-item label="回复图片" prop="images">
<image-upload v-model="form.images" />
@ -166,7 +131,6 @@ export default {
title: "",
//
open: false,
// imgUrl:[],
//
queryParams: {
pageNum: 1,
@ -187,28 +151,57 @@ export default {
},
//
rules: {
content: [
{ required: true, message: "回复内容不能为空", trigger: "blur" }
]
}
}
},
created() {
this.queryParams.consultationId = this.parseConsultationId(this.consultationId)
this.getList()
this.initQuery()
},
watch: {
// consultationId
consultationId: {
handler(newVal) {
this.initQuery()
},
immediate: true
}
},
methods: {
//
initQuery() {
const id = this.parseConsultationId(this.consultationId)
if (id) {
this.queryParams.consultationId = id
this.getList()
} else {
// consultationId
this.queryParams.consultationId = null
this.getList() // this.commentsList = []
}
},
/** 查询兽医回复列表 */
getList() {
this.loading = true
console.log('查询回复列表,参数:', this.queryParams)
listComments(this.queryParams).then(response => {
this.commentsList = response.rows
this.total = response.total
this.loading = false
}).catch(() => {
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
@ -225,42 +218,61 @@ export default {
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
// consultationId
this.queryParams = {
...this.queryParams,
pageNum: 1,
pageSize: 10,
replyName: null,
content: null,
images: null,
isSensitive: null,
sensitiveWords: null,
createdAt: null,
updatedAt: null,
userId: null
}
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加兽医回复"
this.form.consultationId = this.consultationId;
this.form.consultationId = this.consultationId
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getComments(id).then(response => {
// console.log(1111,response)
// const imgUrl = JSON.parse(response.data.images)
// console.log(222,img)
this.form = response.data
// consultationId
this.form.consultationId = this.consultationId
this.open = true
this.title = "修改兽医回复"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
@ -270,17 +282,22 @@ export default {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
}).catch(() => {
this.$modal.msgError("修改失败")
})
} else {
addComments(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
}).catch(() => {
this.$modal.msgError("新增失败")
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
@ -291,6 +308,7 @@ export default {
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('vet/comments/export', {
@ -298,6 +316,7 @@ export default {
}, `comments_${new Date().getTime()}.xlsx`)
},
// consultationId
parseConsultationId(id) {
if (id == null || id === '' || id === undefined) {
return null
@ -320,18 +339,16 @@ export default {
console.error('无效的consultationId:', id)
return null
}
}
}
</script>
<style scoped>
::v-deep .pagestyle .el-input{
::v-deep .pagestyle .el-input {
width: auto !important;
}
::v-deep .pagestyle .pagination-container{
::v-deep .pagestyle .pagination-container {
background-color: #f8fafc;
}
</style>
@ -345,7 +362,7 @@ export default {
transition: all 0.3s ease;
}
.alter-btn:hover{
.alter-btn:hover {
background-color: rgb(230, 255, 238);
transform: translateY(-1px);
}
@ -434,4 +451,3 @@ export default {
border-radius: 0 0 12px 12px;
}
</style>

66
chenhai-ui/src/views/vet/knowledge/index.vue

@ -140,12 +140,18 @@
<el-table v-loading="loading" :data="knowledgeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="发布专家" align="center" width="120">
<!-- <el-table-column label="发布专家" align="center" width="120">-->
<!-- <template slot-scope="scope">-->
<!-- <div v-if="scope.row.expertName" style="font-weight: bold;">-->
<!-- {{ scope.row.expertName }}-->
<!-- </div>-->
<!-- <span v-else style="color: #999;">-</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="发布者" align="center" prop="nickName" min-width="100" show-overflow-tooltip/>
<el-table-column label="头像" align="center" prop="avatar" width="100">
<template slot-scope="scope">
<div v-if="scope.row.expertName" style="font-weight: bold;">
{{ scope.row.expertName }}
</div>
<span v-else style="color: #999;">-</span>
<image-preview :src="scope.row.avatar" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="封面" align="center" prop="coverImage" width="100">
@ -161,7 +167,7 @@
<!-- <div v-html="scope.row.content"></div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="发布时间" align="center" prop="publishTime" min-width="200" show-overflow-tooltip />
<el-table-column label="发布时间" align="center" prop="createTime" min-width="200" show-overflow-tooltip />
<el-table-column label="查看次数" align="center" prop="viewCount" min-width="200" show-overflow-tooltip />
<!-- 文章分类列 - 使用 el-tag 显示颜色 -->
@ -314,21 +320,21 @@
<!-- 提示选择为您推荐药品的专家-->
<!-- </div>-->
<!-- </el-form-item>-->
<el-form-item label="推荐专家" prop="expertId">
<el-select
v-model="form.expertId"
placeholder="请选择推荐专家"
clearable
filterable
style="width: 100%;"
>
<el-option
v-for="expert in expertList"
:key="expert.expertId"
:label="expert.realName"
:value="expert.expertId"
/>
</el-select>
<!-- <el-form-item label="推荐专家" prop="expertId">-->
<!-- <el-select-->
<!-- v-model="form.expertId"-->
<!-- placeholder="请选择推荐专家"-->
<!-- clearable-->
<!-- filterable-->
<!-- style="width: 100%;"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="expert in expertList"-->
<!-- :key="expert.expertId"-->
<!-- :label="expert.realName"-->
<!-- :value="expert.expertId"-->
<!-- />-->
<!-- </el-select>-->
<div style="font-size: 12px; color: #999; margin-top: 5px;">
提示选择为您推荐药品的专家
</div>
@ -355,15 +361,15 @@
/>
</el-select>
</el-form-item>
<el-form-item label="发布时间" prop="publishTime">
<el-date-picker
v-model="form.publishTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择时间"
style="width: 100%;"
/>
</el-form-item>
<!-- <el-form-item label="发布时间" prop="publishTime">-->
<!-- <el-date-picker-->
<!-- v-model="form.publishTime"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择时间"-->
<!-- style="width: 100%;"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注信息" />
</el-form-item>

113
chenhai-ui/src/views/vet/plan/index.vue

@ -75,10 +75,7 @@
<el-table-column label="农牧户姓名" align="center" prop="farmerName" />
<el-table-column label="动物类型" align="center" prop="animalType" />
<el-table-column label="症状描述" align="center" prop="symptoms" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="诊断结果" align="center" prop="diagnosis" />-->
<el-table-column label="治疗方式" align="center" prop="treatmentMethod" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="治疗方案描述" align="center" prop="treatmentDesc" />-->
<!-- <el-table-column label="注意事项" align="center" prop="precautions" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="300">
<template slot-scope="scope">
<el-button
@ -243,7 +240,7 @@
</template>
<script>
import { listPlan, getPlan, delPlan, addPlan, updatePlan, listPlanByConsultationId } from "@/api/vet/plan"
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/vet/plan"
export default {
name: "Plan",
@ -277,6 +274,8 @@ export default {
flag: false,
//
currentDetail: {},
// 'search' /'relation'
currentMode: 'relation',
//
queryParams: {
pageNum: 1,
@ -317,49 +316,93 @@ export default {
}
}
},
created() {
// consultationId
if (this.consultationId) {
this.queryParams.consultationId = this.consultationId
}
this.getList()
},
watch: {
consultationId: {
immediate: true,
handler() {
this.getList()
handler(newVal, oldVal) {
console.log('consultationId变化:', oldVal, '->', newVal)
if (newVal) {
//
this.currentMode = 'relation'
// consultationId
this.queryParams.consultationId = newVal
this.queryParams.pageNum = 1
this.getList()
}
}
}
},
// created() {
// this.getList()
// },
methods: {
/** 查询治疗方案列表 */
// getList() {
// this.loading = true
// listPlan(this.queryParams).then(response => {
// this.planList = response.rows
// this.total = response.total
// this.loading = false
// })
// },
getList() {
this.loading = true
if (this.consultationId) {
this.queryParams.consultationId= this.consultationId
listPlanByConsultationId(this.queryParams).then(response => {
console.log('getList called, mode:', this.currentMode, 'consultationId:', this.consultationId)
console.log('queryParams:', JSON.stringify(this.queryParams))
//
if (this.currentMode === 'search' || !this.consultationId) {
//
const params = { ...this.queryParams }
delete params.consultationId
listPlan(params).then(response => {
this.planList = response.rows
this.total = response.total
this.loading = false
console.log('搜索模式查询完成,总数:', this.total)
}).catch(error => {
console.error('查询失败:', error)
this.loading = false
})
} else {
//
// consultationId
this.queryParams.consultationId = this.consultationId
listPlan(this.queryParams).then(response => {
this.planList = response.rows
this.total = response.total
this.loading = false
console.log('关联模式查询完成,总数:', this.total)
}).catch(error => {
console.error('关联查询失败:', error)
this.loading = false
})
}
},
//
resetQueryParams() {
this.queryParams = {
...this.queryParams,
planNo: null,
title: null,
farmerName: null,
farmerPhone: null,
animalType: null,
symptoms: null,
diagnosis: null,
treatmentMethod: null,
treatmentDesc: null,
precautions: null,
status: null,
userId: null,
}
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
@ -383,28 +426,53 @@ export default {
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
//
this.currentMode = 'search'
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
//
this.resetForm("queryForm")
this.handleQuery()
//
this.resetQueryParams()
//
this.queryParams.pageNum = 1
// consultationId
if (this.consultationId) {
this.currentMode = 'relation'
this.queryParams.consultationId = this.consultationId
} else {
//
this.currentMode = 'search'
}
this.getList()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
// consultationId
if (this.consultationId) {
this.form.consultationId = this.consultationId
}
this.open = true
this.title = "添加治疗方案"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
@ -415,6 +483,7 @@ export default {
this.title = "修改治疗方案"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
@ -435,6 +504,7 @@ export default {
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
@ -446,6 +516,7 @@ export default {
}).catch(() => {
})
},
/** 导出按钮操作 */
handleExport() {
this.download('vet/plan/export', {

44
chenhai-ui/src/views/vet/training/index.vue

@ -18,17 +18,17 @@
v-hasPermi="['vet:training:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-s-promotion"
size="mini"
:disabled="single"
@click="handleSubmitAudit"
v-hasPermi="['vet:training:submit']"
>提交审核</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="info"-->
<!-- plain-->
<!-- icon="el-icon-s-promotion"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleSubmitAudit"-->
<!-- v-hasPermi="['vet:training:submit']"-->
<!-- >提交审核</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="primary"
@ -149,17 +149,17 @@
class="info-btn alter-btn"
>修改</el-button>
<!-- 提交审核按钮审核拒绝或无需审核状态 -->
<el-button
size="mini"
type="text"
icon="el-icon-s-promotion"
style="color: #dab708"
@click="handleSubmitAudit(scope.row.id)"
v-hasPermi="['vet:training:submit']"
v-if="scope.row.status === '0' && scope.row.auditStatus === '0'"
class="info-btn submit-btn"
>提交审核</el-button>
<!-- &lt;!&ndash; 提交审核按钮审核拒绝或无需审核状态 &ndash;&gt;-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-s-promotion"-->
<!-- style="color: #dab708"-->
<!-- @click="handleSubmitAudit(scope.row.id)"-->
<!-- v-hasPermi="['vet:training:submit']"-->
<!-- v-if="scope.row.status === '0' && scope.row.auditStatus === '0'"-->
<!-- class="info-btn submit-btn"-->
<!-- >提交审核</el-button>-->
<!-- 审核按钮待审核状态管理员 -->
<el-button

Loading…
Cancel
Save