提交 00d8a877 编写于 作者: xinxu.wang's avatar xinxu.wang

Merge branch 'dev-accountPat-0522' into 'release'

Dev account pat 0522

See merge request !135
流水线 #52956 已失败 于阶段
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId> <groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-client</artifactId> <artifactId>pica-cloud-account-client</artifactId>
<version>1.1.7-SNAPSHOT</version> <version>1.1.8-SNAPSHOT</version>
<name>pica-cloud-account-client</name> <name>pica-cloud-account-client</name>
<packaging>jar</packaging> <packaging>jar</packaging>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<dependency> <dependency>
<groupId>com.pica.cloud.account</groupId> <groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId> <artifactId>pica-cloud-account-common</artifactId>
<version>1.1.7-SNAPSHOT</version> <version>1.1.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
......
package com.pica.cloud.account.account.client; package com.pica.cloud.account.account.client;
import com.pica.cloud.account.account.common.req.*; 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.*;
import com.pica.cloud.account.account.common.resp.AcctSelfPatId;
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 com.pica.cloud.foundation.entity.PicaResponse;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -18,12 +15,18 @@ public interface PatHealthPackClient { ...@@ -18,12 +15,18 @@ public interface PatHealthPackClient {
@GetMapping(value = "/account/pat-health/acctId/unionId/{unionId}") @GetMapping(value = "/account/pat-health/acctId/unionId/{unionId}")
PicaResponse<Integer> getAcctIdByUnionId(@PathVariable("unionId") String unionId); PicaResponse<Integer> getAcctIdByUnionId(@PathVariable("unionId") String unionId);
@GetMapping(value = "/account/pat-health/unionId/acctId/{acctId}")
PicaResponse<String> getUnionIdByAcctId(@PathVariable("acctId") Integer acctId);
@GetMapping(value = "/account/pat-health/acctId/patId/{patientId}") @GetMapping(value = "/account/pat-health/acctId/patId/{patientId}")
PicaResponse<Integer> getAcctIdByPatId(@PathVariable("patientId") Integer patientId); PicaResponse<Integer> getAcctIdByPatId(@PathVariable("patientId") Integer patientId);
@GetMapping(value = "/account/pat-health/directPatIds/{patientId}") @GetMapping(value = "/account/pat-health/directPatIds/{patientId}")
PicaResponse<List<Integer>> getDirectPatIdsByPatId(@PathVariable("patientId") Integer patientId); PicaResponse<List<Integer>> getDirectPatIdsByPatId(@PathVariable("patientId") Integer patientId);
@GetMapping(value = "/account/pat-health/directPatIds/unionId")
PicaResponse<List<Integer>> getDirectPatIdsByUnionId(@RequestParam("unionId") String unionId);
@GetMapping(value = "/account/pat-health/familyPats/{acctId}/containAcct/{containAcct}") @GetMapping(value = "/account/pat-health/familyPats/{acctId}/containAcct/{containAcct}")
PicaResponse<PatFamilyResp> getFamilyPatsByAcctId(@PathVariable("acctId") Integer acctId, @PathVariable("containAcct") Integer containAcct); PicaResponse<PatFamilyResp> getFamilyPatsByAcctId(@PathVariable("acctId") Integer acctId, @PathVariable("containAcct") Integer containAcct);
...@@ -39,6 +42,9 @@ public interface PatHealthPackClient { ...@@ -39,6 +42,9 @@ public interface PatHealthPackClient {
@GetMapping(value = "/account/pat-health/familyAcct/patId/{patId}") @GetMapping(value = "/account/pat-health/familyAcct/patId/{patId}")
PicaResponse<Integer> getFamilyAcctPatId(@PathVariable("patId") Integer patId); PicaResponse<Integer> getFamilyAcctPatId(@PathVariable("patId") Integer patId);
@GetMapping(value = "/account/pat-health/familyAcct/self/patId/{patId}")
PicaResponse<List<Integer>> getRelationSelfAcctPatId(@PathVariable("patId") Integer patId);
@PostMapping(value = "/account/pat-health/familyAcct/patIds") @PostMapping(value = "/account/pat-health/familyAcct/patIds")
PicaResponse<AcctPatIdResp> getFamilyAcctPatIds(@RequestBody AcctPatIdReq acctPatIdReq); PicaResponse<AcctPatIdResp> getFamilyAcctPatIds(@RequestBody AcctPatIdReq acctPatIdReq);
...@@ -57,4 +63,9 @@ public interface PatHealthPackClient { ...@@ -57,4 +63,9 @@ public interface PatHealthPackClient {
@PostMapping(value = "/account/pat-health/acct/updatePatByAcctId") @PostMapping(value = "/account/pat-health/acct/updatePatByAcctId")
PicaResponse<Boolean> updatePatByAcctId(@RequestBody UpdateAcctPatInfoReq req); PicaResponse<Boolean> updatePatByAcctId(@RequestBody UpdateAcctPatInfoReq req);
@GetMapping(value = "/account/pat-health/acctInfo/patId/{patientId}")
PicaResponse<List<AcctSelfPatInfoResp>> getAcctInfoByPatId(@PathVariable("patientId") Integer patientId);
@GetMapping(value = "/account/pat-health/acctInfo/patInfo/{unionId}")
PicaResponse<AcctSelfPatInfoResp> getAcctInfoByUnionId(@PathVariable("unionId") String unionId);
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId> <groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId> <artifactId>pica-cloud-account-common</artifactId>
<version>1.1.7-SNAPSHOT</version> <version>1.1.8-SNAPSHOT</version>
<name>pica-cloud-account-common</name> <name>pica-cloud-account-common</name>
<packaging>jar</packaging> <packaging>jar</packaging>
......
package com.pica.cloud.account.account.common.resp;
public class AcctSelfPatInfoResp {
private Integer accId;
private Integer patientId;
private String name;
private String mobilePhone;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobilePhone() {
return mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
public Integer getAccId() {
return accId;
}
public void setAccId(Integer accId) {
this.accId = accId;
}
public Integer getPatientId() {
return patientId;
}
public void setPatientId(Integer patientId) {
this.patientId = patientId;
}
}
[2023-05-26 11:10:42.328] [INFO ] [main] org.springframework.context.support.AbstractApplicationContext.prepareRefresh - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@48c4245d: startup date [Fri May 26 11:10:42 CST 2023]; root of context hierarchy
[2023-05-26 11:10:42.635] [INFO ] [main] org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.<init> - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
[2023-05-26 11:10:42.671] [INFO ] [main] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization - Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$f6c6f5d1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2023-05-26 11:10:42.957] [INFO ] [main] org.springframework.cloud.netflix.eureka.InstanceInfoFactory.create - Setting initial instance status as: STARTING
[2023-05-26 11:10:43.082] [INFO ] [main] com.netflix.discovery.DiscoveryClient.<init> - Initializing Eureka in region us-east-1
[2023-05-26 11:10:43.258] [INFO ] [main] com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using JSON encoding codec LegacyJacksonJson
[2023-05-26 11:10:43.258] [INFO ] [main] com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using JSON decoding codec LegacyJacksonJson
[2023-05-26 11:10:43.423] [INFO ] [main] com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using XML encoding codec XStreamXml
[2023-05-26 11:10:43.423] [INFO ] [main] com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using XML decoding codec XStreamXml
[2023-05-26 11:10:43.697] [INFO ] [main] com.netflix.discovery.shared.resolver.aws.ConfigClusterResolver.getClusterEndpoints - Resolving eureka endpoints via configuration
[2023-05-26 11:10:43.726] [INFO ] [main] com.netflix.discovery.DiscoveryClient.fetchRegistry - Disable delta property : false
[2023-05-26 11:10:43.726] [INFO ] [main] com.netflix.discovery.DiscoveryClient.fetchRegistry - Single vip registry refresh property : null
[2023-05-26 11:10:43.726] [INFO ] [main] com.netflix.discovery.DiscoveryClient.fetchRegistry - Force full registry fetch : false
[2023-05-26 11:10:43.727] [INFO ] [main] com.netflix.discovery.DiscoveryClient.fetchRegistry - Application is null : false
[2023-05-26 11:10:43.727] [INFO ] [main] com.netflix.discovery.DiscoveryClient.fetchRegistry - Registered Applications size is zero : true
[2023-05-26 11:10:43.727] [INFO ] [main] com.netflix.discovery.DiscoveryClient.fetchRegistry - Application version is -1: true
[2023-05-26 11:10:43.727] [INFO ] [main] com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry - Getting all instance registry info from the eureka server
[2023-05-26 11:10:43.932] [INFO ] [main] com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry - The response status is 200
[2023-05-26 11:10:43.935] [INFO ] [main] com.netflix.discovery.DiscoveryClient.initScheduledTasks - Not registering with Eureka server per configuration
[2023-05-26 11:10:43.941] [INFO ] [main] com.netflix.discovery.DiscoveryClient.<init> - Discovery Client initialized at timestamp 1685070643941 with initial instances count: 90
[2023-05-26 11:10:44.219] [INFO ] [main] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate - Fetching config from server at: http://192.168.110.122:7892/
[2023-05-26 11:10:45.415] [INFO ] [main] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate - Located environment: name=com.pica.cloud.account, profiles=[dev], label=publish, version=d0099e1dcf49dd68033b50965489f3dce8498752, state=null
[2023-05-26 11:10:45.416] [INFO ] [main] org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize - Located property source: CompositePropertySource [name='configService', propertySources=[MapPropertySource {name='configClient'}, MapPropertySource {name='http://192.168.110.53/com.pica.cloud.account/pica-cloud-configuration.git/application-dev.properties'}]]
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
<dependency> <dependency>
<groupId>com.pica.cloud.account</groupId> <groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId> <artifactId>pica-cloud-account-common</artifactId>
<version>1.1.7-SNAPSHOT</version> <version>1.1.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
package com.pica.cloud.account.account.server.controller; package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.common.req.*; 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.*;
import com.pica.cloud.account.account.common.resp.AcctSelfPatId;
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.AccountPatFamilyRecordService; import com.pica.cloud.account.account.server.service.AccountPatFamilyRecordService;
import com.pica.cloud.account.account.server.service.PatHealthPackService; import com.pica.cloud.account.account.server.service.PatHealthPackService;
import com.pica.cloud.foundation.entity.PicaResponse; import com.pica.cloud.foundation.entity.PicaResponse;
...@@ -41,6 +38,12 @@ public class PatHealthPackController { ...@@ -41,6 +38,12 @@ public class PatHealthPackController {
return PicaResponse.toResponse(packService.getAcctIdByUnionId(unionId)); return PicaResponse.toResponse(packService.getAcctIdByUnionId(unionId));
} }
@ApiOperation("获取unionId-根据主账户ID")
@GetMapping(value = "/unionId/acctId/{acctId}")
public PicaResponse<String> getUnionIdByAcctId(@PathVariable("acctId") Integer acctId) throws Exception {
return PicaResponse.toResponse(packService.getUnionIdByAcctId(acctId));
}
@ApiOperation("获取主账户ID-作为监护人自身patientId") @ApiOperation("获取主账户ID-作为监护人自身patientId")
@GetMapping(value = "/acctId/patId/{patientId}") @GetMapping(value = "/acctId/patId/{patientId}")
public PicaResponse<Integer> getAcctIdByPatId(@PathVariable("patientId") Integer patientId) throws Exception { public PicaResponse<Integer> getAcctIdByPatId(@PathVariable("patientId") Integer patientId) throws Exception {
...@@ -53,6 +56,12 @@ public class PatHealthPackController { ...@@ -53,6 +56,12 @@ public class PatHealthPackController {
return PicaResponse.toResponse(packService.getDirectPatIdsByPatId(patientId)); return PicaResponse.toResponse(packService.getDirectPatIdsByPatId(patientId));
} }
@ApiOperation("所在家庭组的监护人 + 同级家庭成员 + 下级所有成员 patientId list,去除自身、去重;")
@GetMapping(value = "/directPatIds/unionId")
public PicaResponse<List<Integer>> getDirectPatIdsByUnionId(@RequestParam("unionId") String unionId) throws Exception {
return PicaResponse.toResponse(packService.getDirectPatIdsByUnionId(unionId));
}
@ApiOperation("根据accid获取自身家庭成员List;containAcct:0 包含自身 1 不包含自身") @ApiOperation("根据accid获取自身家庭成员List;containAcct:0 包含自身 1 不包含自身")
@GetMapping(value = "/familyPats/{acctId}/containAcct/{containAcct}") @GetMapping(value = "/familyPats/{acctId}/containAcct/{containAcct}")
public PicaResponse<PatFamilyResp> getFamilyPatsByAcctId(@PathVariable("acctId") Integer acctId, @PathVariable("containAcct") Integer containAcct) throws Exception { public PicaResponse<PatFamilyResp> getFamilyPatsByAcctId(@PathVariable("acctId") Integer acctId, @PathVariable("containAcct") Integer containAcct) throws Exception {
...@@ -84,6 +93,13 @@ public class PatHealthPackController { ...@@ -84,6 +93,13 @@ public class PatHealthPackController {
return PicaResponse.toResponse(packService.getFamilyAcctPatId(patId)); return PicaResponse.toResponse(packService.getFamilyAcctPatId(patId));
} }
@ApiOperation("根据patientId获取监护人acctId),本人成员(监护人patId)")
@GetMapping(value = "/familyAcct/self/patId/{patId}")
public PicaResponse<List<Integer>> getRelationSelfAcctPatId(@PathVariable("patId") Integer patId) throws Exception {
return PicaResponse.toResponse(packService.getFamilyAcctIdsPatId(patId));
}
@ApiOperation("根据patientIds 获取监护人-本人监护人(自身patId),本人成员(监护人patId)") @ApiOperation("根据patientIds 获取监护人-本人监护人(自身patId),本人成员(监护人patId)")
@PostMapping(value = "/familyAcct/patIds") @PostMapping(value = "/familyAcct/patIds")
public PicaResponse<AcctPatIdResp> getFamilyAcctPatIds(@RequestBody AcctPatIdReq acctPatIdReq) throws Exception { public PicaResponse<AcctPatIdResp> getFamilyAcctPatIds(@RequestBody AcctPatIdReq acctPatIdReq) throws Exception {
...@@ -121,4 +137,23 @@ public class PatHealthPackController { ...@@ -121,4 +137,23 @@ public class PatHealthPackController {
return PicaResponse.toResponse(packService.updatePatByAcctId(req)); return PicaResponse.toResponse(packService.updatePatByAcctId(req));
} }
@ApiOperation("获取主账户-作为监护人自身patientId")
@GetMapping(value = "/acctInfo/patId/{patientId}")
public PicaResponse<List<AcctSelfPatInfoResp>> getAcctInfoByPatId(@PathVariable("patientId") Integer patientId) throws Exception {
return PicaResponse.toResponse(packService.getAcctInfoByPatId(patientId));
}
@ApiOperation("获取主账户-作为监护人自身patientId")
@GetMapping(value = "/acctInfo/patInfo/{unionId}")
public PicaResponse<AcctSelfPatInfoResp> getAcctInfoByUnionId(@PathVariable("unionId") String unionId) throws Exception {
return PicaResponse.toResponse(packService.getAcctInfoByUnionId(unionId));
}
@ApiOperation("更新accId 对应的患者信息")
@PostMapping(value = "/acct/updateAcct")
public PicaResponse updatePat(@RequestBody UpdateAcctPatInfoReq req) {
packService.updatePat(req);
return PicaResponse.toResponse();
}
} }
package com.pica.cloud.account.account.server.mapper; package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.common.req.AcctPatPageReq; import com.pica.cloud.account.account.common.resp.AcctSelfPatInfoResp;
import com.pica.cloud.account.account.server.entity.AcctPatFamily; import com.pica.cloud.account.account.server.entity.AcctPatFamily;
import java.util.List; import java.util.List;
...@@ -26,7 +26,7 @@ public interface AcctPatFamilyMapper { ...@@ -26,7 +26,7 @@ public interface AcctPatFamilyMapper {
List<AcctPatFamily> getListByPatIdSelfs(List<Integer> list); List<AcctPatFamily> getListByPatIdSelfs(List<Integer> list);
/** 查询居民id所在家庭组监护人- 作为家庭成员、非主账户本人居民id,单条ok 多条异常数据 */ /** 查询居民id所在家庭组监护人- 作为家庭成员、非主账户本人居民id,单条ok 多条异常数据 */
AcctPatFamily getByPatIdNotSelf(Integer patId); List<AcctPatFamily> getByPatIdNotSelf(Integer patId);
List<AcctPatFamily> getListByPatIdNotSelfs(List<Integer> list); List<AcctPatFamily> getListByPatIdNotSelfs(List<Integer> list);
...@@ -47,4 +47,9 @@ public interface AcctPatFamilyMapper { ...@@ -47,4 +47,9 @@ public interface AcctPatFamilyMapper {
List<AcctPatFamily> getMemberListByPatIds(List<Integer> patIds); List<AcctPatFamily> getMemberListByPatIds(List<Integer> patIds);
List<Integer> queryPatIdByPage(Map map); List<Integer> queryPatIdByPage(Map map);
List<AcctSelfPatInfoResp> getAcctInfoByPatIdSelf(Integer patId);
AcctSelfPatInfoResp getAcctInfoByUnionId(String unionId);
List<Integer> getPatIdsByUnionId(String unionId);
} }
\ No newline at end of file
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
package com.pica.cloud.account.account.server.service; package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.common.req.*; 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.*;
import com.pica.cloud.account.account.common.resp.AcctSelfPatId;
import com.pica.cloud.account.account.common.resp.PatBindResp;
import com.pica.cloud.account.account.common.resp.PatFamilyResp;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import java.util.List; import java.util.List;
...@@ -22,10 +19,14 @@ public interface PatHealthPackService { ...@@ -22,10 +19,14 @@ public interface PatHealthPackService {
Integer getAcctIdByUnionId(String unionId); Integer getAcctIdByUnionId(String unionId);
String getUnionIdByAcctId(Integer acctId);
Integer getAcctIdByPatId(Integer patientId); Integer getAcctIdByPatId(Integer patientId);
List<Integer> getDirectPatIdsByPatId(Integer patientId); List<Integer> getDirectPatIdsByPatId(Integer patientId);
List<Integer> getDirectPatIdsByUnionId(String unionId);
PatFamilyResp getFamilyPatsByAcctId(Integer acctId,Integer containAcct); PatFamilyResp getFamilyPatsByAcctId(Integer acctId,Integer containAcct);
Integer saveAcct(AcctPatInfoReq patInfoReq); Integer saveAcct(AcctPatInfoReq patInfoReq);
...@@ -36,6 +37,8 @@ public interface PatHealthPackService { ...@@ -36,6 +37,8 @@ public interface PatHealthPackService {
Integer getFamilyAcctPatId(Integer patId); Integer getFamilyAcctPatId(Integer patId);
List<Integer> getFamilyAcctIdsPatId(Integer patId);
AcctPatIdResp getFamilyAcctPatIds(AcctPatIdReq acctPatIdReq); AcctPatIdResp getFamilyAcctPatIds(AcctPatIdReq acctPatIdReq);
Integer initAccts(List<InitAcctReq> list); Integer initAccts(List<InitAcctReq> list);
...@@ -45,4 +48,10 @@ public interface PatHealthPackService { ...@@ -45,4 +48,10 @@ public interface PatHealthPackService {
AcctSelfPatId getAcctIdByMobile(String mobile); AcctSelfPatId getAcctIdByMobile(String mobile);
boolean updatePatByAcctId(UpdateAcctPatInfoReq req); boolean updatePatByAcctId(UpdateAcctPatInfoReq req);
void updatePat(UpdateAcctPatInfoReq req);
List<AcctSelfPatInfoResp> getAcctInfoByPatId(Integer patientId);
AcctSelfPatInfoResp getAcctInfoByUnionId(String unionId);
} }
...@@ -4,10 +4,8 @@ package com.pica.cloud.account.account.server.service.impl; ...@@ -4,10 +4,8 @@ package com.pica.cloud.account.account.server.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.common.req.*; 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.*;
import com.pica.cloud.account.account.common.resp.AcctSelfPatId; import com.pica.cloud.account.account.server.entity.AccountPatientInfoEntity;
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.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.entity.AcctPatUnion;
...@@ -15,6 +13,7 @@ import com.pica.cloud.account.account.server.enums.AccountExceptionEnum; ...@@ -15,6 +13,7 @@ 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.AccountTypeEnum;
import com.pica.cloud.account.account.server.enums.SourceTypeEnum; 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.exception.AccountException;
import com.pica.cloud.account.account.server.mapper.AccountPatientInfoMapper;
import com.pica.cloud.account.account.server.mapper.AcctPatFamilyMapper; 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.AcctPatInfoMapper;
import com.pica.cloud.account.account.server.mapper.AcctPatUnionMapper; import com.pica.cloud.account.account.server.mapper.AcctPatUnionMapper;
...@@ -22,6 +21,7 @@ import com.pica.cloud.account.account.server.service.PatHealthPackService; ...@@ -22,6 +21,7 @@ import com.pica.cloud.account.account.server.service.PatHealthPackService;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants; import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils; import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaException; import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.utils.utils.StringUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -62,6 +62,12 @@ public class PatHealthPackServiceIml implements PatHealthPackService { ...@@ -62,6 +62,12 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
return patUnion == null ? 0 : patUnion.getAcctId(); return patUnion == null ? 0 : patUnion.getAcctId();
} }
@Override
public String getUnionIdByAcctId(Integer acctId) {
AcctPatUnion patUnion = patUnionMapper.selectByAcctId(acctId);
return patUnion == null ? "" : patUnion.getUnionId();
}
/** /**
* @Description 获取居民id是本人的家庭组记录- * @Description 获取居民id是本人的家庭组记录-
* 作为家庭主账户、本人居民id,单条ok 多条异常数据 * 作为家庭主账户、本人居民id,单条ok 多条异常数据
...@@ -128,9 +134,10 @@ public class PatHealthPackServiceIml implements PatHealthPackService { ...@@ -128,9 +134,10 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
patIds.addAll(sonFamilyList.stream().map(obj -> obj.getPatientId()).collect(toList())); patIds.addAll(sonFamilyList.stream().map(obj -> obj.getPatientId()).collect(toList()));
} }
//自身成员 //自身成员
AcctPatFamily member = patFamilyMapper.getByPatIdNotSelf(patientId); List<AcctPatFamily> acctPatFamilyList = patFamilyMapper.getByPatIdNotSelf(patientId);
if (null != member) { if (CollectionUtils.isNotEmpty(acctPatFamilyList)) {
//存在自己作为成员身份记录,add 上级监护人 //存在自己作为成员身份记录,add 上级监护人
AcctPatFamily member = acctPatFamilyList.get(0);
AcctPatFamily parentAcct = patFamilyMapper.getSelfByAcctId(member.getAcctId()); AcctPatFamily parentAcct = patFamilyMapper.getSelfByAcctId(member.getAcctId());
if (null != parentAcct) { if (null != parentAcct) {
patIds.add(parentAcct.getPatientId()); patIds.add(parentAcct.getPatientId());
...@@ -147,6 +154,11 @@ public class PatHealthPackServiceIml implements PatHealthPackService { ...@@ -147,6 +154,11 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
return rtnPatIds; return rtnPatIds;
} }
@Override
public List<Integer> getDirectPatIdsByUnionId(String unionId) {
return patFamilyMapper.getPatIdsByUnionId(unionId);
}
/** /**
* @Description TODO * @Description TODO
* @Author peijun.zhao * @Author peijun.zhao
...@@ -175,7 +187,8 @@ public class PatHealthPackServiceIml implements PatHealthPackService { ...@@ -175,7 +187,8 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
} else if (0 == containAcct) { } else if (0 == containAcct) {
//不包含建立acct账户的pat数据 //不包含建立acct账户的pat数据
List<AcctPatFamily> acctList = patFamilyMapper.getByPatIdSelfList(allPadIds); List<AcctPatFamily> acctList = patFamilyMapper.getByPatIdSelfList(allPadIds);
List<Integer> acctPatIds = acctList.stream().map(obj -> obj.getPatientId()).collect(toList()); // List<Integer> acctPatIds = acctList.stream().map(obj -> obj.getPatientId()).collect(toList());
List<Integer> acctPatIds = acctList.stream().filter(e -> e.getAcctId().intValue() == acctId.intValue()).map(obj -> obj.getPatientId()).collect(toList());
for (AcctPatFamily family : patFamilyList) { for (AcctPatFamily family : patFamilyList) {
if (!acctPatIds.contains(family.getPatientId())) { if (!acctPatIds.contains(family.getPatientId())) {
AcctPatFamilyDto dto = new AcctPatFamilyDto(); AcctPatFamilyDto dto = new AcctPatFamilyDto();
...@@ -202,12 +215,20 @@ public class PatHealthPackServiceIml implements PatHealthPackService { ...@@ -202,12 +215,20 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
String mobileEncrypt = EncryptUtils.encryptContent(patInfoReq.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE); String mobileEncrypt = EncryptUtils.encryptContent(patInfoReq.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE);
//check 手机号是否已是主账户 //check 手机号是否已是主账户
AcctPatFamily acctPatFamily = patFamilyMapper.getByPatIdSelf(patInfoReq.getPatientId()); AcctPatInfo req = new AcctPatInfo();
if (null != acctPatFamily) { req.setMobilePhone(mobileEncrypt);
AcctPatInfo info = patInfoMapper.selectByCondition(req);
if (null != info) {
// 重复时返回已有账户 // 重复时返回已有账户
return acctPatFamily.getAcctId(); return info.getId();
} }
// AcctPatFamily acctPatFamily = patFamilyMapper.getByPatIdSelf(patInfoReq.getPatientId());
// if (null != acctPatFamily) {
// // 重复时返回已有账户
// return acctPatFamily.getAcctId();
// }
//手机号无重复时创建 //手机号无重复时创建
AcctPatInfo patInfo = new AcctPatInfo(); AcctPatInfo patInfo = new AcctPatInfo();
patInfo.setName(patInfoReq.getName()); patInfo.setName(patInfoReq.getName());
...@@ -335,55 +356,23 @@ public class PatHealthPackServiceIml implements PatHealthPackService { ...@@ -335,55 +356,23 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
//check member valid //check member valid
List<AcctPatFamilyDto> memberList = familyReqReq.getMemberList(); List<AcctPatFamilyDto> memberList = familyReqReq.getMemberList();
List<AcctPatFamilyDto> failList = new ArrayList<>(); List<AcctPatFamilyDto> failList = new ArrayList<>();
List<Integer> patIds = memberList.stream().map(obj -> obj.getPatientId()).collect(toList()); List<AcctPatFamily> patFamilyList = patFamilyMapper.getListByAcctId(familyReqReq.getAcctId());
List<AcctPatFamilyDto> relatedPats = new ArrayList<>(); List<Integer> patientIdList = patFamilyList.stream().map(obj -> obj.getPatientId()).collect(toList());
List<AcctPatFamily> members = patFamilyMapper.getMemberListByPatIds(patIds); for (AcctPatFamilyDto member : memberList) {
for (AcctPatFamily member : members) { if (!patientIdList.contains(member.getPatientId())) {
if (!familyReqReq.getAcctId().equals(member.getAcctId())) {
//居民已被其他账户绑定为家庭成员
AcctPatFamilyDto failOne = new AcctPatFamilyDto();
failOne.setPatientId(member.getPatientId());
failOne.setRelation(member.getRelation());
failList.add(failOne);
successFlag = false;
resp.setFailMsg(AccountExceptionEnum.PAT_MEMBER_HAS_MORE.getMessage());
resp.setCode(AccountExceptionEnum.PAT_MEMBER_HAS_MORE.getCode());
} else {
//居民已被传入acctId关联为家庭成员,不需要再保存
AcctPatFamilyDto failOneRelated = new AcctPatFamilyDto();
failOneRelated.setRelation(member.getRelation());
failOneRelated.setPatientId(member.getPatientId());
relatedPats.add(failOneRelated);
successFlag = false;
resp.setFailMsg(AccountExceptionEnum.PAT_MEMBER_HAS_BINDED_SELF.getMessage());
resp.setCode(AccountExceptionEnum.PAT_MEMBER_HAS_BINDED_SELF.getCode());
}
}
//已关联自身居民list
if (relatedPats.size() > 0) {
successFlag = false;
failList.addAll(relatedPats);
}
//通过后 再建立家庭关系
if (successFlag) {
AcctPatFamily acct = patFamilyMapper.getSelfByAcctId(familyReqReq.getAcctId());
for (AcctPatFamilyDto member : memberList) {
AcctPatFamily entity = new AcctPatFamily(); AcctPatFamily entity = new AcctPatFamily();
entity.setAcctId(familyReqReq.getAcctId()); entity.setAcctId(familyReqReq.getAcctId());
entity.setPatientId(member.getPatientId()); entity.setPatientId(member.getPatientId());
entity.setRelation(member.getRelation()); entity.setRelation(member.getRelation());
entity.setDeleteFlag(1); entity.setDeleteFlag(1);
entity.setCreatedId(acct.getPatientId()); entity.setCreatedId(familyReqReq.getAcctId());
entity.setModifiedId(acct.getPatientId()); entity.setModifiedId(familyReqReq.getAcctId());
entity.setCreatedTime(new Date()); entity.setCreatedTime(new Date());
entity.setModifiedTime(new Date()); entity.setModifiedTime(new Date());
patFamilyMapper.insert(entity); patFamilyMapper.insert(entity);
} }
} }
resp.setSuccessFlag(successFlag); resp.setSuccessFlag(successFlag);
resp.setFailMemberList(failList); resp.setFailMemberList(failList);
return resp; return resp;
...@@ -398,8 +387,9 @@ public class PatHealthPackServiceIml implements PatHealthPackService { ...@@ -398,8 +387,9 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
rtnPatId = acctMember.getPatientId(); rtnPatId = acctMember.getPatientId();
} else { } else {
//查询是否存在 作为成员的记录 //查询是否存在 作为成员的记录
AcctPatFamily member = patFamilyMapper.getByPatIdNotSelf(patId); List<AcctPatFamily> memberList = patFamilyMapper.getByPatIdNotSelf(patId);
if (null != member) { if (CollectionUtils.isNotEmpty(memberList)) {
AcctPatFamily member = memberList.get(0);
//本人为成员时记录存在 //本人为成员时记录存在
AcctPatFamily acctPat = patFamilyMapper.getSelfByAcctId(member.getAcctId()); AcctPatFamily acctPat = patFamilyMapper.getSelfByAcctId(member.getAcctId());
rtnPatId = acctPat.getPatientId(); rtnPatId = acctPat.getPatientId();
...@@ -410,6 +400,32 @@ public class PatHealthPackServiceIml implements PatHealthPackService { ...@@ -410,6 +400,32 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
return rtnPatId; return rtnPatId;
} }
@Override
public List<Integer> getFamilyAcctIdsPatId(Integer patId) {
List<Integer> acctIdList = new ArrayList<>();
//查询本人
AcctPatFamily acctMember = patFamilyMapper.getByPatIdSelf(patId);
if (null != acctMember) {
acctIdList.add(acctMember.getAcctId());
}
//查询作为成员的主账户acctId
List<AcctPatFamily> acctPatFamilies = patFamilyMapper.getByPatIdNotSelf(patId);
if (CollectionUtils.isNotEmpty(acctPatFamilies)) {
List<Integer> list = acctPatFamilies.stream().map(AcctPatFamily::getAcctId).distinct().collect(toList());
for (Integer acctId : list) {
if (null == acctMember || !Objects.equals(acctId, acctMember.getAcctId())) {
//本人为成员时记录存在
AcctPatFamily acctPat = patFamilyMapper.getSelfByAcctId(acctId);
if (null != acctPat) {
acctIdList.add(acctId);
}
}
}
}
return acctIdList;
}
/** /**
* @Description 根据居民id批量获取对应的主账号对应的patId * @Description 根据居民id批量获取对应的主账号对应的patId
...@@ -609,4 +625,28 @@ public class PatHealthPackServiceIml implements PatHealthPackService { ...@@ -609,4 +625,28 @@ public class PatHealthPackServiceIml implements PatHealthPackService {
return true; return true;
} }
@Override
public void updatePat(UpdateAcctPatInfoReq req) {
AcctPatUnion patUnion = patUnionMapper.selectByUnionId(req.getUnionId());
if (StringUtil.isNotNull(patUnion) && StringUtil.isNotNull(patUnion.getAcctId())) {
AcctPatInfo entity = new AcctPatInfo();
entity.setId(patUnion.getAcctId());
entity.setName(req.getName());
entity.setModifiedId(patUnion.getAcctId());
entity.setModifiedTime(new Date());
patInfoMapper.updateByPrimaryKeySelective(entity);
}
}
@Override
public List<AcctSelfPatInfoResp> getAcctInfoByPatId(Integer patientId) {
return patFamilyMapper.getAcctInfoByPatIdSelf(patientId);
}
@Override
public AcctSelfPatInfoResp getAcctInfoByUnionId(String unionId) {
return patFamilyMapper.getAcctInfoByUnionId(unionId);
}
} }
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
from account_pat_family from account_pat_family
where patient_id = #{patientId,jdbcType=INTEGER} where patient_id = #{patientId,jdbcType=INTEGER}
and relation = 1 and relation = 1
and delete_flag = 1; and delete_flag = 1 order by created_time desc limit 1
</select> </select>
<select id="getListByPatIdSelfs" parameterType="java.util.List" resultMap="BaseResultMap" > <select id="getListByPatIdSelfs" parameterType="java.util.List" resultMap="BaseResultMap" >
...@@ -195,7 +195,8 @@ ...@@ -195,7 +195,8 @@
from account_pat_family from account_pat_family
where patient_id = #{patientId,jdbcType=INTEGER} where patient_id = #{patientId,jdbcType=INTEGER}
AND relation != 1 AND relation != 1
and delete_flag = 1; and delete_flag = 1
order by modified_time desc
</select> </select>
<select id="getListByPatIdNotSelfs" parameterType="java.util.List" resultMap="BaseResultMap" > <select id="getListByPatIdNotSelfs" parameterType="java.util.List" resultMap="BaseResultMap" >
...@@ -270,4 +271,37 @@ ...@@ -270,4 +271,37 @@
limit #{begin},#{end} limit #{begin},#{end}
</select> </select>
<select id="getAcctInfoByPatIdSelf" parameterType="java.lang.Integer" resultType="com.pica.cloud.account.account.common.resp.AcctSelfPatInfoResp" >
select
api.id as accId, pf.patient_id as patientId, api.name , api.mobile_phone as mobilePhone
from account_pat_family pf, account_pat_info api
where pf.patient_id = #{patientId,jdbcType=INTEGER}
AND pf.relation = 1
and pf.delete_flag = 1
and pf.acct_id = api.id
and api.delete_flag = 1
</select>
<select id="getAcctInfoByUnionId" parameterType="java.lang.String" resultType="com.pica.cloud.account.account.common.resp.AcctSelfPatInfoResp" >
select
api.id as accId, pf.patient_id as patientId, api.name , api.mobile_phone as mobilePhone
from account_pat_family pf, account_pat_info api, account_pat_union pu
where pu.union_id = #{unionId} and pu.union_type = 1
and pu.acct_id = api.id
and pu.delete_flag = 1
AND pf.relation = 1
and pf.delete_flag = 1
and pf.acct_id = api.id
and api.delete_flag = 1
</select>
<select id="getPatIdsByUnionId" parameterType="java.lang.String" resultType="java.lang.Integer" >
select
distinct pf.patient_id as patientId
from account_pat_family pf, account_pat_union pu
where pu.union_id = #{unionId} and pu.union_type = 1
and pu.delete_flag = 1
and pf.delete_flag = 1
and pu.acct_id = pf.acct_id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -145,7 +145,8 @@ ...@@ -145,7 +145,8 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from account_pat_union from account_pat_union
where union_id = #{unionId,jdbcType=VARCHAR} where union_id = #{unionId,jdbcType=VARCHAR}
and delete_flag = 1; and delete_flag = 1
order by modified_time desc limit 1
</select> </select>
<select id="selectByAcctId" parameterType="java.lang.Integer" resultMap="BaseResultMap" > <select id="selectByAcctId" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
...@@ -153,7 +154,8 @@ ...@@ -153,7 +154,8 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from account_pat_union from account_pat_union
where acct_id = #{acctId,jdbcType=INTEGER} where acct_id = #{acctId,jdbcType=INTEGER}
and delete_flag = 1; and delete_flag = 1
order by modified_time desc limit 1
</select> </select>
<insert id="initBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id"> <insert id="initBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册