提交 1e63c7ce 编写于 作者:  Peijun.zhao's avatar Peijun.zhao

Merge branch 'yizhixing-0616' into 'release'

Yizhixing 0616

reviewCode赵培军

See merge request !31
流水线 #26801 已失败 于阶段
in 0 second
......@@ -13,6 +13,8 @@
*.iws
*.iml
*.ipr
*.gitignore
/nbproject/private/
/build/
......@@ -73,4 +75,5 @@ crashlytics-build.properties
fabric.properties
LOG_PATH_IS_UNDEFINED/
/LOG_PATH_IS_UNDEFINED/
\ No newline at end of file
/LOG_PATH_IS_UNDEFINED/
*tomcat-log/*
......@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-client</artifactId>
<version>1.0.3.4</version>
<version>1.0.3.5</version>
<name>pica-cloud-account-client</name>
<packaging>jar</packaging>
......@@ -28,7 +28,7 @@
<dependency>
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.1.3</version>
<version>1.0.1.4</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
......
package com.pica.cloud.account.account.client;
import com.pica.cloud.account.account.common.req.AcctPatFamilyReq;
import com.pica.cloud.account.account.common.req.AcctPatInfoReq;
import com.pica.cloud.account.account.common.req.AcctPatPageReq;
import com.pica.cloud.account.account.common.req.InitAcctReq;
import com.pica.cloud.account.account.common.req.*;
import com.pica.cloud.account.account.common.resp.AcctPatIdResp;
import com.pica.cloud.account.account.common.resp.PatBindResp;
import com.pica.cloud.account.account.common.resp.PatFamilyResp;
import com.pica.cloud.foundation.entity.PicaResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
......@@ -43,6 +38,9 @@ public interface PatHealthPackClient {
@GetMapping(value = "/account/pat-health/familyAcct/patId/{patId}")
PicaResponse<Integer> getFamilyAcctPatId(@PathVariable("patId") Integer patId);
@PostMapping(value = "/account/pat-health/familyAcct/patIds")
PicaResponse<AcctPatIdResp> getFamilyAcctPatIds(@RequestBody AcctPatIdReq acctPatIdReq);
@PostMapping(value = "/account/pat-health/init/accts")
PicaResponse initAccts(@RequestBody List<InitAcctReq> initAcctReqList);
......
......@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.1.3</version>
<version>1.0.1.4</version>
<name>pica-cloud-account-common</name>
<packaging>jar</packaging>
......
package com.pica.cloud.account.account.common.req;
import java.util.List;
public class AcctPatIdReq {
private List<Integer> patIds;
public List<Integer> getPatIds() {
return patIds;
}
public void setPatIds(List<Integer> patIds) {
this.patIds = patIds;
}
}
package com.pica.cloud.account.account.common.resp;
public class AcctPatId {
private Integer reqPatId;
private Integer acctPatId;
public Integer getReqPatId() {
return reqPatId;
}
public void setReqPatId(Integer reqPatId) {
this.reqPatId = reqPatId;
}
public Integer getAcctPatId() {
return acctPatId;
}
public void setAcctPatId(Integer acctPatId) {
this.acctPatId = acctPatId;
}
}
package com.pica.cloud.account.account.common.resp;
import io.swagger.annotations.ApiModel;
import java.util.Map;
/**
*
*/
@ApiModel(description = "建立微信与账号关联关系-resp")
public class AcctPatIdResp {
private Map<Integer, Integer> patFamId;
public Map<Integer, Integer> getPatFamId() {
return patFamId;
}
public void setPatFamId(Map<Integer, Integer> patFamId) {
this.patFamId = patFamId;
}
}
......@@ -138,7 +138,7 @@
<dependency>
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.1.3</version>
<version>1.0.1.4</version>
</dependency>
<dependency>
......
......@@ -224,7 +224,7 @@ public class AccountController extends AccountBaseController {
this.checkMobilePhone(request.getMobile());
//接入新旭事务一致性
String batchNo = IntactUtils.getUUID();
intactUtil.sendIntact(batchNo,"loginRegister",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_1,"entity:"+ JSON.toJSONString(entity));
intactUtil.sendIntact(batchNo,"h5-loginRegister",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_1,"entity:"+ JSON.toJSONString(entity));
AccountReq req = new AccountReq();
req.setMobilePhone(request.getMobile());
// 登录或注册,只能使用验证码
......@@ -237,19 +237,35 @@ public class AccountController extends AccountBaseController {
Account account = accountService.getByMobilePhone(req.getMobilePhone());
if (account != null) {
// 登录
PicaResponse response = this.login(req);
PicaResponse response = null;
try {
response = this.login(req);
} catch (PicaException e) {
if(e.getCode().equals(PicaResultCode.PARAM_IS_INVALID.code()) || e.getCode().equals(PicaResultCode.RESULE_DATA_NONE.code())){
intactUtil.sendIntact(batchNo,"h5-loginRegister",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"验证码错误或过期-不加入提醒,返回值:"+ JSON.toJSONString(response));
}
throw e;
}
if (response.getData() != null) {
LoginResult result = new LoginResult();
result.setToken(response.getData().toString());
intactUtil.sendIntact(batchNo,"loginRegister",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"登录成功,返回值:"+ JSON.toJSONString(response.getData()));
intactUtil.sendIntact(batchNo,"h5-loginRegister",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"登录成功,返回值:"+ JSON.toJSONString(response.getData()));
return PicaResponse.toResponse(result);
}
return response;
} else {
// 注册
PicaResponse<LoginResult> result = this.register(req);
intactUtil.sendIntact(batchNo,"loginRegister",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"注册成功,返回值:"+ JSON.toJSONString(result));
PicaResponse<LoginResult> result = null;
try {
result = this.register(req);
} catch (PicaException e) {
if(e.getCode().equals(PicaResultCode.PARAM_IS_INVALID.code()) || e.getCode().equals(PicaResultCode.RESULE_DATA_NONE.code())){
intactUtil.sendIntact(batchNo,"h5-loginRegister",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"验证码错误或过期-不加入提醒,返回值:"+ JSON.toJSONString(result));
}
throw e;
}
intactUtil.sendIntact(batchNo,"h5-loginRegister",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"注册成功,返回值:"+ JSON.toJSONString(result));
return result;
}
}
......
// Copyright 2016-2101 Pica.
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.common.req.AcctPatFamilyReq;
import com.pica.cloud.account.account.common.req.AcctPatInfoReq;
import com.pica.cloud.account.account.common.req.AcctPatPageReq;
import com.pica.cloud.account.account.common.req.InitAcctReq;
import com.pica.cloud.account.account.common.req.*;
import com.pica.cloud.account.account.common.resp.AcctPatIdResp;
import com.pica.cloud.account.account.common.resp.PatBindResp;
import com.pica.cloud.account.account.common.resp.PatFamilyResp;
import com.pica.cloud.account.account.server.service.PatHealthPackService;
......@@ -81,6 +79,11 @@ public class PatHealthPackController {
return PicaResponse.toResponse(packService.getFamilyAcctPatId(patId));
}
@ApiOperation("根据patientIds 获取监护人-本人监护人(自身patId),本人成员(监护人patId)")
@PostMapping(value = "/familyAcct/patIds")
public PicaResponse<AcctPatIdResp> getFamilyAcctPatIds(@RequestBody AcctPatIdReq acctPatIdReq) throws Exception {
return PicaResponse.toResponse(packService.getFamilyAcctPatIds(acctPatIdReq));
}
@ApiOperation("初始主账户数据")
@PostMapping(value = "/init/accts")
......
......@@ -64,6 +64,7 @@ public enum AccountExceptionEnum {
PAT_MOBILE_BINDED_WECHAT_ERROR("216555","该手机已绑定其他微信"),
PAT_MEMBER_HAS_BINDED_SELF("216556","该成员已被账户绑定为家庭成员,不需要再次绑定"),
PAT_HAS_CREATE_ACCT("216557","初始居民已存在主账户"),
PAT_QUERY_MAX("216558","查询参数过多"),
xxx_xxx("","");
......
......@@ -22,15 +22,22 @@ public interface AcctPatFamilyMapper {
/** 获取居民id是本人的家庭组记录- 作为家庭主账户、本人居民id,单条ok 多条异常数据 */
AcctPatFamily getByPatIdSelf(Integer patId);
/** list查询 波子1000条调用 */
List<AcctPatFamily> getListByPatIdSelfs(List<Integer> list);
/** 查询居民id所在家庭组监护人- 作为家庭成员、非主账户本人居民id,单条ok 多条异常数据 */
AcctPatFamily getByPatIdNotSelf(Integer patId);
List<AcctPatFamily> getListByPatIdNotSelfs(List<Integer> list);
/** 获取主账户下所有家庭成员 */
List<AcctPatFamily> getListByAcctId(Integer acctId);
/** 根据账户id 获取主账户居民 */
AcctPatFamily getSelfByAcctId(Integer acctId);
List<AcctPatFamily> getSelfListByAcctIds(List<Integer> list);
List<AcctPatFamily> getListByPatIds(List<Integer> patIds);
List<AcctPatFamily> getByPatIdSelfList(List<Integer> patIds);
......
// Copyright 2016-2101 Pica.
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.common.req.AcctPatFamilyReq;
import com.pica.cloud.account.account.common.req.AcctPatInfoReq;
import com.pica.cloud.account.account.common.req.AcctPatPageReq;
import com.pica.cloud.account.account.common.req.InitAcctReq;
import com.pica.cloud.account.account.common.req.*;
import com.pica.cloud.account.account.common.resp.AcctPatIdResp;
import com.pica.cloud.account.account.common.resp.PatBindResp;
import com.pica.cloud.account.account.common.resp.PatFamilyResp;
......@@ -36,6 +34,8 @@ public interface PatHealthPackService {
Integer getFamilyAcctPatId(Integer patId);
AcctPatIdResp getFamilyAcctPatIds(AcctPatIdReq acctPatIdReq);
Integer initAccts(List<InitAcctReq> list);
List<Integer> queryByPage(AcctPatPageReq patPageReq);
......
......@@ -395,6 +395,7 @@ public class LoginServiceImpl implements LoginService {
map.put("openid", weChatEntity.getOpenid());
Map weChatUserInfo = WeChatUtils.getWeChatUserInfo(map, weChatURL);
WeChatUserInfoEntity weChatUserInfoEntity = WeChatUtils.mergeWechatUserInfo(weChatUserInfo, weChatEntity.getOpenid());
logger.info("loginByWeChat: 获取微信用户信息:{}",JSONObject.toJSONString(weChatUserInfoEntity));
String unionId = weChatUserInfoEntity.getUnionid();
AccountUnionEntity accountUnionEntity = accountUnionMapper.selectByUnionId(unionId);
//是否绑定逻辑的判断
......
......@@ -3,6 +3,7 @@ package com.pica.cloud.account.account.server.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.common.req.*;
import com.pica.cloud.account.account.common.resp.AcctPatIdResp;
import com.pica.cloud.account.account.common.resp.PatBindResp;
import com.pica.cloud.account.account.common.resp.PatFamilyResp;
import com.pica.cloud.account.account.server.entity.AcctPatFamily;
......@@ -11,11 +12,11 @@ import com.pica.cloud.account.account.server.entity.AcctPatUnion;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.enums.SourceTypeEnum;
import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.mapper.AcctPatFamilyMapper;
import com.pica.cloud.account.account.server.mapper.AcctPatInfoMapper;
import com.pica.cloud.account.account.server.mapper.AcctPatUnionMapper;
import com.pica.cloud.account.account.server.service.PatHealthPackService;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaException;
......@@ -29,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import static com.pica.cloud.account.account.server.enums.AccountTypeEnum.union_login_blog;
import static java.util.stream.Collectors.toList;
/**
......@@ -80,23 +80,22 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
}
/**
* @Description
* 父亲(监护人)、母亲
* 儿子、女儿---(儿媳 女媳 非家庭成员)
* 孙子、孙女、外孙、外孙女
*
* @Description 父亲(监护人)、母亲
* 儿子、女儿---(儿媳 女媳 非家庭成员)
* 孙子、孙女、外孙、外孙女
* <p>
* 儿子(监护人)、儿媳
* 孙子、孙女
*
* 孙子、孙女
* <p>
* 女儿(监护人)、女媳
* 外孙、外孙女
*
*
* 查询:儿子 patId查
* 返回:父亲,儿媳,孙子,孙女 patId
*
* 查询:父亲
* 返回:父亲、母亲、儿子、女儿
* 外孙、外孙女
* <p>
* <p>
* 查询:儿子 patId查
* 返回:父亲,儿媳,孙子,孙女 patId
* <p>
* 查询:父亲
* 返回:父亲、母亲、儿子、女儿
* @Author peijun.zhao
* @Date 2020/5/20 17:11
* @ModifyDate 2020/5/20 17:11
......@@ -114,24 +113,24 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
List<Integer> query = new ArrayList<>();
query.add(patientId);
List<AcctPatFamily> memberList = patFamilyMapper.getListByPatIds(query);
if(CollectionUtils.isEmpty(memberList)){
if (CollectionUtils.isEmpty(memberList)) {
//该居民id作为成员无 家庭成员记录
return patIds;
}
//自身监护人
AcctPatFamily self = patFamilyMapper.getByPatIdSelf(patientId);
if(null != self){
if (null != self) {
//自己存在监护人身份,家庭关系成员add
List<AcctPatFamily> sonFamilyList = patFamilyMapper.getListByAcctId(self.getAcctId());
patIds.addAll(sonFamilyList.stream().map(obj -> obj.getPatientId()).collect(toList()));
}
//自身成员
AcctPatFamily member = patFamilyMapper.getByPatIdNotSelf(patientId);
if(null != member){
if (null != member) {
//存在自己作为成员身份记录,add 上级监护人
AcctPatFamily parentAcct = patFamilyMapper.getSelfByAcctId(member.getAcctId());
if(null != parentAcct){
if (null != parentAcct) {
patIds.add(parentAcct.getPatientId());
//监护人组内所有成员 包括自身
......@@ -158,32 +157,32 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
public PatFamilyResp getFamilyPatsByAcctId(Integer acctId, Integer containAcct) {
PatFamilyResp resp = new PatFamilyResp();
List<AcctPatFamily> patFamilyList = patFamilyMapper.getListByAcctId(acctId);
List<AcctPatFamilyDto> dtos = new ArrayList<>();
List<Integer> allPadIds = patFamilyList.stream().map(obj ->obj.getPatientId()).collect(toList());
if(CollectionUtils.isEmpty(allPadIds)){
List<AcctPatFamilyDto> dtos = new ArrayList<>();
List<Integer> allPadIds = patFamilyList.stream().map(obj -> obj.getPatientId()).collect(toList());
if (CollectionUtils.isEmpty(allPadIds)) {
return resp;
}
if(1 == containAcct){
if (1 == containAcct) {
resp.setMemberPatIds(allPadIds);
for(AcctPatFamily family : patFamilyList){
for (AcctPatFamily family : patFamilyList) {
AcctPatFamilyDto dto = new AcctPatFamilyDto();
dto.setPatientId(family.getPatientId());
dto.setRelation(family.getRelation());
dtos.add(dto);
}
}else if(0 == containAcct){
} else if (0 == containAcct) {
//不包含建立acct账户的pat数据
List<AcctPatFamily> acctList = patFamilyMapper.getByPatIdSelfList(allPadIds);
List<Integer> acctPatIds = acctList.stream().map(obj -> obj.getPatientId()).collect(toList());
for(AcctPatFamily family : patFamilyList){
if(!acctPatIds.contains(family.getPatientId())){
for (AcctPatFamily family : patFamilyList) {
if (!acctPatIds.contains(family.getPatientId())) {
AcctPatFamilyDto dto = new AcctPatFamilyDto();
dto.setPatientId(family.getPatientId());
dto.setRelation(family.getRelation());
dtos.add(dto);
}
}
resp.setMemberPatIds(dtos.stream().distinct().map(obj ->obj.getPatientId()).filter(x -> x!=null).collect(toList()));
resp.setMemberPatIds(dtos.stream().distinct().map(obj -> obj.getPatientId()).filter(x -> x != null).collect(toList()));
}
resp.setMemberList(dtos);
......@@ -193,9 +192,9 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
@Transactional
@Override
public Integer saveAcct(AcctPatInfoReq patInfoReq) {
logger.info("saveAcct:{}",JSONObject.toJSONString(patInfoReq));
if(Objects.isNull(patInfoReq.getPatientId()) || patInfoReq.getPatientId() == 0 || Objects.isNull(patInfoReq.getName())
|| Objects.isNull(patInfoReq.getMobile()) ){
logger.info("saveAcct:{}", JSONObject.toJSONString(patInfoReq));
if (Objects.isNull(patInfoReq.getPatientId()) || patInfoReq.getPatientId() == 0 || Objects.isNull(patInfoReq.getName())
|| Objects.isNull(patInfoReq.getMobile())) {
throw new PicaException(AccountExceptionEnum.PAT_SAVE_PARAM_ERROR.getCode(), AccountExceptionEnum.PAT_SAVE_PARAM_ERROR.getMessage());
}
......@@ -240,7 +239,7 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
@Transactional
@Override
public PatBindResp bindUnion(AcctPatInfoReq patInfoReq) {
logger.info("bindUnion:{}",JSONObject.toJSONString(patInfoReq));
logger.info("bindUnion:{}", JSONObject.toJSONString(patInfoReq));
PatBindResp resp = new PatBindResp();
//unionid是否已被其他账号绑定
AcctPatUnion patUnion = patUnionMapper.selectByUnionId(patInfoReq.getUnionId());
......@@ -299,8 +298,8 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
List<Integer> patIds = memberList.stream().map(obj -> obj.getPatientId()).collect(toList());
List<AcctPatFamilyDto> relatedPats = new ArrayList<>();
List<AcctPatFamily> members = patFamilyMapper.getMemberListByPatIds(patIds);
for(AcctPatFamily member : members){
if(!familyReqReq.getAcctId().equals(member.getAcctId())){
for (AcctPatFamily member : members) {
if (!familyReqReq.getAcctId().equals(member.getAcctId())) {
//居民已被其他账户绑定为家庭成员
AcctPatFamilyDto failOne = new AcctPatFamilyDto();
failOne.setPatientId(member.getPatientId());
......@@ -308,7 +307,7 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
failList.add(failOne);
successFlag = false;
resp.setFailMsg(AccountExceptionEnum.PAT_MEMBER_HAS_MORE.getMessage());
}else {
} else {
//居民已被传入acctId关联为家庭成员,不需要再保存
AcctPatFamilyDto failOneRelated = new AcctPatFamilyDto();
failOneRelated.setRelation(member.getRelation());
......@@ -320,15 +319,15 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
}
//已关联自身居民list
if(relatedPats.size() > 0){
if (relatedPats.size() > 0) {
successFlag = false;
failList.addAll(relatedPats);
}
//通过后 再建立家庭关系
if(successFlag){
if (successFlag) {
AcctPatFamily acct = patFamilyMapper.getSelfByAcctId(familyReqReq.getAcctId());
for(AcctPatFamilyDto member : memberList){
for (AcctPatFamilyDto member : memberList) {
AcctPatFamily entity = new AcctPatFamily();
entity.setAcctId(familyReqReq.getAcctId());
entity.setPatientId(member.getPatientId());
......@@ -352,23 +351,96 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
public Integer getFamilyAcctPatId(Integer patId) {
Integer rtnPatId = patId;
AcctPatFamily acctMember = patFamilyMapper.getByPatIdSelf(patId);
if(null != acctMember){
if (null != acctMember) {
//本人为监护人 返回自身patId
rtnPatId = acctMember.getPatientId();
}else {
} else {
//查询是否存在 作为成员的记录
AcctPatFamily member = patFamilyMapper.getByPatIdNotSelf(patId);
if(null != member){
if (null != member) {
//本人为成员时记录存在
AcctPatFamily acctPat = patFamilyMapper.getSelfByAcctId(member.getAcctId());
rtnPatId = acctPat.getPatientId();
}else {
} else {
//传入patId不存在家庭记录
}
}
return rtnPatId;
}
/**
* @Description 根据居民id批量获取对应的主账号对应的patId
* @Author wangyongbo
* @Date 2020/6/15 上午11:58
* @ModifyDate 2020/6/15 上午11:58
* @Params
* @Return
*/
@Override
public AcctPatIdResp getFamilyAcctPatIds(AcctPatIdReq acctPatIdReq) {
AcctPatIdResp resp = new AcctPatIdResp();
Map<Integer, Integer> patFamId = new HashMap<>();
if (acctPatIdReq == null) {
throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR);
}
/***批量处理*/
List<Integer> allPatIds = acctPatIdReq.getPatIds();
int once = 500;
for (int i = 0; i < allPatIds.size(); i += once) {
List<Integer> patIds = null;
if (allPatIds.size() < i + once) {
patIds = allPatIds.subList(i, allPatIds.size());
} else {
patIds = allPatIds.subList(i, i + once);
}
/**先获取是主账号本人的居民id*/
List<AcctPatFamily> acctMembers = patFamilyMapper.getListByPatIdSelfs(patIds);
for (AcctPatFamily family : acctMembers) {
patFamId.put(family.getPatientId(), family.getPatientId());
}
/** 本人为监护人的patIds*/
List<Integer> acctMemberPatIds = acctMembers.stream().map(o -> o.getPatientId()).collect(toList());
/**作为成员的记录*/
List<Integer> memberIds = patIds.stream().filter(reqPatId -> acctMemberPatIds.stream().noneMatch(patId -> reqPatId.equals(patId))).collect(toList());
if (CollectionUtils.isNotEmpty(memberIds)) {
/**获取不是本人的主账号的本人居民id*/
List<AcctPatFamily> members = patFamilyMapper.getListByPatIdNotSelfs(memberIds);
if (CollectionUtils.isNotEmpty(members)) {
List<Integer> memberAcctIds = members.stream().map(o -> o.getAcctId()).collect(toList());
if (CollectionUtils.isNotEmpty(memberAcctIds)) {
List<AcctPatFamily> acctPats = patFamilyMapper.getSelfListByAcctIds(memberAcctIds);
for (AcctPatFamily family : acctPats) {
for (AcctPatFamily member : members) {
if (StringUtils.equals(String.valueOf(family.getAcctId()), String.valueOf(member.getAcctId()))) {
patFamId.put(member.getPatientId(), family.getPatientId());
}
}
}
}
/**没有主账号的patIds*/
memberIds.removeAll(members.stream().map(o -> o.getPatientId()).collect(toList()));
if (CollectionUtils.isNotEmpty(memberIds)) {
for (Integer member : memberIds) {
patFamId.put(member, member);
}
}
}
}
}
resp.setPatFamId(patFamId);
return resp;
}
@Transactional
@Override
public Integer initAccts(List<InitAcctReq> list) {
......@@ -379,18 +451,18 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
// List<String> mobiles = list.stream().map(obj -> obj.getMobile()).collect(toList());
List<String> encryMobiles = list.stream().map(obj -> obj.getEncryMobile()).collect(toList());
List<AcctPatFamily> checkPatIdList = patFamilyMapper.getByPatIdSelfList(patIds);
if(CollectionUtils.isNotEmpty(checkPatIdList)){
if (CollectionUtils.isNotEmpty(checkPatIdList)) {
//病人id在成员表中 作为主账户不应该存在
throw new PicaException(AccountExceptionEnum.PAT_HAS_CREATE_ACCT.getCode(), AccountExceptionEnum.PAT_HAS_CREATE_ACCT.getMessage());
}
List<AcctPatInfo> checkMobileList = patInfoMapper.getListByMobiles(encryMobiles);
if(CollectionUtils.isNotEmpty(checkMobileList)){
if (CollectionUtils.isNotEmpty(checkMobileList)) {
throw new PicaException(AccountExceptionEnum.PAT_HAS_CREATE_ACCT.getCode(), AccountExceptionEnum.PAT_HAS_CREATE_ACCT.getMessage());
}
//初始主账户数据
List<AcctPatInfo> infoList = new ArrayList<>();
for(InitAcctReq initAcctReq : list){
for (InitAcctReq initAcctReq : list) {
AcctPatInfo patInfo = new AcctPatInfo();
patInfo.setMobilePhone(initAcctReq.getEncryMobile());
patInfo.setName(initAcctReq.getName());
......@@ -401,10 +473,10 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
//获取入库账户ID 关联成员表;
// List<AcctPatInfo> saveAccts = patInfoMapper.getListByMobiles(encryMobiles);
List<AcctPatFamily> saveList = new ArrayList<>();
for(AcctPatInfo acct : infoList){
for(InitAcctReq req : list){
for (AcctPatInfo acct : infoList) {
for (InitAcctReq req : list) {
AcctPatFamily family = new AcctPatFamily();
if(req.getEncryMobile().equals(acct.getMobilePhone())){
if (req.getEncryMobile().equals(acct.getMobilePhone())) {
family.setRelation(1);
family.setPatientId(req.getPatId());
family.setAcctId(acct.getId());
......@@ -417,11 +489,11 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
//初始 账户联合表
List<AcctPatUnion> unionList = new ArrayList<>();
for(AcctPatInfo acct : infoList){
for(InitAcctReq req : list){
for (AcctPatInfo acct : infoList) {
for (InitAcctReq req : list) {
AcctPatUnion patUnion = new AcctPatUnion();
if(req.getEncryMobile().equals(acct.getMobilePhone())){
if(StringUtils.isNotEmpty(req.getUnionId())){
if (req.getEncryMobile().equals(acct.getMobilePhone())) {
if (StringUtils.isNotEmpty(req.getUnionId())) {
patUnion.setAcctId(acct.getId());
patUnion.setUnionType(AccountTypeEnum.UNION_LOGIN_WE_CHAT.getCode());
patUnion.setUnionId(req.getUnionId());
......@@ -440,16 +512,16 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
public List<Integer> queryByPage(AcctPatPageReq patPageReq) {
Integer pageNo = 1;
Integer pageSize = 100;
if(null != patPageReq.getPageNo() || 0 != patPageReq.getPageNo()){
if (null != patPageReq.getPageNo() || 0 != patPageReq.getPageNo()) {
pageNo = patPageReq.getPageNo();
}
if(null != patPageReq.getPageSize() && 0 != patPageReq.getPageSize()){
if (null != patPageReq.getPageSize() && 0 != patPageReq.getPageSize()) {
pageSize = patPageReq.getPageSize();
}
Map query = new HashMap();
query.put("begin",(pageNo-1) * pageSize);
query.put("end",pageSize);
query.put("begin", (pageNo - 1) * pageSize);
query.put("end", pageSize);
return patFamilyMapper.queryPatIdByPage(query);
}
......
package com.pica.cloud.account.account.server.util;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.enums.SourceTypeEnum;
......@@ -98,6 +99,7 @@ public class TokenUtils {
* @return
*/
public String generateToken(Account account) {
logger.info("generateToken account:{}",JSONObject.toJSONString(account));
Integer registerSource = account.getRegisterSource();
String newToken = "";
try {
......
......@@ -156,6 +156,18 @@
and delete_flag = 1;
</select>
<select id="getSelfListByAcctIds" parameterType="java.util.List" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from account_pat_family
where acct_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
and relation = 1
and delete_flag = 1;
</select>
<select id="getByPatIdSelf" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
......@@ -165,6 +177,18 @@
and delete_flag = 1;
</select>
<select id="getListByPatIdSelfs" parameterType="java.util.List" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from account_pat_family
where patient_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
and relation = 1
and delete_flag = 1;
</select>
<select id="getByPatIdNotSelf" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
......@@ -174,6 +198,18 @@
and delete_flag = 1;
</select>
<select id="getListByPatIdNotSelfs" parameterType="java.util.List" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from account_pat_family
where patient_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
AND relation != 1
and delete_flag = 1;
</select>
<select id="getListByPatIds" parameterType="java.util.List" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册