|
|
@@ -10,8 +10,11 @@ import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.company.domain.CompanyDept;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.CompanyDeptMapper;
|
|
|
+import com.fs.company.mapper.CompanyUserMapper;
|
|
|
+import com.fs.his.domain.FsDoctor;
|
|
|
import com.fs.his.domain.FsImportMember;
|
|
|
import com.fs.his.domain.FsPrescribeDataScrm;
|
|
|
+import com.fs.his.mapper.FsDoctorMapper;
|
|
|
import com.fs.his.mapper.FsImportMemberMapper;
|
|
|
import com.fs.his.mapper.FsPrescribeDataScrmMapper;
|
|
|
import com.fs.his.service.IFsUserAddressService;
|
|
|
@@ -72,6 +75,12 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
|
|
|
@Autowired
|
|
|
private IFsUserAddressService fsUserAddressService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FsDoctorMapper fsDoctorMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CompanyUserMapper companyUserMapper;
|
|
|
+
|
|
|
private static final Set<Integer> ALLOWED_STATUSES =
|
|
|
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(0, 5, 6))); // 允许操作完善客户信息的状态
|
|
|
|
|
|
@@ -94,6 +103,14 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
|
|
|
//批量获取处方信息
|
|
|
List<FsPrescribeDataScrm> fsPrescribeDataScrms = prescribeDataScrmMapper.selectFsPrescribeDataScrmListByIds(prescriptionIds);
|
|
|
//TODO 后续可能会在客户信息列表展示商城处方信息
|
|
|
+ //批量获取医生id
|
|
|
+ List<Long> doctorIds = companyCustomers.stream().map(FsCompanyCustomer::getDoctorId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ //查询医生信息并用Map<Long,String>存起来key为医生id,value为医生名称
|
|
|
+ Map<Long, String> doctorMap = fsDoctorMapper.selectDoctorByIds(doctorIds).stream().collect(Collectors.toMap(FsDoctor::getDoctorId, FsDoctor::getDoctorName));
|
|
|
+ //遍历companyCustomers根据医生id赋值正确医生名字
|
|
|
+ companyCustomers.forEach(customer -> {
|
|
|
+ customer.setDoctorName(doctorMap.get(customer.getDoctorId()));
|
|
|
+ });
|
|
|
return companyCustomers;
|
|
|
}
|
|
|
|
|
|
@@ -243,6 +260,15 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
|
|
|
fsCompanyCustomer.setCompanyUserId(companyUser.getUserId());
|
|
|
fsCompanyCustomer.setCompanyUserName(companyUser.getNickName());
|
|
|
fsCompanyCustomer.setClaimStatus(BigDecimal.ONE.intValue());//已认领
|
|
|
+ //获取销售绑定医生信息
|
|
|
+ companyUser = companyUserMapper.selectCompanyUserById(companyUser.getUserId());
|
|
|
+ if (companyUser==null||companyUser.getDoctorId()==null){
|
|
|
+ throw new CustomException("销售未绑定医生");
|
|
|
+ }
|
|
|
+ //查询医生信息
|
|
|
+ FsDoctor fsDoctor = fsDoctorMapper.selectFsDoctorByDoctorId(companyUser.getDoctorId());
|
|
|
+ fsCompanyCustomer.setDoctorId(fsDoctor.getDoctorId());
|
|
|
+ fsCompanyCustomer.setDoctorName(fsDoctor.getDoctorName());
|
|
|
return fsCompanyCustomerMapper.updateFsCompanyCustomer(fsCompanyCustomer);
|
|
|
}
|
|
|
|
|
|
@@ -310,7 +336,13 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
|
|
|
if (fsCompanyCustomer == null) {
|
|
|
return customerInfoVO;
|
|
|
}
|
|
|
+ //-----------------------组装客户基本信息----------------------------------
|
|
|
BeanUtils.copyProperties(fsCompanyCustomer, customerInfoVO);
|
|
|
+ //电话号脱敏
|
|
|
+ if (customerInfoVO.getPhone() != null) {
|
|
|
+ customerInfoVO.setPhone(customerInfoVO.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
|
|
|
+ }
|
|
|
+ //-----------------------开始处理Json问答数据----------------------------------
|
|
|
String jsonStr = fsCompanyCustomer.getJsonInfo();
|
|
|
if (StringUtils.isBlank(jsonStr)) {
|
|
|
return customerInfoVO;
|