Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
B
byh-family-doctor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
包
包
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
杨凯
byh-family-doctor
Commits
c524d4dc
提交
c524d4dc
authored
3月 19, 2024
作者:
杨凯
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:家庭医生初始化
上级
c305bee8
全部展开
显示空白字符变更
内嵌
并排
正在显示
30 个修改的文件
包含
1460 行增加
和
52 行删除
+1460
-52
MobileBenefitPackageClient.java
...ihui/family/doctor/client/MobileBenefitPackageClient.java
+30
-0
pom.xml
family-doctor-common/pom.xml
+6
-0
MobileBenefitResp.java
.../ebaiyihui/family/doctor/common/bo/MobileBenefitResp.java
+17
-0
Result.java
...in/java/com/ebaiyihui/family/doctor/common/bo/Result.java
+98
-0
NotifyConsultDataDTO.java
...iyihui/family/doctor/common/dto/NotifyConsultDataDTO.java
+45
-0
SignedDoctorDTO.java
...m/ebaiyihui/family/doctor/common/dto/SignedDoctorDTO.java
+3
-0
SyncSignedOrderDTO.java
...baiyihui/family/doctor/common/dto/SyncSignedOrderDTO.java
+23
-0
ThirdPushDTO.java
.../com/ebaiyihui/family/doctor/common/dto/ThirdPushDTO.java
+15
-0
AccessTokenVo.java
.../com/ebaiyihui/family/doctor/common/vo/AccessTokenVo.java
+26
-0
MobileBenefitPackageVo.java
...yihui/family/doctor/common/vo/MobileBenefitPackageVo.java
+41
-0
RegistPatientVo.java
...om/ebaiyihui/family/doctor/common/vo/RegistPatientVo.java
+22
-0
pom.xml
family-doctor-server/pom.xml
+27
-15
CommonConstants.java
...amily/doctor/server/common/constants/CommonConstants.java
+11
-0
ProjProperties.java
...family/doctor/server/common/constants/ProjProperties.java
+6
-0
UrlConstants.java
...i/family/doctor/server/common/constants/UrlConstants.java
+20
-0
SignStatus.java
...aiyihui/family/doctor/server/common/enums/SignStatus.java
+1
-1
SignTypeEnum.java
...yihui/family/doctor/server/common/enums/SignTypeEnum.java
+40
-0
MobileBenefitPackageController.java
...tor/server/controller/MobileBenefitPackageController.java
+43
-0
MobileBenefitPackageEntity.java
...mily/doctor/server/entity/MobileBenefitPackageEntity.java
+61
-0
PatientSignEntity.java
...iyihui/family/doctor/server/entity/PatientSignEntity.java
+6
-0
MobileBenefitPackageMapper.java
...mily/doctor/server/mapper/MobileBenefitPackageMapper.java
+29
-0
MobileBenefitPackageService.java
...ly/doctor/server/service/MobileBenefitPackageService.java
+23
-0
MobileBenefitPackageServiceImpl.java
.../server/service/impl/MobileBenefitPackageServiceImpl.java
+143
-0
PatientServiceImpl.java
...family/doctor/server/service/impl/PatientServiceImpl.java
+42
-36
DESUtils.java
...ava/com/ebaiyihui/family/doctor/server/util/DESUtils.java
+78
-0
DateUtils.java
...va/com/ebaiyihui/family/doctor/server/util/DateUtils.java
+20
-0
HttpKit.java
...java/com/ebaiyihui/family/doctor/server/util/HttpKit.java
+273
-0
SignUtils.java
...va/com/ebaiyihui/family/doctor/server/util/SignUtils.java
+90
-0
ThirdOrderPushUtil.java
...aiyihui/family/doctor/server/util/ThirdOrderPushUtil.java
+146
-0
MobileBenefitPackageMapper.xml
.../src/main/resources/mapper/MobileBenefitPackageMapper.xml
+75
-0
没有找到文件。
family-doctor-client/src/main/java/com/ebaiyihui/family/doctor/client/MobileBenefitPackageClient.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
client
;
import
com.ebaiyihui.family.doctor.common.bo.MobileBenefitResp
;
import
com.ebaiyihui.family.doctor.common.bo.Result
;
import
com.ebaiyihui.family.doctor.common.vo.MobileBenefitPackageVo
;
import
com.ebaiyihui.family.doctor.common.vo.RegistPatientVo
;
import
com.ebaiyihui.framework.response.BaseResponse
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* @ClassName: MobileBenefitPackageClient
* @Author:yanliang
* @Date:2024/3/19 11:35
* @Description
*/
@FeignClient
(
value
=
"byh-family-doctor"
)
public
interface
MobileBenefitPackageClient
{
@GetMapping
(
"/h5/login"
)
@ApiOperation
(
value
=
"登陆并注册就诊卡"
)
public
BaseResponse
<
RegistPatientVo
>
login
(
@RequestParam
(
"token"
)
String
token
);
@PostMapping
(
"/benefit/add"
)
@ApiOperation
(
value
=
"生成权益订单同步推送"
)
public
Result
<
MobileBenefitResp
>
addBenefitPackage
(
@RequestBody
List
<
MobileBenefitPackageVo
>
vos
);
}
family-doctor-common/pom.xml
浏览文件 @
c524d4dc
...
...
@@ -37,6 +37,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.ebaiyihui
</groupId>
<artifactId>
byh-card-service-client
</artifactId>
<version>
${card.version}
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/bo/MobileBenefitResp.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
bo
;
import
lombok.Data
;
/**
* @ClassName: MobileBenefitResp
* @Author:yanliang
* @Date:2024/3/19 11:39
* @Description
*/
@Data
public
class
MobileBenefitResp
{
private
String
orderStatus
;
private
String
orderDesc
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/bo/Result.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
bo
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
java.beans.Transient
;
import
java.util.Objects
;
/**
* @ClassName: Result
* @Author:yanliang
* @Date:2024/3/18 15:23
* @Description
*/
public
class
Result
<
T
>
{
public
static
final
String
DEFAULT_SUCCESS_MESSAGE
=
"success"
;
public
static
final
String
DEFAULT_ERROR_MESSAGE
=
"failed"
;
public
static
final
String
DEFAULT_SUCCESS_CODE
=
"200"
;
public
static
final
String
DEFAULT_ERROR_CODE
=
"0"
;
private
String
code
;
private
String
message
;
private
T
data
;
public
Result
()
{
}
public
Result
(
String
code
,
String
message
,
T
data
)
{
this
.
code
=
code
;
this
.
data
=
data
;
this
.
message
=
message
;
}
public
static
<
T
>
Result
<
T
>
success
(
Object
t
)
{
Result
<
T
>
res
=
new
Result
();
res
.
setCode
(
DEFAULT_SUCCESS_CODE
);
res
.
setMsg
(
DEFAULT_SUCCESS_MESSAGE
);
res
.
setData
((
T
)
t
);
return
res
;
}
public
static
<
T
>
Result
<
T
>
success
()
{
Result
<
T
>
res
=
new
Result
();
res
.
setCode
(
DEFAULT_SUCCESS_CODE
);
res
.
setMsg
(
DEFAULT_SUCCESS_MESSAGE
);
res
.
setData
((
T
)
null
);
return
res
;
}
public
static
<
T
>
Result
<
T
>
error
()
{
Result
<
T
>
res
=
new
Result
();
res
.
setCode
(
DEFAULT_ERROR_CODE
);
res
.
setMsg
(
DEFAULT_ERROR_MESSAGE
);
res
.
setData
((
T
)
null
);
return
res
;
}
public
static
<
T
>
Result
<
T
>
error
(
Object
t
)
{
Result
<
T
>
res
=
new
Result
();
res
.
setCode
(
DEFAULT_ERROR_CODE
);
res
.
setMsg
(
DEFAULT_ERROR_MESSAGE
);
res
.
setData
((
T
)
t
);
return
res
;
}
public
String
getCode
()
{
return
this
.
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
this
.
message
;
}
public
void
setMsg
(
String
message
)
{
this
.
message
=
message
;
}
public
T
getData
()
{
return
this
.
data
;
}
public
void
setData
(
T
data
)
{
this
.
data
=
data
;
}
@Transient
@JsonIgnore
public
boolean
isSuccess
()
{
return
Objects
.
equals
(
this
.
code
,
"200"
);
}
public
String
toString
()
{
return
"ResultResponse [code="
+
this
.
code
+
", message="
+
this
.
message
+
", data="
+
this
.
data
+
"]"
;
}
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/dto/NotifyConsultDataDTO.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @ClassName: NotifyConsultDataDTO
* @Author:yanliang
* @Date:2024/3/19 14:27
* @Description
*/
@Data
public
class
NotifyConsultDataDTO
extends
ThirdPushDTO
{
@ApiModelProperty
(
value
=
"激活订单ID"
,
required
=
true
)
// @NotBlank(message = "激活订单ID 不为空")
private
String
activateOrderId
;
@ApiModelProperty
(
value
=
"问诊订单ID"
,
required
=
true
)
// @NotBlank(message = "问诊订单ID 不为空")
private
String
consultOrderNo
;
@ApiModelProperty
(
value
=
"订单状态(服务方提供状态映射关系)"
,
required
=
true
)
// @NotBlank(message = "订单状态 不为空")
private
String
status
;
@ApiModelProperty
(
value
=
"权益编码"
,
required
=
true
)
// @NotBlank(message = "权益编码 不为空")
private
String
productId
;
@ApiModelProperty
(
value
=
"就诊人ID(首次推送必填)"
,
required
=
false
)
private
String
patientId
;
@ApiModelProperty
(
value
=
"接诊医生"
,
required
=
false
)
private
String
expertName
;
@ApiModelProperty
(
value
=
"下单时间(首次推送必填)格式:yyyy-MM-dd?HH:mm:ss||yyyy/MM/ddHH:mm:ss||yyyy.MM.ddHH:mm:ss||yyyy年MM月dd日HH:mm:ss"
,
required
=
true
)
private
String
orderDate
;
@ApiModelProperty
(
value
=
"病情描述"
,
required
=
false
)
private
String
content
;
@ApiModelProperty
(
value
=
"私参(JSONString)?具体参数根据服务方定义"
,
required
=
false
)
private
String
privateParams
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/dto/SignedDoctorDTO.java
浏览文件 @
c524d4dc
...
...
@@ -42,6 +42,9 @@ public class SignedDoctorDTO {
@ApiModelProperty
(
"签约编号"
)
private
String
admId
;
@ApiModelProperty
(
"权益包id"
)
private
String
packageOrderId
;
@ApiModelProperty
(
"签约状态1.未签约2.已签约3:已解约"
)
private
Integer
signStatus
;
...
...
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/dto/SyncSignedOrderDTO.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
dto
;
import
lombok.Data
;
/**
* @ClassName: SyncSignedOrderDTO
* @Author:yanliang
* @Date:2024/3/18 15:40
* @Description
*/
@Data
public
class
SyncSignedOrderDTO
extends
ThirdPushDTO
{
private
String
doctorId
;
private
String
signSeqId
;
private
String
phone
;
private
String
signType
;
private
String
benefitOrderId
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/dto/ThirdPushDTO.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
dto
;
import
lombok.Data
;
/**
* @ClassName: ThirdPushDTO
* @Author:yanliang
* @Date:2024/3/18 15:40
* @Description
*/
@Data
public
class
ThirdPushDTO
{
private
String
supplierCode
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/vo/AccessTokenVo.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @ClassName: AccessTokenVo
* @Author:yanliang
* @Date:2024/3/18 15:22
* @Description
*/
@Data
public
class
AccessTokenVo
{
@ApiModelProperty
(
value
=
"鉴权token"
)
private
String
accessToken
;
@ApiModelProperty
(
value
=
"refreshToken"
)
private
String
refreshToken
;
@ApiModelProperty
(
value
=
"token类型"
)
private
String
tokenType
;
@ApiModelProperty
(
value
=
"生效时间(毫秒)"
)
private
Integer
expiresIn
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/vo/MobileBenefitPackageVo.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @ClassName: MobileBenefitPackageVo
* @Author:yanliang
* @Date:2024/3/19 11:38
* @Description
*/
@Data
public
class
MobileBenefitPackageVo
{
@ApiModelProperty
(
value
=
"权益编码"
)
private
String
productId
;
@ApiModelProperty
(
value
=
"手机号"
)
private
String
phone
;
@ApiModelProperty
(
value
=
"外部用户id"
)
private
String
userId
;
@ApiModelProperty
(
value
=
"外部订单id"
)
private
String
orderId
;
@ApiModelProperty
(
value
=
"激活订单id"
)
private
String
activateOrderId
;
@ApiModelProperty
(
value
=
"有效期开始时间"
)
private
String
benefitsStartTime
;
@ApiModelProperty
(
value
=
"有效期结束时间"
)
private
String
benefitsEndTime
;
@ApiModelProperty
(
value
=
"限制次数"
)
private
Integer
timeLimit
;
@ApiModelProperty
(
value
=
"是否续订【1:自动续订,0:一次性】"
)
private
String
isRenew
;
}
family-doctor-common/src/main/java/com/ebaiyihui/family/doctor/common/vo/RegistPatientVo.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
common
.
vo
;
import
com.ebaiyihui.card.common.vo.CardDetailsInfoRespVO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @ClassName: RegistPatientVo
* @Author:yanliang
* @Date:2024/3/19 10:38
* @Description
*/
@Data
public
class
RegistPatientVo
{
@ApiModelProperty
(
"就诊人信息"
)
CardDetailsInfoRespVO
patientInfo
;
@ApiModelProperty
(
"激活权益订单号"
)
private
String
activateOrderId
;
}
family-doctor-server/pom.xml
浏览文件 @
c524d4dc
...
...
@@ -114,17 +114,17 @@
<version>
5.1.30
</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
<!-- <version>1.3.2</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.mybatis</groupId>-->
<!-- <artifactId>mybatis</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
<!-- <version>1.3.2</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.mybatis</groupId>-->
<!-- <artifactId>mybatis</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<dependency>
<groupId>
com.baomidou
</groupId>
...
...
@@ -150,10 +150,10 @@
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.amqp</groupId>-->
<!-- <artifactId>spring-rabbit</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.amqp</groupId>-->
<!-- <artifactId>spring-rabbit</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>
com.ning
</groupId>
...
...
@@ -212,6 +212,12 @@
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
com.ebaiyihui
</groupId>
<artifactId>
byh-card-service-client
</artifactId>
<version>
${card.version}
</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.ebaiyihui</groupId>-->
...
...
@@ -242,6 +248,12 @@
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
4.4.2
</version>
</dependency>
</dependencies>
<build>
...
...
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/common/constants/CommonConstants.java
浏览文件 @
c524d4dc
...
...
@@ -131,4 +131,15 @@ public class CommonConstants {
public
static
final
String
ORGAN_NAME
=
"南昌众康医院"
;
public
static
final
Long
ORGAN_CODE
=
130188L
;
public
static
final
Integer
DAY
=
30
;
public
static
final
String
GRANT_TYPE
=
"client_credentials"
;
public
static
final
String
DES_SECRET
=
"zk26rdgfsg23j42fewegfr234h23423g44323"
;
public
static
final
String
SIGN_SECRET
=
"123456"
;
public
static
final
String
SUPPLIER_CODE
=
"ZhongKang"
;
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/common/constants/ProjProperties.java
浏览文件 @
c524d4dc
...
...
@@ -20,4 +20,10 @@ public class ProjProperties {
private
String
userInfo
;
private
String
baseAddress
;
private
String
familyDoctorThirdUrl
;
private
String
familyDoctorThirdClientId
;
private
String
familyDoctorThirdClientSecret
;
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/common/constants/UrlConstants.java
浏览文件 @
c524d4dc
...
...
@@ -10,4 +10,24 @@ package com.ebaiyihui.family.doctor.server.common.constants;
public
class
UrlConstants
{
public
static
final
String
GO_EASY_PUSH
=
"/cloud/push/goeasy/pushgoeasyuserid"
;
/**
* 获取token地址
*/
public
static
final
String
GET_TOKEN_URL
=
"/auth/v1.0.0/oauth/token"
;
/**
* 订单同步地址
*/
public
static
final
String
PUSH_DATA_URL
=
"/notify_consult/v1.0.1/data"
;
/**
* 签约信息同步
*/
public
static
final
String
SYNC_SIGNED_ORDER_URL
=
"/auth/v1.0.1/signature/info"
;
/**
* 修改签约信息
*/
public
static
final
String
UPDATE_SIGNED_ORDER_URL
=
"auth/v1.0.1/signature/changeSign"
;
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/common/enums/SignStatus.java
浏览文件 @
c524d4dc
...
...
@@ -11,7 +11,7 @@ public enum SignStatus {
// 签约状态1.未签约2.已签约3:已解约
NORMAL
(
"未签约
2
"
,
1
),
NORMAL
(
"未签约"
,
1
),
SIGNED
(
"已签约"
,
2
),
...
...
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/common/enums/SignTypeEnum.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
common
.
enums
;
/**
* @ClassName: SignTypeEnum
* @Author:yanliang
* @Date:2024/3/18 16:06
* @Description
*/
public
enum
SignTypeEnum
{
// 1:签约团体,2:签约医生
SIGNED_MEMBER
(
"签名团体"
,
"1"
),
SIGNED_DOCTOR
(
"签名医生"
,
"2"
);
public
String
desc
;
public
String
value
;
private
SignTypeEnum
(
String
desc
,
String
value
)
{
this
.
desc
=
desc
;
this
.
value
=
value
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/controller/MobileBenefitPackageController.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
controller
;
import
com.ebaiyihui.family.doctor.common.bo.MobileBenefitResp
;
import
com.ebaiyihui.family.doctor.common.bo.Result
;
import
com.ebaiyihui.family.doctor.common.vo.MobileBenefitPackageVo
;
import
com.ebaiyihui.family.doctor.common.vo.RegistPatientVo
;
import
com.ebaiyihui.family.doctor.server.service.MobileBenefitPackageService
;
import
com.ebaiyihui.framework.response.BaseResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* @ClassName: MobileBenefitPackageController
* @Author:yanliang
* @Date:2024/3/19 10:36
* @Description
*/
@Slf4j
@RestController
@RequestMapping
(
"/mobile/v1.0.0"
)
@Api
(
tags
=
"众康移动对接相关API"
)
public
class
MobileBenefitPackageController
{
@Autowired
private
MobileBenefitPackageService
mobileBenefitPackageService
;
@GetMapping
(
"/h5/login"
)
@ApiOperation
(
value
=
"登陆并注册就诊卡"
)
public
BaseResponse
<
RegistPatientVo
>
login
(
@RequestParam
(
"token"
)
String
token
)
{
return
mobileBenefitPackageService
.
register
(
token
);
}
@PostMapping
(
"/benefit/add"
)
@ApiOperation
(
value
=
"生成权益订单同步推送"
)
public
Result
<
MobileBenefitResp
>
addBenefitPackage
(
@RequestBody
List
<
MobileBenefitPackageVo
>
vos
){
return
mobileBenefitPackageService
.
addBenefitPackage
(
vos
);
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/entity/MobileBenefitPackageEntity.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @ClassName: MobileBenefitPackageEntity
* @Author:yanliang
* @Date:2024/3/19 10:35
* @Description
*/
@Data
@TableName
(
value
=
"mobile_benefit_package"
)
public
class
MobileBenefitPackageEntity
{
/**
* 主键ID
*/
private
String
xId
;
/**
* 创建时间
*/
private
Date
xCreateTime
;
/**
* 更新时间
*/
private
Date
xUpdateTime
;
@ApiModelProperty
(
value
=
"权益编码"
)
private
String
productId
;
@ApiModelProperty
(
value
=
"手机号"
)
private
String
phone
;
@ApiModelProperty
(
value
=
"外部用户id"
)
private
String
userId
;
@ApiModelProperty
(
value
=
"外部订单id"
)
private
String
orderId
;
@ApiModelProperty
(
value
=
"激活订单id"
)
private
String
activateOrderId
;
@ApiModelProperty
(
value
=
"有效期开始时间"
)
private
String
benefitsStartTime
;
@ApiModelProperty
(
value
=
"有效期结束时间"
)
private
String
benefitsEndTime
;
@ApiModelProperty
(
value
=
"限制次数"
)
private
Integer
timeLimit
;
@ApiModelProperty
(
value
=
"是否续订【1:自动续订,0:一次性】"
)
private
String
isRenew
;
@ApiModelProperty
(
value
=
"使用次数"
)
private
Integer
used
;
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/entity/PatientSignEntity.java
浏览文件 @
c524d4dc
...
...
@@ -74,4 +74,10 @@ public class PatientSignEntity {
@ApiModelProperty
(
"业务状态2:进行中3:已完成4:已过期"
)
private
Integer
status
;
@ApiModelProperty
(
"权益包id"
)
private
String
packageOrderId
;
@ApiModelProperty
(
"签名结束时间"
)
private
Date
signEndTime
;
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/mapper/MobileBenefitPackageMapper.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
mapper
;
import
com.ebaiyihui.family.doctor.server.entity.MobileBenefitPackageEntity
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @ClassName: MobileBenefitPackageMapper
* @Author:yanliang
* @Date:2024/3/19 10:56
* @Description
*/
@Mapper
public
interface
MobileBenefitPackageMapper
{
void
insert
(
MobileBenefitPackageEntity
entity
);
MobileBenefitPackageEntity
queryByPhone
(
@Param
(
"mobile"
)
String
mobile
,
@Param
(
"activateOrderId"
)
String
activateOrderId
);
void
updateUsed
(
MobileBenefitPackageEntity
entity
);
// MobileBenefitPackageEntity queryByOrderId(@Param("orderId") String orderId);
void
update
(
MobileBenefitPackageEntity
entity
);
List
<
String
>
getPatientIdsByPhoneAndOrderId
(
@Param
(
"phone"
)
String
phone
);
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/MobileBenefitPackageService.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
service
;
import
com.ebaiyihui.family.doctor.common.bo.MobileBenefitResp
;
import
com.ebaiyihui.family.doctor.common.bo.Result
;
import
com.ebaiyihui.family.doctor.common.vo.MobileBenefitPackageVo
;
import
com.ebaiyihui.family.doctor.common.vo.RegistPatientVo
;
import
com.ebaiyihui.framework.response.BaseResponse
;
import
java.util.List
;
/**
* @ClassName: MobileBenefitPackageService
* @Author:yanliang
* @Date:2024/3/19 10:37
* @Description
*/
public
interface
MobileBenefitPackageService
{
BaseResponse
<
RegistPatientVo
>
register
(
String
token
);
Result
<
MobileBenefitResp
>
addBenefitPackage
(
List
<
MobileBenefitPackageVo
>
vos
);
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/impl/MobileBenefitPackageServiceImpl.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.ebaiyihui.card.common.CardServiceApi
;
import
com.ebaiyihui.card.common.vo.CardDetailsInfoRespVO
;
import
com.ebaiyihui.card.common.vo.RegisterCardReqVO
;
import
com.ebaiyihui.family.doctor.common.bo.MobileBenefitResp
;
import
com.ebaiyihui.family.doctor.common.bo.Result
;
import
com.ebaiyihui.family.doctor.common.vo.MobileBenefitPackageVo
;
import
com.ebaiyihui.family.doctor.common.vo.RegistPatientVo
;
import
com.ebaiyihui.family.doctor.server.common.constants.CommonConstants
;
import
com.ebaiyihui.family.doctor.server.entity.MobileBenefitPackageEntity
;
import
com.ebaiyihui.family.doctor.server.entity.PatientEntity
;
import
com.ebaiyihui.family.doctor.server.mapper.MobileBenefitPackageMapper
;
import
com.ebaiyihui.family.doctor.server.mapper.PatientMapper
;
import
com.ebaiyihui.family.doctor.server.service.MobileBenefitPackageService
;
import
com.ebaiyihui.family.doctor.server.util.DESUtils
;
import
com.ebaiyihui.framework.response.BaseResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* @ClassName: MobileBenefitPackageServiceImpl
* @Author:yanliang
* @Date:2024/3/19 10:37
* @Description
*/
@Slf4j
@Service
public
class
MobileBenefitPackageServiceImpl
implements
MobileBenefitPackageService
{
@Autowired
private
CardServiceApi
cardServiceFeignClient
;
@Autowired
private
PatientMapper
patientMapper
;
@Autowired
private
MobileBenefitPackageMapper
mobileBenefitPackageMapper
;
@Override
public
BaseResponse
<
RegistPatientVo
>
register
(
String
token
)
{
token
=
token
.
replace
(
" "
,
"+"
);
Map
<
String
,
String
>
map
=
JSONObject
.
parseObject
(
DESUtils
.
decrypt
(
token
,
CommonConstants
.
DES_SECRET
),
Map
.
class
);
log
.
info
(
"解析token结果:{}"
,
map
);
MobileBenefitPackageEntity
entity
=
mobileBenefitPackageMapper
.
queryByPhone
(
map
.
get
(
"mobile"
),
map
.
get
(
"activateOrderId"
));
if
(
ObjectUtils
.
isEmpty
(
entity
))
{
return
BaseResponse
.
error
(
"没有查询到有关权益"
);
}
//注册就诊卡
RegisterCardReqVO
registerCardReqVO
=
new
RegisterCardReqVO
();
registerCardReqVO
.
setAppCode
(
"NCZK"
);
registerCardReqVO
.
setChannelCode
(
"PATIENT_WX"
);
registerCardReqVO
.
setChannelName
(
"PATIENT_WX"
);
registerCardReqVO
.
setPatientName
(
map
.
get
(
"patientName"
));
registerCardReqVO
.
setCredNo
(
map
.
get
(
"card_no"
));
registerCardReqVO
.
setCredTypeCode
(
"01"
);
registerCardReqVO
.
setCredTypeName
(
"居民身份证"
);
registerCardReqVO
.
setCardTypeCode
(
"1703"
);
registerCardReqVO
.
setCardTypeName
(
"虚拟就诊卡"
);
registerCardReqVO
.
setOrganCode
(
"130188"
);
registerCardReqVO
.
setOrganName
(
"南昌众康医院"
);
registerCardReqVO
.
setTel
(
map
.
get
(
"mobile"
));
log
.
info
(
"注册就诊卡请求:{}"
,
registerCardReqVO
);
BaseResponse
<
CardDetailsInfoRespVO
>
response
=
cardServiceFeignClient
.
registerOrBindCard
(
registerCardReqVO
);
log
.
info
(
"注册就诊卡结果:{}"
,
response
);
if
(!
response
.
isSuccess
()
||
StringUtils
.
isEmpty
(
response
))
{
return
BaseResponse
.
error
(
"注册就诊卡失败"
);
}
CardDetailsInfoRespVO
data
=
response
.
getData
();
RegistPatientVo
registPatientVo
=
new
RegistPatientVo
();
registPatientVo
.
setPatientInfo
(
data
);
registPatientVo
.
setActivateOrderId
(
map
.
get
(
"activateOrderId"
));
String
patientId
=
map
.
get
(
"patient_id"
);
if
(!
StringUtils
.
isEmpty
(
patientId
))
{
// 查询患者信息
QueryWrapper
<
PatientEntity
>
wrapper
=
new
QueryWrapper
<>();
PatientEntity
patient
=
new
PatientEntity
();
patient
.
setId
(
patientId
);
wrapper
.
setEntity
(
patient
);
PatientEntity
patientEntity
=
patientMapper
.
selectOne
(
wrapper
);
if
(
Objects
.
isNull
(
patientEntity
))
{
patientEntity
=
new
PatientEntity
();
patientEntity
.
setId
(
patientId
);
patientEntity
.
setPatientName
(
data
.
getPatientName
());
patientEntity
.
setPhone
(
data
.
getTel
());
patientEntity
.
setPatientType
(
CommonConstants
.
PATIENT_TYPE
);
patientEntity
.
setGender
(
Integer
.
valueOf
(
data
.
getGender
()));
patientEntity
.
setBirthDates
(
data
.
getBirth
());
patientEntity
.
setCredNo
(
data
.
getCredNo
());
patientEntity
.
setUserId
(
entity
.
getUserId
());
log
.
info
(
"数据库不存在添加患者: {}"
,
JSON
.
toJSONString
(
patientEntity
));
patientMapper
.
insert
(
patientEntity
);
}
//保存就诊人id
entity
.
setUserId
(
map
.
get
(
"patient_id"
));
mobileBenefitPackageMapper
.
update
(
entity
);
}
return
BaseResponse
.
success
(
registPatientVo
);
}
@Override
public
Result
<
MobileBenefitResp
>
addBenefitPackage
(
List
<
MobileBenefitPackageVo
>
vos
)
{
log
.
info
(
"推送订单信息:{}"
,
vos
);
try
{
vos
.
forEach
(
vo
->
{
MobileBenefitPackageEntity
entity
=
new
MobileBenefitPackageEntity
();
BeanUtils
.
copyProperties
(
vo
,
entity
);
mobileBenefitPackageMapper
.
insert
(
entity
);
});
}
catch
(
Exception
e
)
{
log
.
error
(
"保存权益包信息失败:{}"
,
e
.
getMessage
());
return
Result
.
error
(
failed
());
}
return
Result
.
success
(
success
());
}
private
MobileBenefitResp
success
()
{
MobileBenefitResp
resp
=
new
MobileBenefitResp
();
resp
.
setOrderStatus
(
"OOS"
);
resp
.
setOrderDesc
(
"成功"
);
return
resp
;
}
private
MobileBenefitResp
failed
()
{
MobileBenefitResp
resp
=
new
MobileBenefitResp
();
resp
.
setOrderStatus
(
"OOF"
);
resp
.
setOrderDesc
(
"失败"
);
return
resp
;
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/service/impl/PatientServiceImpl.java
浏览文件 @
c524d4dc
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.dto.NotifyConsultDataDTO
;
import
com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO
;
import
com.ebaiyihui.family.doctor.common.dto.SignedDoctorDTO
;
import
com.ebaiyihui.family.doctor.server.common.constants.CommonConstants
;
import
com.ebaiyihui.family.doctor.server.common.enums.ImSignStatus
;
import
com.ebaiyihui.family.doctor.server.common.enums.SignStatus
;
import
com.ebaiyihui.family.doctor.server.common.enums.StatusEnum
;
import
com.ebaiyihui.family.doctor.server.entity.
Patient
Entity
;
import
com.ebaiyihui.family.doctor.server.entity.
MobileBenefitPackage
Entity
;
import
com.ebaiyihui.family.doctor.server.entity.PatientSignEntity
;
import
com.ebaiyihui.family.doctor.server.exception.BusinessException
;
import
com.ebaiyihui.family.doctor.server.mapper.
Patient
Mapper
;
import
com.ebaiyihui.family.doctor.server.mapper.
MobileBenefitPackage
Mapper
;
import
com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper
;
import
com.ebaiyihui.family.doctor.server.service.GoEasyPushService
;
import
com.ebaiyihui.family.doctor.server.service.ImChatTemplate
;
import
com.ebaiyihui.family.doctor.server.service.ImMsgTemplateService
;
import
com.ebaiyihui.family.doctor.server.service.PatientService
;
import
com.ebaiyihui.family.doctor.server.util.IDCardUtil
;
import
com.ebaiyihui.family.doctor.server.util.DateUtils
;
import
com.ebaiyihui.family.doctor.server.util.ThirdOrderPushUtil
;
import
com.ebaiyihui.family.doctor.server.util.UUIDUtil
;
import
com.ebaiyihui.framework.response.BaseResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.util.Date
;
import
java.util.Objects
;
/**
...
...
@@ -40,7 +43,7 @@ public class PatientServiceImpl implements PatientService {
private
PatientSignMapper
patientSignMapper
;
@Autowired
private
PatientMapper
patient
Mapper
;
private
MobileBenefitPackageMapper
mobileBenefitPackage
Mapper
;
@Autowired
private
ImMsgTemplateService
imMsgTemplateService
;
...
...
@@ -51,38 +54,21 @@ public class PatientServiceImpl implements PatientService {
@Autowired
private
ImChatTemplate
imChatTemplate
;
@Autowired
private
ThirdOrderPushUtil
thirdOrderPushUtil
;
@Override
public
BaseResponse
<
String
>
signedDoctor
(
SignedDoctorDTO
reqVo
)
{
String
orderId
=
UUIDUtil
.
generateViewId
();
String
admId
=
UUIDUtil
.
getUUID
();
String
patientId
=
"jtys_"
+
reqVo
.
getCredNo
();
String
patientUserId
=
orderId
+
"_jtys"
;
QueryWrapper
<
PatientEntity
>
wrapper
=
new
QueryWrapper
<>();
PatientEntity
patient
=
new
PatientEntity
();
patient
.
setId
(
reqVo
.
getPatientId
());
wrapper
.
setEntity
(
patient
);
PatientEntity
patientEntity
=
patientMapper
.
selectOne
(
wrapper
);
if
(
Objects
.
isNull
(
patientEntity
))
{
patientEntity
=
new
PatientEntity
();
patientEntity
.
setId
(
patientId
);
patientEntity
.
setPatientName
(
reqVo
.
getName
());
patientEntity
.
setPhone
(
reqVo
.
getPhone
());
patientEntity
.
setPatientType
(
CommonConstants
.
PATIENT_TYPE
);
patientEntity
.
setGender
(
Integer
.
valueOf
(
IDCardUtil
.
getGenderForInteger
(
reqVo
.
getCredNo
())));
patientEntity
.
setBirthDates
(
IDCardUtil
.
getBirthByIdCard
(
reqVo
.
getCredNo
()));
patientEntity
.
setCredNo
(
reqVo
.
getCredNo
());
patientEntity
.
setUserId
(
patientUserId
);
log
.
info
(
"数据库不存在添加患者: {}"
,
JSON
.
toJSONString
(
patientEntity
));
patientMapper
.
insert
(
patientEntity
);
}
else
{
patientId
=
patientEntity
.
getId
();
patientUserId
=
patientEntity
.
getUserId
();
MobileBenefitPackageEntity
entity
=
mobileBenefitPackageMapper
.
queryByPhone
(
reqVo
.
getPhone
(),
reqVo
.
getPackageOrderId
());
if
(
ObjectUtils
.
isEmpty
(
entity
))
{
return
BaseResponse
.
error
(
"没有查询到有关权益"
);
}
String
admId
=
UUIDUtil
.
getUUID
();
Date
curDate
=
new
Date
();
Date
signEndTime
=
DateUtils
.
getAfterDay
(
curDate
,
CommonConstants
.
DAY
);
// 处理换绑医生
if
(
Objects
.
nonNull
(
reqVo
.
getAdmId
()))
{
QueryWrapper
<
PatientSignEntity
>
psWrapper
=
new
QueryWrapper
<>();
...
...
@@ -91,9 +77,11 @@ public class PatientServiceImpl implements PatientService {
psWrapper
.
setEntity
(
patientSign
);
PatientSignEntity
patientSignEntity
=
patientSignMapper
.
selectOne
(
psWrapper
);
if
(
Objects
.
nonNull
(
patientSignEntity
))
{
signEndTime
=
patientSignEntity
.
getSignEndTime
();
patientSignEntity
.
setStatus
(
StatusEnum
.
FINISH_APPLY
.
getValue
());
patientSignEntity
.
setSignStatus
(
3
);
patientSignEntity
.
setSignStatus
(
SignStatus
.
CANCEL
.
getValue
()
);
patientSignEntity
.
setSubStatus
(
2
);
patientSignEntity
.
setSignEndTime
(
curDate
);
patientSignMapper
.
updateById
(
patientSignEntity
);
}
}
...
...
@@ -107,13 +95,14 @@ public class PatientServiceImpl implements PatientService {
patientSignEntity
.
setDoctorName
(
reqVo
.
getDoctorName
());
patientSignEntity
.
setDeptId
(
reqVo
.
getDeptId
());
patientSignEntity
.
setDeptName
(
reqVo
.
getDeptName
());
patientSignEntity
.
setSignStatus
(
reqVo
.
getSignStatus
());
patientSignEntity
.
setSignStatus
(
SignStatus
.
CANCEL
.
getValue
().
equals
(
reqVo
.
getSignStatus
())
?
SignStatus
.
SIGNED
.
getValue
()
:
reqVo
.
getSignStatus
());
patientSignEntity
.
setPatientPhone
(
reqVo
.
getPhone
());
patientSignEntity
.
setCredNo
(
reqVo
.
getCredNo
());
patientSignEntity
.
setPatientId
(
patientId
);
patientSignEntity
.
setPatientId
(
reqVo
.
getPatientId
()
);
patientSignEntity
.
setPatientName
(
reqVo
.
getName
());
patientSignEntity
.
setPatientUserId
(
patientUserId
);
patientSignEntity
.
setPatientUserId
(
entity
.
getUserId
()
);
patientSignEntity
.
setStatus
(
StatusEnum
.
IN_CONSULTATION
.
getValue
());
patientSignEntity
.
setSignEndTime
(
signEndTime
);
patientSignMapper
.
insert
(
patientSignEntity
);
...
...
@@ -131,8 +120,25 @@ public class PatientServiceImpl implements PatientService {
sendImMsgDTO
.
setAppCode
(
CommonConstants
.
APP_CODE
);
sendImMsgDTO
.
setOrganId
(
CommonConstants
.
ORGAN_CODE
);
sendImMsgDTO
.
setType
(
SignStatus
.
SIGNED
.
getValue
().
equals
(
reqVo
.
getSignStatus
())
?
ImSignStatus
.
SIGN_SUC
.
getValue
()
:
SignStatus
.
CANCEL
.
getValue
().
equals
(
reqVo
.
getSignStatus
())
?
ImSignStatus
.
SIGN
_SUC
.
getValue
()
:
SignStatus
.
CANCEL
.
getValue
().
equals
(
reqVo
.
getSignStatus
())
?
ImSignStatus
.
REISSUE
_SUC
.
getValue
()
:
ImSignStatus
.
INQUIRY_SCH_DOC
.
getValue
());
if
(!
SignStatus
.
NORMAL
.
getValue
().
equals
(
reqVo
.
getSignStatus
()))
{
// 推送第三方权益使用
NotifyConsultDataDTO
notifyConsultDataDTO
=
new
NotifyConsultDataDTO
();
notifyConsultDataDTO
.
setActivateOrderId
(
reqVo
.
getPackageOrderId
());
notifyConsultDataDTO
.
setConsultOrderNo
(
admId
);
notifyConsultDataDTO
.
setStatus
(
String
.
valueOf
(
reqVo
.
getSignStatus
()));
notifyConsultDataDTO
.
setProductId
(
entity
.
getProductId
());
notifyConsultDataDTO
.
setPatientId
(
entity
.
getUserId
());
notifyConsultDataDTO
.
setExpertName
(
reqVo
.
getDoctorName
());
notifyConsultDataDTO
.
setOrderDate
(
DateUtils
.
dateToFullString
(
patientSignEntity
.
getCreateTime
()));
thirdOrderPushUtil
.
syncBenefitUsedOrder
(
notifyConsultDataDTO
);
}
// 推送第三方签名相关订单信息
thirdOrderPushUtil
.
pushSignedOrder
(
String
.
valueOf
(
reqVo
.
getDoctorId
()),
reqVo
.
getPhone
(),
String
.
valueOf
(
patientSignEntity
.
getId
()),
reqVo
.
getPackageOrderId
(),
reqVo
.
getSignStatus
());
imMsgTemplateService
.
sendImMsg
(
sendImMsgDTO
);
// 推送app提示语
...
...
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/util/DESUtils.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
util
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Base64
;
import
javax.crypto.Cipher
;
import
javax.crypto.SecretKey
;
import
javax.crypto.SecretKeyFactory
;
import
javax.crypto.spec.DESedeKeySpec
;
import
java.nio.charset.StandardCharsets
;
/**
* @ClassName: DESUtils
* @Author:yanliang
* @Date:2024/3/19 11:10
* @Description
*/
@Slf4j
public
class
DESUtils
{
/**
* DES 加密
*
* <dependency>* <groupId>commons-codec</groupId>
* <artifactId>commons-codec</artifactId>
* <version>1.14</version>
* </dependency>
* <p>
* org.apache.commons.codec.binary.Base64
*
* @param originData 原始数据,未加密
* @param secret 加密秘钥
* @return
*/
public
static
String
encrypt
(
String
originData
,
String
secret
)
{
try
{
DESedeKeySpec
dks
=
new
DESedeKeySpec
(
secret
.
getBytes
(
StandardCharsets
.
UTF_8
));
SecretKeyFactory
keyFactory
=
SecretKeyFactory
.
getInstance
(
"DESede"
);
SecretKey
securekey
=
keyFactory
.
generateSecret
(
dks
);
Cipher
cipher
=
Cipher
.
getInstance
(
"DESede/ECB/PKCS5Padding"
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
securekey
);
byte
[]
b
=
cipher
.
doFinal
(
originData
.
getBytes
());
return
new
String
(
Base64
.
encodeBase64
(
b
),
StandardCharsets
.
UTF_8
).
replaceAll
(
"\r"
,
""
).
replaceAll
(
"\n"
,
""
);
}
catch
(
Exception
e
)
{
log
.
error
(
"加密异常:{}"
,
e
);
return
""
;
}
}
/**
* DES 解密
*
* @param encryptData 加密串
* @param secret 加密/解密 secret
* @return
*/
public
static
String
decrypt
(
String
encryptData
,
String
secret
)
{
try
{
// --通过 base64,将字符串转成 byte 数组
byte
[]
bytesrc
=
Base64
.
decodeBase64
(
encryptData
.
getBytes
());
// --解密的 key
DESedeKeySpec
dks
=
new
DESedeKeySpec
(
secret
.
getBytes
(
StandardCharsets
.
UTF_8
));
SecretKeyFactory
keyFactory
=
SecretKeyFactory
.
getInstance
(
"DESede"
);
SecretKey
securekey
=
keyFactory
.
generateSecret
(
dks
);
// --Chipher 对象解密
Cipher
cipher
=
Cipher
.
getInstance
(
"DESede/ECB/PKCS5Padding"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
securekey
);
byte
[]
retByte
=
cipher
.
doFinal
(
bytesrc
);
return
new
String
(
retByte
);
}
catch
(
Exception
e
)
{
log
.
error
(
"解密异常:"
,
e
);
return
""
;
}
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/util/DateUtils.java
浏览文件 @
c524d4dc
...
...
@@ -10,6 +10,7 @@ import java.text.DateFormat;
import
java.text.ParseException
;
import
java.text.ParsePosition
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.ZoneOffset
;
import
java.time.format.DateTimeFormatter
;
...
...
@@ -2085,4 +2086,23 @@ public class DateUtils {
}
return
age
;
}
/**
* 将某个时间往后推day天
*
* @param currentDate
* @param day
* @return
*/
public
static
Date
getAfterDay
(
Date
currentDate
,
int
day
)
{
// 创建Calendar对象并设置为当前日期
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
currentDate
);
// 往后推30天
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
day
);
// 获取推迟后的日期
Date
futureDate
=
calendar
.
getTime
();
return
futureDate
;
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/util/HttpKit.java
0 → 100644
浏览文件 @
c524d4dc
差异被折叠。
点击展开。
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/util/SignUtils.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
util
;
import
cn.hutool.core.util.CharsetUtil
;
import
cn.hutool.crypto.digest.DigestAlgorithm
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
lombok.extern.slf4j.Slf4j
;
import
java.lang.reflect.Field
;
import
java.security.MessageDigest
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.TreeMap
;
/**
* @ClassName: SignUtils
* @Author:yanliang
* @Date:2024/3/18 14:52
* @Description
*/
@Slf4j
public
class
SignUtils
{
public
final
static
String
NO_STR
=
"0"
;
public
static
String
getSignatureToStr
(
Map
<
String
,
String
>
params
,
String
secret
)
{
// 先将参数以其参数名的字典序升序进行排序
Map
<
String
,
String
>
sortedParams
=
new
TreeMap
<
String
,
String
>(
params
);
Set
<
Map
.
Entry
<
String
,
String
>>
entrys
=
sortedParams
.
entrySet
();
// 遍历排序后的字典,将所有参数按"key=value"格式拼接在一起
StringBuilder
basestring
=
new
StringBuilder
();
for
(
Map
.
Entry
<
String
,
String
>
param
:
entrys
)
{
basestring
.
append
(
param
.
getKey
()).
append
(
"="
).
append
(
param
.
getValue
());
}
basestring
.
append
(
secret
);
log
.
info
(
"加密前参数:{}"
,
basestring
.
toString
());
// 使用MD5对待签名串求签
byte
[]
bytes
=
null
;
try
{
MessageDigest
md5
=
MessageDigest
.
getInstance
(
DigestAlgorithm
.
MD5
.
getValue
());
bytes
=
md5
.
digest
(
basestring
.
toString
().
getBytes
(
CharsetUtil
.
CHARSET_UTF_8
));
}
catch
(
Exception
ex
)
{
log
.
error
(
"错误信息:{}"
,
ex
);
}
// 将MD5输出的二进制结果转换为小写的十六进制
StringBuilder
sign
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
bytes
.
length
;
i
++)
{
String
hex
=
Integer
.
toHexString
(
bytes
[
i
]
&
0xFF
);
if
(
hex
.
length
()
==
1
)
{
sign
.
append
(
NO_STR
);
}
sign
.
append
(
hex
);
}
return
sign
.
toString
();
}
/**
* 检验参数 并返回Map
*/
public
static
Map
<
String
,
String
>
paramToMap
(
Object
obj
)
{
/*** 过滤多余参数 并转换为Map<String, String> ***/
Map
<
String
,
Object
>
objMap
=
convertObjectToMap
(
obj
);
// 类型转换
Map
<
String
,
String
>
strMap
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
objMap
),
new
TypeReference
<
HashMap
<
String
,
String
>>()
{
}
);
return
strMap
;
}
public
static
Map
<
String
,
Object
>
convertObjectToMap
(
Object
object
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
try
{
Class
<?>
clazz
=
object
.
getClass
();
Field
[]
fields
=
clazz
.
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
field
.
setAccessible
(
true
);
String
fieldName
=
field
.
getName
();
Object
fieldValue
=
field
.
get
(
object
);
map
.
put
(
fieldName
,
fieldValue
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
map
;
}
}
family-doctor-server/src/main/java/com/ebaiyihui/family/doctor/server/util/ThirdOrderPushUtil.java
0 → 100644
浏览文件 @
c524d4dc
package
com
.
ebaiyihui
.
family
.
doctor
.
server
.
util
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ebaiyihui.family.doctor.common.bo.Result
;
import
com.ebaiyihui.family.doctor.common.dto.NotifyConsultDataDTO
;
import
com.ebaiyihui.family.doctor.common.dto.SyncSignedOrderDTO
;
import
com.ebaiyihui.family.doctor.common.dto.ThirdPushDTO
;
import
com.ebaiyihui.family.doctor.common.vo.AccessTokenVo
;
import
com.ebaiyihui.family.doctor.server.common.constants.CommonConstants
;
import
com.ebaiyihui.family.doctor.server.common.constants.ProjProperties
;
import
com.ebaiyihui.family.doctor.server.common.constants.UrlConstants
;
import
com.ebaiyihui.family.doctor.server.common.enums.SignTypeEnum
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @ClassName: ThirdOrderPushUtil
* @Author:yanliang
* @Date:2024/3/18 14:49
* @Description
*/
@Slf4j
@Component
public
class
ThirdOrderPushUtil
{
@Autowired
private
ProjProperties
projProperties
;
public
<
T
extends
ThirdPushDTO
>
Map
<
String
,
String
>
getThirdHead
(
T
t
)
{
log
.
info
(
"业务入参:{}"
,
t
);
t
.
setSupplierCode
(
CommonConstants
.
SUPPLIER_CODE
);
String
param
=
JSONObject
.
toJSONString
(
t
);
log
.
info
(
"业务数据:{}"
,
param
);
String
assessToken
=
getAssessToken
();
Map
<
String
,
String
>
header
=
new
HashMap
<>();
header
.
put
(
"Authorization"
,
assessToken
);
Map
<
String
,
String
>
map
=
null
;
try
{
map
=
SignUtils
.
paramToMap
(
t
);
}
catch
(
Exception
e
)
{
log
.
error
(
"参数转换失败:{}"
,
e
);
}
String
sign
=
SignUtils
.
getSignatureToStr
(
map
,
CommonConstants
.
SIGN_SECRET
);
header
.
put
(
"sign"
,
sign
);
header
.
put
(
"timestamp"
,
String
.
valueOf
(
new
Date
().
getTime
()));
return
header
;
}
public
String
getAssessToken
()
{
Map
<
String
,
String
>
param
=
new
HashMap
<>(
16
);
param
.
put
(
"grantType"
,
CommonConstants
.
GRANT_TYPE
);
param
.
put
(
"clientId"
,
projProperties
.
getFamilyDoctorThirdClientId
());
param
.
put
(
"clientSecret"
,
projProperties
.
getFamilyDoctorThirdClientSecret
());
try
{
String
result
=
HttpKit
.
jsonPost
(
projProperties
.
getFamilyDoctorThirdUrl
()
+
UrlConstants
.
GET_TOKEN_URL
,
JSONObject
.
toJSONString
(
param
));
Result
<
AccessTokenVo
>
resultResp
=
JSONObject
.
parseObject
(
result
,
Result
.
class
);
if
(
resultResp
.
isSuccess
())
{
AccessTokenVo
accessTokenVo
=
JSONObject
.
parseObject
(
String
.
valueOf
(
resultResp
.
getData
()),
AccessTokenVo
.
class
);
return
accessTokenVo
.
getTokenType
()
+
" "
+
accessTokenVo
.
getAccessToken
();
}
}
catch
(
Exception
e
)
{
log
.
error
(
"错误信息:{}"
,
e
);
}
return
null
;
}
/**
* 推送签名信息
*
* @param doctorId
* @param phone
* @param signId
* @param packageOrderId
* @param signStatus
*/
@Async
public
void
pushSignedOrder
(
String
doctorId
,
String
phone
,
String
signId
,
String
packageOrderId
,
Integer
signStatus
)
{
// 推送签名信息
SyncSignedOrderDTO
syncSignedOrderDTO
=
new
SyncSignedOrderDTO
();
syncSignedOrderDTO
.
setDoctorId
(
String
.
valueOf
(
doctorId
));
syncSignedOrderDTO
.
setPhone
(
phone
);
syncSignedOrderDTO
.
setBenefitOrderId
(
packageOrderId
);
syncSignedOrderDTO
.
setSignSeqId
(
signId
);
syncSignedOrderDTO
.
setSignType
(
SignTypeEnum
.
SIGNED_DOCTOR
.
getValue
());
switch
(
signStatus
)
{
case
2
:
syncSignedOrder
(
syncSignedOrderDTO
);
break
;
case
3
:
updateSignedOrder
(
syncSignedOrderDTO
);
break
;
}
}
@Async
public
void
syncBenefitUsedOrder
(
NotifyConsultDataDTO
notifyConsultDataDTO
)
{
try
{
String
param
=
JSONObject
.
toJSONString
(
notifyConsultDataDTO
);
log
.
info
(
"syncBenefitUsedOrder请求入参{}"
,
param
);
String
result
=
HttpKit
.
jsonPost
(
projProperties
.
getFamilyDoctorThirdUrl
()
+
UrlConstants
.
PUSH_DATA_URL
,
param
,
getThirdHead
(
notifyConsultDataDTO
));
log
.
info
(
"syncBenefitUsedOrder请求返参{}"
,
param
);
}
catch
(
Exception
e
)
{
log
.
error
(
"syncSignedOrder推送失败:{}"
,
e
);
}
}
/**
* 签约信息同步
*
* @param syncSignedOrderDTO
*/
public
void
syncSignedOrder
(
SyncSignedOrderDTO
syncSignedOrderDTO
)
{
try
{
String
param
=
JSONObject
.
toJSONString
(
syncSignedOrderDTO
);
log
.
info
(
"syncSignedOrder请求入参{}"
,
param
);
String
result
=
HttpKit
.
jsonPost
(
projProperties
.
getFamilyDoctorThirdUrl
()
+
UrlConstants
.
SYNC_SIGNED_ORDER_URL
,
param
,
getThirdHead
(
syncSignedOrderDTO
));
log
.
info
(
"syncSignedOrder请求返参{}"
,
param
);
}
catch
(
Exception
e
)
{
log
.
error
(
"syncSignedOrder推送失败:{}"
,
e
);
}
}
/**
* 改签约信息同步
*
* @param syncSignedOrderDTO
*/
public
void
updateSignedOrder
(
SyncSignedOrderDTO
syncSignedOrderDTO
)
{
try
{
String
param
=
JSONObject
.
toJSONString
(
syncSignedOrderDTO
);
log
.
info
(
"updateSignedOrder请求入参{}"
,
param
);
String
result
=
HttpKit
.
jsonPost
(
projProperties
.
getFamilyDoctorThirdUrl
()
+
UrlConstants
.
UPDATE_SIGNED_ORDER_URL
,
param
,
getThirdHead
(
syncSignedOrderDTO
));
log
.
info
(
"updateSignedOrder请求返参{}"
,
param
);
}
catch
(
Exception
e
)
{
log
.
error
(
"updateSignedOrder推送失败:{}"
,
e
);
}
}
}
family-doctor-server/src/main/resources/mapper/MobileBenefitPackageMapper.xml
0 → 100644
浏览文件 @
c524d4dc
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.ebaiyihui.family.doctor.server.mapper.MobileBenefitPackageMapper"
>
<sql
id=
"base_columns"
>
x_id,productId,phone,userId,orderId,timeLimit,used
</sql>
<insert
id=
"insert"
>
INSERT INTO mobile_benefit_package (
<if
test=
"productId != '' and productId != null"
>
productId,
</if>
<if
test=
"userId != '' and userId != null"
>
userId,
</if>
<if
test=
"activateOrderId != '' and activateOrderId != null"
>
orderId,
</if>
<if
test=
"timeLimit != 0 and timeLimit != null"
>
timeLimit,
</if>
<if
test=
"orderId != '' and orderId != null"
>
benefitOrderId,
</if>
<if
test=
"benefitsStartTime != '' and benefitsStartTime != null"
>
benefitsStartTime,
</if>
<if
test=
"benefitsEndTime != '' and benefitsEndTime != null"
>
benefitsEndTime,
</if>
<if
test=
"isRenew != '' and isRenew != null"
>
isRenew,
</if>
<if
test=
"phone != '' and phone != null"
>
phone
</if>
)
VALUES
(
<if
test=
"productId != '' and productId != null"
>
#{productId,jdbcType=VARCHAR},
</if>
<if
test=
"userId != '' and userId != null"
>
#{userId,jdbcType=VARCHAR},
</if>
<if
test=
"activateOrderId != '' and activateOrderId != null"
>
#{activateOrderId,jdbcType=VARCHAR},
</if>
<if
test=
"timeLimit != 0 and timeLimit != null"
>
#{timeLimit,jdbcType=TINYINT},
</if>
<if
test=
"orderId != '' and orderId != null"
>
#{orderId,jdbcType=VARCHAR},
</if>
<if
test=
"benefitsStartTime != '' and benefitsStartTime != null"
>
#{benefitsStartTime},
</if>
<if
test=
"benefitsEndTime != '' and benefitsEndTime != null"
>
#{benefitsEndTime},
</if>
<if
test=
"isRenew != '' and isRenew != null"
>
#{isRenew,jdbcType=VARCHAR},
</if>
<if
test=
"phone != '' and phone != null"
>
#{phone,jdbcType=VARCHAR}
</if>
)
</insert>
<update
id=
"updateUsed"
>
update mobile_benefit_package set
used = #{used,jdbcType=TINYINT}
where phone = #{phone,jdbcType=VARCHAR} and orderId = #{orderId}
</update>
<update
id=
"update"
>
update mobile_benefit_package set
userId = #{userId,jdbcType=VARCHAR}
where phone = #{phone,jdbcType=VARCHAR} and orderId = #{orderId}
</update>
<select
id=
"queryByPhone"
resultType=
"com.ebaiyihui.family.doctor.server.entity.MobileBenefitPackageEntity"
>
SELECT
<include
refid=
"base_columns"
/>
FROM
mobile_benefit_package
WHERE
phone = #{mobile} and orderId = #{activateOrderId}
ORDER BY
x_create_time DESC
LIMIT 0,1
</select>
<!-- <select id="queryByOrderId" resultType="com.ebaiyihui.family.doctor.server.entity.MobileBenefitPackageEntity">-->
<!-- SELECT-->
<!-- <include refid="base_columns"/>-->
<!-- FROM-->
<!-- mobile_benefit_package-->
<!-- WHERE-->
<!-- orderId = #{orderId}-->
<!-- ORDER BY-->
<!-- x_create_time DESC-->
<!-- LIMIT 0,1-->
<!-- </select>-->
<select
id=
"getPatientIdsByPhoneAndOrderId"
resultType=
"java.lang.String"
>
SELECT DISTINCT
ia.patient_id
FROM
mobile_benefit_package mbp
LEFT JOIN inquiry_admission ia ON mbp.orderId = ia.package_id
WHERE
mbp.phone = #{phone}
</select>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论