提交 30ccb643 编写于 作者:  Peijun.zhao's avatar Peijun.zhao

add followup create doctor

上级 038aeee1
流水线 #47315 已取消 于阶段
package com.pica.cloud.account.account.client; package com.pica.cloud.account.account.client;
import com.pica.cloud.account.account.common.req.EncryptEntity; import com.pica.cloud.account.account.common.req.*;
import com.pica.cloud.account.account.common.req.LoginResult;
import com.pica.cloud.account.account.common.req.OCINRequest;
import com.pica.cloud.account.account.common.req.circle.CircleAcctInitReq; import com.pica.cloud.account.account.common.req.circle.CircleAcctInitReq;
import com.pica.cloud.account.account.common.req.shop.ShopAcctInitReq; import com.pica.cloud.account.account.common.req.shop.ShopAcctInitReq;
import com.pica.cloud.foundation.entity.PicaResponse; import com.pica.cloud.foundation.entity.PicaResponse;
...@@ -31,6 +29,9 @@ public interface RegisterClient { ...@@ -31,6 +29,9 @@ public interface RegisterClient {
@PostMapping(value = "/account/circle/acct") @PostMapping(value = "/account/circle/acct")
PicaResponse<List<Integer>> register(@RequestBody CircleAcctInitReq circleAcctInitReq, @RequestHeader(value = "token") String token); PicaResponse<List<Integer>> register(@RequestBody CircleAcctInitReq circleAcctInitReq, @RequestHeader(value = "token") String token);
@PostMapping(value = "/account/circle/acct/followup")
PicaResponse<List<DocInfoResp>> registerFollowup(@RequestBody List<DocInfoReq> req, @RequestHeader(value = "token") String token);
@PostMapping(value = "/account/shop/acct") @PostMapping(value = "/account/shop/acct")
PicaResponse<Map<String,Integer>> shopRegister(@RequestBody ShopAcctInitReq shopAcctInitReq, @RequestHeader(value = "token") String token); PicaResponse<Map<String,Integer>> shopRegister(@RequestBody ShopAcctInitReq shopAcctInitReq, @RequestHeader(value = "token") String token);
......
package com.pica.cloud.account.account.common.req;
/**
* User: Joy
* Description:
* Date: 2022-06-17 15:26
*/
public class DocInfoReq {
private String name;
private String mobile;
private String seq;
// 1 安卓 2 ios 3 web 4 h5 5 admin
private Integer source;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
}
package com.pica.cloud.account.account.common.req;
/**
* User: Joy
* Description:
* Date: 2022-06-17 15:27
*/
public class DocInfoResp {
private String seq;
private Integer doctorId;
public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}
public Integer getDoctorId() {
return doctorId;
}
public void setDoctorId(Integer doctorId) {
this.doctorId = doctorId;
}
}
package com.pica.cloud.account.account.server.controller; package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.common.req.DocInfoReq;
import com.pica.cloud.account.account.common.req.DocInfoResp;
import com.pica.cloud.account.account.common.req.circle.CircleAcctInitReq; import com.pica.cloud.account.account.common.req.circle.CircleAcctInitReq;
import com.pica.cloud.account.account.common.req.circle.DiyAcctInitReq; import com.pica.cloud.account.account.common.req.circle.DiyAcctInitReq;
import com.pica.cloud.account.account.server.service.CircleAccountService; import com.pica.cloud.account.account.server.service.CircleAccountService;
...@@ -36,6 +38,12 @@ public class CircleUserController { ...@@ -36,6 +38,12 @@ public class CircleUserController {
return PicaResponse.toResponse(circleAccountService.createCircleAccount(circleAcctInitReq)); return PicaResponse.toResponse(circleAccountService.createCircleAccount(circleAcctInitReq));
} }
@PostMapping("/acct/followup")
@EnabledLoginValidate
public PicaResponse<List<DocInfoResp>> followupUserInit(@RequestBody List<DocInfoReq> req) {
return PicaResponse.toResponse(circleAccountService.createFollowupAccount(req));
}
@PostMapping("/acct/decryMobile") @PostMapping("/acct/decryMobile")
@EnabledLoginValidate @EnabledLoginValidate
public PicaResponse<List<Integer>> circleUserInitDecryMobile(@RequestBody DiyAcctInitReq diyAcctInitReq) { public PicaResponse<List<Integer>> circleUserInitDecryMobile(@RequestBody DiyAcctInitReq diyAcctInitReq) {
......
package com.pica.cloud.account.account.server.service; package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.common.req.DocInfoReq;
import com.pica.cloud.account.account.common.req.DocInfoResp;
import com.pica.cloud.account.account.common.req.circle.CircleAcctInitReq; import com.pica.cloud.account.account.common.req.circle.CircleAcctInitReq;
import com.pica.cloud.account.account.common.req.shop.ShopAcctInitReq; import com.pica.cloud.account.account.common.req.shop.ShopAcctInitReq;
import com.pica.cloud.account.account.common.req.circle.DiyAcctInitReq; import com.pica.cloud.account.account.common.req.circle.DiyAcctInitReq;
...@@ -19,6 +21,9 @@ public interface CircleAccountService { ...@@ -19,6 +21,9 @@ public interface CircleAccountService {
//创建圈子入口-用户账号 //创建圈子入口-用户账号
List<Integer> createCircleAccount(CircleAcctInitReq circleAcctInitReq); List<Integer> createCircleAccount(CircleAcctInitReq circleAcctInitReq);
//随访入口-创建用户账号
List<DocInfoResp> createFollowupAccount(List<DocInfoReq> initAccoutsReq);
//批量创建用户- 手机号,姓名 //批量创建用户- 手机号,姓名
List<Integer> createDiyAccount(DiyAcctInitReq diyAcctInitReq); List<Integer> createDiyAccount(DiyAcctInitReq diyAcctInitReq);
......
package com.pica.cloud.account.account.server.service.impl; package com.pica.cloud.account.account.server.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.common.req.DocInfoReq;
import com.pica.cloud.account.account.common.req.DocInfoResp;
import com.pica.cloud.account.account.common.req.circle.CircleAcctInit; import com.pica.cloud.account.account.common.req.circle.CircleAcctInit;
import com.pica.cloud.account.account.common.req.circle.CircleAcctInitReq; import com.pica.cloud.account.account.common.req.circle.CircleAcctInitReq;
import com.pica.cloud.account.account.common.req.circle.DiyAcctInit; import com.pica.cloud.account.account.common.req.circle.DiyAcctInit;
...@@ -75,6 +77,38 @@ public class CircleAccountServiceImpl implements CircleAccountService { ...@@ -75,6 +77,38 @@ public class CircleAccountServiceImpl implements CircleAccountService {
return savedIds; return savedIds;
} }
@Override
public List<DocInfoResp> createFollowupAccount(List<DocInfoReq> initAccoutsReq) {
List<DocInfoResp> respList = new ArrayList<>();
try {
for (DocInfoReq acct : initAccoutsReq) {
DocInfoResp resp = new DocInfoResp();
Account dbAcct = accountMapper.getByMobilePhone(acct.getMobile()); //获取医生表账号信息
if (null == dbAcct) {
Account account = new Account();
account.setName(acct.getName());
account.setNickname(acct.getName());
account.setMobilePhone(acct.getMobile());
account.setRegisterSource(acct.getSource());
accountService.createAccount(account, null);
logger.info("createCircleAccount insert {}", account.getId().intValue());
resp.setDoctorId(account.getId().intValue());
resp.setSeq(acct.getSeq());
} else {
resp.setDoctorId(dbAcct.getId().intValue());
resp.setSeq(acct.getSeq());
logger.info("createCircleAccount exist {}", dbAcct.getId().intValue());
}
respList.add(resp);
}
} catch (Exception e) {
logger.error("createCircleAccount error:{}", e.getMessage());
throw e;
}
return respList;
}
@Override @Override
public List<Integer> createDiyAccount(DiyAcctInitReq diyAcctInitReq) { public List<Integer> createDiyAccount(DiyAcctInitReq diyAcctInitReq) {
logger.info("createDiyAccount:{}", JSONObject.toJSONString(diyAcctInitReq)); logger.info("createDiyAccount:{}", JSONObject.toJSONString(diyAcctInitReq));
...@@ -163,18 +197,18 @@ public class CircleAccountServiceImpl implements CircleAccountService { ...@@ -163,18 +197,18 @@ public class CircleAccountServiceImpl implements CircleAccountService {
@Transactional @Transactional
@Override @Override
public List<Integer> registerAndCertify(DiyAcctInitReq diyAcctInitReq) { public List<Integer> registerAndCertify(DiyAcctInitReq diyAcctInitReq) {
if(!diyAcctInitReq.getCode().equals("618")){ if (!diyAcctInitReq.getCode().equals("618")) {
return null; return null;
} }
logger.info("createDiyAccount:{}", JSONObject.toJSONString(diyAcctInitReq)); logger.info("createDiyAccount:{}", JSONObject.toJSONString(diyAcctInitReq));
List<Integer> savedIds = new ArrayList<>(); List<Integer> savedIds = new ArrayList<>();
Map<Integer,DiyAcctInit> idCardMap = new HashMap<>(); Map<Integer, DiyAcctInit> idCardMap = new HashMap<>();
try { try {
if (CollectionUtils.isNotEmpty(diyAcctInitReq.getDiyAcctInitList())) { if (CollectionUtils.isNotEmpty(diyAcctInitReq.getDiyAcctInitList())) {
for (DiyAcctInit acctInit : diyAcctInitReq.getDiyAcctInitList()) { for (DiyAcctInit acctInit : diyAcctInitReq.getDiyAcctInitList()) {
if(!checkIdNum(acctInit.getCard())){ if (!checkIdNum(acctInit.getCard())) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "身份证号格式错误:" + acctInit.getCard()); throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "身份证号格式错误:" + acctInit.getCard());
} }
...@@ -203,7 +237,7 @@ public class CircleAccountServiceImpl implements CircleAccountService { ...@@ -203,7 +237,7 @@ public class CircleAccountServiceImpl implements CircleAccountService {
} }
// 对这批医生进行实名认证状态更新; // 对这批医生进行实名认证状态更新;
for(Integer id : savedIds){ for (Integer id : savedIds) {
try { try {
// check 身份证号是否已被他人使用 // check 身份证号是否已被他人使用
String encryCard = EncryptUtils.encryptContent(idCardMap.get(id).getCard(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_IDNO); String encryCard = EncryptUtils.encryptContent(idCardMap.get(id).getCard(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_IDNO);
...@@ -211,22 +245,22 @@ public class CircleAccountServiceImpl implements CircleAccountService { ...@@ -211,22 +245,22 @@ public class CircleAccountServiceImpl implements CircleAccountService {
Account accountCard = accountMapper.getByCard(encryCard); Account accountCard = accountMapper.getByCard(encryCard);
String encryMobile = EncryptUtils.encryptContent(idCardMap.get(id).getDecryMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE); String encryMobile = EncryptUtils.encryptContent(idCardMap.get(id).getDecryMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE);
if(accountCard != null && !accountCard.getMobilePhone().equals(encryMobile)){ if (accountCard != null && !accountCard.getMobilePhone().equals(encryMobile)) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "身份证号已被使用:" + idCardMap.get(id).getCard()); throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "身份证号已被使用:" + idCardMap.get(id).getCard());
} }
Account doctor = accountMapper.selectById(id); Account doctor = accountMapper.selectById(id);
boolean updateFlag = false; boolean updateFlag = false;
if(doctor.getStatus() != null && doctor.getStatus() != 3){ if (doctor.getStatus() != null && doctor.getStatus() != 3) {
doctor.setStatus(3); doctor.setStatus(3);
updateFlag = true; updateFlag = true;
} }
if(doctor.getCertifyStatus() != null && doctor.getCertifyStatus() != 3){ if (doctor.getCertifyStatus() != null && doctor.getCertifyStatus() != 3) {
doctor.setCertifyStatus(3); doctor.setCertifyStatus(3);
updateFlag = true; updateFlag = true;
} }
if(!updateFlag){ if (!updateFlag) {
continue; continue;
} }
doctor.setName(idCardMap.get(id).getUserName()); doctor.setName(idCardMap.get(id).getUserName());
...@@ -249,7 +283,7 @@ public class CircleAccountServiceImpl implements CircleAccountService { ...@@ -249,7 +283,7 @@ public class CircleAccountServiceImpl implements CircleAccountService {
} }
public static void main(String[] args) { public static void main(String[] args) {
Map map =getBirthdayAgeSex("310115198210277251"); Map map = getBirthdayAgeSex("310115198210277251");
System.out.println(map); System.out.println(map);
} }
...@@ -273,14 +307,14 @@ public class CircleAccountServiceImpl implements CircleAccountService { ...@@ -273,14 +307,14 @@ public class CircleAccountServiceImpl implements CircleAccountService {
boolean flag = true; boolean flag = true;
if (number.length == 15) { if (number.length == 15) {
for (int x = 0; x < number.length; x++) { for (int x = 0; x < number.length; x++) {
if (!flag){ if (!flag) {
return new HashMap<String, String>(); return new HashMap<String, String>();
} }
flag = Character.isDigit(number[x]); flag = Character.isDigit(number[x]);
} }
} else if (number.length == 18) { } else if (number.length == 18) {
for (int x = 0; x < number.length - 1; x++) { for (int x = 0; x < number.length - 1; x++) {
if (!flag){ if (!flag) {
return new HashMap<String, String>(); return new HashMap<String, String>();
} }
flag = Character.isDigit(number[x]); flag = Character.isDigit(number[x]);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册