Selaa lähdekoodia

修复个微采集表提交信息逻辑

cgp 2 päivää sitten
vanhempi
commit
4567aae7a6

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

@@ -1206,7 +1206,7 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
         if(prescribe.getStatus()!=0){
             return R.error("非法操作");
         }
-        //无论审核是否通过,都删除之前只有医生签名的处方图片
+        //无论审核是否通过,都删除之前只有医生签名的处方图片,为了后续药师审核通过重新生成图片
         delUrl(param.getPrescribeId());
 
         FsPrescribe map=new FsPrescribe();

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

@@ -21,6 +21,11 @@ public interface FsUserInformationCollectionPersonalLogMapper
      */
     public FsUserInformationCollectionPersonalLog selectFsUserInformationCollectionPersonalLogById(Long id);
 
+    /**
+     *  根据采集信息id查询最新一条记录
+     * */
+    public FsUserInformationCollectionPersonalLog selectLatestByCollectionId(@Param("collectionId") Long collectionId);
+
     /**
      * 查询个微-用户信息采集订单流程记录列表
      * 

+ 21 - 4
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -298,6 +298,9 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         if (collection == null) {
             throw new CustomException("用户:"+param.getUserId()+"没有用户采集信息");
         }
+        if(collection.getQwTag()==1){
+            throw new CustomException("用户信息采集已同步到个微,请勿修改");
+        }
         if (collection.getUserConfirm() == 1 && collection.getUserConfirm2() == 0) {
             throw new CustomException("确认中,暂无法修改");
         }
@@ -925,6 +928,17 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
                         }
                     }
                 }
+                if (collection.getQwTag()==1){
+                    //如果是个微信息采集,需要取个微的处方图片
+                    FsUserInformationCollectionPersonalLog collectionPersonalLog = infoCollectionPersonalLogMapper.selectLatestByCollectionId(collection.getId());
+                    if (collectionPersonalLog!=null&&collectionPersonalLog.getPrescribeId()!=null){
+                        FsPrescribe fsPrescribe = fsPrescribeMapper.selectFsPrescribeByPrescribeId(collectionPersonalLog.getPrescribeId());
+                        if (fsPrescribe != null) {
+                            vo.setPrescribeImgUrl(fsPrescribe.getPrescribeImgUrl());
+                            vo.setPrescribeStatus(fsPrescribe.getStatus());
+                        }
+                    }
+                }
             }
             vo.setQwTag(collection.getQwTag());
             vo.setPersonalCollectStatus(collection.getPersonalCollectStatus());
@@ -1605,7 +1619,6 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
             log.error("信息采集用户信息不一致,当前用户userId:{},信息采集表实际userId:{}", param.getUserId(), informationCollection.getUserId());
             throw new CustomException("用户信息不一致,请检查");
         }
-        int result = 0;
         //根据前端传递的填写结果判断是否更新标识符
         if (informationCollection.getFillFlag() == 0 && !CollectionUtils.isEmpty(param.getAnswers())) {
             param.getAnswers().forEach(answer -> {
@@ -1622,7 +1635,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
                 informationCollection.setFillFlag(1);//TODO 这里需要配合前端优化一下改成0
                 informationCollection.setCompleteStatus(0);
             }
-            fsUserInformationCollectionMapper.updateFsUserInformationCollection(informationCollection);
+            int result=fsUserInformationCollectionMapper.updateFsUserInformationCollection(informationCollection);
             if (informationCollection.getQwTag()==0){//企业微信息采集需要记录填写时间
                 FsUserInformationCollectionSchedule schedule = scheduleMapper.selectCollectionScheduleRunningByCollectionId(informationCollection.getId());
                 if (schedule == null) {
@@ -1630,11 +1643,15 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
                 }
                 //设置填写时间
                 schedule.setFillTime(DateUtils.getNowDate());
-                result = scheduleMapper.updateFsUserInformationCollectionSchedule(schedule);
+                return scheduleMapper.updateFsUserInformationCollectionSchedule(schedule);
+            }else {
+                //个微信息采集直接返回更新条数
+                return result;
             }
 
         }
-        return result;
+        log.error("采集信息问题提交异常,提交问答参数:{}",param);
+        return 1;
     }
 
     @Override

+ 7 - 0
fs-service/src/main/resources/mapper/hisStore/FsUserInformationCollectionPersonalLogMapper.xml

@@ -69,6 +69,13 @@
         AND prescribe_id = #{prescribeId}
     </select>
 
+    <select id="selectLatestByCollectionId" parameterType="Long" resultMap="FsUserInformationCollectionPersonalLogResult">
+        <include refid="selectFsUserInformationCollectionPersonalLogVo"/>
+        WHERE collection_id = #{collectionId}
+        ORDER BY create_time DESC
+        LIMIT 1
+    </select>
+
     <select id="selectFsUserInformationCollectionPersonalLogById" parameterType="Long" resultMap="FsUserInformationCollectionPersonalLogResult">
         <include refid="selectFsUserInformationCollectionPersonalLogVo"/>
         where id = #{id}

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

@@ -139,19 +139,13 @@ public class UserInfoCollectionController extends AppBaseController {
     @PostMapping("/submitCollectionAnswerParam")
     public R submitCollectionAnswerParam(@RequestBody SubmitCollectionAnswerParam param)
     {
-//        long userId;
-//        try {
-//            String userIdStr = getUserId();
-//            if (StringUtils.isEmpty(userIdStr)) {
-//                throw new CustomException("请登录");
-//            }
-//            userId = Long.parseLong(userIdStr);
-//        } catch (Exception e) {
-//            return R.error(401, "未登录");
-//        }
         param.setUserId(Long.parseLong(getUserId()));
         int result = userInformationCollectionService.submitCollectionAnswerParam(param);
-        return R.ok();
+        if (result > 0) {
+            return R.ok();
+        } else {
+            return R.error();
+        }
     }
 
     /**