浏览代码

1.套餐包问答 2.套餐包关联套餐包问答

wjj 3 周之前
父节点
当前提交
58e433c9fc

+ 115 - 0
fs-admin/src/main/java/com/fs/his/controller/FsQuestionAndAnswerController.java

@@ -0,0 +1,115 @@
+package com.fs.his.controller;
+
+import java.util.List;
+
+import com.fs.his.vo.OptionsVO;
+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.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.his.domain.FsQuestionAndAnswer;
+import com.fs.his.service.IFsQuestionAndAnswerService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 问答Controller
+ * 
+ * @author fs
+ * @date 2025-09-29
+ */
+@RestController
+@RequestMapping("/his/answer")
+public class FsQuestionAndAnswerController extends BaseController
+{
+    @Autowired
+    private IFsQuestionAndAnswerService fsQuestionAndAnswerService;
+
+    /**
+     * 查询问答列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:answer:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsQuestionAndAnswer fsQuestionAndAnswer)
+    {
+        startPage();
+        List<FsQuestionAndAnswer> list = fsQuestionAndAnswerService.selectFsQuestionAndAnswerList(fsQuestionAndAnswer);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出问答列表
+     */
+    @PreAuthorize("@ss.hasPermi('his:answer:export')")
+    @Log(title = "问答", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsQuestionAndAnswer fsQuestionAndAnswer)
+    {
+        List<FsQuestionAndAnswer> list = fsQuestionAndAnswerService.selectFsQuestionAndAnswerList(fsQuestionAndAnswer);
+        ExcelUtil<FsQuestionAndAnswer> util = new ExcelUtil<FsQuestionAndAnswer>(FsQuestionAndAnswer.class);
+        return util.exportExcel(list, "问答数据");
+    }
+
+    /**
+     * 获取问答详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('his:answer:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(fsQuestionAndAnswerService.selectFsQuestionAndAnswerById(id));
+    }
+
+    /**
+     * 新增问答
+     */
+    @PreAuthorize("@ss.hasPermi('his:answer:add')")
+    @Log(title = "问答", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsQuestionAndAnswer fsQuestionAndAnswer)
+    {
+        return toAjax(fsQuestionAndAnswerService.insertFsQuestionAndAnswer(fsQuestionAndAnswer));
+    }
+
+    /**
+     * 修改问答
+     */
+    @PreAuthorize("@ss.hasPermi('his:answer:edit')")
+    @Log(title = "问答", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsQuestionAndAnswer fsQuestionAndAnswer)
+    {
+        return toAjax(fsQuestionAndAnswerService.updateFsQuestionAndAnswer(fsQuestionAndAnswer));
+    }
+
+    /**
+     * 删除问答
+     */
+    @PreAuthorize("@ss.hasPermi('his:answer:remove')")
+    @Log(title = "问答", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(fsQuestionAndAnswerService.deleteFsQuestionAndAnswerByIds(ids));
+    }
+
+    /**
+     * 查询问答列表
+     */
+    @GetMapping("/allList")
+    public TableDataInfo getHospital()
+    {
+        List<OptionsVO> list = fsQuestionAndAnswerService.selectAllQuestionOptions();
+        return getDataTable(list);
+    }
+}

+ 4 - 0
fs-service/src/main/java/com/fs/his/domain/FsPackage.java

@@ -104,4 +104,8 @@ public class FsPackage extends BaseEntity
     /** 节气 */
     private Long solarTerm;
     private String appIds;
+    /**
+     * 问答id
+     */
+    private Long questionId;
 }

+ 29 - 0
fs-service/src/main/java/com/fs/his/domain/FsQuestionAndAnswer.java

@@ -0,0 +1,29 @@
+package com.fs.his.domain;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 问答对象 fs_question_and_answer
+ *
+ * @author fs
+ * @date 2025-09-29
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsQuestionAndAnswer extends BaseEntity{
+
+    /** $column.columnComment */
+    private Long id;
+
+    private String questionName;
+
+    /** 问答数据 */
+    @Excel(name = "问答数据")
+    private String jsonInfo;
+
+
+}

+ 66 - 0
fs-service/src/main/java/com/fs/his/mapper/FsQuestionAndAnswerMapper.java

@@ -0,0 +1,66 @@
+package com.fs.his.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.his.domain.FsQuestionAndAnswer;
+import com.fs.his.vo.OptionsVO;
+import org.apache.ibatis.annotations.Select;
+
+/**
+ * 问答Mapper接口
+ * 
+ * @author fs
+ * @date 2025-09-29
+ */
+public interface FsQuestionAndAnswerMapper extends BaseMapper<FsQuestionAndAnswer>{
+    /**
+     * 查询问答
+     * 
+     * @param id 问答主键
+     * @return 问答
+     */
+    FsQuestionAndAnswer selectFsQuestionAndAnswerById(Long id);
+
+    /**
+     * 查询问答列表
+     * 
+     * @param fsQuestionAndAnswer 问答
+     * @return 问答集合
+     */
+    List<FsQuestionAndAnswer> selectFsQuestionAndAnswerList(FsQuestionAndAnswer fsQuestionAndAnswer);
+
+    /**
+     * 新增问答
+     * 
+     * @param fsQuestionAndAnswer 问答
+     * @return 结果
+     */
+    int insertFsQuestionAndAnswer(FsQuestionAndAnswer fsQuestionAndAnswer);
+
+    /**
+     * 修改问答
+     * 
+     * @param fsQuestionAndAnswer 问答
+     * @return 结果
+     */
+    int updateFsQuestionAndAnswer(FsQuestionAndAnswer fsQuestionAndAnswer);
+
+    /**
+     * 删除问答
+     * 
+     * @param id 问答主键
+     * @return 结果
+     */
+    int deleteFsQuestionAndAnswerById(Long id);
+
+    /**
+     * 批量删除问答
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteFsQuestionAndAnswerByIds(Long[] ids);
+
+    @Select("select id dictValue,question_name dictLabel from fs_question_and_answer  ")
+    List<OptionsVO> selectAllQuestionOptions();
+}

+ 65 - 0
fs-service/src/main/java/com/fs/his/service/IFsQuestionAndAnswerService.java

@@ -0,0 +1,65 @@
+package com.fs.his.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.his.domain.FsQuestionAndAnswer;
+import com.fs.his.vo.FsQuestionAndAnswerVO;
+import com.fs.his.vo.OptionsVO;
+
+/**
+ * 问答Service接口
+ * 
+ * @author fs
+ * @date 2025-09-29
+ */
+public interface IFsQuestionAndAnswerService extends IService<FsQuestionAndAnswer>{
+    /**
+     * 查询问答
+     * 
+     * @param id 问答主键
+     * @return 问答
+     */
+    FsQuestionAndAnswerVO selectFsQuestionAndAnswerById(Long id);
+
+    /**
+     * 查询问答列表
+     * 
+     * @param fsQuestionAndAnswer 问答
+     * @return 问答集合
+     */
+    List<FsQuestionAndAnswer> selectFsQuestionAndAnswerList(FsQuestionAndAnswer fsQuestionAndAnswer);
+
+    /**
+     * 新增问答
+     * 
+     * @param fsQuestionAndAnswer 问答
+     * @return 结果
+     */
+    int insertFsQuestionAndAnswer(FsQuestionAndAnswer fsQuestionAndAnswer);
+
+    /**
+     * 修改问答
+     * 
+     * @param fsQuestionAndAnswer 问答
+     * @return 结果
+     */
+    int updateFsQuestionAndAnswer(FsQuestionAndAnswer fsQuestionAndAnswer);
+
+    /**
+     * 批量删除问答
+     * 
+     * @param ids 需要删除的问答主键集合
+     * @return 结果
+     */
+    int deleteFsQuestionAndAnswerByIds(Long[] ids);
+
+    /**
+     * 删除问答信息
+     * 
+     * @param id 问答主键
+     * @return 结果
+     */
+    int deleteFsQuestionAndAnswerById(Long id);
+
+    List<OptionsVO> selectAllQuestionOptions();
+}

+ 115 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsQuestionAndAnswerServiceImpl.java

@@ -0,0 +1,115 @@
+package com.fs.his.service.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.fs.common.utils.DateUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.his.vo.AnswerVO;
+import com.fs.his.vo.FsQuestionAndAnswerVO;
+import com.fs.his.vo.OptionsVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.fs.his.mapper.FsQuestionAndAnswerMapper;
+import com.fs.his.domain.FsQuestionAndAnswer;
+import com.fs.his.service.IFsQuestionAndAnswerService;
+
+/**
+ * 问答Service业务层处理
+ * 
+ * @author fs
+ * @date 2025-09-29
+ */
+@Service
+public class FsQuestionAndAnswerServiceImpl extends ServiceImpl<FsQuestionAndAnswerMapper, FsQuestionAndAnswer> implements IFsQuestionAndAnswerService {
+
+
+    @Autowired
+    private FsQuestionAndAnswerMapper fsQuestionAndAnswerMapper;
+    /**
+     * 查询问答
+     * 
+     * @param id 问答主键
+     * @return 问答
+     */
+    @Override
+    public FsQuestionAndAnswerVO selectFsQuestionAndAnswerById(Long id)
+    {
+        FsQuestionAndAnswer fsQuestionAndAnswer = baseMapper.selectFsQuestionAndAnswerById(id);
+        FsQuestionAndAnswerVO vo = new FsQuestionAndAnswerVO();
+        vo.setQuestionName(fsQuestionAndAnswer.getQuestionName());
+        List<AnswerVO> answerVOS = JSONObject.parseArray(fsQuestionAndAnswer.getJsonInfo(), AnswerVO.class);
+        vo.setAnswers(answerVOS);
+        vo.setId(fsQuestionAndAnswer.getId());
+        return vo;
+    }
+
+    /**
+     * 查询问答列表
+     * 
+     * @param fsQuestionAndAnswer 问答
+     * @return 问答
+     */
+    @Override
+    public List<FsQuestionAndAnswer> selectFsQuestionAndAnswerList(FsQuestionAndAnswer fsQuestionAndAnswer)
+    {
+        return baseMapper.selectFsQuestionAndAnswerList(fsQuestionAndAnswer);
+    }
+
+    /**
+     * 新增问答
+     * 
+     * @param fsQuestionAndAnswer 问答
+     * @return 结果
+     */
+    @Override
+    public int insertFsQuestionAndAnswer(FsQuestionAndAnswer fsQuestionAndAnswer)
+    {
+        fsQuestionAndAnswer.setCreateTime(DateUtils.getNowDate());
+        return baseMapper.insertFsQuestionAndAnswer(fsQuestionAndAnswer);
+    }
+
+    /**
+     * 修改问答
+     * 
+     * @param fsQuestionAndAnswer 问答
+     * @return 结果
+     */
+    @Override
+    public int updateFsQuestionAndAnswer(FsQuestionAndAnswer fsQuestionAndAnswer)
+    {
+        fsQuestionAndAnswer.setUpdateTime(DateUtils.getNowDate());
+        return baseMapper.updateFsQuestionAndAnswer(fsQuestionAndAnswer);
+    }
+
+    /**
+     * 批量删除问答
+     * 
+     * @param ids 需要删除的问答主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsQuestionAndAnswerByIds(Long[] ids)
+    {
+        return baseMapper.deleteFsQuestionAndAnswerByIds(ids);
+    }
+
+    /**
+     * 删除问答信息
+     * 
+     * @param id 问答主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsQuestionAndAnswerById(Long id)
+    {
+        return baseMapper.deleteFsQuestionAndAnswerById(id);
+    }
+
+    @Override
+    public List<OptionsVO> selectAllQuestionOptions() {
+        return fsQuestionAndAnswerMapper.selectAllQuestionOptions();
+    }
+}

+ 13 - 0
fs-service/src/main/java/com/fs/his/vo/AnswerVO.java

@@ -0,0 +1,13 @@
+package com.fs.his.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class AnswerVO {
+
+    private String title;
+
+    private List<String> options;
+}

+ 2 - 0
fs-service/src/main/java/com/fs/his/vo/FsPackageVO.java

@@ -124,4 +124,6 @@ public class FsPackageVO {
 
     private Long solarTerm;
     private String appIds;
+
+    private Long questionId;
 }

+ 15 - 0
fs-service/src/main/java/com/fs/his/vo/FsQuestionAndAnswerVO.java

@@ -0,0 +1,15 @@
+package com.fs.his.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class FsQuestionAndAnswerVO {
+
+    private Long id;
+
+    private String questionName;
+
+    private List<AnswerVO> answers;
+}

+ 5 - 1
fs-service/src/main/resources/mapper/his/FsPackageMapper.xml

@@ -49,10 +49,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="description"    column="description"    />
         <result property="solarTerm"    column="solar_term"    />
         <result property="appIds"    column="app_ids"    />
+        <result property="questionId"    column="question_id"    />
     </resultMap>
 
     <sql id="selectFsPackageVo">
-        select package_id,description,usage_per_use_count,icd_code,images,doctor_remark,second_name,follow_temp_id,product_cost_price,inquiry_cost_price,total_cost_price,follow_num,`explain`,indication,store_id,private_type,recipe_type,counts,usage_frequency_unit, package_name,img_url,is_show,total_price,cycle,duration,`desc`,product_type,price,tags,sales,disease_type,num,package_sub_type,describe_json,pay_type,package_type, sort, product_json, status, create_time, update_time, is_del,solar_term,app_ids from fs_package
+        select package_id,description,usage_per_use_count,icd_code,images,doctor_remark,second_name,follow_temp_id,product_cost_price,inquiry_cost_price,total_cost_price,follow_num,`explain`,indication,store_id,private_type,recipe_type,counts,usage_frequency_unit, package_name,img_url,is_show,total_price,cycle,duration,`desc`,product_type,price,tags,sales,disease_type,num,package_sub_type,describe_json,pay_type,package_type, sort, product_json, status, create_time, update_time, is_del,solar_term,app_ids,question_id from fs_package
     </sql>
 
     <select id="selectFsPackageList" parameterType="FsPackage" resultMap="FsPackageResult">
@@ -132,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="description != null">description,</if>
             <if test="solarTerm != null">solar_term,</if>
             <if test="appIds != null">app_ids,</if>
+            <if test="questionId != null">question_id,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="packageName != null">#{packageName},</if>
@@ -177,6 +179,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="description != null">#{description},</if>
             <if test="solarTerm != null">#{solarTerm},</if>
             <if test="appIds != null">#{appIds},</if>
+            <if test="questionId != null">#{questionId},</if>
         </trim>
     </insert>
 
@@ -226,6 +229,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="description != null">description = #{description},</if>
             <if test="solarTerm != null">solar_term = #{solarTerm},</if>
             <if test="appIds != null ">app_ids = #{appIds},</if>
+            <if test="questionId != null ">question_id = #{questionId},</if>
         </trim>
         where package_id = #{packageId}
     </update>

+ 70 - 0
fs-service/src/main/resources/mapper/his/FsQuestionAndAnswerMapper.xml

@@ -0,0 +1,70 @@
+<?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.fs.his.mapper.FsQuestionAndAnswerMapper">
+    
+    <resultMap type="FsQuestionAndAnswer" id="FsQuestionAndAnswerResult">
+        <result property="id"    column="id"    />
+        <result property="jsonInfo"    column="json_info"    />
+        <result property="questionName"    column="question_name"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectFsQuestionAndAnswerVo">
+        select id,question_name ,json_info, create_time, update_time from fs_question_and_answer
+    </sql>
+
+    <select id="selectFsQuestionAndAnswerList" parameterType="FsQuestionAndAnswer" resultMap="FsQuestionAndAnswerResult">
+        <include refid="selectFsQuestionAndAnswerVo"/>
+        <where>  
+            <if test="jsonInfo != null  and jsonInfo != ''"> and json_info = #{jsonInfo}</if>
+        </where>
+    </select>
+    
+    <select id="selectFsQuestionAndAnswerById" parameterType="Long" resultMap="FsQuestionAndAnswerResult">
+        <include refid="selectFsQuestionAndAnswerVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertFsQuestionAndAnswer" parameterType="FsQuestionAndAnswer">
+        insert into fs_question_and_answer
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="jsonInfo != null">json_info,</if>
+            <if test="questionName != null">question_name,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="jsonInfo != null">#{jsonInfo},</if>
+            <if test="questionName != null">#{questionName},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFsQuestionAndAnswer" parameterType="FsQuestionAndAnswer">
+        update fs_question_and_answer
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="jsonInfo != null">json_info = #{jsonInfo},</if>
+            <if test="questionName != null">question_name = #{questionName},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteFsQuestionAndAnswerById" parameterType="Long">
+        delete from fs_question_and_answer where id = #{id}
+    </delete>
+
+    <delete id="deleteFsQuestionAndAnswerByIds" parameterType="String">
+        delete from fs_question_and_answer where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>