|
|
@ -2,12 +2,17 @@ package com.ccsens.ht.service; |
|
|
|
|
|
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.ccsens.cloudutil.bean.tall.dto.MemberRoleDto; |
|
|
|
import com.ccsens.cloudutil.bean.tall.dto.UserDto; |
|
|
|
import com.ccsens.cloudutil.bean.tall.vo.UserVo; |
|
|
|
import com.ccsens.cloudutil.feign.TallFeignClient; |
|
|
|
import com.ccsens.ht.bean.dto.PatientDto; |
|
|
|
import com.ccsens.ht.bean.po.HtPatient; |
|
|
|
import com.ccsens.ht.bean.po.HtPatientExample; |
|
|
|
import com.ccsens.ht.bean.po.HtPatientReport; |
|
|
|
import com.ccsens.ht.persist.mapper.HtPatientMapper; |
|
|
|
import com.ccsens.ht.persist.mapper.HtPatientReportMapper; |
|
|
|
import com.ccsens.ht.uitl.Constant; |
|
|
|
import com.ccsens.util.*; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -40,6 +45,8 @@ public class PatientService implements IPatientService { |
|
|
|
private HtPatientReportMapper htPatientReportMapper; |
|
|
|
@Autowired |
|
|
|
private HtPatientMapper htPatientMapper; |
|
|
|
@Autowired |
|
|
|
private TallFeignClient tallFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -100,7 +107,7 @@ public class PatientService implements IPatientService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public long editPatient(HtPatient patient) { |
|
|
|
public long editPatient(HtPatient patient, Long userId) { |
|
|
|
log.info("编辑病人信息:{}", patient); |
|
|
|
HtPatient oldPatient = null; |
|
|
|
//身份证唯一标识 ID 或 身份证
|
|
|
@ -124,18 +131,27 @@ public class PatientService implements IPatientService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//TODO 为病人注册账号
|
|
|
|
// if (oldPatient == null || oldPatient.getUserId() == null || oldPatient.getUserId() == 0) {
|
|
|
|
// UserDto.DefaultUserSingup signup = new UserDto.DefaultUserSingup();
|
|
|
|
// signup.setAccount(patient.getMobile());
|
|
|
|
// signup.setPhone(patient.getMobile());
|
|
|
|
// signup.setSource(Constant.Regist.SOURCE_HT);
|
|
|
|
// JsonResponse<Map> result = HttpUtil.postJson(Constant.Url.REGIST, signup, JsonResponse.class);
|
|
|
|
// if (result.getCode() != CodeEnum.SUCCESS.getCode().longValue()) {
|
|
|
|
// return 0;
|
|
|
|
// }
|
|
|
|
// patient.setUserId(Long.parseLong(String.valueOf(result.getData().get("userId"))));
|
|
|
|
// }
|
|
|
|
if (oldPatient == null || oldPatient.getUserId() == null || oldPatient.getUserId() == 0) { |
|
|
|
UserDto.DefaultUserSingup signup = new UserDto.DefaultUserSingup(); |
|
|
|
signup.setAccount(patient.getMobile()); |
|
|
|
signup.setPhone(patient.getMobile()); |
|
|
|
signup.setSource(Constant.Regist.SOURCE_HT); |
|
|
|
JsonResponse<UserVo.DefaultUserSingup> result = tallFeignClient.defaultRegister(signup); |
|
|
|
if (result.getCode() != CodeEnum.SUCCESS.getCode().longValue()) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
patient.setUserId(result.getData().getId()); |
|
|
|
|
|
|
|
//为病人分配角色
|
|
|
|
MemberRoleDto.Assign assign = new MemberRoleDto.Assign(); |
|
|
|
assign.setUserId(result.getData().getId()); |
|
|
|
assign.setCreateBy(userId); |
|
|
|
assign.setName(patient.getName()); |
|
|
|
List<String> roles = new ArrayList<>(); |
|
|
|
roles.add(Constant.Ht.Doctor.PATIENT); |
|
|
|
assign.setRoleNames(roles); |
|
|
|
tallFeignClient.assignRoles(assign); |
|
|
|
} |
|
|
|
if (oldPatient != null) { |
|
|
|
patient.setId(oldPatient.getId()); |
|
|
|
htPatientMapper.updateByPrimaryKeySelective(patient); |
|
|
|