Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
40bb58ab
提交
40bb58ab
编写于
5月 14, 2020
作者:
Peijun.zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
居民账户7个接口 业务实现类 todo
上级
6a8a3329
流水线
#25364
已失败 于阶段
in 0 second
变更
14
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
554 行增加
和
24 行删除
+554
-24
PatHealthPackClient.java
...ica/cloud/account/account/client/PatHealthPackClient.java
+40
-0
AcctPatFamilyDto.java
...ca/cloud/account/account/common/req/AcctPatFamilyDto.java
+34
-0
AcctPatFamilyReq.java
...ca/cloud/account/account/common/req/AcctPatFamilyReq.java
+39
-0
AcctPatInfoReq.java
...pica/cloud/account/account/common/req/AcctPatInfoReq.java
+26
-0
PatBindResp.java
...m/pica/cloud/account/account/common/resp/PatBindResp.java
+37
-0
PatFamilyResp.java
...pica/cloud/account/account/common/resp/PatFamilyResp.java
+32
-0
PatHealthPackController.java
...nt/account/server/controller/PatHealthPackController.java
+241
-23
AccountExceptionEnum.java
...ud/account/account/server/enums/AccountExceptionEnum.java
+2
-0
AcctPatFamilyMapper.java
...ud/account/account/server/mapper/AcctPatFamilyMapper.java
+18
-0
AcctPatInfoMapper.java
...loud/account/account/server/mapper/AcctPatInfoMapper.java
+6
-0
AcctPatUnionMapper.java
...oud/account/account/server/mapper/AcctPatUnionMapper.java
+4
-0
AcctPatFamilyMapper.xml
server/src/main/resources/mybatis/AcctPatFamilyMapper.xml
+46
-0
AcctPatInfoMapper.xml
server/src/main/resources/mybatis/AcctPatInfoMapper.xml
+13
-1
AcctPatUnionMapper.xml
server/src/main/resources/mybatis/AcctPatUnionMapper.xml
+16
-0
未找到文件。
client/src/main/java/com/pica/cloud/account/account/client/PatHealthPackClient.java
0 → 100644
浏览文件 @
40bb58ab
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.resp.PatBindResp
;
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
java.util.List
;
@FeignClient
(
name
=
"13201-pica-cloud-account"
)
public
interface
PatHealthPackClient
{
@GetMapping
(
value
=
"/account/pat-health/acctId/unionId/{unionId}"
)
PicaResponse
<
Integer
>
getAcctIdByUnionId
(
@PathVariable
(
"unionId"
)
String
unionId
);
@GetMapping
(
value
=
"/account/pat-health/acctId/patId/{patientId}"
)
PicaResponse
<
Integer
>
getAcctIdByPatId
(
@PathVariable
(
"patientId"
)
Integer
patientId
);
@GetMapping
(
value
=
"/account/pat-health/directPatIds/{patientId}"
)
PicaResponse
<
List
<
Integer
>>
getDirectPatIdsByPatId
(
@PathVariable
(
"patientId"
)
Integer
patientId
);
@GetMapping
(
value
=
"/account/pat-health/familyPats/{acctId}"
)
PicaResponse
<
List
<
Integer
>>
getFamilyPatsByAcctId
(
@PathVariable
(
"acctId"
)
Integer
acctId
);
@PostMapping
(
value
=
"/account/pat-health/acct"
)
PicaResponse
saveAcct
(
@RequestBody
AcctPatInfoReq
patInfoReq
);
@PostMapping
(
value
=
"/account/pat-health/acct/bindUnion"
)
PicaResponse
<
PatBindResp
>
bindUnion
(
@RequestBody
AcctPatInfoReq
patInfoReq
);
@PostMapping
(
value
=
"/account/pat-health/family/member"
)
PicaResponse
saveMember
(
@RequestBody
AcctPatFamilyReq
familyReqReq
);
}
common/src/main/java/com/pica/cloud/account/account/common/req/AcctPatFamilyDto.java
0 → 100644
浏览文件 @
40bb58ab
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
common
.
req
;
/**
* @ClassName AcctPatFamilyDto
* @Description TODO
* @Author peijun.zhao
* @Date 2020/5/14 13:21
* @ModifyDate 2020/5/14 13:21
* @Version 1.0
*/
public
class
AcctPatFamilyDto
{
private
Integer
patientId
;
private
Integer
relation
;
public
Integer
getPatientId
()
{
return
patientId
;
}
public
void
setPatientId
(
Integer
patientId
)
{
this
.
patientId
=
patientId
;
}
public
Integer
getRelation
()
{
return
relation
;
}
public
void
setRelation
(
Integer
relation
)
{
this
.
relation
=
relation
;
}
}
common/src/main/java/com/pica/cloud/account/account/common/req/AcctPatFamilyReq.java
0 → 100644
浏览文件 @
40bb58ab
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
common
.
req
;
import
io.swagger.annotations.ApiModel
;
import
java.util.List
;
/**
* @ClassName AcctPatFamilyReq
* @Description TODO
* @Author peijun.zhao
* @Date 2020/5/14 13:21
* @ModifyDate 2020/5/14 13:21
* @Version 1.0
*/
@ApiModel
public
class
AcctPatFamilyReq
{
private
Integer
acctId
;
private
List
<
AcctPatFamilyDto
>
memberList
;
public
Integer
getAcctId
()
{
return
acctId
;
}
public
void
setAcctId
(
Integer
acctId
)
{
this
.
acctId
=
acctId
;
}
public
List
<
AcctPatFamilyDto
>
getMemberList
()
{
return
memberList
;
}
public
void
setMemberList
(
List
<
AcctPatFamilyDto
>
memberList
)
{
this
.
memberList
=
memberList
;
}
}
common/src/main/java/com/pica/cloud/account/account/common/req/AcctPatInfoReq.java
浏览文件 @
40bb58ab
// Copyright 2016-2101 Pica.
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
common
.
req
;
package
com
.
pica
.
cloud
.
account
.
account
.
common
.
req
;
import
com.sun.istack.internal.NotNull
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
/**
/**
* @ClassName AcctPatInfoReq
* @ClassName AcctPatInfoReq
...
@@ -14,16 +16,24 @@ import io.swagger.annotations.ApiModel;
...
@@ -14,16 +16,24 @@ import io.swagger.annotations.ApiModel;
@ApiModel
@ApiModel
public
class
AcctPatInfoReq
{
public
class
AcctPatInfoReq
{
// @NotNull
private
String
name
;
private
String
name
;
// @NotNull
private
String
mobile
;
private
String
mobile
;
private
String
unionId
;
private
String
unionId
;
private
Integer
acctId
;
private
Integer
acctId
;
@ApiModelProperty
(
"1.云鹊健康小程序"
)
private
Integer
type
;
private
Integer
type
;
private
Integer
patientId
;
@ApiModelProperty
(
"1:本人 2:父母 3:子女 4:配偶 5:其他"
)
private
Integer
memberType
;
public
String
getName
()
{
public
String
getName
()
{
return
name
;
return
name
;
}
}
...
@@ -63,4 +73,20 @@ public class AcctPatInfoReq {
...
@@ -63,4 +73,20 @@ public class AcctPatInfoReq {
public
void
setType
(
Integer
type
)
{
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
this
.
type
=
type
;
}
}
public
Integer
getPatientId
()
{
return
patientId
;
}
public
void
setPatientId
(
Integer
patientId
)
{
this
.
patientId
=
patientId
;
}
public
Integer
getMemberType
()
{
return
memberType
;
}
public
void
setMemberType
(
Integer
memberType
)
{
this
.
memberType
=
memberType
;
}
}
}
common/src/main/java/com/pica/cloud/account/account/common/resp/PatBindResp.java
0 → 100644
浏览文件 @
40bb58ab
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
common
.
resp
;
import
io.swagger.annotations.ApiModel
;
/**
* @ClassName PatBindResp
* @Description TODO
* @Author peijun.zhao
* @Date 2020/5/13 13:24
* @ModifyDate 2020/5/13 13:24
* @Version 1.0
*/
@ApiModel
(
description
=
"建立微信与账号关联关系-resp"
)
public
class
PatBindResp
{
private
boolean
bindStatus
;
private
String
msg
;
public
boolean
isBindStatus
()
{
return
bindStatus
;
}
public
void
setBindStatus
(
boolean
bindStatus
)
{
this
.
bindStatus
=
bindStatus
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
common/src/main/java/com/pica/cloud/account/account/common/resp/PatFamilyResp.java
0 → 100644
浏览文件 @
40bb58ab
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
common
.
resp
;
import
com.pica.cloud.account.account.common.req.AcctPatFamilyDto
;
import
io.swagger.annotations.ApiModel
;
import
java.util.List
;
@ApiModel
(
description
=
"建立家庭服务关系-resp"
)
public
class
PatFamilyResp
{
private
boolean
successFlag
;
private
List
<
AcctPatFamilyDto
>
failMemberList
;
public
boolean
isSuccessFlag
()
{
return
successFlag
;
}
public
void
setSuccessFlag
(
boolean
successFlag
)
{
this
.
successFlag
=
successFlag
;
}
public
List
<
AcctPatFamilyDto
>
getFailMemberList
()
{
return
failMemberList
;
}
public
void
setFailMemberList
(
List
<
AcctPatFamilyDto
>
failMemberList
)
{
this
.
failMemberList
=
failMemberList
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/controller/PatHealthPackController.java
浏览文件 @
40bb58ab
// Copyright 2016-2101 Pica.
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
import
com.pica.cloud.account.account.common.req.AcctPatFamilyDto
;
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.AcctPatInfoReq
;
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
;
import
com.pica.cloud.account.account.server.entity.AcctPatInfo
;
import
com.pica.cloud.account.account.server.entity.AcctPatInfo
;
import
com.pica.cloud.account.account.server.entity.AcctPatUnion
;
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.foundation.encryption.common.constants.EncryptConstants
;
import
com.pica.cloud.foundation.encryption.util.EncryptUtils
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
/**
/**
* @Description TODO
* @Description TODO
* @Author peijun.zhao
* @Author peijun.zhao
* @Date 2020/5/12 15:55
* @Date 2020/5/12 15:55
* @ModifyDate 2020/5/12 15:55
* @ModifyDate 2020/5/12 15:55
* @Params
* @Params
* @Return
* @Return
*/
*/
@Api
(
description
=
"健康包"
)
@Api
(
description
=
"健康包"
)
@RestController
@RestController
@RequestMapping
(
"/pat
/
health"
)
@RequestMapping
(
"/pat
-
health"
)
public
class
PatHealthPackController
{
public
class
PatHealthPackController
{
@ApiOperation
(
"获取主账户ID"
)
@Autowired
@GetMapping
(
value
=
"/{unionId}"
)
private
AcctPatInfoMapper
patInfoMapper
;
public
PicaResponse
getAcctIdByUnionId
(
@PathVariable
(
"unionId"
)
String
unionId
)
throws
Exception
{
return
PicaResponse
.
toResponse
(
"mockUnionId-123"
);
@Autowired
private
AcctPatUnionMapper
patUnionMapper
;
@Autowired
private
AcctPatFamilyMapper
patFamilyMapper
;
@ApiOperation
(
"获取主账户ID-根据unionId"
)
@GetMapping
(
value
=
"/acctId/unionId/{unionId}"
)
public
PicaResponse
<
Integer
>
getAcctIdByUnionId
(
@PathVariable
(
"unionId"
)
String
unionId
)
throws
Exception
{
AcctPatUnion
patUnion
=
patUnionMapper
.
selectByUnionId
(
unionId
);
return
PicaResponse
.
toResponse
(
patUnion
==
null
?
0
:
patUnion
.
getAcctId
());
}
@ApiOperation
(
"获取主账户ID-作为监护人自身patientId"
)
@GetMapping
(
value
=
"/acctId/patId/{patientId}"
)
public
PicaResponse
<
Integer
>
getAcctIdByPatId
(
@PathVariable
(
"patientId"
)
Integer
patientId
)
throws
Exception
{
List
<
AcctPatFamily
>
patFamilyList
=
patFamilyMapper
.
getByPatIdSelf
(
patientId
);
if
(
CollectionUtils
.
isEmpty
(
patFamilyList
))
{
//该居民id无 家庭成员记录,返回0
return
PicaResponse
.
toResponse
(
0
);
}
if
(
patFamilyList
.
size
()
>
1
)
{
//db中数据有异常,log todo 抛异常
return
PicaResponse
.
toResponse
(
patFamilyList
.
get
(
0
).
getAcctId
());
}
return
PicaResponse
.
toResponse
(
patFamilyList
.
get
(
0
).
getAcctId
());
}
@ApiOperation
(
"上级的监护人 + 下级所有成员 patientId list"
)
@GetMapping
(
value
=
"/directPatIds/{patientId}"
)
public
PicaResponse
<
List
<
Integer
>>
getDirectPatIdsByPatId
(
@PathVariable
(
"patientId"
)
Integer
patientId
)
throws
Exception
{
List
<
Integer
>
patIds
=
new
ArrayList
<>();
List
<
AcctPatFamily
>
memberList
=
patFamilyMapper
.
getByPatIdNotSelf
(
patientId
);
if
(
CollectionUtils
.
isEmpty
(
memberList
))
{
//该居民id无 家庭成员记录,返回null
return
PicaResponse
.
toResponse
(
patIds
);
}
if
(
memberList
.
size
()
>
1
)
{
//db中数据有异常,log todo 抛异常
return
PicaResponse
.
toResponse
(
memberList
.
get
(
0
).
getAcctId
());
}
//加入病人id所在家庭组的监护人- 上级
AcctPatFamily
parentMember
=
patFamilyMapper
.
getSelfByAcctId
(
memberList
.
get
(
0
).
getAcctId
());
patIds
.
add
(
parentMember
.
getPatientId
());
//下级所有成员 包括自身
List
<
AcctPatFamily
>
patFamilyList
=
patFamilyMapper
.
getListByAcctId
(
memberList
.
get
(
0
).
getAcctId
());
patIds
.
addAll
(
patFamilyList
.
stream
().
map
(
obj
->
obj
.
getPatientId
()).
collect
(
toList
()));
return
PicaResponse
.
toResponse
(
patIds
);
}
@ApiOperation
(
"根据accid获取家庭关系idList"
)
@GetMapping
(
value
=
"/familyPats/{acctId}"
)
public
PicaResponse
<
List
<
Integer
>>
getFamilyPatsByAcctId
(
@PathVariable
(
"acctId"
)
Integer
acctId
)
throws
Exception
{
List
<
AcctPatFamily
>
patFamilyList
=
patFamilyMapper
.
getListByAcctId
(
acctId
);
return
PicaResponse
.
toResponse
(
patFamilyList
);
}
}
@ApiOperation
(
"保存主账户"
)
@ApiOperation
(
"保存主账户"
)
@PostMapping
(
value
=
"/acct"
)
@PostMapping
(
value
=
"/acct"
)
public
PicaResponse
saveAcct
(
@RequestBody
AcctPatInfoReq
patInfoReq
)
throws
Exception
{
@Transactional
public
PicaResponse
<
Integer
>
saveAcct
(
@RequestBody
AcctPatInfoReq
patInfoReq
)
throws
Exception
{
if
(
Objects
.
isNull
(
patInfoReq
.
getPatientId
())
||
patInfoReq
.
getPatientId
()
==
0
||
Objects
.
isNull
(
patInfoReq
.
getName
())
||
Objects
.
isNull
(
patInfoReq
.
getMobile
())
){
//log // TODO: 2020/5/14
return
null
;
}
String
mobileEncrypt
=
EncryptUtils
.
encryptContent
(
patInfoReq
.
getMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
);
//check 手机号是否已是主账户
// AcctPatInfo query = new AcctPatInfo();
// query.setMobilePhone(mobileEncrypt);
// List<AcctPatInfo> acctList = patInfoMapper.selectByCondition(query);
List
<
AcctPatFamily
>
patFamilyList
=
patFamilyMapper
.
getByPatIdSelf
(
patInfoReq
.
getPatientId
());
if
(
CollectionUtils
.
isNotEmpty
(
patFamilyList
))
{
// 重复时返回已有账户
return
PicaResponse
.
toResponse
(
patFamilyList
.
get
(
0
));
}
//手机号无重复时创建
AcctPatInfo
patInfo
=
new
AcctPatInfo
();
AcctPatInfo
patInfo
=
new
AcctPatInfo
();
patInfo
.
setName
(
"db已有用户A"
);
patInfo
.
setName
(
patInfoReq
.
getName
());
patInfo
.
setMobilePhone
(
"1234567"
);
patInfo
.
setMobilePhone
(
mobileEncrypt
);
return
PicaResponse
.
toResponse
(
patInfo
);
patInfo
.
setRegisterProduct
(
1
);
patInfo
.
setRegisterSource
(
1
);
//todo
patInfo
.
setRegTime
(
new
Date
());
patInfo
.
setDeleteFlag
(
1
);
patInfo
.
setCreatedId
(
0
);
//todo 本人
patInfo
.
setModifiedId
(
0
);
patInfo
.
setCreatedTime
(
new
Date
());
patInfo
.
setModifiedTime
(
new
Date
());
patInfoMapper
.
insert
(
patInfo
);
AcctPatFamily
patFamily
=
new
AcctPatFamily
();
patFamily
.
setAcctId
(
patInfo
.
getId
());
patFamily
.
setPatientId
(
patInfoReq
.
getPatientId
());
patFamily
.
setRelation
(
1
);
patFamily
.
setDeleteFlag
(
1
);
patFamily
.
setCreatedId
(
0
);
//todo 本人
patFamily
.
setModifiedId
(
0
);
patFamily
.
setCreatedTime
(
new
Date
());
patFamily
.
setModifiedTime
(
new
Date
());
patFamilyMapper
.
insert
(
patFamily
);
return
PicaResponse
.
toResponse
(
patInfo
.
getId
());
}
}
@ApiOperation
(
"建立微信与账号关联关系"
)
@ApiOperation
(
"建立微信与账号关联关系"
)
@PostMapping
(
value
=
"/bindUnion"
)
@PostMapping
(
value
=
"/acct/bindUnion"
)
public
PicaResponse
bindUnion
(
@RequestBody
AcctPatInfoReq
patInfoReq
)
throws
Exception
{
public
PicaResponse
<
PatBindResp
>
bindUnion
(
@RequestBody
AcctPatInfoReq
patInfoReq
)
throws
Exception
{
// AcctPatInfo patInfo = new AcctPatInfo();
PatBindResp
resp
=
new
PatBindResp
();
// patInfo.setName("db已有用户A");
//unionid是否已被其他账号绑定
// patInfo.setMobilePhone("1234567");
AcctPatUnion
patUnion
=
patUnionMapper
.
selectByUnionId
(
patInfoReq
.
getUnionId
());
return
PicaResponse
.
toResponse
(
"success"
);
if
(
Objects
.
nonNull
(
patUnion
))
{
//被绑定
//且非传入acct_d
if
(!
patUnion
.
getAcctId
().
equals
(
patInfoReq
.
getAcctId
()))
{
resp
.
setBindStatus
(
false
);
resp
.
setMsg
(
"该unionid已被其他手机号绑定"
);
}
else
{
//unionId,已被传入acctId绑定,返回 true
resp
.
setBindStatus
(
true
);
}
}
else
{
//acctId是否已绑定其他unionId
patUnion
=
patUnionMapper
.
selectByAcctId
(
patInfoReq
.
getAcctId
());
if
(
Objects
.
nonNull
(
patUnion
))
{
//acctId已有unionId,且不是传入的unionId
if
(!
patUnion
.
getUnionId
().
equals
(
patInfoReq
.
getUnionId
()))
{
resp
.
setBindStatus
(
false
);
resp
.
setMsg
(
"该手机号已绑定其他微信号,请尝试使用其他手机号"
);
}
}
else
{
//未绑定 新增绑定记录
AcctPatUnion
entity
=
new
AcctPatUnion
();
entity
.
setAcctId
(
patInfoReq
.
getAcctId
());
entity
.
setUnionId
(
patInfoReq
.
getUnionId
());
entity
.
setUnionType
(
1
);
entity
.
setDeleteFlag
(
1
);
entity
.
setCreatedId
(
0
);
//todo 本人
entity
.
setModifiedId
(
0
);
entity
.
setCreatedTime
(
new
Date
());
entity
.
setModifiedTime
(
new
Date
());
patUnionMapper
.
insert
(
entity
);
resp
.
setBindStatus
(
true
);
}
}
return
PicaResponse
.
toResponse
(
resp
);
}
}
@ApiOperation
(
"建立微信与账号关联关系"
)
@ApiOperation
(
"建立家庭服务关系"
)
@PostMapping
(
value
=
"/bindUnion"
)
@PostMapping
(
value
=
"/family/member"
)
public
PicaResponse
bindUnion1
(
@RequestBody
AcctPatInfoReq
patInfoReq
)
throws
Exception
{
public
PicaResponse
saveMember
(
@RequestBody
AcctPatFamilyReq
familyReqReq
)
throws
Exception
{
// AcctPatInfo patInfo = new AcctPatInfo();
// patInfo.setName("db已有用户A");
PatFamilyResp
resp
=
new
PatFamilyResp
();
// patInfo.setMobilePhone("1234567");
boolean
successFlag
=
true
;
return
PicaResponse
.
toResponse
(
"success"
);
//check member valid
List
<
AcctPatFamilyDto
>
memberList
=
familyReqReq
.
getMemberList
();
for
(
AcctPatFamilyDto
member
:
memberList
){
//null check todo
}
List
<
AcctPatFamilyDto
>
failList
=
new
ArrayList
<>();
List
<
Integer
>
patIds
=
memberList
.
stream
().
map
(
obj
->
obj
.
getPatientId
()).
collect
(
toList
());
List
<
AcctPatFamilyDto
>
relatedPats
=
new
ArrayList
<>();
List
<
AcctPatFamily
>
familyList
=
patFamilyMapper
.
getListByPatIds
(
patIds
);
for
(
AcctPatFamily
member
:
familyList
){
if
(!
familyReqReq
.
getAcctId
().
equals
(
member
.
getAcctId
())){
AcctPatFamilyDto
failOne
=
new
AcctPatFamilyDto
();
failOne
.
setPatientId
(
member
.
getPatientId
());
failOne
.
setRelation
(
member
.
getRelation
());
failList
.
add
(
failOne
);
successFlag
=
false
;
}
else
{
//居民已被传入acctId关联为家庭成员,不需要再保存
AcctPatFamilyDto
failOneRelated
=
new
AcctPatFamilyDto
();
failOneRelated
.
setRelation
(
member
.
getRelation
());
failOneRelated
.
setPatientId
(
member
.
getPatientId
());
relatedPats
.
add
(
failOneRelated
);
}
}
//已关联自身居民list
if
(
relatedPats
.
size
()
>
0
){
successFlag
=
false
;
failList
.
addAll
(
relatedPats
);
}
//通过后 再建立家庭关系
if
(
successFlag
){
for
(
AcctPatFamilyDto
member
:
memberList
){
AcctPatFamily
entity
=
new
AcctPatFamily
();
entity
.
setAcctId
(
familyReqReq
.
getAcctId
());
entity
.
setPatientId
(
member
.
getPatientId
());
entity
.
setRelation
(
member
.
getRelation
());
entity
.
setDeleteFlag
(
1
);
entity
.
setCreatedId
(
familyReqReq
.
getAcctId
());
entity
.
setModifiedId
(
familyReqReq
.
getAcctId
());
entity
.
setCreatedTime
(
new
Date
());
entity
.
setModifiedTime
(
new
Date
());
patFamilyMapper
.
insert
(
entity
);
}
}
resp
.
setSuccessFlag
(
successFlag
);
resp
.
setFailMemberList
(
failList
);
return
PicaResponse
.
toResponse
(
resp
);
}
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/enums/AccountExceptionEnum.java
浏览文件 @
40bb58ab
...
@@ -56,6 +56,8 @@ public enum AccountExceptionEnum {
...
@@ -56,6 +56,8 @@ public enum AccountExceptionEnum {
PICA_MOBILE_NOT_SETED_PASSWORD_H5
(
"216548"
,
"该手机号尚未设置密码,设置密码请前往云鹊医APP,或使用其他方式登录。"
),
PICA_MOBILE_NOT_SETED_PASSWORD_H5
(
"216548"
,
"该手机号尚未设置密码,设置密码请前往云鹊医APP,或使用其他方式登录。"
),
PICA_PWD_MISMATCH_5_H5
(
"216549"
,
"该账号密码错误次数已达上限请24小时后再试,或请使用其他登录方式"
),
PICA_PWD_MISMATCH_5_H5
(
"216549"
,
"该账号密码错误次数已达上限请24小时后再试,或请使用其他登录方式"
),
PAT_ACCT_HAS_EXIST
(
"216550"
,
"账号已存在"
),
xxx_xxx
(
""
,
""
);
xxx_xxx
(
""
,
""
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/mapper/AcctPatFamilyMapper.java
浏览文件 @
40bb58ab
...
@@ -2,6 +2,8 @@ package com.pica.cloud.account.account.server.mapper;
...
@@ -2,6 +2,8 @@ package com.pica.cloud.account.account.server.mapper;
import
com.pica.cloud.account.account.server.entity.AcctPatFamily
;
import
com.pica.cloud.account.account.server.entity.AcctPatFamily
;
import
java.util.List
;
public
interface
AcctPatFamilyMapper
{
public
interface
AcctPatFamilyMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
deleteByPrimaryKey
(
Integer
id
);
...
@@ -14,4 +16,20 @@ public interface AcctPatFamilyMapper {
...
@@ -14,4 +16,20 @@ public interface AcctPatFamilyMapper {
int
updateByPrimaryKeySelective
(
AcctPatFamily
record
);
int
updateByPrimaryKeySelective
(
AcctPatFamily
record
);
int
updateByPrimaryKey
(
AcctPatFamily
record
);
int
updateByPrimaryKey
(
AcctPatFamily
record
);
/** 获取居民id是本人的家庭组记录- 作为家庭主账户、本人居民id,单条ok 多条异常数据 */
List
<
AcctPatFamily
>
getByPatIdSelf
(
Integer
patId
);
/** 查询居民id所在家庭组监护人- 作为家庭成员、非主账户本人居民id,单条ok 多条异常数据 */
List
<
AcctPatFamily
>
getByPatIdNotSelf
(
Integer
patId
);
/** 获取主账户下所有家庭成员 */
List
<
AcctPatFamily
>
getListByAcctId
(
Integer
acctId
);
/** 根据账户id 获取主账户居民id */
AcctPatFamily
getSelfByAcctId
(
Integer
acctId
);
List
<
AcctPatFamily
>
getListByPatIds
(
List
<
Integer
>
patIds
);
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/mapper/AcctPatInfoMapper.java
浏览文件 @
40bb58ab
...
@@ -2,6 +2,9 @@ package com.pica.cloud.account.account.server.mapper;
...
@@ -2,6 +2,9 @@ package com.pica.cloud.account.account.server.mapper;
import
com.pica.cloud.account.account.server.entity.AcctPatInfo
;
import
com.pica.cloud.account.account.server.entity.AcctPatInfo
;
import
java.util.List
;
import
java.util.Map
;
public
interface
AcctPatInfoMapper
{
public
interface
AcctPatInfoMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
deleteByPrimaryKey
(
Integer
id
);
...
@@ -14,4 +17,7 @@ public interface AcctPatInfoMapper {
...
@@ -14,4 +17,7 @@ public interface AcctPatInfoMapper {
int
updateByPrimaryKeySelective
(
AcctPatInfo
record
);
int
updateByPrimaryKeySelective
(
AcctPatInfo
record
);
int
updateByPrimaryKey
(
AcctPatInfo
record
);
int
updateByPrimaryKey
(
AcctPatInfo
record
);
List
<
AcctPatInfo
>
selectByCondition
(
AcctPatInfo
record
);
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/mapper/AcctPatUnionMapper.java
浏览文件 @
40bb58ab
...
@@ -14,4 +14,8 @@ public interface AcctPatUnionMapper {
...
@@ -14,4 +14,8 @@ public interface AcctPatUnionMapper {
int
updateByPrimaryKeySelective
(
AcctPatUnion
record
);
int
updateByPrimaryKeySelective
(
AcctPatUnion
record
);
int
updateByPrimaryKey
(
AcctPatUnion
record
);
int
updateByPrimaryKey
(
AcctPatUnion
record
);
AcctPatUnion
selectByUnionId
(
String
unionId
);
AcctPatUnion
selectByAcctId
(
Integer
acctId
);
}
}
\ No newline at end of file
server/src/main/resources/mybatis/AcctPatFamilyMapper.xml
浏览文件 @
40bb58ab
...
@@ -139,4 +139,50 @@
...
@@ -139,4 +139,50 @@
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</update>
<select
id=
"getListByAcctId"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from account_pat_family
where acct_id = #{acctId,jdbcType=INTEGER}
and delete_flag = 1;
</select>
<select
id=
"getSelfByAcctId"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from account_pat_family
where acct_id = #{acctId,jdbcType=INTEGER} and relation = 1
and delete_flag = 1;
</select>
<select
id=
"getByPatIdSelf"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from account_pat_family
where patient_id = #{patientId,jdbcType=INTEGER}
and relation = 1
and delete_flag = 1;
</select>
<select
id=
"getByPatIdNotSelf"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from account_pat_family
where patient_id = #{patientId,jdbcType=INTEGER}
AND relation != 1
and delete_flag = 1;
</select>
<select
id=
"getListByPatIds"
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 delete_flag = 1;
</select>
</mapper>
</mapper>
\ No newline at end of file
server/src/main/resources/mybatis/AcctPatInfoMapper.xml
浏览文件 @
40bb58ab
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
delete from account_pat_info
delete from account_pat_info
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</delete>
</delete>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.AcctPatInfo"
>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.AcctPatInfo"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into account_pat_info (id, name, mobile_phone,
insert into account_pat_info (id, name, mobile_phone,
password, register_product, register_source,
password, register_product, register_source,
birthday, age, sex, id_card,
birthday, age, sex, id_card,
...
@@ -220,4 +220,16 @@
...
@@ -220,4 +220,16 @@
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</update>
<select
id=
"selectByCondition"
resultMap=
"BaseResultMap"
parameterType=
"com.pica.cloud.account.account.server.entity.AcctPatInfo"
>
select
<include
refid=
"Base_Column_List"
/>
from account_pat_info
where delete_flag = 1
<if
test=
"mobilePhone != null"
>
AND mobile_phone = #{mobilePhone,jdbcType=VARCHAR}
</if>
</select>
</mapper>
</mapper>
\ No newline at end of file
server/src/main/resources/mybatis/AcctPatUnionMapper.xml
浏览文件 @
40bb58ab
...
@@ -139,4 +139,20 @@
...
@@ -139,4 +139,20 @@
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</update>
<select
id=
"selectByUnionId"
parameterType=
"java.lang.String"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from account_pat_union
where union_id = #{unionId,jdbcType=VARCHAR}
and delete_flag = 1;
</select>
<select
id=
"selectByAcctId"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from account_pat_union
where acct_id = #{acctId,jdbcType=INTEGER}
and delete_flag = 1;
</select>
</mapper>
</mapper>
\ No newline at end of file
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录