Bläddra i källkod

医生端新增患者信息表

cgp 3 dagar sedan
förälder
incheckning
4ff4789e6a

+ 122 - 0
fs-doctor-app/src/main/java/com/fs/app/controller/FsDoctorPatientController.java

@@ -0,0 +1,122 @@
+package com.fs.app.controller;
+
+import com.fs.common.exception.CustomException;
+import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.his.domain.FsDoctor;
+import com.fs.his.domain.FsDoctorPatient;
+import com.fs.his.service.IFsDoctorPatientService;
+import com.fs.his.service.IFsDoctorService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import com.fs.common.core.domain.AjaxResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 患者信息Controller
+ *
+ * @author yourname
+ * @date 2026-04-28
+ */
+
+@Slf4j
+@Api(tags = "医生端-患者信息表")
+@RestController
+@RequestMapping("/app/patientInfo")
+public class FsDoctorPatientController extends AppBaseController {
+    @Autowired
+    private IFsDoctorPatientService fsDoctorPatientService;
+
+    @Autowired
+    private IFsDoctorService fsDoctorService;
+    /**
+     * 查询患者信息列表
+     */
+    @ApiOperation("查询患者列表")
+    @GetMapping("/list")
+    public AjaxResult list(FsDoctorPatient fsDoctorPatient) {
+        String doctorId = getDoctorId();
+        if (StringUtils.isBlank(doctorId)){
+            return AjaxResult.error("请重新登录");
+        }
+        fsDoctorPatient.setDoctorId(Long.valueOf(doctorId));
+        PageHelper.startPage(fsDoctorPatient.getPageNum(), fsDoctorPatient.getPageSize());
+        List<FsDoctorPatient> list = fsDoctorPatientService.selectFsDoctorPatientList(fsDoctorPatient);
+        PageInfo<FsDoctorPatient> listPageInfo=new PageInfo<>(list);
+        return AjaxResult.success(listPageInfo);
+    }
+
+    /**
+     * 导出患者信息
+     */
+    @ApiOperation("导出患者信息")
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, FsDoctorPatient fsDoctorPatient) {
+        List<FsDoctorPatient> list = fsDoctorPatientService.selectFsDoctorPatientList(fsDoctorPatient);
+        ExcelUtil<FsDoctorPatient> util = new ExcelUtil<>(FsDoctorPatient.class);
+        try {
+            util.exportExcel(response, list, "患者信息数据");
+        }catch (Exception e){
+            log.error("导出患者信息异常",e);
+            throw new CustomException("导出患者信息异常");
+        }
+
+    }
+
+    /**
+     * 获取患者信息详细信息
+     */
+    @ApiOperation("获取患者详情")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return AjaxResult.success(fsDoctorPatientService.selectFsDoctorPatientById(id));
+    }
+
+    /**
+     * 新增患者信息
+     */
+    @ApiOperation("新增患者")
+    @PostMapping
+    public AjaxResult add(@RequestBody FsDoctorPatient fsDoctorPatient) {
+        return AjaxResult.success(fsDoctorPatientService.insertFsDoctorPatient(fsDoctorPatient));
+    }
+
+    /**
+     * 修改患者信息
+     */
+    @ApiOperation("修改患者")
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsDoctorPatient fsDoctorPatient) {
+        return AjaxResult.success(fsDoctorPatientService.updateFsDoctorPatient(fsDoctorPatient));
+    }
+
+    /**
+     * 删除患者信息
+     */
+    @ApiOperation("删除患者")
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return AjaxResult.success(fsDoctorPatientService.deleteFsDoctorPatientByIds(ids));
+    }
+
+    /**
+     * 获取当前登录医生信息(姓名、执业证号、签名图片)
+     * */
+    @ApiOperation("获取当前登录医生信息")
+    @GetMapping("/getDoctorBaseInfo")
+    public AjaxResult getDoctorInfo(){
+        String doctorId = getDoctorId();
+        if (StringUtils.isBlank(doctorId)){
+            return AjaxResult.error("请重新登录");
+        }
+        FsDoctor fsDoctor = fsDoctorService.selectFsDoctorByDoctorId(Long.valueOf(doctorId));
+        return AjaxResult.success(fsDoctor);
+    }
+}

+ 98 - 0
fs-service/src/main/java/com/fs/his/domain/FsDoctorPatient.java

@@ -0,0 +1,98 @@
+package com.fs.his.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 患者信息对象 fs_doctor_patient
+ *
+ * @author yourname
+ * @date 2026-04-28
+ */
+@Data
+public class FsDoctorPatient extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /** 患者ID */
+    private Long id;
+
+    /** 患者姓名 */
+    @Excel(name = "患者姓名")
+    private String patientName;
+
+    /** 性别(0男 1女 2未知) */
+    @Excel(name = "性别", readConverterExp = "0=男,1=女,2=未知")
+    private String sex;
+
+    /** 年龄 */
+    @Excel(name = "年龄")
+    private Integer age;
+
+    /** 电话 */
+    @Excel(name = "电话")
+    private String phone;
+
+    /** 接诊时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "接诊时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date receptionTime;
+
+    /** 接诊医生 */
+    @Excel(name = "接诊医生")
+    private String receptionDoctor;
+
+    /** 所在市 */
+    @Excel(name = "所在市")
+    private String city;
+
+    /** 现病史 */
+    @Excel(name = "现病史")
+    private String presentIllness;
+
+    /** 既往史 */
+    @Excel(name = "既往史")
+    private String pastHistory;
+
+    /** 过敏史 */
+    @Excel(name = "过敏史")
+    private String allergyHistory;
+
+    /** 诊断 */
+    @Excel(name = "诊断")
+    private String diagnosis;
+
+    /** 证型 */
+    @Excel(name = "证型")
+    private String syndromeType;
+
+    /** 证型调理 */
+    @Excel(name = "证型调理")
+    private String syndromeRegulation;
+
+    /** 诊疗意见 */
+    @Excel(name = "诊疗意见")
+    private String treatmentOpinion;
+
+    /** 注意禁忌 */
+    @Excel(name = "注意禁忌")
+    private String precautions;
+
+    /** 医师签名 */
+    @Excel(name = "医师签名")
+    private String doctorSignature;
+
+    /** 医师执业证编号 */
+    @Excel(name = "医师执业证编号")
+    private String practiceCertificateNo;
+
+    /** 接诊医生ID */
+    private Long doctorId;
+
+    //分页相关
+    private Integer pageNum;
+    private Integer pageSize;
+}

+ 60 - 0
fs-service/src/main/java/com/fs/his/mapper/FsDoctorPatientMapper.java

@@ -0,0 +1,60 @@
+package com.fs.his.mapper;
+
+import com.fs.his.domain.FsDoctorPatient;
+import java.util.List;
+
+/**
+ * 患者信息Mapper接口
+ *
+ * @author yourname
+ * @date 2026-04-28
+ */
+public interface FsDoctorPatientMapper {
+    /**
+     * 查询患者信息
+     *
+     * @param id 患者信息主键
+     * @return 患者信息
+     */
+    public FsDoctorPatient selectFsDoctorPatientById(Long id);
+
+    /**
+     * 查询患者信息列表
+     *
+     * @param fsDoctorPatient 患者信息
+     * @return 患者信息集合
+     */
+    public List<FsDoctorPatient> selectFsDoctorPatientList(FsDoctorPatient fsDoctorPatient);
+
+    /**
+     * 新增患者信息
+     *
+     * @param fsDoctorPatient 患者信息
+     * @return 结果
+     */
+    public int insertFsDoctorPatient(FsDoctorPatient fsDoctorPatient);
+
+    /**
+     * 修改患者信息
+     *
+     * @param fsDoctorPatient 患者信息
+     * @return 结果
+     */
+    public int updateFsDoctorPatient(FsDoctorPatient fsDoctorPatient);
+
+    /**
+     * 删除患者信息(逻辑删除)
+     *
+     * @param id 患者信息主键
+     * @return 结果
+     */
+    public int deleteFsDoctorPatientById(Long id);
+
+    /**
+     * 批量删除患者信息(逻辑删除)
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteFsDoctorPatientByIds(Long[] ids);
+}

+ 37 - 0
fs-service/src/main/java/com/fs/his/service/IFsDoctorPatientService.java

@@ -0,0 +1,37 @@
+package com.fs.his.service;
+
+import com.fs.his.domain.FsDoctorPatient;
+import java.util.List;
+
+/**
+ * 患者信息Service接口
+ *
+ * @author yourname
+ * @date 2026-04-28
+ */
+public interface IFsDoctorPatientService {
+    /**
+     * 查询患者信息
+     */
+    public FsDoctorPatient selectFsDoctorPatientById(Long id);
+
+    /**
+     * 查询患者信息列表
+     */
+    public List<FsDoctorPatient> selectFsDoctorPatientList(FsDoctorPatient fsDoctorPatient);
+
+    /**
+     * 新增患者信息
+     */
+    public int insertFsDoctorPatient(FsDoctorPatient fsDoctorPatient);
+
+    /**
+     * 修改患者信息
+     */
+    public int updateFsDoctorPatient(FsDoctorPatient fsDoctorPatient);
+
+    /**
+     * 删除患者信息
+     */
+    public int deleteFsDoctorPatientByIds(Long[] ids);
+}

+ 46 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsDoctorPatientServiceImpl.java

@@ -0,0 +1,46 @@
+package com.fs.his.service.impl;
+
+import com.fs.his.domain.FsDoctorPatient;
+import com.fs.his.mapper.FsDoctorPatientMapper;
+import com.fs.his.service.IFsDoctorPatientService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 患者信息Service业务层处理
+ *
+ * @author yourname
+ * @date 2026-04-28
+ */
+@Service
+public class FsDoctorPatientServiceImpl implements IFsDoctorPatientService {
+    @Autowired
+    private FsDoctorPatientMapper fsDoctorPatientMapper;
+
+    @Override
+    public FsDoctorPatient selectFsDoctorPatientById(Long id) {
+        return fsDoctorPatientMapper.selectFsDoctorPatientById(id);
+    }
+
+    @Override
+    public List<FsDoctorPatient> selectFsDoctorPatientList(FsDoctorPatient fsDoctorPatient) {
+        return fsDoctorPatientMapper.selectFsDoctorPatientList(fsDoctorPatient);
+    }
+
+    @Override
+    public int insertFsDoctorPatient(FsDoctorPatient fsDoctorPatient) {
+        return fsDoctorPatientMapper.insertFsDoctorPatient(fsDoctorPatient);
+    }
+
+    @Override
+    public int updateFsDoctorPatient(FsDoctorPatient fsDoctorPatient) {
+        return fsDoctorPatientMapper.updateFsDoctorPatient(fsDoctorPatient);
+    }
+
+    @Override
+    public int deleteFsDoctorPatientByIds(Long[] ids) {
+        return fsDoctorPatientMapper.deleteFsDoctorPatientByIds(ids);
+    }
+}

+ 133 - 0
fs-service/src/main/resources/mapper/his/FsDoctorPatientMapper.xml

@@ -0,0 +1,133 @@
+<?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.FsDoctorPatientMapper">
+
+    <resultMap type="com.fs.his.domain.FsDoctorPatient" id="FsDoctorPatientResult">
+        <result property="id"                   column="id"                    />
+        <result property="patientName"          column="patient_name"          />
+        <result property="sex"                  column="sex"                   />
+        <result property="age"                  column="age"                   />
+        <result property="phone"                column="phone"                 />
+        <result property="receptionTime"        column="reception_time"        />
+        <result property="receptionDoctor"      column="reception_doctor"      />
+        <result property="city"                 column="city"                  />
+        <result property="presentIllness"       column="present_illness"       />
+        <result property="pastHistory"          column="past_history"          />
+        <result property="allergyHistory"       column="allergy_history"       />
+        <result property="diagnosis"            column="diagnosis"             />
+        <result property="syndromeType"         column="syndrome_type"         />
+        <result property="syndromeRegulation"   column="syndrome_regulation"   />
+        <result property="treatmentOpinion"     column="treatment_opinion"     />
+        <result property="precautions"          column="precautions"           />
+        <result property="doctorSignature"      column="doctor_signature"      />
+        <result property="practiceCertificateNo" column="practice_certificate_no" />
+        <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="remark"               column="remark"                />
+        <result property="doctorId"             column="doctor_id"             />
+    </resultMap>
+
+    <sql id="selectFsDoctorPatientVo">
+        select id, patient_name, sex, age, phone, reception_time, reception_doctor, city,
+               present_illness, past_history, allergy_history, diagnosis, syndrome_type,
+               syndrome_regulation, treatment_opinion, precautions, doctor_signature,
+               practice_certificate_no, doctor_id,
+               create_by, create_time, update_by, update_time, remark, del_flag
+        from fs_doctor_patient
+    </sql>
+
+    <select id="selectFsDoctorPatientList" parameterType="com.fs.his.domain.FsDoctorPatient" resultMap="FsDoctorPatientResult">
+        <include refid="selectFsDoctorPatientVo"/>
+        where del_flag = '0'
+        <if test="patientName != null and patientName != ''">
+            and patient_name like concat('%', #{patientName}, '%')
+        </if>
+        <if test="sex != null and sex != ''">
+            and sex = #{sex}
+        </if>
+        <if test="phone != null and phone != ''">
+            and phone like concat('%', #{phone}, '%')
+        </if>
+        <if test="receptionDoctor != null and receptionDoctor != ''">
+            and reception_doctor like concat('%', #{receptionDoctor}, '%')
+        </if>
+        <if test="receptionTime != null">
+            and reception_time = #{receptionTime}
+        </if>
+        <if test="beginTime != null and beginTime != ''">
+            and reception_time &gt;= #{params.beginTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and reception_time &lt;= #{params.endTime}
+        </if>
+        <if test="doctorId != null">
+            and doctor_id = #{doctorId}
+        </if>
+        order by reception_time desc
+    </select>
+
+    <select id="selectFsDoctorPatientById" parameterType="Long" resultMap="FsDoctorPatientResult">
+        <include refid="selectFsDoctorPatientVo"/>
+        where id = #{id} and del_flag = '0'
+    </select>
+
+    <insert id="insertFsDoctorPatient" parameterType="com.fs.his.domain.FsDoctorPatient" useGeneratedKeys="true" keyProperty="id">
+        insert into fs_doctor_patient (
+            patient_name, sex, age, phone, reception_time, reception_doctor, city,
+            present_illness, past_history, allergy_history, diagnosis, syndrome_type,
+            syndrome_regulation, treatment_opinion, precautions, doctor_signature,
+            practice_certificate_no, doctor_id,
+            create_by, create_time, remark
+        ) values (
+                     #{patientName}, #{sex}, #{age}, #{phone}, #{receptionTime}, #{receptionDoctor}, #{city},
+                     #{presentIllness}, #{pastHistory}, #{allergyHistory}, #{diagnosis}, #{syndromeType},
+                     #{syndromeRegulation}, #{treatmentOpinion}, #{precautions}, #{doctorSignature},
+                     #{practiceCertificateNo}, #{doctorId},
+                     #{createBy}, sysdate(), #{remark}
+                 )
+    </insert>
+
+    <update id="updateFsDoctorPatient" parameterType="com.fs.his.domain.FsDoctorPatient">
+        update fs_doctor_patient
+        <set>
+            <if test="patientName != null and patientName != ''">patient_name = #{patientName},</if>
+            <if test="sex != null">sex = #{sex},</if>
+            <if test="age != null">age = #{age},</if>
+            <if test="phone != null">phone = #{phone},</if>
+            <if test="receptionTime != null">reception_time = #{receptionTime},</if>
+            <if test="receptionDoctor != null">reception_doctor = #{receptionDoctor},</if>
+            <if test="city != null">city = #{city},</if>
+            <if test="presentIllness != null">present_illness = #{presentIllness},</if>
+            <if test="pastHistory != null">past_history = #{pastHistory},</if>
+            <if test="allergyHistory != null">allergy_history = #{allergyHistory},</if>
+            <if test="diagnosis != null">diagnosis = #{diagnosis},</if>
+            <if test="syndromeType != null">syndrome_type = #{syndromeType},</if>
+            <if test="syndromeRegulation != null">syndrome_regulation = #{syndromeRegulation},</if>
+            <if test="treatmentOpinion != null">treatment_opinion = #{treatmentOpinion},</if>
+            <if test="precautions != null">precautions = #{precautions},</if>
+            <if test="doctorSignature != null">doctor_signature = #{doctorSignature},</if>
+            <if test="practiceCertificateNo != null">practice_certificate_no = #{practiceCertificateNo},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="doctorId != null">doctor_id = #{doctorId},</if>
+            update_time = sysdate()
+        </set>
+        where id = #{id}
+    </update>
+
+    <update id="deleteFsDoctorPatientById" parameterType="Long">
+        update fs_doctor_patient set del_flag = '2' where id = #{id}
+    </update>
+
+    <update id="deleteFsDoctorPatientByIds" parameterType="String">
+        update fs_doctor_patient set del_flag = '2' where id in
+        <foreach collection="array" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+</mapper>