Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
B
byh-family-doctor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
包
包
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
杨凯
byh-family-doctor
Commits
a869027c
提交
a869027c
authored
3月 15, 2024
作者:
杨凯
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:家庭医生初始化
上级
2058ecb0
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
304 行增加
和
13 行删除
+304
-13
Components.java
...ava/com/ebaiyihui/family/doctor/common/bo/Components.java
+19
-0
MsgContent.java
...ava/com/ebaiyihui/family/doctor/common/bo/MsgContent.java
+17
-0
SendImMsgDTO.java
.../com/ebaiyihui/family/doctor/common/dto/SendImMsgDTO.java
+21
-0
SenderEnum.java
...aiyihui/family/doctor/server/common/enums/SenderEnum.java
+40
-0
ImMsgTemplateController.java
...ily/doctor/server/controller/ImMsgTemplateController.java
+43
-0
PatientController.java
...ui/family/doctor/server/controller/PatientController.java
+1
-1
ImMsgTemplateEntity.java
...ihui/family/doctor/server/entity/ImMsgTemplateEntity.java
+33
-0
ImMsgTemplateMapper.java
...ihui/family/doctor/server/mapper/ImMsgTemplateMapper.java
+15
-0
ImChatTemplate.java
...baiyihui/family/doctor/server/service/ImChatTemplate.java
+5
-0
ImMsgTemplateService.java
...ui/family/doctor/server/service/ImMsgTemplateService.java
+16
-0
ImChatTemplateImpl.java
...family/doctor/server/service/impl/ImChatTemplateImpl.java
+39
-12
ImMsgTemplateServiceImpl.java
.../doctor/server/service/impl/ImMsgTemplateServiceImpl.java
+55
-0
没有找到文件。
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/bo/Components.java
0 → 100644
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
bo
;
import
lombok.Data
;
/**
* @ClassName: Components
* @Author:yanliang
* @Date:2024/3/15 10:22
* @Description
*/
@Data
public
class
Components
{
private
String
sender
;
private
Integer
sort
;
private
String
content
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/bo/MsgContent.java
0 → 100644
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
bo
;
import
lombok.Data
;
import
java.util.List
;
/**
* @ClassName: MsgContent
* @Author:yanliang
* @Date:2024/3/15 10:20
* @Description
*/
@Data
public
class
MsgContent
{
private
List
<
Components
>
components
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/dto/SendImMsgDTO.java
0 → 100644
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
dto
;
import
lombok.Data
;
/**
* @ClassName: SendImMsgDTO
* @Author:yanliang
* @Date:2024/3/15 10:09
* @Description
*/
@Data
public
class
SendImMsgDTO
{
private
Integer
type
;
private
String
appCode
;
private
Long
organId
;
private
String
admId
;
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/common/enums/SenderEnum.java
0 → 100644
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
common
.
enums
;
/**
* @ClassName: SenderEnum
* @Author:yanliang
* @Date:2024/3/15 10:59
* @Description
*/
public
enum
SenderEnum
{
DOCTOR
(
"doctor"
,
1
),
PATIENT
(
"patient"
,
2
);
private
String
desc
;
private
Integer
value
;
private
SenderEnum
(
String
desc
,
Integer
value
)
{
this
.
desc
=
desc
;
this
.
value
=
value
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
value
;
}
public
void
setValue
(
Integer
value
)
{
this
.
value
=
value
;
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/controller/ImMsgTemplateController.java
0 → 100644
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
controller
;
import
com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO
;
import
com.ebaiyihui.family.doctor.server.service.ImMsgTemplateService
;
import
com.ebaiyihui.framework.response.BaseResponse
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @ClassName: ImMsgTemplateController
* @Author:yanliang
* @Date:2024/3/15 10:07
* @Description
*/
@RestController
@RequestMapping
(
"/imMsgTemplate"
)
@Api
(
tags
=
"消息发送API"
)
@Slf4j
public
class
ImMsgTemplateController
{
@Autowired
private
ImMsgTemplateService
imMsgTemplateService
;
@RequestMapping
(
value
=
"/sendImMsg"
,
method
=
RequestMethod
.
POST
)
public
BaseResponse
<
String
>
sendImMsg
(
@RequestBody
SendImMsgDTO
reqVo
,
BindingResult
bindingResult
)
{
BaseResponse
<
String
>
response
=
null
;
try
{
response
=
imMsgTemplateService
.
sendImMsg
(
reqVo
);
}
catch
(
Exception
e
)
{
return
BaseResponse
.
error
(
e
.
getMessage
());
}
return
response
;
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/controller/PatientController.java
浏览文件 @
a869027c
...
...
@@ -44,7 +44,7 @@ public class PatientController {
return
response
;
}
@ApiOperation
(
value
=
"
签约医生
"
,
notes
=
"医生服务feign调用"
)
@ApiOperation
(
value
=
"
获取签约医生信息
"
,
notes
=
"医生服务feign调用"
)
@RequestMapping
(
value
=
"/getSignedDoctor"
,
method
=
RequestMethod
.
POST
)
public
BaseResponse
<
PatientSignEntity
>
getSignedDoctor
(
@RequestBody
SignedDoctorDTO
reqVo
,
BindingResult
bindingResult
)
{
...
...
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/entity/ImMsgTemplateEntity.java
0 → 100644
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
entity
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @ClassName: ImMsgTemplate
* @Author:yanliang
* @Date:2024/3/15 09:59
* @Description
*/
@Data
public
class
ImMsgTemplateEntity
{
private
Long
id
;
private
Integer
type
;
private
String
appCode
;
private
Long
organId
;
private
String
content
;
private
Date
createTime
;
private
Date
updateTime
;
private
String
templateName
;
private
String
remark
;
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/mapper/ImMsgTemplateMapper.java
0 → 100644
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.ebaiyihui.family.doctor.server.entity.ImMsgTemplateEntity
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @ClassName: ImMsgTemplateMapper
* @Author:yanliang
* @Date:2024/3/15 10:05
* @Description
*/
@Mapper
public
interface
ImMsgTemplateMapper
extends
BaseMapper
<
ImMsgTemplateEntity
>
{
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/ImChatTemplate.java
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
service
;
import
com.ebaiyihui.family.doctor.common.bo.Components
;
import
com.ebaiyihui.family.doctor.server.entity.PatientSignEntity
;
import
com.ebaiyihui.framework.response.BaseResponse
;
import
com.ebaiyihui.imforward.client.vo.IMQueryTargetSdkAccountRspVO
;
import
java.util.List
;
/**
* @ClassName: ImChatTemplate
* @Author:yanliang
...
...
@@ -25,4 +28,6 @@ public interface ImChatTemplate {
IMQueryTargetSdkAccountRspVO
queryImAccount
(
String
admId
,
String
imAppCode
,
String
doctorId
);
void
doctorPrompted
(
String
admId
);
Boolean
sendMsg
(
List
<
Components
>
componentsList
,
String
admId
);
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/ImMsgTemplateService.java
0 → 100644
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
service
;
import
com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO
;
import
com.ebaiyihui.framework.response.BaseResponse
;
/**
* @ClassName: ImMsgTemplateService
* @Author:yanliang
* @Date:2024/3/15 10:06
* @Description
*/
public
interface
ImMsgTemplateService
{
BaseResponse
<
String
>
sendImMsg
(
SendImMsgDTO
reqVo
);
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/impl/ImChatTemplateImpl.java
浏览文件 @
a869027c
...
...
@@ -12,6 +12,7 @@ import com.ebaiyihui.family.doctor.common.dto.DoctorIdDTO;
import
com.ebaiyihui.family.doctor.server.common.constants.CommonConstants
;
import
com.ebaiyihui.family.doctor.server.common.constants.IMInformConstants
;
import
com.ebaiyihui.family.doctor.server.common.constants.ImConstants
;
import
com.ebaiyihui.family.doctor.server.common.enums.SenderEnum
;
import
com.ebaiyihui.family.doctor.server.entity.PatientSignEntity
;
import
com.ebaiyihui.family.doctor.server.exception.BusinessException
;
import
com.ebaiyihui.family.doctor.server.feign.DoctorInfofeignClient
;
...
...
@@ -139,6 +140,37 @@ public class ImChatTemplateImpl implements ImChatTemplate {
}
}
@Override
public
Boolean
sendMsg
(
List
<
Components
>
componentsList
,
String
admId
)
{
if
(!
componentsList
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
componentsList
.
size
();
i
++)
{
String
content
=
componentsList
.
get
(
i
).
getContent
();
List
<
MessageInfo
>
messageInfos
=
new
ArrayList
<>();
PatientSignInfo
patientSignInfo
=
getPatientSignInfo
(
admId
);
MessageInfo
messageInfo
=
new
MessageInfo
();
if
(
SenderEnum
.
DOCTOR
.
getDesc
().
equals
(
componentsList
.
get
(
i
).
getSender
()))
{
messageInfo
=
getDoctorInformRefreshPatientParam
(
patientSignInfo
,
IMInformConstants
.
REFRESH
);
}
else
{
messageInfo
=
getInformRefreshPatientParam
(
patientSignInfo
,
IMInformConstants
.
REFRESH
);
}
messageInfos
.
add
(
messageInfo
);
PersonImInformReq
parameter
=
new
PersonImInformReq
();
parameter
.
setMessageInfos
(
messageInfos
);
parameter
.
setAdmissionId
(
admId
);
parameter
.
setBusiCode
(
IMInformConstants
.
IM_SYSTEM_BUSINESS_CODE
);
log
.
info
(
"推送家庭医生提示语推送:{}"
+
JSON
.
toJSONString
(
parameter
.
getMessageInfos
()));
Long
syncFlag
=
i
*
100L
;
if
(
personUserImInform
(
parameter
,
content
,
syncFlag
))
{
log
.
info
(
"推送家庭医生提示语推送成功,admissionId:{}"
,
admId
);
return
true
;
}
}
}
return
null
;
}
/**
* 获取im推送需要的信息
* 1.serviceType 2.0 病人账号 2.1 病人名字 3.3 医生生名字 账号 6.拒绝理由 7.订单号
...
...
@@ -199,24 +231,19 @@ public class ImChatTemplateImpl implements ImChatTemplate {
return
messageInfo
;
}
private
<
T
>
MessageInfo
getInformRefreshPatientParam
(
PatientSignInfo
patientSignInfo
,
T
content
,
Integer
isRefresh
)
{
String
patientUserId
=
patientSignInfo
.
getPatient
UserId
();
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isEmpty
(
patient
UserId
))
{
private
<
T
>
MessageInfo
getInformRefreshPatientParam
(
PatientSignInfo
patientSignInfo
,
Integer
isRefresh
)
{
String
doctorUserId
=
patientSignInfo
.
getDoctor
UserId
();
if
(
StringUtils
.
isEmpty
(
doctor
UserId
))
{
log
.
error
(
"IM INFORM ERROR : 无法查询到接收人信息"
);
return
new
MessageInfo
();
}
MessageInfo
messageInfo
=
new
MessageInfo
();
Message
<
T
>
message
=
new
Message
<>();
message
.
setMessageType
(
IMInformConstants
.
SERVICE_SYSTEM_FIXATION_TYPE
);
message
.
setAdmissionId
(
patientSignInfo
.
getAdmId
());
message
.
setApplicationCode
(
IMInformConstants
.
IM_SYSTEM_BUSINESS_CODE
);
message
.
setIsRefresh
(
isRefresh
);
message
.
setData
(
content
);
messageInfo
.
setMessage
(
message
);
// message.setData(content);
// messageInfo.setMessage(message);
message
.
setApplicationCode
(
IMInformConstants
.
IM_SYSTEM_BUSINESS_CODE
);
messageInfo
.
setSingleAccount
(
newAccount
(
IMInformConstants
.
PATIENT_APPLICATION_CODE
,
patientUserId
));
messageInfo
.
setSelfAccount
(
newAccount
(
IMInformConstants
.
DOCTOR_APPLICATION_CODE
,
patientSignInfo
.
getDoctorUserId
()));
messageInfo
.
setSingleAccount
(
newAccount
(
IMInformConstants
.
DOCTOR_APPLICATION_CODE
,
doctorUserId
));
messageInfo
.
setSelfAccount
(
newAccount
(
IMInformConstants
.
PATIENT_APPLICATION_CODE
,
patientSignInfo
.
getPatientUserId
()));
messageInfo
.
setMessage
(
message
);
return
messageInfo
;
}
...
...
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/impl/ImMsgTemplateServiceImpl.java
0 → 100644
浏览文件 @
a869027c
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.ebaiyihui.family.doctor.common.bo.Components
;
import
com.ebaiyihui.family.doctor.common.bo.MsgContent
;
import
com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO
;
import
com.ebaiyihui.family.doctor.server.entity.ImMsgTemplateEntity
;
import
com.ebaiyihui.family.doctor.server.exception.BusinessException
;
import
com.ebaiyihui.family.doctor.server.mapper.ImMsgTemplateMapper
;
import
com.ebaiyihui.family.doctor.server.service.ImChatTemplate
;
import
com.ebaiyihui.family.doctor.server.service.ImMsgTemplateService
;
import
com.ebaiyihui.framework.response.BaseResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @ClassName: ImMsgTemplateServiceImpl
* @Author:yanliang
* @Date:2024/3/15 10:06
* @Description
*/
@Service
public
class
ImMsgTemplateServiceImpl
implements
ImMsgTemplateService
{
@Autowired
private
ImMsgTemplateMapper
imMsgTemplateMapper
;
@Autowired
private
ImChatTemplate
imChatTemplate
;
@Override
public
BaseResponse
<
String
>
sendImMsg
(
SendImMsgDTO
reqVo
)
{
QueryWrapper
<
ImMsgTemplateEntity
>
wrapper
=
new
QueryWrapper
<>();
ImMsgTemplateEntity
imMsgTemplate
=
new
ImMsgTemplateEntity
();
imMsgTemplate
.
setAppCode
(
reqVo
.
getAppCode
());
imMsgTemplate
.
setOrganId
(
reqVo
.
getOrganId
());
imMsgTemplate
.
setType
(
reqVo
.
getType
());
wrapper
.
setEntity
(
imMsgTemplate
);
ImMsgTemplateEntity
imMsgTemplateEntity
=
imMsgTemplateMapper
.
selectOne
(
wrapper
);
String
components
=
imMsgTemplateEntity
.
getContent
();
MsgContent
msgContent
=
JSON
.
parseObject
(
components
,
MsgContent
.
class
);
List
<
Components
>
componentsList
=
msgContent
.
getComponents
().
stream
().
sorted
(
Comparator
.
comparing
(
Components:
:
getSort
)).
collect
(
Collectors
.
toList
());
Boolean
flag
=
imChatTemplate
.
sendMsg
(
componentsList
,
reqVo
.
getAdmId
());
if
(!
flag
)
{
throw
new
BusinessException
(
"消息推送失败"
);
}
return
BaseResponse
.
success
(
"消息推送成功"
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论