Procházet zdrojové kódy

总后台-医生管理增加患者转交功能

cgp před 2 dny
rodič
revize
8aca6e15cb

+ 36 - 0
fs-admin/src/main/java/com/fs/his/controller/FsDoctorController.java

@@ -6,7 +6,9 @@ import java.util.List;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.SecurityUtils;
 import com.fs.common.utils.sign.Md5Utils;
+import com.fs.his.domain.FsDoctorPatient;
 import com.fs.his.param.*;
+import com.fs.his.service.IFsDoctorPatientService;
 import com.fs.his.utils.RedisCacheUtil;
 import com.fs.his.vo.FsDoctorListVO;
 import com.fs.his.vo.FsDoctorVO;
@@ -36,8 +38,12 @@ public class FsDoctorController extends BaseController
 {
     @Autowired
     private IFsDoctorService fsDoctorService;
+
     @Autowired
     private RedisCacheUtil redisCacheUtil;
+
+    @Autowired
+    private IFsDoctorPatientService fsDoctorPatientService;
     /**
      * 查询医生管理列表
      */
@@ -276,4 +282,34 @@ public class FsDoctorController extends BaseController
         return getDataTable(optionsVOS);
     }
 
+    /**
+     * 获取医生患者信息列表
+     */
+    @GetMapping("/patients/{doctorId}")
+    public AjaxResult getDoctorPatients(@PathVariable("doctorId") Long doctorId) {
+        List<FsDoctorPatient> list = fsDoctorPatientService.selectFsDoctorPatientByDoctorId(doctorId);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 执行患者信息转交
+     */
+    @Log(title = "患者转交", businessType = BusinessType.UPDATE)
+    @PostMapping("/transferPatient")
+    public AjaxResult transferPatient(@RequestBody TransferPatientParam param) {
+        int rows = fsDoctorPatientService.transferPatient(param);
+        return toAjax(rows);
+    }
+
+    /**
+     * 获取医生信息列表
+     * */
+    @GetMapping("/getDoctorList")
+    public AjaxResult getDoctorList() {
+        //获取状态正常的医生信息列表
+        List<FsDoctor> list = fsDoctorService.getActiveDoctorsList();
+        return AjaxResult.success(list);
+    }
+
+
 }

+ 3 - 0
fs-service/src/main/java/com/fs/his/mapper/FsDoctorMapper.java

@@ -241,6 +241,9 @@ public interface FsDoctorMapper
             "</script>"})
     List<FsDoctorListUVO> selectCourseRecommendDoctorList(@Param("param") FsCourseRecommendDoctorParam param);
 
+
+    List<FsDoctor> getActiveDoctorsList();
+
 //    @Select("SELECT d.* FROM fs_doctor d WHERE doctor_type = 1  AND is_audit = 1 AND `status` = 1 ")
 //    List<FsDoctor> selectNoCourseRecommendDoctorList();
 }

+ 22 - 1
fs-service/src/main/java/com/fs/his/mapper/FsDoctorPatientMapper.java

@@ -1,6 +1,8 @@
 package com.fs.his.mapper;
 
 import com.fs.his.domain.FsDoctorPatient;
+import org.apache.ibatis.annotations.Param;
+
 import java.util.List;
 
 /**
@@ -56,5 +58,24 @@ public interface FsDoctorPatientMapper {
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteFsDoctorPatientByIds(Long[] ids);
+    public int deleteFsDoctorPatientByIds(@Param("ids") Long[] ids);
+
+    /**
+     * 根据医生id查询患者信息列表
+     *
+     * @param sourceDoctorId 源医生id
+     * @return 患者信息列表
+     */
+    public List<FsDoctorPatient> selectFsDoctorPatientByDoctorId(Long sourceDoctorId);
+
+    /**
+     * 根据患者id列表批量更新患者所属医生id
+     *
+     * @param targetDoctorId 目标医生id
+     * @param doctorName 目标医生名称
+     * @param patientIds     患者id列表
+     * @return 更新条数
+     */
+    int updateDoctorIdByIds(@Param("doctorId") Long targetDoctorId,@Param("doctorName") String doctorName,
+                            @Param("patientIds") List<Long> patientIds);
 }

+ 20 - 0
fs-service/src/main/java/com/fs/his/param/TransferPatientParam.java

@@ -0,0 +1,20 @@
+package com.fs.his.param;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class TransferPatientParam {
+    //源医生id
+    private Long sourceDoctorId;
+
+    //目标医生id
+    private Long targetDoctorId;
+
+    //目标医生名称
+    private String targetDoctorName;
+
+    //待转交的患者id列表
+    private List<Long> patientIds;
+}

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

@@ -1,6 +1,8 @@
 package com.fs.his.service;
 
 import com.fs.his.domain.FsDoctorPatient;
+import com.fs.his.param.TransferPatientParam;
+
 import java.util.List;
 
 /**
@@ -34,4 +36,13 @@ public interface IFsDoctorPatientService {
      * 删除患者信息
      */
     public int deleteFsDoctorPatientByIds(Long[] ids);
+
+    /**
+     * 查询医生的患者信息列表
+     * */
+    public List<FsDoctorPatient> selectFsDoctorPatientByDoctorId(Long doctorId);
+    /**
+     * 转交患者信息
+     */
+    public int transferPatient(TransferPatientParam param);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/his/service/IFsDoctorService.java

@@ -115,4 +115,7 @@ public interface IFsDoctorService
     List<OptionsVO> selectDoctorOptionsType1();
 
     List<FsDoctorListUVO> getCourseRecommendDoctorList(FsCourseRecommendDoctorParam param);
+
+    //获取所有激活的医生列表
+    List<FsDoctor> getActiveDoctorsList();
 }

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

@@ -3,7 +3,9 @@ package com.fs.his.service.impl;
 import com.fs.common.exception.CustomException;
 import com.fs.his.domain.FsDoctorPatient;
 import com.fs.his.mapper.FsDoctorPatientMapper;
+import com.fs.his.param.TransferPatientParam;
 import com.fs.his.service.IFsDoctorPatientService;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -17,6 +19,7 @@ import java.util.List;
  * @author yourname
  * @date 2026-04-28
  */
+@Slf4j
 @Service
 public class FsDoctorPatientServiceImpl implements IFsDoctorPatientService {
     @Autowired
@@ -74,4 +77,24 @@ public class FsDoctorPatientServiceImpl implements IFsDoctorPatientService {
     public int deleteFsDoctorPatientByIds(Long[] ids) {
         return fsDoctorPatientMapper.deleteFsDoctorPatientByIds(ids);
     }
+
+    @Override
+    public List<FsDoctorPatient> selectFsDoctorPatientByDoctorId(Long doctorId) {
+        //获取医生患者信息列表
+        List<FsDoctorPatient> doctorPatientList = fsDoctorPatientMapper.selectFsDoctorPatientByDoctorId(doctorId);
+        if (CollectionUtils.isEmpty(doctorPatientList)){
+            log.error("患者信息不存在");
+            return Collections.emptyList();
+        }
+        return doctorPatientList;
+    }
+
+    @Override
+    public int transferPatient(TransferPatientParam param) {
+        if (CollectionUtils.isEmpty(param.getPatientIds())){
+            throw new CustomException("患者信息不存在");
+        }
+        //修改患者的归属医生id
+        return fsDoctorPatientMapper.updateDoctorIdByIds(param.getTargetDoctorId(),param.getTargetDoctorName(), param.getPatientIds());
+    }
 }

+ 11 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsDoctorServiceImpl.java

@@ -39,6 +39,7 @@ import com.google.common.reflect.TypeToken;
 import com.google.gson.Gson;
 import com.google.zxing.WriterException;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.compress.utils.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -531,6 +532,16 @@ public class FsDoctorServiceImpl implements IFsDoctorService
         return fsDoctorMapper.selectCourseRecommendDoctorList(param);
     }
 
+    @Override
+    public List<FsDoctor> getActiveDoctorsList() {
+        List<FsDoctor> doctorList=fsDoctorMapper.getActiveDoctorsList();
+        if (CollectionUtils.isEmpty(doctorList)){
+            return Collections.emptyList();
+        }
+        return doctorList;
+
+    }
+
     public static BufferedImage convertCircular(BufferedImage bi1) throws IOException {
         // 透明底的图片
         BufferedImage bi2 = new BufferedImage(bi1.getWidth(), bi1.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsUserInformationCollectionMapper.java

@@ -74,7 +74,7 @@ public interface FsUserInformationCollectionMapper extends BaseMapper<FsUserInfo
 
     @Select({"<script> " +
             " SELECT uic.*,u.nickname userName FROM fs_user_information_collection uic LEFT JOIN fs_user u ON uic.user_id = u.user_id " +
-            "WHERE doctor_id = #{maps.doctorId} and is_package = 0  and user_confirm = 1 " +
+            "WHERE doctor_id = #{maps.doctorId}  and user_confirm = 1 " +
             "<if test='maps.doctorConfirm != null' > and uic.doctor_confirm = #{maps.doctorConfirm}  </if>" +
             "<if test='maps.userConfirm != null' > and uic.user_confirm = #{maps.userConfirm}  </if>" +
             "<if test='maps.userName != null ' > and u.nickname like concat('%',#{maps.userName},'%')</if>" +

+ 4 - 0
fs-service/src/main/resources/mapper/his/FsDoctorMapper.xml

@@ -146,6 +146,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           ORDER BY d.doctor_id ASC
     </select>
 
+    <select id="getActiveDoctorsList" resultType="com.fs.his.domain.FsDoctor">
+        select * from fs_doctor where is_audit=1 and is_show=1 and status=1 and doctor_type=1
+    </select>
+
     <insert id="insertFsDoctor" parameterType="FsDoctor" useGeneratedKeys="true" keyProperty="doctorId">
         insert into fs_doctor
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 16 - 1
fs-service/src/main/resources/mapper/his/FsDoctorPatientMapper.xml

@@ -81,6 +81,11 @@
         where id = #{id} and del_flag = '0'
     </select>
 
+    <select id="selectFsDoctorPatientByDoctorId" parameterType="Long" resultMap="FsDoctorPatientResult">
+        <include refid="selectFsDoctorPatientVo"/>
+        where doctor_id = #{doctorId} and del_flag = '0'
+    </select>
+
     <!-- 动态 insert 语句 -->
     <insert id="insertFsDoctorPatient" parameterType="com.fs.his.domain.FsDoctorPatient" useGeneratedKeys="true" keyProperty="id">
         insert into fs_doctor_patient
@@ -169,7 +174,17 @@
 
     <update id="deleteFsDoctorPatientByIds" parameterType="String">
         update fs_doctor_patient set del_flag = '2' where id in
-        <foreach collection="array" item="id" open="(" separator="," close=")">
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <update id="updateDoctorIdByIds">
+        UPDATE fs_doctor_patient
+        SET doctor_id = #{doctorId},
+        reception_doctor = #{doctorName}
+        WHERE id IN
+        <foreach collection="patientIds" item="id" open="(" separator="," close=")">
             #{id}
         </foreach>
     </update>