|
@@ -1,9 +1,6 @@
|
|
|
package com.fs.hisStore.service.impl;
|
|
|
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
@@ -24,13 +21,21 @@ import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
|
import com.fs.core.config.WxMaConfiguration;
|
|
|
+import com.fs.course.mapper.FsUserCompanyUserMapper;
|
|
|
import com.fs.course.param.CollectionInfoConfirmParam;
|
|
|
import com.fs.course.vo.FsUserInfoCollectionUVO;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.domain.FsDoctor;
|
|
|
+import com.fs.his.domain.FsPackage;
|
|
|
+import com.fs.his.domain.FsPackageOrder;
|
|
|
+import com.fs.his.domain.FsStoreOrder;
|
|
|
import com.fs.his.mapper.FsDoctorMapper;
|
|
|
+import com.fs.his.mapper.FsPackageMapper;
|
|
|
+import com.fs.his.mapper.FsPackageOrderMapper;
|
|
|
import com.fs.his.service.IFsDoctorService;
|
|
|
+import com.fs.his.service.IFsPackageOrderService;
|
|
|
import com.fs.his.service.IFsQuestionAndAnswerService;
|
|
|
+import com.fs.his.service.IFsStoreOrderService;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.vo.AnswerVO;
|
|
|
import com.fs.his.vo.FsQuestionAndAnswerVO;
|
|
@@ -50,6 +55,7 @@ import org.springframework.stereotype.Service;
|
|
|
import com.fs.hisStore.mapper.FsUserInformationCollectionMapper;
|
|
|
import com.fs.hisStore.domain.FsUserInformationCollection;
|
|
|
import com.fs.hisStore.service.IFsUserInformationCollectionService;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
/**
|
|
@@ -85,6 +91,15 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
@Autowired
|
|
|
RedisCache redisCache;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FsPackageMapper packageMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreOrderService storeOrderService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FsPackageOrderMapper packageOrderMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询用户信息采集
|
|
|
*
|
|
@@ -268,6 +283,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public R doctorConfirm(FsUserInformationCollection collection) {
|
|
|
FsUserInformationCollection fsUserInformationCollection = fsUserInformationCollectionMapper.selectFsUserInformationCollectionById(collection.getId());
|
|
|
if (fsUserInformationCollection == null) {
|
|
@@ -288,12 +304,20 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
});
|
|
|
}
|
|
|
FsUserInformationCollection map = new FsUserInformationCollection();
|
|
|
+ map.setId(collection.getId());
|
|
|
if (answerVOS != null && !answerVOS.isEmpty()) {
|
|
|
map.setJsonInfo(JSON.toJSONString(answerVOS));
|
|
|
}
|
|
|
- map.setId(collection.getId());
|
|
|
- map.setDoctorAdvice(collection.getDoctorAdvice());
|
|
|
- map.setDoctorConfirm(1);
|
|
|
+ if (fsUserInformationCollection.getIsPackage() == 1) {
|
|
|
+ map.setDoctorAdvice(collection.getDoctorAdvice());
|
|
|
+ map.setDoctorConfirm(1);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ //没有关联套餐包医生确认清空所有状态
|
|
|
+ map.setDoctorConfirm(0);
|
|
|
+ map.setUserConfirm(0);
|
|
|
+ }
|
|
|
+
|
|
|
if (fsUserInformationCollectionMapper.updateFsUserInformationCollection(map) > 0) {
|
|
|
|
|
|
//更新医生确认信息
|
|
@@ -312,25 +336,54 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public FsUserInfoCollectionUVO info(Long id) {
|
|
|
+ public FsUserInfoCollectionUVO info(Long id,Long userId) {
|
|
|
FsUserInfoCollectionUVO vo = new FsUserInfoCollectionUVO();
|
|
|
FsUserInformationCollection collection = fsUserInformationCollectionMapper.selectFsUserInformationCollectionById(id);
|
|
|
+
|
|
|
if (collection != null) {
|
|
|
+ //TODO 测试完放开
|
|
|
+ if (!Objects.equals(collection.getUserId(), userId)) {
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
if (collection.getIsPackage() == 1) {
|
|
|
vo.setPackageId(collection.getPackageId());
|
|
|
vo.setPayType(collection.getPayType());
|
|
|
vo.setAmount(collection.getAmount());
|
|
|
-
|
|
|
+ FsPackage fsPackage = new FsPackage();
|
|
|
+ FsPackage fsPackage1 = packageMapper.selectFsPackageByPackageId(collection.getPackageId());
|
|
|
+ if (fsPackage1 != null) {
|
|
|
+ fsPackage = fsPackage1;
|
|
|
+ }
|
|
|
+ vo.setFsPackage(fsPackage);
|
|
|
+ CompanyUser companyUser = companyUserMapper.selectCompanyUserById(collection.getCompanyUserId());
|
|
|
+ if (companyUser == null) {
|
|
|
+ throw new CustomException("销售不存在");
|
|
|
+ }
|
|
|
+ vo.setCompanyUserId(collection.getCompanyUserId());
|
|
|
+ vo.setCompanyId(companyUser.getCompanyId());
|
|
|
+ vo.setPackageOrderCode(collection.getPackageOrderCode());
|
|
|
+ FsPackageOrder fsPackageOrder = packageOrderMapper.selectByOderCode(collection.getPackageOrderCode());
|
|
|
+ if(fsPackageOrder!=null) {
|
|
|
+ vo.setOrderStatus(fsPackageOrder.getIsPay());
|
|
|
+ vo.setOrderId(fsPackageOrder.getOrderId());
|
|
|
+ vo.setPatientJson(fsPackageOrder.getPatientJson());
|
|
|
+ }
|
|
|
}
|
|
|
vo.setIsPackage(collection.getIsPackage());
|
|
|
vo.setId(collection.getId());
|
|
|
vo.setAnswers(JSON.parseArray(collection.getJsonInfo(), AnswerVO.class));
|
|
|
vo.setStatus(collection.getStatus());
|
|
|
+ vo.setUserConfirm(collection.getUserConfirm());
|
|
|
+ vo.setUserConfirm2(collection.getUserConfirm2());
|
|
|
+ vo.setDoctorConfirm(collection.getDoctorConfirm());
|
|
|
+ vo.setUserAdvice(collection.getUserAdvice());
|
|
|
+ vo.setDoctorAdvice(collection.getDoctorAdvice());
|
|
|
}
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public R userConfirm(CollectionInfoConfirmParam param) {
|
|
|
if (param.getId() == null) {
|
|
|
return R.error("参数错误");
|
|
@@ -354,22 +407,33 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
|
|
|
//第一次确认
|
|
|
if (collection.getStatus() == 1) {
|
|
|
map.setStatus(2);
|
|
|
-
|
|
|
- //存入医生确认统计时间数据
|
|
|
- FsDoctorConfirm doctorConfirm = new FsDoctorConfirm();
|
|
|
- doctorConfirm.setCollectionId(collection.getId());
|
|
|
- doctorConfirm.setDoctorId(collection.getDoctorId());
|
|
|
- doctorConfirm.setStartTime(DateUtils.getNowDate());
|
|
|
- doctorConfirmService.insertFsDoctorConfirm(doctorConfirm);
|
|
|
- redisCache.setCacheObject("doctorConfirm:" + collection.getId(), doctorConfirm);
|
|
|
-
|
|
|
} else if (collection.getStatus() == 2) {
|
|
|
+ //清空订单号
|
|
|
+ fsUserInformationCollectionMapper.collectionOderCodeNULL(collection.getId());
|
|
|
map.setStatus(1);
|
|
|
map.setDoctorConfirm(0);
|
|
|
map.setUserConfirm(0);
|
|
|
+ map.setUserConfirm2(0);
|
|
|
+ FsStoreOrder fsStoreOrder = storeOrderService.selectFsStoreOrderByOrderCode(collection.getPackageOrderCode());
|
|
|
+ if (fsStoreOrder != null) {
|
|
|
+ FsStoreOrder editOrder = new FsStoreOrder();
|
|
|
+ editOrder.setOrderId(fsStoreOrder.getOrderId());
|
|
|
+ editOrder.setIsConfirm(1);
|
|
|
+ storeOrderService.updateFsStoreOrder(editOrder);
|
|
|
+ } else {
|
|
|
+ return R.error("没有找到订单");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (fsUserInformationCollectionMapper.updateFsUserInformationCollection(map) > 0) {
|
|
|
+ //存入医生确认统计时间数据
|
|
|
+ FsDoctorConfirm doctorConfirm = new FsDoctorConfirm();
|
|
|
+ doctorConfirm.setCollectionId(collection.getId());
|
|
|
+ doctorConfirm.setDoctorId(collection.getDoctorId());
|
|
|
+ doctorConfirm.setStartTime(DateUtils.getNowDate());
|
|
|
+ doctorConfirmService.insertFsDoctorConfirm(doctorConfirm);
|
|
|
+ //医生确认时间存入缓存 医生确认后删除
|
|
|
+ redisCache.setCacheObject("doctorConfirm:" + collection.getId(), doctorConfirm);
|
|
|
return R.ok();
|
|
|
}
|
|
|
return R.error("用户确认失败");
|