Bladeren bron

update:信息采集

ct 6 dagen geleden
bovenliggende
commit
1a55b031e9

+ 4 - 0
fs-service/src/main/java/com/fs/his/param/FsUserInformationCollectionParam.java

@@ -48,5 +48,9 @@ public class FsUserInformationCollectionParam {
 
     private String doctorSign;
 
+    private Long doctorId;
+
+    private Long doctorType2Id;
+
     private String packageOrderCode;
 }

+ 63 - 29
fs-service/src/main/java/com/fs/his/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -14,8 +14,11 @@ import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.company.domain.CompanyUser;
+import com.fs.company.domain.CompanyUserUser;
 import com.fs.company.mapper.CompanyUserMapper;
+import com.fs.company.mapper.CompanyUserUserMapper;
 import com.fs.company.service.ICompanyService;
+import com.fs.company.service.ICompanyUserService;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
@@ -149,6 +152,11 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
     private IFsInquiryOrderService fsInquiryOrderService;
     @Autowired
     private OpenIMService openIMService;
+    @Autowired
+    private CompanyUserUserMapper companyUserUserMapper;
+    @Autowired
+    private FsPackageMapper fsPackageMapper;
+
     /**
      * 查询用户信息采集
      *
@@ -219,6 +227,9 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         if (collection.getUserConfirm() == 1 && collection.getUserConfirm2() == 0) {
             throw new CustomException("确认中,暂无法修改");
         }
+        param.setDoctorId(collection.getDoctorId());
+        param.setDoctorType2Id(collection.getDoctorType2Id());
+        param.setPackageId(collection.getPackageId());
         FsUserInformationCollection fsUserInformationCollection = getFsUserInformationCollection(param);
         fsUserInformationCollection.setUpdateTime(DateUtils.getNowDate());
         baseMapper.updateFsUserInformationCollection(fsUserInformationCollection);
@@ -246,6 +257,9 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         }
         //清空订单号
         fsUserInformationCollectionMapper.collectionOderCodeNULL(param.getId());
+        param.setDoctorId(collection.getDoctorId());
+        param.setDoctorType2Id(collection.getDoctorType2Id());
+        param.setPackageId(collection.getPackageId());
         FsUserInformationCollection fsUserInformationCollection = getFsUserInformationCollection(param);
         fsUserInformationCollection.setUserConfirm2(0);
         fsUserInformationCollection.setUserConfirm(0);
@@ -674,6 +688,20 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         if (!Objects.equals(collection.getUserId(), param.getUserId())) {
             return R.error("用户信息不匹配,无法确认");
         }
+        //绑定用户
+        CompanyUserUser companyUserUserMap=new CompanyUserUser();
+        companyUserUserMap.setCompanyUserId(collection.getCompanyUserId());
+        companyUserUserMap.setUserId(collection.getUserId());
+        List<CompanyUserUser> list= companyUserUserMapper.selectCompanyUserUserList(companyUserUserMap);
+        if(list==null|| list.isEmpty()){
+            CompanyUser companyUser=companyUserMapper.selectCompanyUserById(collection.getCompanyUserId());
+            if(companyUser!=null&&companyUser.getStatus().equals("0")){
+                companyUserUserMap.setCompanyId(companyUser.getCompanyId());
+                companyUserUserMap.setCreateTime(new Date());
+                companyUserUserMapper.insertCompanyUserUser(companyUserUserMap);
+            }
+        }
+
         FsUserInformationCollection map = new FsUserInformationCollection();
         map.setId(param.getId());
         map.setUserConfirm(1);
@@ -982,37 +1010,43 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         if (companyUser == null) {
             throw new CustomException("销售不存在");
         }
-        Long doctorId = null;
-        if (companyUser.getDoctorId() != null) {
-            FsDoctor doctor = doctorMapper.selectFsDoctorByDoctorId(companyUser.getDoctorId());
-            if (doctor != null) {
-                doctorId = doctor.getDoctorId();
-            }
-        } else {
-            //随机获取医生id
-            doctorId = iFsDoctorService.selectFsDoctorDoctorByPackage();
-        }
-        fsUserInformationCollection.setDoctorId(doctorId);
-
+        //医生
+        Long doctorId = companyUser.getDoctorId();
+        fsUserInformationCollection.setDoctorId(getDoctorId(doctorId,1,param.getPackageId()));
+        //药师
+        Long doctorType2Id = param.getDoctorType2Id();
+        fsUserInformationCollection.setDoctorType2Id(getDoctorId(doctorType2Id,2,param.getPackageId()));
         return fsUserInformationCollection;
     }
 
-    public static void main(String[] args) {
-//        String str1 = "[{\"options\":[{\"flag\":false,\"name\":\"通天\",\"value\":0},{\"flag\":false,\"name\":\"哈哈\",\"value\":1}],\"title\":\"测试标题1\",\"value\":1},{\"options\":[{\"flag\":false,\"name\":\"呼呼\",\"value\":0},{\"flag\":false,\"name\":\"嘻嘻\",\"value\":1}],\"title\":\"测试标题2\",\"value\":1},{\"options\":[{\"flag\":false,\"name\":\"胸痛\",\"value\":0},{\"flag\":false,\"name\":\"胸闷\",\"value\":1},{\"flag\":false,\"name\":\"头晕\",\"value\":2},{\"flag\":false,\"name\":\"肢体麻木\",\"value\":3},{\"flag\":false,\"name\":\"无\",\"value\":4}],\"title\":\"您目前是否有心脑血管相关症状,如胸痛、胸闷、头晕、肢体麻木等?\",\"value\":1}]";
-//        String str2 = "[{\"options\":[{\"flag\":true,\"name\":\"胸痛\",\"value\":0},{\"flag\":true,\"name\":\"胸闷\",\"value\":1},{\"flag\":true,\"name\":\"头晕\",\"value\":2},{\"flag\":true,\"name\":\"肢体麻木\",\"value\":3},{\"flag\":true,\"name\":\"无\",\"value\":4}],\"title\":\"您目前是否有心脑血管相关症状,如胸痛、胸闷、头晕、肢体麻木等?\",\"value\":1},{\"options\":[{\"flag\":false,\"name\":\"胃疼\",\"value\":0},{\"flag\":false,\"name\":\"反酸\",\"value\":1},{\"flag\":false,\"name\":\"恶心\",\"value\":2},{\"flag\":false,\"name\":\"呕吐\",\"value\":3},{\"flag\":false,\"name\":\"黑便\",\"value\":4},{\"flag\":false,\"name\":\"无\",\"value\":5}],\"title\":\"您近期是否出现胃部不适症状,如胃痛、反酸、恶心、呕吐或黑便?\",\"value\":1}]";
-//        List<AnswerVO> vo1 = null;
-//        List<AnswerVO> vo2 = JSON.parseArray(str2, AnswerVO.class);
-//        System.out.println(vo1);
-//        System.out.println(vo2);
-//        vo2.addAll(vo1);
-//        Map<String, List<AnswerVO>> collect = vo2.stream()
-//                .collect(Collectors.groupingBy(AnswerVO::getTitle));
-//        List<AnswerVO> collect1 = vo2.stream()
-//                .collect(Collectors.groupingBy(AnswerVO::getTitle))
-//                .values().stream()
-//                .map(group -> group.stream().reduce((a, b) -> a).orElse(null)).collect(Collectors.toList());
-//        System.out.println(JSON.toJSONString(collect));
-//        System.out.println(JSON.toJSONString(collect1));
-        boolean contains = "是否有糖尿病相关疾病?".contains("糖尿病");
+    /**
+     *  如果是药师 需要根据套餐类型查询药师
+     * @param doctorId
+     * @param doctorType 1医生 2药师
+     * @return
+     */
+    private Long getDoctorId(Long doctorId,Integer doctorType,Long packageId) {
+        FsDoctor doctor = null;
+        if (doctorId != null) {
+            doctor = doctorMapper.selectFsDoctorByDoctorId(doctorId);
+        }
+        if (doctorId == null || doctor == null) {
+            if (doctorType == 1){
+                //随机获取医生id
+                doctorId = iFsDoctorService.selectFsDoctorDoctorByPackage();
+            } else if (doctorType == 2){
+                //随机获取药师id
+                FsPackage fsPackage = fsPackageMapper.selectFsPackageByPackageId(packageId);
+                if (fsPackage != null){
+                    doctor =doctorMapper.selectPackageFsDoctorType2Ids(fsPackage.getProductType());
+                }
+                if (doctor != null) {
+                    doctorId = doctor.getDoctorId();
+                }
+            }
+
+        }
+        return doctorId;
     }
+
 }

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

@@ -13,6 +13,8 @@ import java.util.List;
 @Data
 public class FsUserInformationCollectionAndPatientVO extends FsUserInformationCollection {
     private FsPatient patientInfo; //病人信息
+    private Integer isPay;
+    private Long storeOrderId;
 
 
 }

+ 27 - 7
fs-user-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java

@@ -6,17 +6,22 @@ import com.fs.company.domain.CompanyUser;
 import com.fs.company.domain.CompanyUserUser;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.company.service.ICompanyUserUserService;
-import com.fs.his.domain.FsPatient;
-import com.fs.his.domain.FsUserInformationCollection;
+import com.fs.his.domain.*;
+import com.fs.his.mapper.FsStoreOrderMapper;
 import com.fs.his.param.CollectionInfoConfirmParam;
 import com.fs.his.param.FsUserInformationCollectionParam;
+import com.fs.his.service.IFsPackageOrderService;
 import com.fs.his.service.IFsPatientService;
+import com.fs.his.service.IFsStoreOrderService;
 import com.fs.his.service.IFsUserInformationCollectionService;
+import com.fs.his.service.impl.FsStoreOrderServiceImpl;
 import com.fs.his.vo.FsUserInformationCollectionAndPatientVO;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 
 /**
  * 用户信息采集Controller
@@ -34,7 +39,8 @@ public class FsUserInformationCollectionController extends AppBaseController
     private IFsPatientService fsPatientService;
     @Autowired
     private ICompanyUserService companyUserService;
-
+    @Autowired
+    private IFsPackageOrderService fsPackageOrderService;
 
 
     /**
@@ -60,16 +66,30 @@ public class FsUserInformationCollectionController extends AppBaseController
         CompanyUser companyUser = companyUserService.selectCompanyUserById(info.getCompanyUserId());
         info.setCompanyId(companyUser.getCompanyId());
         Long patientId = info.getPatientId();
+
+        FsUserInformationCollectionAndPatientVO vo = new FsUserInformationCollectionAndPatientVO();
+        BeanUtils.copyProperties(info, vo);
+
         if(patientId != null){
             FsPatient fsPatient = fsPatientService.selectFsPatientByPatientId(patientId);
             if (fsPatient != null){
-                FsUserInformationCollectionAndPatientVO vo = new FsUserInformationCollectionAndPatientVO();
-                BeanUtils.copyProperties(info, vo);
+
                 vo.setPatientInfo(fsPatient);
-                return R.ok().put("data", vo);
+                //查询是否支付
+                Integer isPay = 0;
+                Long packageOrderId = info.getPackageOrderId();
+                if (packageOrderId != null){
+                    FsPackageOrder order = fsPackageOrderService.selectFsPackageOrderByOrderId(packageOrderId);
+                    if (order != null && order.getStatus() > 1){
+                        isPay = 1;
+                        vo.setStoreOrderId(order.getStoreOrderId());
+                    }
+                }
+                vo.setIsPay(isPay);
             }
         }
-        return R.ok().put("data", info);
+
+        return R.ok().put("data", vo);
     }