cgp 5 днів тому
батько
коміт
655e77f660
23 змінених файлів з 623 додано та 26 видалено
  1. 27 0
      fs-company/src/main/java/com/fs/hisStore/controller/FsUserInformationCollectionController.java
  2. 26 0
      fs-doctor-app/src/main/java/com/fs/app/controller/FsPrescribeController.java
  3. 10 3
      fs-doctor-app/src/main/java/com/fs/app/controller/PrescribeController.java
  4. 8 0
      fs-service/src/main/java/com/fs/course/param/CollectionInfoConfirmParam.java
  5. 8 0
      fs-service/src/main/java/com/fs/course/vo/FsUserInfoCollectionUVO.java
  6. 45 0
      fs-service/src/main/java/com/fs/enums/PostPayPrescStatusEnum.java
  7. 5 0
      fs-service/src/main/java/com/fs/his/domain/FsPrescribe.java
  8. 12 1
      fs-service/src/main/java/com/fs/his/mapper/FsPrescribeMapper.java
  9. 13 0
      fs-service/src/main/java/com/fs/his/param/FsPrescribeAuditParam.java
  10. 5 1
      fs-service/src/main/java/com/fs/his/param/FsPrescribeParam.java
  11. 42 0
      fs-service/src/main/java/com/fs/his/param/WaitPrescribeParam.java
  12. 17 0
      fs-service/src/main/java/com/fs/his/service/IFsPrescribeService.java
  13. 139 0
      fs-service/src/main/java/com/fs/his/service/impl/FsPrescribeServiceImpl.java
  14. 12 1
      fs-service/src/main/java/com/fs/his/vo/FsPrescribeListDVO.java
  15. 8 0
      fs-service/src/main/java/com/fs/his/vo/FsPrescribeListVO.java
  16. 5 0
      fs-service/src/main/java/com/fs/hisStore/dto/FsUserInformationCollectionOverviewDTO.java
  17. 11 0
      fs-service/src/main/java/com/fs/hisStore/param/bindCollectionPackageParam.java
  18. 12 1
      fs-service/src/main/java/com/fs/hisStore/service/IFsUserInformationCollectionService.java
  19. 143 17
      fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java
  20. 10 0
      fs-service/src/main/java/com/fs/hisStore/vo/FsUserInformationCollectionVO.java
  21. 51 1
      fs-service/src/main/resources/mapper/his/FsPrescribeMapper.xml
  22. 3 0
      fs-service/src/main/resources/mapper/hisStore/FsUserInformationCollectionMapper.xml
  23. 11 1
      fs-user-app/src/main/java/com/fs/app/controller/UserInfoCollectionController.java

+ 27 - 0
fs-company/src/main/java/com/fs/hisStore/controller/FsUserInformationCollectionController.java

@@ -6,10 +6,13 @@ import com.fs.common.core.domain.R;
 import com.fs.company.mapper.CompanyUserRoleMapper;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.security.SecurityUtils;
+import com.fs.his.domain.FsPrescribe;
 import com.fs.his.domain.FsUserInformationCollectionSchedule;
+import com.fs.his.service.IFsPrescribeService;
 import com.fs.hisStore.dto.FsUserInformationCollectionOverviewDTO;
 import com.fs.hisStore.dto.PendingSalesInfoQueryDTO;
 import com.fs.hisStore.param.FsUserInformationCollectionParam;
+import com.fs.hisStore.param.bindCollectionPackageParam;
 import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,6 +39,9 @@ public class FsUserInformationCollectionController extends BaseController
     @Autowired
     private IFsUserInformationCollectionService fsUserInformationCollectionService;
 
+    @Autowired
+    private IFsPrescribeService prescribeService;
+
     @Autowired
     private CompanyUserRoleMapper roleMapper;
 
@@ -217,6 +223,27 @@ public class FsUserInformationCollectionController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 销售绑定个微信息采集套餐包
+     * */
+    @PostMapping("/bindCollectionPackage")
+    public AjaxResult bindCollectionPackage(@RequestBody bindCollectionPackageParam param){
+        Long collectionId = fsUserInformationCollectionService.bindCollectionPackage(param);
+        if (collectionId>0){
+            return AjaxResult.success(collectionId);
+        }
+        return AjaxResult.error();
+    }
+    
+    /**
+     * 根据用户id最新审核通过处方信息
+     * */
+    @GetMapping("/getLastAuditPassPrescribeInfo")
+    public AjaxResult getLastAuditPassPrescribeInfo(@RequestParam Long userId){
+        FsPrescribe fsPrescribe = prescribeService.selectNewestAuditedPrescribeByUserId(userId);
+        return AjaxResult.success(fsPrescribe);
+    }
+
     /**
      * 查询销售是否具有代填权限
      * */

+ 26 - 0
fs-doctor-app/src/main/java/com/fs/app/controller/FsPrescribeController.java

@@ -16,6 +16,7 @@ import com.fs.his.dto.FsPrescribeRecordRejectDto;
 import com.fs.his.dto.PrescribeRejectDTO;
 import com.fs.his.mapper.FsPatientMapper;
 import com.fs.his.param.FsPrescribeParam;
+import com.fs.his.param.WaitPrescribeParam;
 import com.fs.his.service.IFsDoctorService;
 import com.fs.his.service.IFsExportTaskService;
 import com.fs.his.service.IFsPrescribeRecordService;
@@ -266,6 +267,31 @@ public class FsPrescribeController extends BaseController
         return AjaxResult.success(prescribeRecordService.selectRecordListByPrescribeId(prescribeId));
     }
 
+    //查询医生待开方列表--个微后付款版
+    @PostMapping("/waitPrescribeAfterPaymentList")
+    public TableDataInfo waitPrescribeList(@RequestBody WaitPrescribeParam waitPrescribeParam) {
+        startPage();
+        List<FsPrescribeListVO> list = fsPrescribeService.selectWaitPrescribeList(waitPrescribeParam);
+        for (FsPrescribeListVO vo : list){
+            vo.setRefuseCount(prescribeRecordService.selectRefuseCount(vo.getPrescribeId()));
+            if (vo.getPatientTel()!=null){
+                vo.setPatientTel(vo.getPatientTel().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+            }
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 医生确认处方--个微后付款版
+     * @param param 处方
+     * @return AjaxResult
+     */
+    @PostMapping("/confirmPrescribeAfterPayment")
+    public AjaxResult confirmPrescriptionMicroPayment(@RequestBody FsPrescribeParam param){
+        fsPrescribeService.confirmPrescribeAfterPayment(param);
+        return AjaxResult.success();
+    }
+
     public String getDoctorId()
     {
         String headValue =  ServletUtils.getRequest().getHeader("APPToken");

+ 10 - 3
fs-doctor-app/src/main/java/com/fs/app/controller/PrescribeController.java

@@ -112,16 +112,23 @@ public class PrescribeController extends  AppBaseController {
 
 
     @Login
-    @ApiOperation("审核处方")
+    @ApiOperation("药师审核处方")
     @PostMapping("/audit")
     @Synchronized
     public R audit(@Validated @RequestBody FsPrescribeAuditParam param, HttpServletRequest request){
         param.setDoctorId(Long.parseLong(getDoctorId()));
-        return prescribeService.audit(param);
+        if (param.getQwTag()!=null&&param.getQwTag()==0){
+            //企微审核逻辑
+            return prescribeService.audit(param);
+        } else if (param.getQwTag()!=null&&param.getQwTag()==1&&param.getPersonalCollectStatus()!=null&&param.getPersonalCollectStatus()==3) {
+            //个微审核逻辑
+            return prescribeService.auditAfterPaymentList(param);
+        }
+        log.error("药师审核处方入参:{}",param);
+        return R.error("参数错误");
     }
 
 
-
     @Login
     @GetMapping("/getDoctorPrescribeById")
     public R getDoctorPrescribeById(@RequestParam("prescribeId")Long prescribeId)

+ 8 - 0
fs-service/src/main/java/com/fs/course/param/CollectionInfoConfirmParam.java

@@ -1,7 +1,10 @@
 package com.fs.course.param;
 
+import com.fs.his.vo.AnswerVO;
 import lombok.Data;
 
+import java.util.List;
+
 @Data
 public class CollectionInfoConfirmParam {
     private Long id;
@@ -10,4 +13,9 @@ public class CollectionInfoConfirmParam {
 
     //用户建议
     private String userAdvice;
+
+    /**
+     * 模板问题以及答案
+     */
+    private List<AnswerVO> answers;
 }

+ 8 - 0
fs-service/src/main/java/com/fs/course/vo/FsUserInfoCollectionUVO.java

@@ -81,4 +81,12 @@ public class FsUserInfoCollectionUVO {
     private Long userId;
     //是否填写
     private Integer fillTag;
+
+    //0:企微 1:个微
+    private Integer qwTag;
+
+    /**
+     * 个微信息采集状态
+     * */
+    private Integer personalCollectStatus;
 }

+ 45 - 0
fs-service/src/main/java/com/fs/enums/PostPayPrescStatusEnum.java

@@ -0,0 +1,45 @@
+package com.fs.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+import java.util.Optional;
+
+/**
+ * 后付款--处方流程状态枚举
+ */
+@Getter
+@AllArgsConstructor
+public enum PostPayPrescStatusEnum {
+
+    INFO_COLLECTION(0, "创建个微信息采集"),
+    USER_BIND(1, "用户已绑定userId"),
+    FULLY_COLLECTED_DATA(2, "已完善采集信息"),
+    DOCTOR_PRESCRIBE(3, "医生开方"),
+    PHARMACIST_REVIEW(4, "药师审核并生成处方"),
+    PACKAGE_BIND(5, "销售选择绑定套餐包"),
+    ORDER_PAID(6, "用户付款生成订单"),
+    UNKNOWN(7, "未知状态");
+
+    private final Integer code;
+    private final String desc;
+
+    /**
+     * 根据状态码获取枚举
+     */
+    public static PostPayPrescStatusEnum getByCode(Integer code) {
+        return Optional.ofNullable(code)
+                .flatMap(c -> Arrays.stream(values())
+                        .filter(e -> e.getCode().equals(c))
+                        .findFirst())
+                .orElse(UNKNOWN);
+    }
+
+    /**
+     * 判断是否为指定状态
+     */
+    public boolean is(Integer code) {
+        return this.code.equals(code);
+    }
+}

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

@@ -198,6 +198,11 @@ public class FsPrescribe extends BaseEntity
      * */
     private Integer isSendToThirdParty;
 
+    /**
+     * 信息采集主键
+     * */
+    private Long collectionId;
+
     public FsPrescribe() {
     }
 

+ 12 - 1
fs-service/src/main/java/com/fs/his/mapper/FsPrescribeMapper.java

@@ -94,8 +94,9 @@ public interface FsPrescribeMapper
             "</script>"})
     List<FsPrescribeListVO> selectFsPrescribeListVO(FsPrescribeParam fsPrescribe);
     @Select({"<script> " +
-            "select p.*,d.doctor_name  from fs_prescribe p    " +
+            "select p.*,d.doctor_name,infoc.id as collectionId,infoc.qw_tag,infoc.personal_collect_status  from fs_prescribe p    " +
             " left join fs_doctor d on d.doctor_id = p.doctor_id " +
+            " left join fs_user_information_collection infoc on p.user_id = infoc.user_id " +
             "where 1=1  " +
             "<if test = ' maps.patientName!=null and maps.patientName != \"\"  '> " +
             "and p.patient_name like concat('%', #{maps.patientName}, '%') " +
@@ -323,4 +324,14 @@ public interface FsPrescribeMapper
      * 根据用户id列表查询处方列表
      **/
     List<FsPrescribe> selectFsPrescribeListByUserIds(@Param("userIds") List<Long> userIds);
+
+    /**
+     * 查询等待开方列表(后付款版)
+     **/
+    List<FsPrescribeListVO> selectWaitPrescribeList(WaitPrescribeParam waitPrescribeParam);
+
+    /**
+     * 根据用户id查询最新审核通过的处方信息
+     * */
+    FsPrescribe selectNewestAuditedPrescribeByUserId(@Param("userId") Long userId);
 }

+ 13 - 0
fs-service/src/main/java/com/fs/his/param/FsPrescribeAuditParam.java

@@ -11,4 +11,17 @@ public class FsPrescribeAuditParam extends BaseParam implements Serializable {
     Integer status;//1通过 2不通过
     String auditReason;//拒绝原因
 
+    /**
+     * 信息采集主键id
+     * */
+    private Long collectionId;
+
+    //0:企微 1:个微
+    private Integer qwTag;
+
+    /**
+     * 个微信息采集状态
+     * */
+    private Integer personalCollectStatus;
+
 }

+ 5 - 1
fs-service/src/main/java/com/fs/his/param/FsPrescribeParam.java

@@ -159,7 +159,11 @@ public class FsPrescribeParam {
     private String groupCode;
 
     /** 医生开始操作时间戳 */
-
     private Long startOperateTime;
 
+    /**
+     * 信息采集主键id
+     * */
+    private Long collectionId;
+
 }

+ 42 - 0
fs-service/src/main/java/com/fs/his/param/WaitPrescribeParam.java

@@ -0,0 +1,42 @@
+package com.fs.his.param;
+
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+
+@Data
+public class WaitPrescribeParam extends BaseEntity {
+    //患者姓名
+    private String patientName;
+
+    //销售姓名
+    private String companyUserName;
+
+    // 处方类型
+    private Integer prescribeType;
+
+    // 医生姓名
+    private String doctorName;
+
+    // 用户ID
+    private Long userId;
+
+    // 处方单号
+    private String prescribeCode;
+    // 患者电话
+    private String patientTel;
+    // 医生ID
+    private Long doctorId;
+    // 处方状态
+    private Integer status;
+    // 创建时间范围
+    private String sTime;
+    private String eTime;
+    // 审核时间范围
+    private String auditSTime;
+    private String auditETime;
+    private String auditTime;
+    //页码
+    private Integer pageNum;
+    //每页数量
+    private Integer pageSize;
+}

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

@@ -87,6 +87,8 @@ public interface IFsPrescribeService
 
     R audit(FsPrescribeAuditParam param);
 
+    R auditAfterPaymentList(FsPrescribeAuditParam param);
+
      String PrescribeImg(Long prescribeId);
      String PrescribeImgYsy(Long prescribeId);
 
@@ -142,4 +144,19 @@ public interface IFsPrescribeService
      * 根据用户id列表获取用户处方列表(审核通过的处方)
      * */
     List<FsPrescribe> selectFsPrescribeListByUserIds(List<Long> userIds);
+
+    /**
+     * 获取等待审核的处方列表--后付款版
+     * */
+    List<FsPrescribeListVO> selectWaitPrescribeList(WaitPrescribeParam waitPrescribeParam);
+
+    /**
+     * 确认处方--后付款版
+     * */
+    void confirmPrescribeAfterPayment(FsPrescribeParam param);
+
+    /**
+     * 根据用户id查询最新审核通过的处方信息
+     * */
+    FsPrescribe selectNewestAuditedPrescribeByUserId(Long userId);
 }

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

@@ -14,6 +14,7 @@ import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.doctor.domain.DoctorMsg;
 import com.fs.doctor.mapper.DoctorMsgMapper;
+import com.fs.enums.PostPayPrescStatusEnum;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.*;
 import com.fs.his.dto.FsPackagePatientDTO;
@@ -1315,6 +1316,72 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
 
     }
 
+    @Override
+    public R auditAfterPaymentList(FsPrescribeAuditParam param) {
+        FsPrescribe prescribe=this.selectFsPrescribeByPrescribeId(param.getPrescribeId());
+        if(prescribe.getStatus()!=0){
+            return R.error("非法操作");
+        }
+        //无论审核是否通过,都删除之前只有医生签名的处方图片
+        delUrl(param.getPrescribeId());
+
+        FsPrescribe map=new FsPrescribe();
+        map.setPrescribeId(param.getPrescribeId());
+        map.setDrugDoctorId(param.getDoctorId());
+        map.setStatus(param.getStatus());
+        map.setAuditReason(param.getAuditReason());
+        map.setAuditTime(new Date());
+        FsDoctor doctor=doctorService.selectFsDoctorByDoctorId(map.getDrugDoctorId());
+        if(StringUtils.isNotEmpty(doctor.getSignUrl())){
+            map.setDrugDoctorSignUrl(doctor.getSignUrl());
+        }
+
+        //获取医生和药师名称
+        FsPrescribeListVO vo = fsPrescribeMapper.selectDoctorNameAndDoctorDrugNameByPrescribeId(prescribe.getPrescribeId());
+        //生成审核记录
+        FsPrescribeRecord prescribeRecord = new FsPrescribeRecord();
+        prescribeRecord.setPrescribeId(prescribe.getPrescribeId());
+        prescribeRecord.setDoctorId(prescribe.getDoctorId());
+        prescribeRecord.setDrugDoctorId(prescribe.getDrugDoctorId());
+        prescribeRecord.setPrescribeImgUrl(prescribe.getPrescribeImgUrl());
+        prescribeRecord.setStatus(param.getStatus());
+        if (prescribe.getStatus() == 2) {//药师审核不通过设置原因
+            prescribeRecord.setAuditReason(param.getAuditReason());
+        }
+        prescribeRecord.setCreateTime(DateUtils.getNowDate());
+        prescribeRecord.setDoctorName(vo.getDoctorName());
+        prescribeRecord.setDrugDoctorName(vo.getDoctorDrugName());
+        prescribeRecordService.insertFsPrescribeRecord(prescribeRecord);
+        if (param.getStatus() == 1) {
+            //审核通过
+            map.setAuditReason("");
+            //重置处方单定时任务(药师审核通过后需要生成拥有药师签名的标识)
+            fsExportTaskService.resetFsExportTaskByPrescribeIdAndSignFlag(param.getPrescribeId(),2);
+            //修改采集表个微状态 销售可以根据处方给客户分享套餐包进行下单了
+            FsUserInformationCollection informationCollection = collectionMapper.selectFsUserInformationCollectionById(param.getCollectionId());
+            informationCollection.setPersonalCollectStatus(PostPayPrescStatusEnum.PHARMACIST_REVIEW.getCode());
+            collectionMapper.updateFsUserInformationCollection(informationCollection);
+        }
+        if (param.getStatus() == 2) {
+            //生成拒方消息
+            DoctorMsg msg = new DoctorMsg();
+            msg.setDoctorId(prescribe.getDoctorId());
+            msg.setType(1);
+            msg.setTitle("药师拒方,处方编号:"+prescribe.getPrescribeCode());
+            msg.setContent("拒方原因:"+param.getAuditReason()+",请重新开方");
+            msg.setCreateTime(DateUtils.getNowDate());
+            doctorMsgMapper.insertDoctorMsg(msg);
+
+            FsUserInformationCollection informationCollection = collectionMapper.selectFsUserInformationCollectionById(param.getCollectionId());
+            informationCollection.setPersonalCollectStatus(PostPayPrescStatusEnum.DOCTOR_PRESCRIBE.getCode());
+            collectionMapper.updateFsUserInformationCollection(informationCollection);
+        }
+        if (this.updateFsPrescribe(map) > 0){
+            return R.ok("审核成功");
+        }
+        return R.error("审核失败");
+    }
+
     public void penDrawString( Graphics2D pen,String value,int x,int y){
         if (value!=null){
             pen.drawString(value,x,y);
@@ -1507,4 +1574,76 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
         return resultList;
     }
 
+    @Override
+    public List<FsPrescribeListVO> selectWaitPrescribeList(WaitPrescribeParam waitPrescribeParam) {
+        List<FsPrescribeListVO> resultList=fsPrescribeMapper.selectWaitPrescribeList(waitPrescribeParam);
+        if (CollectionUtils.isEmpty(resultList)){
+            return Collections.emptyList();
+        }
+        return resultList;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void confirmPrescribeAfterPayment(FsPrescribeParam param) {
+        FsPrescribe fsPrescribe = fsPrescribeMapper.selectFsPrescribeByPrescribeId(param.getPrescribeId());
+        if (fsPrescribe == null) {
+            log.error("个微处方信息不存在,处方id:{}", param.getPrescribeId());
+            throw new CustomException("个微处方信息不存在");
+        }
+        //医生操作结束时间(第一次确认处方)
+//        if (fsPrescribe.getEndOperateTime() == null) {
+//            if (param.getStartOperateTime() == null) {
+//                throw new CustomException("操作时间参数错误,开方失败");
+//            }
+//            fsPrescribe.setStartOperateTime(new Date(param.getStartOperateTime()));
+//            fsPrescribe.setEndOperateTime(DateUtils.getNowDate());
+//            Long seconds = DateUtil.between(fsPrescribe.getStartOperateTime(), fsPrescribe.getEndOperateTime(), DateUnit.SECOND);
+//            fsPrescribe.setOperateSecond(seconds);
+//        }
+        //医生已确认
+        fsPrescribe.setDoctorConfirm(1);
+        //待药师审核
+        fsPrescribe.setStatus(0);
+        fsPrescribeMapper.updateFsPrescribe(fsPrescribe);
+
+        //用户信息采集医生确认
+        FsUserInformationCollection collection = collectionMapper.selectFsUserInformationCollectionById(param.getCollectionId());
+        if (collection != null) {
+            FsUserInformationCollection willUpdate = new FsUserInformationCollection();
+            willUpdate.setId(collection.getId());
+            willUpdate.setDoctorConfirm(1);//医生已确认
+            willUpdate.setPersonalCollectStatus(PostPayPrescStatusEnum.DOCTOR_PRESCRIBE.getCode());
+            collectionMapper.updateFsUserInformationCollection(willUpdate);
+            //确认完成后删除缓存(如果有缓存)
+            redisCache.deleteObject("collectionPrescribeId:" + fsPrescribe.getPrescribeId());
+        }
+        //医生确认后生成处方单
+        PrescriptionTaskRecord record = new PrescriptionTaskRecord();
+        record.setPrescribeId(param.getPrescribeId());
+        record.setCreateTime(LocalDateTime.now());
+        record.setExecuteStatus(0);
+        record.setRetryCount(0);
+        //只生成医生签名图片标识
+        record.setSignFlag(1);
+        prescriptionTaskRecordMapper.insert(record);
+
+        //生成药师审核消息
+        DoctorMsg msg = new DoctorMsg();
+        msg.setType(2);
+        msg.setDoctorId(fsPrescribe.getDrugDoctorId());
+        msg.setTitle("处方审核");
+        msg.setContent("处方编号:"+fsPrescribe.getPrescribeCode()+"待审核");
+        msg.setCreateTime(DateUtils.getNowDate());
+        doctorMsgMapper.insertDoctorMsg(msg);
+
+        //医生确认处方后立即生成处方图片
+        self().createDoctorSignImg(fsPrescribe);
+    }
+
+    @Override
+    public FsPrescribe selectNewestAuditedPrescribeByUserId(Long userId) {
+        return fsPrescribeMapper.selectNewestAuditedPrescribeByUserId(userId);
+    }
+
 }

+ 12 - 1
fs-service/src/main/java/com/fs/his/vo/FsPrescribeListDVO.java

@@ -59,6 +59,17 @@ public class FsPrescribeListDVO implements Serializable {
 
     private String doctorName;
 
-
+    /**
+     * 信息采集主键id
+     * */
+    private Long collectionId;
+
+    //0:企微 1:个微
+    private Integer qwTag;
+
+    /**
+     * 个微信息采集状态
+     * */
+    private Integer personalCollectStatus;
 
 }

+ 8 - 0
fs-service/src/main/java/com/fs/his/vo/FsPrescribeListVO.java

@@ -197,4 +197,12 @@ public class FsPrescribeListVO {
      * */
     private Long collectionId;
 
+    //0:企微 1:个微
+    private Integer qwTag;
+
+    /**
+     * 个微信息采集状态
+     * */
+    private Integer personalCollectStatus;
+
 }

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

@@ -25,6 +25,11 @@ public class FsUserInformationCollectionOverviewDTO  extends BaseEntity {
     //完善状态 0-未完善 1-完善
     private Integer completeStatus;
 
+    /**
+     * 信息采集标识 0-企微信息采集 1-个微信息采集
+     */
+    private Integer qwTag;
+
     //个微状态
     private Integer personalCollectStatus;
 

+ 11 - 0
fs-service/src/main/java/com/fs/hisStore/param/bindCollectionPackageParam.java

@@ -0,0 +1,11 @@
+package com.fs.hisStore.param;
+
+import lombok.Data;
+
+@Data
+public class bindCollectionPackageParam {
+    //信息采集主键id
+    private Long id;
+    //套餐包id
+    private Long packageId;
+}

+ 12 - 1
fs-service/src/main/java/com/fs/hisStore/service/IFsUserInformationCollectionService.java

@@ -13,6 +13,7 @@ import com.fs.hisStore.dto.FsUserInformationCollectionOverviewDTO;
 import com.fs.hisStore.dto.PendingSalesInfoQueryDTO;
 import com.fs.hisStore.param.FsUserInformationCollectionListDParam;
 import com.fs.hisStore.param.FsUserInformationCollectionParam;
+import com.fs.hisStore.param.bindCollectionPackageParam;
 import com.fs.hisStore.vo.FsUserInformationCollectionListDVO;
 import com.fs.hisStore.vo.FsUserInformationCollectionVO;
 import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
@@ -62,7 +63,10 @@ public interface IFsUserInformationCollectionService extends IService<FsUserInfo
      * @param fsUserInformationCollection 用户信息采集
      * @return 用户信息采集集合
      */
-    Long createSimpleUserInfo(FsUserInformationCollectionParam fsUserInformationCollection);
+    FsUserInformationCollection createSimpleUserInfo(FsUserInformationCollectionParam fsUserInformationCollection);
+
+    //个微版信息采集信息确认并生成处方
+    R generateFormalPrescription(CollectionInfoConfirmParam param);
     /**
      * 批量删除用户信息采集
      * 
@@ -181,4 +185,11 @@ public interface IFsUserInformationCollectionService extends IService<FsUserInfo
      * 查询销售已完善信息采集列表
      * */
     List<FsUserInformationCollectionOverviewVo> fullyCollectionInfoList(FsUserInformationCollectionOverviewDTO queryDto);
+
+    /**
+     * 绑定个微信息采集套餐包
+     * @param param 绑定参数
+     * @return 是否绑定成功
+     */
+    Long bindCollectionPackage(bindCollectionPackageParam param);
 }

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

@@ -10,6 +10,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -33,6 +34,7 @@ import com.fs.course.param.SubmitCollectionAnswerParam;
 import com.fs.course.vo.FsUserInfoCollectionUVO;
 import com.fs.doctor.domain.DoctorMsg;
 import com.fs.doctor.mapper.DoctorMsgMapper;
+import com.fs.enums.PostPayPrescStatusEnum;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.*;
 import com.fs.his.enums.CollectionTaskStatusEnum;
@@ -48,6 +50,7 @@ import com.fs.hisStore.dto.FsUserInformationCollectionOverviewDTO;
 import com.fs.hisStore.dto.PendingSalesInfoQueryDTO;
 import com.fs.hisStore.param.FsUserInformationCollectionListDParam;
 import com.fs.hisStore.param.FsUserInformationCollectionParam;
+import com.fs.hisStore.param.bindCollectionPackageParam;
 import com.fs.hisStore.vo.FsUserInformationCollectionListDVO;
 import com.fs.hisStore.vo.FsUserInformationCollectionVO;
 import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
@@ -56,7 +59,6 @@ import com.fs.huifuPay.domain.HuifuConfirmrefundResult;
 import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentDelaytransConfirmrefundRequest;
 import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
 import com.fs.huifuPay.service.HuiFuService;
-import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.mapper.FsUserInformationCollectionScheduleMapper;
 import com.fs.qw.mapper.QwExternalContactMapper;
 import com.fs.store.domain.FsDoctorConfirm;
@@ -195,6 +197,12 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
     @Autowired
     private QwExternalContactMapper qwExternalContactMapper;
 
+    @Autowired
+    private IPollingAssignDoctorService pollingAssignDoctorService;
+
+    @Autowired
+    private FsUserMapper fsUserMapper;
+
 
 
     /**
@@ -230,9 +238,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Long insertFsUserInformationCollection(FsUserInformationCollectionParam param) {
-        if (param.getFillFlag()!=null&&param.getFillFlag()==1&&!getSalesProxyFillConfig()){
-            throw new CustomException("当前不可代填写患者问题信息,请刷新页面后重试");
-        }
+        checkSalesFillCondition(param);
         if (param.getIsPackage() != null && param.getIsPackage() == 1) {
             FsPackage fsPackage = packageMapper.selectFsPackageByPackageId(param.getPackageId());
             if (fsPackage != null && !(fsPackage.getProductType() == 1 || fsPackage.getProductType() == 2 || fsPackage.getProductType() == 3)) {
@@ -277,9 +283,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
     @Transactional(rollbackFor = Exception.class)
     public Long updateFsUserInformationCollection(FsUserInformationCollectionParam param)
     {
-        if (param.getFillFlag()!=null&&param.getFillFlag()==1&&!getSalesProxyFillConfig()){
-            throw new CustomException("当前不可代填写患者问题信息,请刷新页面后重试");
-        }
+        checkSalesFillCondition(param);
         if (param.getId() == null || param.getId() < 1) {
             throw new CustomException("参数错误");
         }
@@ -346,10 +350,8 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
     //创建简化版采集信息(没有用户id)
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Long createSimpleUserInfo(FsUserInformationCollectionParam param) {
-        if (param.getFillFlag()!=null&&param.getFillFlag()==1&&!getSalesProxyFillConfig()){
-            throw new CustomException("当前不可代填写患者问题信息,请刷新页面后重试");
-        }
+    public FsUserInformationCollection createSimpleUserInfo(FsUserInformationCollectionParam param) {
+        checkSalesFillCondition(param);
         if (param.getIsPackage() != null && param.getIsPackage() == 1) {
             FsPackage fsPackage = packageMapper.selectFsPackageByPackageId(param.getPackageId());
             if (fsPackage != null && !(fsPackage.getProductType() == 1 || fsPackage.getProductType() == 2 || fsPackage.getProductType() == 3)) {
@@ -361,6 +363,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         FsUserInformationCollection fsUserInformationCollection = buildUserInfoCollection(param);
         //添加个微标识
         fsUserInformationCollection.setQwTag(1);
+        fsUserInformationCollection.setPersonalCollectStatus(PostPayPrescStatusEnum.INFO_COLLECTION.getCode());//个微采集表初始状态
         try {
             if (validateRequiredRemarks(param.getAnswers(),param.getQuestionId())){
                 //用户采集信息问题完善状态 0-未完善 1-完善
@@ -369,16 +372,109 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
                 fsUserInformationCollection.setCompleteStatus(0);
             }
             baseMapper.insertFsUserInformationCollection(fsUserInformationCollection);
-            //构建采集进度对象
-            FsUserInformationCollectionSchedule fsUserInformationCollectionSchedule = buildUserInfoSchedule(fsUserInformationCollection);
-            //新增用户信息采集进度
-            scheduleMapper.insertFsUserInformationCollectionSchedule(fsUserInformationCollectionSchedule);
-            log.info("新增用户信息采集进度数据,信息采集数据id:{}", fsUserInformationCollectionSchedule.getCollectionId());
+
         } catch (Exception e) {
             logger.error("极速版-----用户信息采集进度创建失败", e);
             throw new CustomException("信息采集进度创建失败");
         }
-        return fsUserInformationCollection.getId();
+        return fsUserInformationCollection;
+    }
+
+    //个微信息采集确认并生成医生待开处方
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public R generateFormalPrescription(CollectionInfoConfirmParam param) {
+        FsUserInformationCollection collection = fsUserInformationCollectionMapper.selectFsUserInformationCollectionById(param.getId());
+        if (collection == null) {
+            log.error("当前用户userId:{},信息采集表id:{}", param.getUserId(), param.getId());
+            return R.error("采集信息不存在");
+        }
+        if (!Objects.equals(collection.getUserId(), param.getUserId())) {
+            log.error("当前用户userId:{},信息采集表userId:{}", param.getUserId(), collection.getUserId());
+            return R.error("用户信息不匹配,无法确认");
+        }
+
+        collection.setPersonalCollectStatus(PostPayPrescStatusEnum.FULLY_COLLECTED_DATA.getCode());
+        if (fsUserInformationCollectionMapper.updateFsUserInformationCollection(collection) > 0) {
+            //新增fs_prescribe处方信息
+            FsPrescribe fsPrescribe = transformCollectionDtoToFsPrescribe(param, collection);
+            fsPrescribe.setCollectionId(collection.getId());
+            int addPrescribeResult = fsPrescribeMapper.insertFsPrescribe(fsPrescribe);
+
+            //存入医生确认统计时间数据
+            Date currentTime = DateUtils.getNowDate();
+            FsDoctorConfirm doctorConfirm = new FsDoctorConfirm();
+            doctorConfirm.setCollectionId(collection.getId());
+            doctorConfirm.setDoctorId(collection.getDoctorId());
+            doctorConfirm.setStartTime(currentTime);
+            doctorConfirmService.insertFsDoctorConfirm(doctorConfirm);
+            //医生确认时间存入缓存 医生确认后删除
+            redisCache.setCacheObject("doctorConfirm:" + collection.getId(), doctorConfirm);
+            return R.ok();
+        }
+        return R.error("用户确认失败");
+    }
+
+    private FsPrescribe transformCollectionDtoToFsPrescribe(CollectionInfoConfirmParam param, FsUserInformationCollection fsUserInformationCollection) {
+        //构建处方编号
+        String prescribeCode = IdUtil.getSnowflake(0, 0).nextIdStr();
+        FsPrescribe fsPrescribe = new FsPrescribe();
+        fsPrescribe.setCreateTime(DateUtils.getNowDate());
+        fsPrescribe.setStatus(0);//待开方
+        fsPrescribe.setDoctorConfirm(0);//未确认
+        fsPrescribe.setUsageJson(JSON.toJSONString(param.getAnswers()));
+        fsPrescribe.setHistoryAllergic(fsUserInformationCollection.getAllergy());
+
+        fsPrescribe.setPrescribeCode(prescribeCode);
+        fsPrescribe.setPatientAge(String.valueOf(fsUserInformationCollection.getAge()));
+        fsPrescribe.setPatientId(fsUserInformationCollection.getUserId());
+
+        fsPrescribe.setPatientName(fsUserInformationCollection.getUserName());
+
+        fsPrescribe.setPatientGender(String.valueOf(fsUserInformationCollection.getSex() == 1 ? 1 : 0));
+        fsPrescribe.setPatientAge(String.valueOf(fsUserInformationCollection.getAge()));
+        FsUser fsUser = fsUserMapper.selectFsUserById(fsUserInformationCollection.getUserId());
+        if (fsUser == null) {
+            log.error("用户信息获取异常:" + fsUserInformationCollection.getUserId());
+            throw new CustomException("网络异常,请稍后再试!");
+        }
+        fsPrescribe.setPatientTel(fsUser.getPhone());
+        //查询销售绑定医生
+        CompanyUser companyUser = companyUserMapper.selectCompanyUserByCompanyUserId(fsUserInformationCollection.getCompanyUserId());
+        if (companyUser == null || companyUser.getDoctorId() == null) {
+            log.error("销售信息获取异常:" + fsUserInformationCollection.getCompanyUserId());
+            throw new CustomException("销售未绑定医生,请稍后再试!");
+        }
+        Long doctorId = companyUser.getDoctorId();
+        fsPrescribe.setDoctorId(doctorId);
+        FsDoctor fsDoctor = doctorMapper.selectFsDoctorByDoctorId(doctorId);
+        if (fsDoctor == null) {
+            log.error("开方医生信息获取异常:" + companyUser.getDoctorId());
+            throw new CustomException("网络异常,请稍后再试!");
+        }
+
+        fsPrescribe.setPrescribeDoctorId(fsDoctor.getDoctorId());
+        fsPrescribe.setPrescribeDoctorSignUrl(fsDoctor.getSignUrl());
+        //分配在线的随机药师
+        FsDoctor fsDrugDoctor = null;
+        try {
+            // 使用新写的轮询服务分配药师,传入处方编号
+            fsDrugDoctor = pollingAssignDoctorService.getNextPharmacist(prescribeCode);
+
+            fsPrescribe.setDrugDoctorId(fsDrugDoctor.getDoctorId());
+            fsPrescribe.setDrugDoctorSignUrl(fsDrugDoctor.getSignUrl());
+        } catch (Exception e) {
+            log.error("分配药师失败 - 处方号:{}", prescribeCode, e);
+            throw new CustomException("网络异常,请稍后再试!");
+        }
+        return fsPrescribe;
+    }
+
+    //检测销售代填条件
+    private void checkSalesFillCondition(FsUserInformationCollectionParam param) {
+        if (param.getFillFlag() != null && param.getFillFlag() == 1 && !getSalesProxyFillConfig()) {
+            throw new CustomException("当前不可代填写患者问题信息,请刷新页面后重试");
+        }
     }
 
     /**
@@ -742,6 +838,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
                     }
                 }
             }
+            vo.setQwTag(collection.getQwTag());
             vo.setIsPackage(collection.getIsPackage());
             vo.setId(collection.getId());
             vo.setAnswers(JSON.parseArray(collection.getJsonInfo(), AnswerVO.class));
@@ -1388,6 +1485,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         map.setUserId(param.getUserId());
         map.setId(param.getCollectionId());
         map.setQwTag(1);
+        map.setPersonalCollectStatus(PostPayPrescStatusEnum.USER_BIND.getCode());//个微采集表完善采集表状态
         if (fsUserInformationCollectionMapper.updateFsUserInformationCollection(map) > 0) {
             //更新信息采集进度表里面的用户id
             FsUserInformationCollectionSchedule schedule = scheduleMapper.selectCollectionScheduleRunningByCollectionId(param.getCollectionId());
@@ -1515,6 +1613,34 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         return resultList;
     }
 
+    @Override
+    public Long bindCollectionPackage(bindCollectionPackageParam param) {
+        //校验参数
+        FsUserInformationCollection informationCollection = fsUserInformationCollectionMapper.selectFsUserInformationCollectionById(param.getId());
+        if (informationCollection == null || informationCollection.getQwTag() == 0 || informationCollection.getCompleteStatus() == 0) {
+            log.error("用户信息采集id:{},条件不符", param.getId());
+            throw new CustomException("信息采集绑定条件不符合");
+        }
+        CompanyUser companyUser = companyUserMapper.selectCompanyUserById(informationCollection.getCompanyUserId());
+        if (companyUser == null) {
+            throw new CustomException("未查询到绑定销售人员");
+        }
+        FsPackage fsPackage = packageMapper.selectFsPackageByPackageId(param.getPackageId());
+        if (fsPackage == null){
+            throw new CustomException("套餐包不存在或已下架");
+        }
+        //套餐包必须是OTC、中药、处方药类型
+        if (fsPackage.getProductType() == 1 || fsPackage.getProductType() == 2 || fsPackage.getProductType() == 3) {
+            informationCollection.setPackageId(param.getPackageId());
+            informationCollection.setPersonalCollectStatus(PostPayPrescStatusEnum.PACKAGE_BIND.getCode());
+            int result = fsUserInformationCollectionMapper.updateFsUserInformationCollection(informationCollection);
+            if (result > 0){
+                return informationCollection.getId();
+            }
+        }
+        return 0L;
+    }
+
     /**
      * 校验必填备注:对于 open=true 且被勾选的选项,必须填写备注文本
      *

+ 10 - 0
fs-service/src/main/java/com/fs/hisStore/vo/FsUserInformationCollectionVO.java

@@ -63,4 +63,14 @@ public class FsUserInformationCollectionVO {
      * */
     private Integer completeStatus;
 
+    /**
+     * 信息采集标识 0-企微信息采集 1-个微信息采集
+     */
+    private Integer qwTag;
+
+    /**
+     * 个微信息采集状态
+     * */
+    private Integer personalCollectStatus;
+
 }

+ 51 - 1
fs-service/src/main/resources/mapper/his/FsPrescribeMapper.xml

@@ -54,6 +54,7 @@
         <result property="operateSecond"    column="operate_second"    />
         <result property="thirdPartyUserId"    column="third_party_user_id"    />
         <result property="isSendToThirdParty"    column="is_send_to_third_party"    />
+        <result property="collectionId"    column="collection_id"    />
     </resultMap>
 
     <sql id="selectFsPrescribeVo">
@@ -65,7 +66,7 @@
              , patient_age, patient_name, weight, is_history_allergic, history_allergic, liver_unusual
              , renal_unusual, is_lactation, patient_tel, patient_gender, record_pic, prescribe_img_url
              , audit_reason, diagnose, doctor_id,drug_doctor_id, create_time, status, audit_time,remark
-             ,usage_json,store_id,doctor_confirm, start_operate_time,end_operate_time,operate_second,third_party_user_id,is_send_to_third_party from fs_prescribe
+             ,usage_json,store_id,doctor_confirm, start_operate_time,end_operate_time,operate_second,third_party_user_id,is_send_to_third_party,collection_id from fs_prescribe
     </sql>
 
     <select id="selectFsPrescribeList" parameterType="FsPrescribe" resultMap="FsPrescribeResult">
@@ -100,6 +101,7 @@
             <if test="doctorConfirm != null "> and doctor_confirm = #{doctorConfirm}</if>
             <if test="thirdPartyUserId != null "> and third_party_user_id = #{thirdPartyUserId}</if>
             <if test="isSendToThirdParty != null "> and is_send_to_third_party = #{isSendToThirdParty}</if>
+            <if test="collectionId != null "> and collection_id = #{collectionId}</if>
         </where>
         order by prescribe_id desc
     </select>
@@ -160,6 +162,7 @@
             <if test="operateSecond != null">operate_second,</if>
             <if test="thirdPartyUserId != null">third_party_user_id,</if>
             <if test="isSendToThirdParty != null">is_send_to_third_party,</if>
+            <if test="collectionId != null">collection_id,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="prescribeType != null">#{prescribeType},</if>
@@ -210,6 +213,7 @@
             <if test="operateSecond != null">#{operateSecond},</if>
             <if test="thirdPartyUserId != null">#{thirdPartyUserId},</if>
             <if test="isSendToThirdParty != null">#{isSendToThirdParty},</if>
+            <if test="collectionId != null">#{collectionId},</if>
         </trim>
     </insert>
 
@@ -264,6 +268,7 @@
             <if test="operateSecond != null">operate_second = #{operateSecond},</if>
             <if test="thirdPartyUserId != null">third_party_user_id = #{thirdPartyUserId},</if>
             <if test="isSendToThirdParty != null">is_send_to_third_party = #{isSendToThirdParty},</if>
+            <if test="collectionId != null">collection_id = #{collectionId},</if>
         </trim>
         where prescribe_id = #{prescribeId}
     </update>
@@ -460,6 +465,51 @@
         order by prescribe_id desc
     </select>
 
+    <select id="selectWaitPrescribeList" resultType="com.fs.his.vo.FsPrescribeListVO">
+        select so.*,CAST(operate_second AS CHAR) operateTime,us.nick_name,dc.doctor_name,
+        dp.doctor_name doctor_drug_name,
+        fse.store_name,
+        main_infoc.id as collectionId,
+        main_infoc.complete_status as completeStatus
+        FROM fs_prescribe so
+        LEFT JOIN fs_user us ON us.user_id=so.user_id
+        LEFT JOIN fs_doctor dc ON dc.doctor_id = so.doctor_id
+        LEFT JOIN fs_doctor dp ON dp.doctor_id =so.drug_doctor_id
+        LEFT JOIN fs_store fse ON fse.store_id = so.store_id
+        LEFT JOIN fs_user_information_collection main_infoc ON main_infoc.user_id = so.user_id
+        <where>
+            main_infoc.qw_tag=1 <!--  只查询类型是个微的信息采集用户-->
+            and so.doctor_confirm != -1     <!--  被医生拒访的处方不展示-->
+            <if test="prescribeType != null ">and so.prescribe_type = #{prescribeType}</if>
+            <if test="userId != null ">and so.user_id = #{userId}</if>
+            <if test="prescribeCode != null  and prescribeCode != ''">and so.prescribe_code = #{prescribeCode}</if>
+            <if test="patientName != null  and patientName != ''">and so.patient_name like concat('%', #{patientName},'%')</if>
+            <if test="doctorName != null  and doctorName != ''">and dc.doctor_name like concat('%', #{doctorName},'%')</if>
+            <if test="patientTel != null  and patientTel != ''">and so.patient_tel = #{patientTel}</if>
+            <if test="doctorId != null  and doctorId != ''">and so.doctor_id = #{doctorId}</if>
+            <if test="status != null ">and so.status = #{status}</if>
+            <if test="sTime != null ">and DATE(so.create_time) &gt;= DATE(#{sTime})</if>
+            <if test="eTime != null ">and DATE(so.create_time) &lt;= DATE(#{eTime})</if>
+            <if test="auditSTime != null ">and DATE(so.audit_time) &gt;= DATE(#{auditSTime})</if>
+            <if test="auditETime != null ">and DATE(so.audit_time) &lt;= DATE(#{auditETime})</if>
+            <if test="auditTime != null ">and so.audit_time = #{auditTime}</if>
+        </where>
+        order by
+        CASE WHEN so.doctor_confirm = 0 THEN 0 ELSE 1 END,
+        so.prescribe_id desc
+    </select>
+
+    <select id="selectNewestAuditedPrescribeByUserId" resultType="com.fs.his.domain.FsPrescribe">
+        select *
+        from fs_prescribe fp
+        where fp.user_id = #{userId}
+          and fp.status = 1
+          and fp.doctor_confirm = 1
+          and fp.prescribe_img_url is not null
+        ORDER BY fp.audit_time DESC
+        LIMIT 1
+    </select>
+
     <update id="updateFsPrescribeListDataCPWByPrescribeIds" parameterType="java.util.List">
         update fs_prescribe
         set

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

@@ -149,6 +149,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="questionId != null">
                 AND infocollect.question_id = #{questionId}
             </if>
+            <if test="qwTag != null">
+                AND infocollect.qw_tag = #{qwTag}
+            </if>
             <if test="companyUserId != null">
                 AND infocollect.company_user_id = #{companyUserId}
             </if>

+ 11 - 1
fs-user-app/src/main/java/com/fs/app/controller/UserInfoCollectionController.java

@@ -21,6 +21,7 @@ import com.fs.his.vo.OptionsVO;
 import com.fs.hisStore.domain.FsUserInformationCollection;
 import com.fs.hisStore.param.FsUserInformationCollectionParam;
 import com.fs.hisStore.service.IFsUserInformationCollectionService;
+import com.fs.hisStore.vo.FsUserInformationCollectionVO;
 import com.fs.qw.service.IFsUserInformationCollectionScheduleService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -66,8 +67,17 @@ public class UserInfoCollectionController extends AppBaseController {
     @ApiOperation("确认用户采集信息")
     @PostMapping("/confirm")
     public R confirm(@RequestBody CollectionInfoConfirmParam param) {
+        FsUserInformationCollectionVO collection = userInformationCollectionService.getCollectionByUserId(param.getId());
+        if (collection == null) {
+            return R.error("用户没有采集信息");
+        }
         param.setUserId(Long.parseLong(getUserId()));
-        return userInformationCollectionService.userConfirm(param);
+        if (collection.getQwTag() == 0) {
+            return userInformationCollectionService.userConfirm(param);
+        } else if (collection.getQwTag() == 1) {
+            return userInformationCollectionService.generateFormalPrescription(param);
+        }
+        return R.error("参数异常,请稍后再试");
     }
 
     @ApiOperation("绑定用户信息")