|
@ -5,12 +5,15 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
|
|
|
import com.yihu.jw.entity.myFamily.PatientApplyLog;
|
|
|
import com.yihu.jw.message.service.MessageService;
|
|
|
import com.yihu.jw.patient.service.personal_Info.BasePatientService;
|
|
|
import com.yihu.jw.patient.service.personal_Info.PatientService;
|
|
|
import com.yihu.jw.wechat.service.WeChatQrcodeService;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@ -22,10 +25,15 @@ public class MyFamilyService {
|
|
|
@Autowired
|
|
|
private PatientFamilyMemberService patientFamilyMemberService;
|
|
|
@Autowired
|
|
|
private BasePatientService patientService;
|
|
|
private PatientService patientService;
|
|
|
@Autowired
|
|
|
private MessageService messageService;
|
|
|
@Value("${}")
|
|
|
@Value("${myFamily.qrCodeFailurTime}")
|
|
|
private String qrCodeFailurTime;
|
|
|
@Autowired
|
|
|
private WeChatQrcodeService weChatQrcodeService;
|
|
|
@Autowired
|
|
|
private PatientApplyLogService patientApplyLogService;
|
|
|
|
|
|
|
|
|
public List<Map<String,Object>> getMyFamilyBindingRole(String patient) throws Exception{
|
|
@ -76,8 +84,9 @@ public class MyFamilyService {
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
public void bindingMyFamily(String saasId,String patient,String familyMobile,Integer platform) throws Exception{
|
|
|
public void bindingMyFamily(HttpServletRequest request,String wechatId, String saasId, String patient, String familyMobile, Integer platform) throws Exception{
|
|
|
|
|
|
BasePatientDO patientDO = patientService.findByIdAndDel(patient);
|
|
|
//1、检验手机号码是否有存在账号,
|
|
|
|
|
|
//2、没有存在账号的,预注册一个账号,调用预注册接口
|
|
@ -88,16 +97,20 @@ public class MyFamilyService {
|
|
|
PatientApplyLog patientApplyLog = new PatientApplyLog();
|
|
|
patientApplyLog.setPatientFamilyMemberName(familyPatient.getName());
|
|
|
patientApplyLog.setPatienyFamilyMemberCode(familyPatient.getId());
|
|
|
String qrCode = "";
|
|
|
String scene ="family_"+patient+"_"+familyPatient.getId();
|
|
|
String qrCode = weChatQrcodeService.getQrcode(request,wechatId, scene);
|
|
|
if(StringUtils.isEmpty(qrCode)){
|
|
|
throw new Exception("qrCode is null");
|
|
|
}
|
|
|
patientApplyLog.setQrCode(qrCode);
|
|
|
// Integer failurTime =
|
|
|
// patientApplyLog.setFailureTime();
|
|
|
// patientApplyLog.setDel(1);
|
|
|
// patientApplyLog.setCreateTime(new Date());
|
|
|
// patientApplyLog.setCreateUser();
|
|
|
// patientApplyLog.setCreateUserName();
|
|
|
|
|
|
|
|
|
Long time = 1000*60*60*Long.valueOf(qrCodeFailurTime);
|
|
|
Long failurTime = (new Date()).getTime()+time;
|
|
|
patientApplyLog.setFailureTime(new Date(failurTime));
|
|
|
patientApplyLog.setDel(1);
|
|
|
patientApplyLog.setCreateTime(new Date());
|
|
|
patientApplyLog.setCreateUser(patient);
|
|
|
patientApplyLog.setCreateUserName(patientDO.getName());
|
|
|
patientApplyLogService.save(patientApplyLog);
|
|
|
|
|
|
//4、发送绑定家人的系统消息
|
|
|
BaseMessageDO messageDO = new BaseMessageDO();
|
|
@ -105,7 +118,7 @@ public class MyFamilyService {
|
|
|
messageDO.setReceiver(familyPatient.getId());
|
|
|
messageDO.setReceiverName(familyPatient.getName());
|
|
|
messageDO.setSender(patient);
|
|
|
BasePatientDO patientDO = patientService.findByIdAndDel(patient);
|
|
|
|
|
|
messageDO.setSenderName(patientDO.getName());
|
|
|
messageDO.setSenderPhoto(patientDO.getPhoto());
|
|
|
messageDO.setTitle("家人绑定");
|