Browse Source

默认就诊人校验

cgp 3 ngày trước cách đây
mục cha
commit
ef6dc7fe58

+ 4 - 8
fs-admin/src/main/java/com/fs/company/controller/CompanyStatisticsController.java

@@ -28,13 +28,9 @@ import com.fs.his.service.IFsStoreOrderService;
 import com.fs.his.service.IFsStorePaymentService;
 import com.fs.his.vo.FsStoreOrderStatsRowVo;
 import com.fs.hisStore.service.IFsStoreOrderScrmService;
-import com.fs.qw.vo.SopCompanyUserTaskVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -680,9 +676,9 @@ public class CompanyStatisticsController extends BaseController
     /**
      * 员工销售统计:部门/员工、进粉时间、下单时间 → 进粉量、订单金额、购买次数、购买人数
      */
-    @GetMapping("/salesStat")
-    @PreAuthorize("hasPermission('company:statistics:salesStat')")
-    public TableDataInfo salesStat(SalesStatCIDParam param) {
+    @PostMapping("/salesStat")
+    @PreAuthorize("@ss.hasPermi('company:statistics:salesStat')")
+    public TableDataInfo salesStat(@RequestBody SalesStatCIDParam param) {
         startPage();
         List<SalesStatCIDVO> voList = statisticsCIDService.getSalesStatistics(param);
         return getDataTable(voList);

+ 17 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsPatientController.java

@@ -115,6 +115,23 @@ public class FsPatientController extends BaseController
         }
      return AjaxResult.success(fsPatientVOS);
     }
+
+    /**
+     * 获取未删除的用户信息
+     */
+    @GetMapping(value = "getUndeletedUserInfoByUserId/{userId}")
+    public AjaxResult getUndeletedUserInfoByUserId(@PathVariable("userId") Long userId)
+    {
+        List<FsPatientVO> fsPatientVOS = fsPatientService.getUndeletedUserInfoByUserId(userId);
+        for (FsPatientVO  fsPatientVO: fsPatientVOS) {
+            if (fsPatientVO.getPhone()!=null){
+                fsPatientVO.setPhone(fsPatientVO.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+
+            }
+
+        }
+        return AjaxResult.success(fsPatientVOS);
+    }
     /**
      * 新增病人
      */

+ 3 - 1
fs-service/src/main/java/com/fs/company/vo/SalesStatCIDVO.java

@@ -1,7 +1,9 @@
 package com.fs.company.vo;
 
-import java.math.BigDecimal;
+import lombok.Data;
 
+import java.math.BigDecimal;
+@Data
 public class SalesStatCIDVO {
     private Integer fansCount;       // 进粉数
     private BigDecimal totalAmount;  // 订单总金额

+ 4 - 0
fs-service/src/main/java/com/fs/his/mapper/FsPatientMapper.java

@@ -94,6 +94,10 @@ public interface FsPatientMapper
     FsPatientVO selectFsPatientByUserId(Long userId);
     @Select("SELECT * FROM fs_patient WHERE user_id=#{userId}")
     List<FsPatientVO> selectFsPatientListByUserId(Long userId);
+
+    @Select("SELECT * FROM fs_patient WHERE user_id=#{userId} and is_del=0")
+    List<FsPatientVO> getUndeletedUserInfoByUserId(Long userId);
+
     @Select({"<script> " +
             "select DISTINCT p.patient_id,p.user_id, p.patient_name,p.id_card,p.birthday,p.sex,p.weight,p.mobile,o.create_time  from fs_inquiry_order o inner join fs_patient p  on o.patient_id=p.patient_id     " +
             "where  p.status=1 and  o.doctor_id=#{maps.doctorId}  " +

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

@@ -68,6 +68,8 @@ public interface IFsPatientService
 
     List<FsPatientVO> selectFsPatientByUserId(Long userId);
 
+    List<FsPatientVO> getUndeletedUserInfoByUserId(Long userId);
+
     List<FsPatientListDVO> selectFsPatientListDVO(FsPatientListDParam param);
 
     Boolean isEntityNull(FsPatientVO fsPatient);

+ 4 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsPatientServiceImpl.java

@@ -139,6 +139,10 @@ public class FsPatientServiceImpl implements IFsPatientService
     public List<FsPatientVO> selectFsPatientByUserId(Long userId) {
         return fsPatientMapper.selectFsPatientListByUserId(userId);
     }
+    @Override
+    public List<FsPatientVO> getUndeletedUserInfoByUserId(Long userId) {
+        return fsPatientMapper.getUndeletedUserInfoByUserId(userId);
+    }
 
     @Override
     public List<FsPatientListDVO> selectFsPatientListDVO(FsPatientListDParam param) {

+ 22 - 18
fs-service/src/main/java/com/fs/his/service/impl/FsProjectRedDetailServiceImpl.java

@@ -4,9 +4,11 @@ import java.util.Date;
 import java.util.List;
 
 import com.fs.common.core.domain.R;
+import com.fs.common.core.redis.RedisCache;
 import com.fs.common.utils.DateUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.his.param.ProjectRedParam;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.fs.his.mapper.FsProjectRedDetailMapper;
@@ -19,83 +21,85 @@ import com.fs.his.service.IFsProjectRedDetailService;
  * @author fs
  * @date 2026-04-24
  */
+@Slf4j
 @Service
 public class FsProjectRedDetailServiceImpl extends ServiceImpl<FsProjectRedDetailMapper, FsProjectRedDetail> implements IFsProjectRedDetailService {
 
 
     @Autowired
     private FsProjectRedDetailMapper fsProjectRedDetailMapper;
+
+    @Autowired
+    private RedisCache redisCache;
+
+    //理疗记录Key前缀
+    private static final String PROJECT_REDIS_KEY = "project:red:";
+
     /**
      * 查询理疗浏览记录
-     * 
+     *
      * @param id 理疗浏览记录主键
      * @return 理疗浏览记录
      */
     @Override
-    public FsProjectRedDetail selectFsProjectRedDetailById(Long id)
-    {
+    public FsProjectRedDetail selectFsProjectRedDetailById(Long id) {
         return baseMapper.selectFsProjectRedDetailById(id);
     }
 
     /**
      * 查询理疗浏览记录列表
-     * 
+     *
      * @param fsProjectRedDetail 理疗浏览记录
      * @return 理疗浏览记录
      */
     @Override
-    public List<FsProjectRedDetail> selectFsProjectRedDetailList(FsProjectRedDetail fsProjectRedDetail)
-    {
+    public List<FsProjectRedDetail> selectFsProjectRedDetailList(FsProjectRedDetail fsProjectRedDetail) {
         return baseMapper.selectFsProjectRedDetailList(fsProjectRedDetail);
     }
 
     /**
      * 新增理疗浏览记录
-     * 
+     *
      * @param fsProjectRedDetail 理疗浏览记录
      * @return 结果
      */
     @Override
-    public int insertFsProjectRedDetail(FsProjectRedDetail fsProjectRedDetail)
-    {
+    public int insertFsProjectRedDetail(FsProjectRedDetail fsProjectRedDetail) {
         fsProjectRedDetail.setCreateTime(DateUtils.getNowDate());
         return baseMapper.insertFsProjectRedDetail(fsProjectRedDetail);
     }
 
     /**
      * 修改理疗浏览记录
-     * 
+     *
      * @param fsProjectRedDetail 理疗浏览记录
      * @return 结果
      */
     @Override
-    public int updateFsProjectRedDetail(FsProjectRedDetail fsProjectRedDetail)
-    {
+    public int updateFsProjectRedDetail(FsProjectRedDetail fsProjectRedDetail) {
         fsProjectRedDetail.setUpdateTime(DateUtils.getNowDate());
         return baseMapper.updateFsProjectRedDetail(fsProjectRedDetail);
     }
 
     /**
      * 批量删除理疗浏览记录
-     * 
+     *
      * @param ids 需要删除的理疗浏览记录主键
      * @return 结果
      */
     @Override
-    public int deleteFsProjectRedDetailByIds(Long[] ids)
-    {
+    public int deleteFsProjectRedDetailByIds(Long[] ids) {
         return baseMapper.deleteFsProjectRedDetailByIds(ids);
     }
 
     /**
      * 删除理疗浏览记录信息
-     * 
+     *
      * @param id 理疗浏览记录主键
      * @return 结果
      */
     @Override
-    public int deleteFsProjectRedDetailById(Long id)
-    {
+    public int deleteFsProjectRedDetailById(Long id) {
         return baseMapper.deleteFsProjectRedDetailById(id);
     }
 

+ 17 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsUserInformationCollectionParam.java

@@ -55,4 +55,21 @@ public class FsUserInformationCollectionParam {
 
     /** 用户信息采集的填写标识 0:未填写,1:已填写*/
     private Integer fillFlag;
+
+    /** 待完善用户列表选择的患者信息 */
+    private PatientInfo patientInfo;
+
+    @Data
+    public static class PatientInfo {
+        /** 患者ID */
+        private Long patientId;
+        /** 患者姓名 */
+        private String patientName;
+        /** 患者手机号 */
+        private String mobile;
+        /** 患者性别 0女 1男 */
+        private String sex;
+        /** 出生日期 yyyy-MM-dd */
+        private String birthday;
+    }
 }

+ 17 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -211,6 +211,8 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
     private FsUserInformationCollectionPersonalLogMapper infoCollectionPersonalLogMapper;
 
 
+    //"默认就诊人"常量字符串
+    private static final String DEFAULT_PATIENT_NAME = "默认就诊人";
 
     /**
      * 查询用户信息采集
@@ -405,6 +407,10 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
             int addPrescribeResult = fsPrescribeMapper.insertFsPrescribe(fsPrescribe);
 
             collection.setPrescribeId(fsPrescribe.getPrescribeId());//TODO 向fs_user_information_collection表写入处方id 后续要优化改成更新一次collection
+            //如果用户的患者信息还是默认就诊人则也需要更新信息采集为待完善
+            if (DEFAULT_PATIENT_NAME.equals(param.getPatientInfo().getPatientName())){
+                collection.setCompleteStatus(0);
+            }
             fsUserInformationCollectionMapper.updateFsUserInformationCollection(collection);
             FsUserInformationCollectionPersonalLog informationCollectionPersonalLog=new FsUserInformationCollectionPersonalLog();
             BeanUtils.copyProperties(collection, informationCollectionPersonalLog);
@@ -1700,6 +1706,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void submitSalesInfo(FsUserInformationCollectionParam param, FsUserInformationCollection sourceInfo) {
         if (sourceInfo == null) {
             sourceInfo = fsUserInformationCollectionMapper.selectFsUserInformationCollectionById(param.getId());
@@ -1718,6 +1725,16 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
             log.error("信息采集id:{}存在必填备注未填写,请完善后再提交", param.getId());//为了不影响业务正常执行这里暂时就不抛异常了
             sourceInfo.setCompleteStatus(0);
         }
+        //如果待完善用户使用患者信息的是"默认就诊人",则需要更新对应处方中的患者信息
+        if (sourceInfo.getPrescribeId()!=null){
+            FsPrescribe fsPrescribe = fsPrescribeMapper.selectFsPrescribeByPrescribeId(sourceInfo.getPrescribeId());
+            fsPrescribe.setPatientBirthday(param.getPatientInfo().getBirthday());
+            fsPrescribe.setPatientId(param.getPatientInfo().getPatientId());
+            fsPrescribe.setPatientName(param.getPatientInfo().getPatientName());
+            fsPrescribe.setPatientTel(param.getPatientInfo().getMobile());
+            fsPrescribe.setPatientGender(param.getPatientInfo().getSex());
+            fsPrescribeMapper.updateFsPrescribe(fsPrescribe);
+        }
         fsUserInformationCollectionMapper.updateFsUserInformationCollection(sourceInfo);
     }
 

+ 1 - 1
fs-service/src/main/resources/mapper/company/CompanyStatisticsCIDMapper.xml

@@ -10,7 +10,7 @@
         <result column="buyerCount" property="buyerCount"/>
     </resultMap>
 
-    <select id="getSalesStatistics" resultMap="SalesStatMap">
+    <select id="getSalesStatistics" parameterType="com.fs.company.param.SalesStatCIDParam" resultMap="SalesStatMap">
         SELECT
             COUNT(DISTINCT CASE
                                WHEN ec.create_time BETWEEN #{param.startAddTime} AND #{param.endAddTime}