Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
B
byh-family-doctor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
包
包
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
杨凯
byh-family-doctor
Commits
fb4a91aa
提交
fb4a91aa
authored
5月 17, 2024
作者:
luzhangjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:病例相关接口
上级
30fe4858
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
563 行增加
和
43 行删除
+563
-43
InvalidMedicalRecordDTO.java
...hui/family/doctor/common/dto/InvalidMedicalRecordDTO.java
+3
-3
ImInfoDetailDocResVo.java
...aiyihui/family/doctor/common/vo/ImInfoDetailDocResVo.java
+3
-0
MedicalSortVo.java
.../com/ebaiyihui/family/doctor/common/vo/MedicalSortVo.java
+31
-0
TreatmentCard.java
.../com/ebaiyihui/family/doctor/common/vo/TreatmentCard.java
+26
-0
PatientMedicalRecordController.java
...tor/server/controller/PatientMedicalRecordController.java
+20
-9
PatientMedicalRecordMapper.java
...mily/doctor/server/mapper/PatientMedicalRecordMapper.java
+3
-0
PatientMedicalRecordService.java
...ly/doctor/server/service/PatientMedicalRecordService.java
+3
-2
RedisTemplateService.java
...ui/family/doctor/server/service/RedisTemplateService.java
+76
-0
PatientMedicalRecordServiceImpl.java
.../server/service/impl/PatientMedicalRecordServiceImpl.java
+327
-29
PatientSignServiceImpl.java
...ly/doctor/server/service/impl/PatientSignServiceImpl.java
+1
-0
RedisTemplateServiceImpl.java
.../doctor/server/service/impl/RedisTemplateServiceImpl.java
+70
-0
没有找到文件。
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/dto/InvalidMedicalRecordDTO.java
浏览文件 @
fb4a91aa
...
...
@@ -8,8 +8,8 @@ import javax.validation.constraints.NotBlank;
@Data
public
class
InvalidMedicalRecordDTO
{
@NotBlank
(
message
=
"
病历ID
不能为空"
)
@ApiModelProperty
(
"
病历ID
"
)
private
String
i
d
;
@NotBlank
(
message
=
"
就诊id
不能为空"
)
@ApiModelProperty
(
"
就诊id
"
)
private
String
admI
d
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/vo/ImInfoDetailDocResVo.java
浏览文件 @
fb4a91aa
...
...
@@ -32,6 +32,9 @@ public class ImInfoDetailDocResVo {
@ApiModelProperty
(
"就诊id"
)
private
String
admId
;
@ApiModelProperty
(
"就诊日期"
)
private
Date
admTime
;
@ApiModelProperty
(
"订单状态 2.进行中 3.已完成"
)
private
Integer
status
;
...
...
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/vo/MedicalSortVo.java
0 → 100644
浏览文件 @
fb4a91aa
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author odd$
* @description: $
* @param: $
* @return: $
* @date: $ $
*/
@Data
public
class
MedicalSortVo
{
@ApiModelProperty
(
"病例记录name"
)
private
String
titleContent
;
@ApiModelProperty
(
"病例记录值"
)
private
Object
value
;
@ApiModelProperty
(
"展示顺序"
)
private
Integer
sort
;
@ApiModelProperty
(
"模块类型"
)
private
Integer
inputType
;
@ApiModelProperty
(
"是否展示在病历卡片"
)
private
Integer
isCard
;
@ApiModelProperty
(
"展示信息类型"
)
private
Integer
titleType
;
@ApiModelProperty
(
"是否为空"
)
private
Integer
isNull
;
@ApiModelProperty
(
"数据key信息"
)
private
String
keywords
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/vo/TreatmentCard.java
0 → 100644
浏览文件 @
fb4a91aa
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.util.List
;
/**
* @program: byh_online_outpatient
* @description:
* @author: zhaosiyi
* @create: 2020-11-03 10:32
**/
@Data
@ToString
public
class
TreatmentCard
{
@ApiModelProperty
(
"复诊病例Id"
)
private
String
medicalRecordId
;
@ApiModelProperty
(
"展示在卡片上的数据"
)
List
<
MedicalSortVo
>
medicalUserFills
;
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/controller/PatientMedicalRecordController.java
浏览文件 @
fb4a91aa
...
...
@@ -13,10 +13,7 @@ import io.swagger.annotations.ApiOperation;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Objects
;
...
...
@@ -48,14 +45,14 @@ public class PatientMedicalRecordController {
return
patientMedicalRecordService
.
updatePatientMedicalRecord
(
dto
);
}
@PostMapping
(
"/in
valid
"
)
@ApiOperation
(
value
=
"
开具处方失效病历"
,
notes
=
"开具处方失效
病历"
)
public
BaseResponse
<
Objects
>
invalid
(
@RequestBody
@Validated
Invalid
MedicalRecordDTO
dto
,
@PostMapping
(
"/in
sertOrUpdate
"
)
@ApiOperation
(
value
=
"
新建或修改复诊病历"
,
notes
=
"新建或修改复诊
病历"
)
public
BaseResponse
<
InsertPatientMedicalRecordVO
>
insertOrUpdate
(
@RequestBody
@Validated
InsertPatient
MedicalRecordDTO
dto
,
BindingResult
bindingResult
)
{
if
(
bindingResult
.
hasErrors
())
{
return
BaseResponse
.
error
(
Objects
.
requireNonNull
(
bindingResult
.
getFieldError
()).
getDefaultMessage
());
}
return
patientMedicalRecordService
.
in
validMedicalRecord
(
dto
);
return
patientMedicalRecordService
.
in
sertOrUpdate
(
dto
);
}
@PostMapping
(
"/detail"
)
...
...
@@ -68,4 +65,18 @@ public class PatientMedicalRecordController {
return
patientMedicalRecordService
.
detailMedicalRecord
(
dto
);
}
@ApiOperation
(
value
=
"推送病例卡片"
,
notes
=
"医生开具复诊病例推送小卡片"
)
@RequestMapping
(
value
=
"/treatmentCard"
,
method
=
RequestMethod
.
POST
)
public
BaseResponse
<
Object
>
treatmentCard
(
@RequestBody
@Validated
InvalidMedicalRecordDTO
param
,
BindingResult
bindingResult
)
{
if
(
bindingResult
.
hasErrors
())
{
return
BaseResponse
.
error
(
Objects
.
requireNonNull
(
bindingResult
.
getFieldError
()).
getDefaultMessage
());
}
return
patientMedicalRecordService
.
treatmentCard
(
param
.
getAdmId
());
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/mapper/PatientMedicalRecordMapper.java
浏览文件 @
fb4a91aa
...
...
@@ -11,4 +11,7 @@ public interface PatientMedicalRecordMapper extends BaseMapper<PatientMedicalRec
@Select
(
"select * from patient_medical_record where id = #{id} and record_status = #{status}"
)
PatientMedicalRecordEntity
getByIdAndStatus
(
String
id
,
int
status
);
@Select
(
"select * from patient_medical_record where adm_id = #{id} and record_status = 1"
)
PatientMedicalRecordEntity
getByAdmId
(
String
admId
);
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/PatientMedicalRecordService.java
浏览文件 @
fb4a91aa
...
...
@@ -19,8 +19,9 @@ public interface PatientMedicalRecordService {
BaseResponse
<
InsertPatientMedicalRecordVO
>
updatePatientMedicalRecord
(
UpdatePatientMedicalRecordDTO
dto
);
BaseResponse
<
Objects
>
invalidMedicalRecord
(
InvalidMedicalRecordDTO
dto
);
BaseResponse
<
PatientMedicalRecordVO
>
detailMedicalRecord
(
InvalidMedicalRecordDTO
dto
);
BaseResponse
<
InsertPatientMedicalRecordVO
>
insertOrUpdate
(
InsertPatientMedicalRecordDTO
dto
);
BaseResponse
<
Object
>
treatmentCard
(
String
admId
);
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/RedisTemplateService.java
0 → 100644
浏览文件 @
fb4a91aa
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
service
;
/**
* @program byh-aggregation-payment
* @description:
* @author: chenmet
* @create: 2019/08/21 15:30
*/
public
interface
RedisTemplateService
{
/**
* Description: 根据key获取值
* @param key
* @return: boolean
* @author: zhaosy
* @date: 2019/10/29 2:06 PM
*/
boolean
get
(
String
key
);
/**
* Description: 根据key来set数据
* @param key
* @return: void
* @author: zhaosy
* @date: 2019/10/29 2:07 PM
*/
void
set
(
String
key
);
/**
* Description: 根据key删除值
* @param key
* @return: boolean
* @author: zhaosy
* @date: 2019/10/29 2:08 PM
*/
boolean
del
(
String
key
);
/**
* Description: 根据key获取redis中的时间
* @param key
* @return: Long
* @author: zhaosy
* @date: 2019/10/29 2:08 PM
*/
Long
getTime
(
String
key
);
/**
* Description: 给redis设置锁,以及锁的过期时间
* @param key
* @param value
* @param time
* @return: boolean
* @author: zhaosy
* @date: 2019/10/29 2:09PM
*/
boolean
addLock
(
String
key
,
String
value
,
long
time
);
boolean
addLockNew
(
String
key
,
String
value
,
long
time
);
/**
* Description: 加锁
* @param key
* @param value
* @return: boolean
*/
boolean
addLock
(
String
key
,
String
value
);
/**
* Description: 判断redis中是否有锁
* @param key
* @return: boolean
* @author: zhaosy
* @date: 2019/10/29 2:11 PM
*/
boolean
hasKey
(
String
key
);
}
\ No newline at end of file
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/impl/PatientMedicalRecordServiceImpl.java
浏览文件 @
fb4a91aa
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.doctoruser.api.pojo.base.dto.doctor.QueryPersonnelInfoReq
;
import
com.doctoruser.api.pojo.base.vo.doctor.PersonnelInfo
;
import
com.doctoruser.api.pojo.vo.UserInfoByDoctorIdRespVO
;
import
com.doctoruser.api.pojo.vo.UserInfoByUserIdRespVO
;
import
com.ebaiyihui.family.doctor.common.bo.Message
;
import
com.ebaiyihui.family.doctor.common.bo.MessageInfo
;
import
com.ebaiyihui.family.doctor.common.bo.PatientSignInfo
;
import
com.ebaiyihui.family.doctor.common.bo.PersonImInformReq
;
import
com.ebaiyihui.family.doctor.common.dto.InsertPatientMedicalRecordDTO
;
import
com.ebaiyihui.family.doctor.common.dto.InvalidMedicalRecordDTO
;
import
com.ebaiyihui.family.doctor.common.dto.UpdatePatientMedicalRecordDTO
;
import
com.ebaiyihui.family.doctor.common.vo.InsertPatientMedicalRecordVO
;
import
com.ebaiyihui.family.doctor.common.vo.
PatientInfo
Vo
;
import
com.ebaiyihui.family.doctor.common.vo.
MedicalSort
Vo
;
import
com.ebaiyihui.family.doctor.common.vo.PatientMedicalRecordVO
;
import
com.ebaiyihui.family.doctor.common.vo.TreatmentCard
;
import
com.ebaiyihui.family.doctor.server.common.constants.IMInformConstants
;
import
com.ebaiyihui.family.doctor.server.entity.PatientEntity
;
import
com.ebaiyihui.family.doctor.server.entity.PatientMedicalRecordEntity
;
import
com.ebaiyihui.family.doctor.server.entity.PatientSignEntity
;
import
com.ebaiyihui.family.doctor.server.exception.BusinessException
;
import
com.ebaiyihui.family.doctor.server.feign.DoctorInfofeignClient
;
import
com.ebaiyihui.family.doctor.server.feign.IMPushMsgFeignClient
;
import
com.ebaiyihui.family.doctor.server.feign.UserApiFeignClient
;
import
com.ebaiyihui.family.doctor.server.mapper.PatientMapper
;
import
com.ebaiyihui.family.doctor.server.mapper.PatientMedicalRecordMapper
;
import
com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper
;
import
com.ebaiyihui.family.doctor.server.service.PatientMedicalRecordService
;
import
com.ebaiyihui.family.doctor.server.util.IDCardUtil
;
import
com.ebaiyihui.family.doctor.server.service.RedisTemplateService
;
import
com.ebaiyihui.family.doctor.server.util.JsonUtil
;
import
com.ebaiyihui.family.doctor.server.util.UUIDUtil
;
import
com.ebaiyihui.framework.response.BaseResponse
;
import
com.ebaiyihui.imforward.client.vo.AccountVO
;
import
com.ebaiyihui.imforward.client.vo.PushSingleMsgDataVO
;
import
com.ebaiyihui.imforward.client.vo.PushSingleMsgReqVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
@Service
@Slf4j
...
...
@@ -40,6 +61,18 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
@Autowired
private
PatientSignMapper
patientSignMapper
;
@Autowired
private
RedisTemplateService
redisTemplateService
;
@Autowired
private
DoctorInfofeignClient
doctorInfofeignClient
;
@Autowired
private
UserApiFeignClient
userApiFeignClient
;
@Autowired
private
IMPushMsgFeignClient
imPushMsgFeignClient
;
@Override
public
BaseResponse
<
InsertPatientMedicalRecordVO
>
insertPatientMedicalRecord
(
InsertPatientMedicalRecordDTO
dto
)
{
...
...
@@ -57,11 +90,11 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
@Override
public
BaseResponse
<
InsertPatientMedicalRecordVO
>
updatePatientMedicalRecord
(
UpdatePatientMedicalRecordDTO
dto
)
{
log
.
info
(
"医生修改复诊病历入参:{}"
,
dto
.
toString
());
if
(
StringUtils
.
isEmpty
(
dto
.
getId
())){
if
(
StringUtils
.
isEmpty
(
dto
.
getId
()))
{
throw
new
BusinessException
(
"修改xid不能为空"
);
}
PatientMedicalRecordEntity
recordEntity
=
patientMedicalRecordMapper
.
getByIdAndStatus
(
dto
.
getId
(),
1
);
if
(
ObjectUtil
.
isNull
(
recordEntity
)){
PatientMedicalRecordEntity
recordEntity
=
patientMedicalRecordMapper
.
getByIdAndStatus
(
dto
.
getId
(),
1
);
if
(
ObjectUtil
.
isNull
(
recordEntity
))
{
throw
new
BusinessException
(
"未找到该病历,或病例失效"
);
}
PatientMedicalRecordEntity
entity
=
new
PatientMedicalRecordEntity
();
...
...
@@ -72,32 +105,15 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
return
BaseResponse
.
success
(
vo
);
}
@Override
public
BaseResponse
<
Objects
>
invalidMedicalRecord
(
InvalidMedicalRecordDTO
dto
)
{
log
.
info
(
"开具处方失效病历入参:{}"
,
dto
.
toString
());
if
(
StringUtils
.
isEmpty
(
dto
.
getId
())){
throw
new
BusinessException
(
"病历id不能未空"
);
}
PatientMedicalRecordEntity
recordEntity
=
patientMedicalRecordMapper
.
getByIdAndStatus
(
dto
.
getId
(),
1
);
if
(
ObjectUtil
.
isNull
(
recordEntity
)){
throw
new
BusinessException
(
"未找到该病历,或病例失效"
);
}
PatientMedicalRecordEntity
entity
=
new
PatientMedicalRecordEntity
();
entity
.
setId
(
dto
.
getId
());
entity
.
setRecordStatus
(
0
);
patientMedicalRecordMapper
.
updateById
(
entity
);
return
BaseResponse
.
success
();
}
@Override
public
BaseResponse
<
PatientMedicalRecordVO
>
detailMedicalRecord
(
InvalidMedicalRecordDTO
dto
)
{
log
.
info
(
"病历详情入参:{}"
,
dto
.
toString
());
if
(
StringUtils
.
isEmpty
(
dto
.
get
Id
()))
{
throw
new
BusinessException
(
"
病历
id不能未空"
);
if
(
StringUtils
.
isEmpty
(
dto
.
get
AdmId
()))
{
throw
new
BusinessException
(
"
就诊
id不能未空"
);
}
PatientMedicalRecordEntity
entity
=
patientMedicalRecordMapper
.
getBy
IdAndStatus
(
dto
.
getId
(),
1
);
if
(
ObjectUtil
.
isNull
(
entity
)){
PatientMedicalRecordEntity
entity
=
patientMedicalRecordMapper
.
getBy
AdmId
(
dto
.
getAdmId
()
);
if
(
ObjectUtil
.
isNull
(
entity
))
{
throw
new
BusinessException
(
"未找到该病历,或病例失效"
);
}
PatientMedicalRecordVO
vo
=
new
PatientMedicalRecordVO
();
...
...
@@ -106,7 +122,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
// 查询患者,医生,科室信息
PatientMedicalRecordVO
.
InfoVo
infoVo
=
new
PatientMedicalRecordVO
.
InfoVo
();
PatientEntity
patientEntity
=
patientMapper
.
selectById
(
entity
.
getPatientId
());
if
(
ObjectUtil
.
isNotNull
(
patientEntity
)){
if
(
ObjectUtil
.
isNotNull
(
patientEntity
))
{
infoVo
.
setPatientName
(
patientEntity
.
getPatientName
());
infoVo
.
setPatientGender
(
String
.
valueOf
(
patientEntity
.
getGender
()));
infoVo
.
setPatientNo
(
patientEntity
.
getCredNo
());
...
...
@@ -115,7 +131,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
infoVo
.
setPatientCredNo
(
patientEntity
.
getCredNo
());
}
PatientSignEntity
patientSignEntity
=
patientSignMapper
.
queryByAdmId
(
entity
.
getAdmId
());
if
(
ObjectUtil
.
isNotNull
(
patientSignEntity
)){
if
(
ObjectUtil
.
isNotNull
(
patientSignEntity
))
{
infoVo
.
setDeptId
(
String
.
valueOf
(
patientSignEntity
.
getDeptId
()));
infoVo
.
setDeptName
(
patientSignEntity
.
getDeptName
());
infoVo
.
setDoctorId
(
String
.
valueOf
(
patientSignEntity
.
getDoctorId
()));
...
...
@@ -124,4 +140,286 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
vo
.
setInfoVo
(
infoVo
);
return
BaseResponse
.
success
(
vo
);
}
@Override
public
BaseResponse
<
InsertPatientMedicalRecordVO
>
insertOrUpdate
(
InsertPatientMedicalRecordDTO
dto
)
{
log
.
info
(
"新增或修改入参:{}"
,
dto
.
toString
());
PatientMedicalRecordEntity
recordEntity
=
patientMedicalRecordMapper
.
getByAdmId
(
dto
.
getAdmId
());
if
(
ObjectUtil
.
isNotNull
(
recordEntity
))
{
// 修改
PatientMedicalRecordEntity
updateEntity
=
new
PatientMedicalRecordEntity
();
BeanUtils
.
copyProperties
(
dto
,
updateEntity
);
updateEntity
.
setId
(
recordEntity
.
getId
());
int
update
=
patientMedicalRecordMapper
.
updateById
(
updateEntity
);
if
(
update
>
0
)
{
return
BaseResponse
.
success
();
}
else
{
return
BaseResponse
.
error
(
"修改失败"
);
}
}
else
{
// 新增
PatientMedicalRecordEntity
entity
=
new
PatientMedicalRecordEntity
();
BeanUtils
.
copyProperties
(
dto
,
entity
);
int
insert
=
patientMedicalRecordMapper
.
insert
(
entity
);
if
(
insert
>
0
)
{
return
BaseResponse
.
success
();
}
else
{
return
BaseResponse
.
error
(
"新增失败"
);
}
}
}
public
BaseResponse
<
Object
>
treatmentCard
(
String
admissionId
)
{
String
redisKey
=
admissionId
+
"_JTYSBL"
;
boolean
flag
=
redisTemplateService
.
addLockNew
(
redisKey
,
redisKey
,
60
);
if
(
flag
)
{
log
.
info
(
"该患者已开过复诊病历"
);
return
BaseResponse
.
error
(
"病历提交过频繁,请稍等后重新提交"
);
}
PatientSignInfo
patientSignInfo
=
getPatientSignInfo
(
admissionId
);
List
<
MessageInfo
>
messageInfos
=
new
ArrayList
<>();
//自定义-病历
messageInfos
.
add
(
getInformCustomPersonDocParam
(
patientSignInfo
,
getTreatmentCard
(
admissionId
),
IMInformConstants
.
CASE_DOCTOR_TYPE
));
//患者
//自定义-病历
messageInfos
.
add
(
getInformCustomPerPatientParam
(
patientSignInfo
,
getTreatmentCard
(
admissionId
),
IMInformConstants
.
CASE_DOCTOR_TYPE
));
PersonImInformReq
parameter
=
new
PersonImInformReq
();
parameter
.
setMessageInfos
(
messageInfos
);
parameter
.
setAdmissionId
(
admissionId
);
parameter
.
setBusiCode
(
IMInformConstants
.
IM_SYSTEM_BUSINESS_CODE
);
if
(
pushImInform
(
messageInfos
,
admissionId
))
{
log
.
info
(
"IM INFORM COMPLETE 医生开具复诊病例推送卡片,admissionId:{}"
,
admissionId
);
}
return
BaseResponse
.
success
();
}
/**
* 获取消息参数-自定义消息推给医生(个人)
*
* @param admissionInfo 就诊信息
* @param content 推送内容
* @param <T>
* @return 不会返回空
*/
private
<
T
>
MessageInfo
getInformCustomPersonDocParam
(
PatientSignInfo
admissionInfo
,
T
content
,
String
businessCode
)
{
String
doctorUserId
=
admissionInfo
.
getDoctorUserId
();
if
(
StringUtils
.
isEmpty
(
doctorUserId
))
{
log
.
error
(
"IM INFORM ERROR : 无法查询到接收人信息"
);
return
new
MessageInfo
();
}
MessageInfo
messageInfo
=
new
MessageInfo
();
Message
<
T
>
message
=
new
Message
<>();
message
.
setMessageType
(
IMInformConstants
.
SERVICE_SYSTEM_FREE_TYPE
);
message
.
setBusinessCode
(
businessCode
);
message
.
setApplicationCode
(
IMInformConstants
.
IM_SYSTEM_BUSINESS_CODE
);
message
.
setAdmissionId
(
admissionInfo
.
getAdmId
());
message
.
setData
(
content
);
message
.
setApplicationCode
(
IMInformConstants
.
IM_SYSTEM_BUSINESS_CODE
);
// 医生账号
messageInfo
.
setSingleAccount
(
newAccount
(
IMInformConstants
.
DOCTOR_APPLICATION_CODE
,
doctorUserId
));
// 患者账号
messageInfo
.
setSelfAccount
(
newAccount
(
IMInformConstants
.
PATIENT_APPLICATION_CODE
,
admissionInfo
.
getPatientUserId
()));
messageInfo
.
setMessage
(
message
);
return
messageInfo
;
}
private
AccountVO
newAccount
(
String
appCode
,
String
userId
)
{
AccountVO
accountVO
=
new
AccountVO
();
accountVO
.
setAppCode
(
appCode
);
accountVO
.
setUserId
(
userId
);
return
accountVO
;
}
/**
* 获取消息参数-自定义消息推给病人(个人))
*
* @param admissionInfo 就诊信息
* @param content 推送内容
* @param <T>
* @return 不会返回空
*/
private
<
T
>
MessageInfo
getInformCustomPerPatientParam
(
PatientSignInfo
admissionInfo
,
T
content
,
String
businessCode
)
{
String
patientUserId
=
admissionInfo
.
getPatientUserId
();
if
(
StringUtils
.
isEmpty
(
patientUserId
))
{
log
.
error
(
"IM INFORM ERROR : 无法查询到接收人信息"
);
return
new
MessageInfo
();
}
MessageInfo
messageInfo
=
new
MessageInfo
();
Message
<
T
>
message
=
new
Message
<>();
message
.
setMessageType
(
IMInformConstants
.
SERVICE_SYSTEM_FREE_TYPE
);
message
.
setBusinessCode
(
businessCode
);
message
.
setAdmissionId
(
admissionInfo
.
getAdmId
());
message
.
setApplicationCode
(
IMInformConstants
.
IM_SYSTEM_BUSINESS_CODE
);
message
.
setData
(
content
);
message
.
setApplicationCode
(
IMInformConstants
.
IM_SYSTEM_BUSINESS_CODE
);
messageInfo
.
setSingleAccount
(
newAccount
(
IMInformConstants
.
PATIENT_APPLICATION_CODE
,
patientUserId
));
messageInfo
.
setSelfAccount
(
newAccount
(
IMInformConstants
.
DOCTOR_APPLICATION_CODE
,
admissionInfo
.
getDoctorUserId
()));
messageInfo
.
setMessage
(
message
);
return
messageInfo
;
}
private
TreatmentCard
getTreatmentCard
(
String
admissionId
)
{
TreatmentCard
treatmentCard
=
new
TreatmentCard
();
PatientMedicalRecordEntity
recordEntity
=
patientMedicalRecordMapper
.
getByAdmId
(
admissionId
);
if
(
null
==
recordEntity
)
{
log
.
info
(
"病例详情查询错误,查询为空"
);
return
null
;
}
List
<
MedicalSortVo
>
list
=
new
ArrayList
<>();
log
.
info
(
"list:{}"
+
JSON
.
toJSONString
(
list
));
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
null
;
}
treatmentCard
.
setMedicalRecordId
(
recordEntity
.
getId
());
treatmentCard
.
setMedicalUserFills
(
list
);
log
.
info
(
"caseHistory:{}"
+
treatmentCard
.
toString
());
return
treatmentCard
;
}
/**
* 获取im推送需要的信息
* 1.serviceType 2.0 病人账号 2.1 病人名字 3.3 医生生名字 账号 6.拒绝理由 7.订单号
* 团队的 1.groupId (注意状态,销毁了就不能发) 2.serviceType 3.0 病人用户账号 3.1 病人名字
* 4.团队的所有医生bean(id,账号,姓名) 5.团队名字 6 拒绝理由 7订单号
*
* @param admId
* @return
* @description 公共方法
*/
private
PatientSignInfo
getPatientSignInfo
(
String
admId
)
{
QueryWrapper
<
PatientSignEntity
>
wrapper
=
new
QueryWrapper
<>();
PatientSignEntity
patientSign
=
new
PatientSignEntity
();
patientSign
.
setAdmId
(
admId
);
wrapper
.
setEntity
(
patientSign
);
PatientSignEntity
patientSignEntity
=
patientSignMapper
.
selectOne
(
wrapper
);
if
(
patientSignEntity
==
null
)
{
log
.
error
(
"IM INFORM ERROR : 没有查询到就诊信息,admId:{}"
,
admId
);
return
new
PatientSignInfo
();
}
PatientSignInfo
patientSignInfo
=
new
PatientSignInfo
();
BeanUtils
.
copyProperties
(
patientSignEntity
,
patientSignInfo
);
patientSignInfo
.
setSignedId
(
patientSignEntity
.
getId
());
// 获取医生基本信息
QueryPersonnelInfoReq
queryPersonnelInfoReq
=
new
QueryPersonnelInfoReq
();
queryPersonnelInfoReq
.
setDoctorId
(
String
.
valueOf
(
patientSignEntity
.
getDoctorId
()));
BaseResponse
<
PersonnelInfo
>
doctorInfo
=
doctorInfofeignClient
.
queryPersonnelInfo
(
queryPersonnelInfoReq
);
// 调用用户系统查询医生userId
UserInfoByUserIdRespVO
userInfoByUserIdRespVO
=
queryDocAccountInfo
(
String
.
valueOf
(
patientSignEntity
.
getDoctorId
()));
if
(
userInfoByUserIdRespVO
==
null
)
{
log
.
error
(
"IM INFORM ERROR : 获取医生信息失败 doctorId:{}"
,
String
.
valueOf
(
patientSignEntity
.
getDoctorId
()));
return
new
PatientSignInfo
();
}
if
(
null
==
doctorInfo
&&
!
doctorInfo
.
isSuccess
())
{
log
.
error
(
"IM INFORM ERROR : 获取医生信息失败 doctorId:{}"
,
String
.
valueOf
(
patientSignEntity
.
getDoctorId
()));
return
new
PatientSignInfo
();
}
patientSignInfo
.
setDoctorUserId
(
userInfoByUserIdRespVO
.
getUserId
());
patientSignInfo
.
setDoctorHeadPortrait
(
doctorInfo
.
getData
().
getPortrait
());
patientSignInfo
.
setDoctorProfessional
(
doctorInfo
.
getData
().
getTitle
());
log
.
info
(
"patientSignInfo:{}"
+
JSON
.
toJSONString
(
patientSignInfo
));
return
patientSignInfo
;
}
private
UserInfoByUserIdRespVO
queryDocAccountInfo
(
String
doctorId
)
{
BaseResponse
<
UserInfoByDoctorIdRespVO
>
response
=
userApiFeignClient
.
getUserInfoByDoctorId
(
doctorId
);
log
.
info
(
"response:{}"
,
JsonUtil
.
convertObject
(
response
));
UserInfoByUserIdRespVO
userInfoByUserIdRespVO
=
new
UserInfoByUserIdRespVO
();
if
(
response
.
isSuccess
())
{
userInfoByUserIdRespVO
.
setUserId
(
response
.
getData
().
getUserId
());
log
.
info
(
"UserInfoByUserIdRespVO===>{}"
,
JSON
.
toJSONString
(
userInfoByUserIdRespVO
));
return
userInfoByUserIdRespVO
;
}
return
null
;
}
/**
* Discreption:封装推送参数
*
* @return:boolean
* @author:wwx
* @date:2021/11/24 16:19
*/
private
boolean
pushImInform
(
List
<
MessageInfo
>
messageInfos
,
String
admissionId
)
{
boolean
flag
=
true
;
PersonImInformReq
parameter
=
new
PersonImInformReq
();
parameter
.
setMessageInfos
(
messageInfos
);
parameter
.
setAdmissionId
(
admissionId
);
parameter
.
setBusiCode
(
IMInformConstants
.
IM_SYSTEM_BUSINESS_CODE
);
flag
=
personImInform
(
parameter
);
return
flag
;
}
/**
* 个人(单聊)系统消息推送
*
* @param param
* @return 是否推送成功
*/
private
boolean
personImInform
(
PersonImInformReq
param
)
{
List
<
MessageInfo
>
messageInfos
=
param
.
getMessageInfos
();
if
(
messageInfos
==
null
||
messageInfos
.
isEmpty
())
{
log
.
error
(
"IM INFORM ERROR : 没有可发送的消息"
);
return
false
;
}
List
<
PushSingleMsgDataVO
>
msgSingleDatas
=
new
ArrayList
<>();
messageInfos
.
forEach
(
e
->
{
PushSingleMsgDataVO
msgsingleData
=
new
PushSingleMsgDataVO
();
msgsingleData
.
setActionType
(
IMInformConstants
.
INFORM_SYSTEM_MESSAGE_TYPE
);
msgsingleData
.
setFromAccount
(
e
.
getSelfAccount
());
msgsingleData
.
setToAccount
(
e
.
getSingleAccount
());
msgsingleData
.
setMessage
(
JsonUtil
.
convertObject
(
e
.
getMessage
()));
//固定系统消息
msgSingleDatas
.
add
(
msgsingleData
);
});
PushSingleMsgReqVO
parameter
=
new
PushSingleMsgReqVO
();
parameter
.
setBusiCode
(
param
.
getBusiCode
());
parameter
.
setUniqueId
(
param
.
getAdmissionId
());
parameter
.
setMsgData
(
msgSingleDatas
);
// 发送IM单人推送
log
.
info
(
"推送入参:{}"
+
JSON
.
toJSONString
(
parameter
));
boolean
pushFlag
=
pushSingleIm
(
parameter
);
if
(
pushFlag
!=
true
)
{
log
.
info
(
"IM INFORM ERROR : im 调用im系统推送失败"
);
return
false
;
}
return
true
;
}
/**
* @param reqVO 请求参数
* @return boolean 发送结果
* @description: 发送IM单人推送
* @author fangyueguo
* @date 2019年02月19日
*/
private
boolean
pushSingleIm
(
PushSingleMsgReqVO
reqVO
)
{
log
.
info
(
"调用IM第三方reqVO:{}"
+
JSON
.
toJSONString
(
reqVO
));
BaseResponse
<?>
response
=
imPushMsgFeignClient
.
pushSingleMsg
(
reqVO
);
log
.
info
(
"发送IM单人推送:{}"
,
response
.
toString
());
return
response
.
isSuccess
();
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/impl/PatientSignServiceImpl.java
浏览文件 @
fb4a91aa
...
...
@@ -231,6 +231,7 @@ public class PatientSignServiceImpl implements PatientSignService {
resVo
.
setDeptId
(
patientSignEntity
.
getDeptId
().
toString
());
resVo
.
setDeptName
(
patientSignEntity
.
getDeptName
());
resVo
.
setSignEndTime
(
patientSignEntity
.
getSignEndTime
());
resVo
.
setAdmTime
(
patientSignEntity
.
getSignEndTime
());
//患者信息
PatientEntity
patientEntity
=
patientMapper
.
selectById
(
patientSignEntity
.
getPatientId
());
...
...
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/impl/RedisTemplateServiceImpl.java
0 → 100644
浏览文件 @
fb4a91aa
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
service
.
impl
;
import
com.ebaiyihui.family.doctor.server.service.RedisTemplateService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.concurrent.TimeUnit
;
/**
* @program byh-aggregation-payment
* @description:
* @author: chenmet
* @create: 2019/08/21 15:31
*/
@Service
@Slf4j
public
class
RedisTemplateServiceImpl
implements
RedisTemplateService
{
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Override
public
boolean
get
(
String
key
)
{
return
stringRedisTemplate
.
hasKey
(
key
);
}
@Override
public
void
set
(
String
key
)
{
stringRedisTemplate
.
opsForValue
().
set
(
key
,
key
,
30
,
TimeUnit
.
SECONDS
);
}
@Override
public
boolean
del
(
String
key
)
{
return
stringRedisTemplate
.
delete
(
key
);
}
@Override
public
Long
getTime
(
String
key
)
{
return
stringRedisTemplate
.
getExpire
(
key
,
TimeUnit
.
SECONDS
);
}
@Override
public
boolean
addLock
(
String
key
,
String
value
,
long
time
)
{
return
stringRedisTemplate
.
opsForValue
().
setIfAbsent
(
key
,
value
);
}
//有锁:true 没锁:false
@Override
public
synchronized
boolean
addLockNew
(
String
key
,
String
value
,
long
time
)
{
boolean
flag
=
true
;
if
(!
get
(
key
)){
stringRedisTemplate
.
opsForValue
().
set
(
key
,
value
,
time
,
TimeUnit
.
SECONDS
);
return
false
;
}
return
flag
;
}
@Override
public
boolean
addLock
(
String
key
,
String
value
)
{
return
stringRedisTemplate
.
opsForValue
().
setIfAbsent
(
key
,
value
);
}
@Override
public
boolean
hasKey
(
String
key
)
{
return
stringRedisTemplate
.
hasKey
(
key
);
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论