Преглед изворни кода

完善客户信息表+患者信息表逻辑

cgp пре 22 часа
родитељ
комит
a5103e0b13

+ 32 - 3
fs-company/src/main/java/com/fs/company/controller/qw/FsCompanyCustomerController.java

@@ -5,18 +5,21 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyUserRoleMapper;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.security.SecurityUtils;
+import com.fs.his.domain.FsPrescribe;
+import com.fs.his.param.CollectionPhoneParam;
+import com.fs.his.param.PrescribePhoneParam;
+import com.fs.his.service.IFsPrescribeService;
+import com.fs.hisStore.service.IFsUserInformationCollectionService;
+import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
 import com.fs.qw.domain.FsCompanyCustomer;
 import com.fs.qw.service.IFsCompanyCustomerService;
 import com.fs.qw.vo.CompanyUserAndDoctorVO;
 import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
-import org.checkerframework.checker.index.qual.SameLen;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -43,6 +46,12 @@ public class FsCompanyCustomerController extends BaseController {
     @Autowired
     private CompanyUserRoleMapper roleMapper;
 
+    @Autowired
+    private IFsPrescribeService fsPrescribeService;
+
+    @Autowired
+    private IFsUserInformationCollectionService fsUserInformationCollectionService;
+
     /**
      * 查询客户列表
      */
@@ -119,4 +128,24 @@ public class FsCompanyCustomerController extends BaseController {
         return AjaxResult.success(companyUserAndDoctorVO);
     }
 
+    /**
+     * 根据传入手机号获取处方列表信息
+     * */
+    @PostMapping("/getPrescribeListByPhone")
+    public TableDataInfo getPrescribeListByPhone(@RequestBody PrescribePhoneParam param){
+        PageHelper.startPage(param.getPageNum(),param.getPageSize());
+        List<FsPrescribe> list = fsPrescribeService.selectPrescribeListByEncryptPhone(param.getPhone());
+        return getDataTable(list);
+    }
+
+    /**
+     * 根据传入手机号获取信息采集列表数据
+     * */
+    @PostMapping("/getCollectionInfoListByPhone")
+    public TableDataInfo getCollectionInfoListByPhone(@RequestBody CollectionPhoneParam param){
+        PageHelper.startPage(param.getPageNum(),param.getPageSize());
+        List<FsUserInformationCollectionOverviewVo> list = fsUserInformationCollectionService.selectUserInformationCollectionByPhone(param.getPhone());
+        return getDataTable(list);
+    }
+
 }

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

@@ -1,12 +1,20 @@
 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.domain.FsPrescribe;
+import com.fs.his.param.CollectionPhoneParam;
+import com.fs.his.param.PrescribePhoneParam;
 import com.fs.his.service.IFsDoctorPatientService;
 import com.fs.his.service.IFsDoctorService;
+import com.fs.his.service.IFsPrescribeService;
+import com.fs.hisStore.service.IFsUserInformationCollectionService;
+import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -36,6 +44,13 @@ public class FsDoctorPatientController extends AppBaseController {
 
     @Autowired
     private IFsDoctorService fsDoctorService;
+
+    @Autowired
+    private IFsPrescribeService fsPrescribeService;
+
+    @Autowired
+    private IFsUserInformationCollectionService fsUserInformationCollectionService;
+
     /**
      * 查询患者信息列表
      */
@@ -119,4 +134,26 @@ public class FsDoctorPatientController extends AppBaseController {
         FsDoctor fsDoctor = fsDoctorService.selectFsDoctorByDoctorId(Long.valueOf(doctorId));
         return AjaxResult.success(fsDoctor);
     }
+
+    /**
+     * 根据传入手机号获取处方列表信息
+     * */
+    @PostMapping("/getPrescribeListByPhone")
+    public AjaxResult getPrescribeListByPhone(@RequestBody PrescribePhoneParam param){
+        PageHelper.startPage(param.getPageNum(),param.getPageSize());
+        List<FsPrescribe> list = fsPrescribeService.selectPrescribeListByEncryptPhone(param.getPhone());
+        PageInfo<FsPrescribe> listPageInfo=new PageInfo<>(list);
+        return AjaxResult.success(listPageInfo);
+    }
+
+    /**
+     * 根据传入手机号获取信息采集列表数据
+     * */
+    @PostMapping("/getCollectionInfoListByPhone")
+    public AjaxResult getCollectionInfoListByPhone(@RequestBody CollectionPhoneParam param){
+        PageHelper.startPage(param.getPageNum(),param.getPageSize());
+        List<FsUserInformationCollectionOverviewVo> list = fsUserInformationCollectionService.selectUserInformationCollectionByPhone(param.getPhone());
+        PageInfo<FsUserInformationCollectionOverviewVo> listPageInfo=new PageInfo<>(list);
+        return AjaxResult.success(listPageInfo);
+    }
 }

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

@@ -203,6 +203,9 @@ public class FsPrescribe extends BaseEntity
      * */
     private Long collectionId;
 
+    /** 医生名称 */
+    private String doctorName;
+
     public FsPrescribe() {
     }
 

+ 5 - 0
fs-service/src/main/java/com/fs/his/mapper/FsPrescribeMapper.java

@@ -344,4 +344,9 @@ public interface FsPrescribeMapper
      * 根据处方id集合批量查询
      * */
     List<FsPrescribe> selectFsPrescribeListByPrescribeIds(@Param("prescribeIds") List<Long> prescribeIds);
+
+    /**
+     * 根据加密手机号查询处方列表
+     * */
+    List<FsPrescribe> selectPrescribeListByEncryptPhone(String phone);
 }

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

@@ -0,0 +1,11 @@
+package com.fs.his.param;
+
+import lombok.Data;
+
+@Data
+public class CollectionPhoneParam {
+    private String phone;
+    //分页相关
+    private Integer pageNum;
+    private Integer pageSize;
+}

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

@@ -0,0 +1,11 @@
+package com.fs.his.param;
+
+import lombok.Data;
+
+@Data
+public class PrescribePhoneParam {
+    private String phone;
+    //分页相关
+    private Integer pageNum;
+    private Integer pageSize;
+}

+ 5 - 0
fs-service/src/main/java/com/fs/his/service/IFsPrescribeService.java

@@ -167,4 +167,9 @@ public interface IFsPrescribeService
      * 根据用户id查询最新审核通过的处方信息
      * */
     FsPrescribe selectNewestAuditedPrescribeByCollectionId(Long collectionId);
+
+    /**
+     * 根据加密后的电话号码查询处方列表
+     * */
+    List<FsPrescribe> selectPrescribeListByEncryptPhone(String phone);
 }

+ 17 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsPrescribeServiceImpl.java

@@ -26,6 +26,7 @@ import com.fs.his.mapper.*;
 import com.fs.his.param.*;
 import com.fs.his.service.*;
 import com.fs.his.utils.ConfigUtil;
+import com.fs.his.utils.PhoneUtil;
 import com.fs.his.utils.qrcode.QRCodeUtils;
 import com.fs.his.vo.*;
 import com.fs.hisStore.domain.FsUserInformationCollection;
@@ -1612,6 +1613,8 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
 //            Long seconds = DateUtil.between(fsPrescribe.getStartOperateTime(), fsPrescribe.getEndOperateTime(), DateUnit.SECOND);
 //            fsPrescribe.setOperateSecond(seconds);
 //        }
+        //处方类型
+        fsPrescribe.setPrescribeType(param.getPrescribeType());
         //处方诊断
         fsPrescribe.setDiagnose(param.getDiagnose());
         //处方医嘱
@@ -1665,4 +1668,18 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
         return fsPrescribeMapper.selectNewestAuditedPrescribeByCollectionId(collectionId);
     }
 
+    @Override
+    public List<FsPrescribe> selectPrescribeListByEncryptPhone(String phone) {
+        if (StringUtils.isBlank(phone)) {
+            throw new CustomException("手机号不能为空");
+        }
+        // 手机号长度为11位时进行加密,否则直接使用原值查询
+        String searchPhone = (phone.length() == 11) ? PhoneUtil.encryptPhone(phone) : phone;
+        List<FsPrescribe> prescribeList = fsPrescribeMapper.selectPrescribeListByEncryptPhone(searchPhone);
+        if (CollectionUtils.isEmpty(prescribeList)){
+            return Collections.emptyList();
+        }
+        return prescribeList;
+    }
+
 }

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

@@ -128,4 +128,13 @@ public interface FsUserInformationCollectionMapper extends BaseMapper<FsUserInfo
      * 重置CID信息采集
      */
     int resetCIDCollection(Long collectionId);
+
+
+    /**
+     * 根据手机号查询用户信息采集表
+     *
+     * @param phone 手机号
+     * @return 用户信息采集表
+     */
+    List<FsUserInformationCollectionOverviewVo> selectFsUserInformationCollectionByPhone(String phone);
 }

+ 5 - 0
fs-service/src/main/java/com/fs/hisStore/service/IFsUserInformationCollectionService.java

@@ -209,4 +209,9 @@ public interface IFsUserInformationCollectionService extends IService<FsUserInfo
      * @return 结果
      */
     int resetCIDCollection(Long collectionId,Long operatorId,String nickName);
+
+    /**
+     * 根据手机号查询已绑定用户的信息采集表数据
+     * */
+    List<FsUserInformationCollectionOverviewVo> selectUserInformationCollectionByPhone(String phone);
 }

+ 38 - 8
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -101,6 +101,8 @@ import com.fs.hisStore.service.IFsUserInformationCollectionService;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import static com.fs.his.utils.PhoneUtil.encryptPhone;
+
 /**
  * 用户信息采集Service业务层处理
  *
@@ -489,7 +491,10 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         }
         fsPrescribe.setPatientId(param.getPatientInfo().getPatientId());
         fsPrescribe.setPatientName(param.getPatientInfo().getPatientName());
-        fsPrescribe.setPatientTel(param.getPatientInfo().getMobile());
+        if (param.getPatientInfo().getMobile() != null){
+            //存储加密字符串到处方表
+            fsPrescribe.setPatientTel(encryptPhone(param.getPatientInfo().getMobile()));
+        }
         fsPrescribe.setPatientGender(String.valueOf(param.getPatientInfo().getSex()));
         return fsPrescribe;
     }
@@ -1722,15 +1727,28 @@ 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);
+            if (fsPrescribe!=null){
+                if (DEFAULT_PATIENT_NAME.equals(fsPrescribe.getPatientName())){
+                    //如果待完善用户的信息采集对应的处方中使用患者名称是"默认就诊人",则需要更新对应处方中的患者信息
+                    fsPrescribe.setPatientBirthday(param.getPatientInfo().getBirthday());
+                    fsPrescribe.setPatientId(param.getPatientInfo().getPatientId());
+                    fsPrescribe.setPatientName(param.getPatientInfo().getPatientName());
+                    if (param.getPatientInfo().getMobile()!=null&&param.getPatientInfo().getMobile().length()==11){
+                        //说明传入的是未加密的手机号,则需要加密后再存储
+                        fsPrescribe.setPatientTel(encryptPhone(param.getPatientInfo().getMobile()));
+                    } else if (param.getPatientInfo().getMobile()!=null&&param.getPatientInfo().getMobile().length()>11) {
+                        //说明传入的是加密后的字符串,无需加密直接赋值
+                        fsPrescribe.setPatientTel(param.getPatientInfo().getMobile());
+                    }
+
+                    fsPrescribe.setPatientGender(param.getPatientInfo().getSex());
+                    fsPrescribeMapper.updateFsPrescribe(fsPrescribe);
+                }
+            }
+
         }
         fsUserInformationCollectionMapper.updateFsUserInformationCollection(sourceInfo);
     }
@@ -1937,6 +1955,18 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         return fsUserInformationCollectionMapper.resetCIDCollection(collectionId);
     }
 
+    @Override
+    public List<FsUserInformationCollectionOverviewVo> selectUserInformationCollectionByPhone(String phone) {
+        if (StringUtils.isEmpty(phone)){
+            throw new CustomException("手机号不能为空");
+        }
+        List<FsUserInformationCollectionOverviewVo> fsUserInformationCollections =fsUserInformationCollectionMapper.selectFsUserInformationCollectionByPhone(phone);
+        if (CollectionUtils.isEmpty(fsUserInformationCollections)){
+            return Collections.emptyList();
+        }
+        return fsUserInformationCollections;
+    }
+
     /**
      * 校验必填备注:对于 open=true 且被勾选的选项,必须填写备注文本
      *

+ 7 - 0
fs-service/src/main/resources/mapper/his/FsPrescribeMapper.xml

@@ -591,6 +591,13 @@
             #{prescribeId}
         </foreach>
     </select>
+    <select id="selectPrescribeListByEncryptPhone" resultType="com.fs.his.domain.FsPrescribe">
+        select fp.*,dc.doctor_name as doctorName
+        from fs_prescribe fp left join fs_doctor dc on dc.doctor_id = fp.doctor_id
+        where
+        patient_tel = #{encryptPhone}
+        order by fp.audit_time desc
+    </select>
 
     <update id="updateFsPrescribeListDataCPWByPrescribeIds" parameterType="java.util.List">
         update fs_prescribe

+ 28 - 0
fs-service/src/main/resources/mapper/hisStore/FsUserInformationCollectionMapper.xml

@@ -265,6 +265,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER BY infocollect.create_time DESC
     </select>
 
+    <select id="selectFsUserInformationCollectionByPhone"
+            resultMap="FsUserInformationCollectionVoResult">
+        SELECT infocollect.id,
+               infocollect.user_id,
+               infocollect.json_info,
+               infocollect.create_time,
+               infocollect.doctor_id,
+               infocollect.company_user_id,
+               infocollect.question_id,
+               infocollect.age,
+               infocollect.user_name,
+               infocollect.sex,
+               infocollect.user_phone_four,
+               infocollect.allergy,
+               infocollect.remark,
+               infocollect.qw_tag,
+               infocollect.personal_collect_status,
+               infocollect.package_order_code,
+               infocollect.prescribe_id,
+               cu.nick_name,
+               fd.doctor_name
+        FROM fs_user_information_collection infocollect
+                 LEFT JOIN company_user cu ON infocollect.company_user_id = cu.user_id
+                 LEFT JOIN fs_doctor fd ON infocollect.doctor_id = fd.doctor_id
+        where infocollect.user_phone_four = #{phone}
+        and infocollect.user_id IS NOT NULL
+    </select>
+
     <insert id="insertFsUserInformationCollection" parameterType="FsUserInformationCollection" useGeneratedKeys="true" keyProperty="id">
         insert into fs_user_information_collection
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 2 - 1
fs-user-app/src/main/java/com/fs/app/controller/PatientController.java

@@ -59,7 +59,8 @@ public class PatientController extends  AppBaseController {
             List<FsPatient> list=patientService.selectFsPatientList(map);
             for (FsPatient fsPatient : list) {
                 if (fsPatient.getMobile()!=null&&fsPatient.getMobile().length()>11&&!fsPatient.getMobile().matches("\\d+")){
-                    fsPatient.setMobile(decryptPhoneMk(fsPatient.getMobile()));
+                    //fsPatient.setMobile(decryptPhoneMk(fsPatient.getMobile()));
+                    fsPatient.setMobile(decryptPhone(fsPatient.getMobile()));//益寿缘信息采集相关直接解密不需要加*
                 }
             }
             //如果用户关联就诊人为空,就添加默认就诊人返回