提交 bd4398c5 authored 作者: zhu's avatar zhu

1.develop

上级 8ea24dfa
......@@ -103,13 +103,13 @@ dependencyManagement {
}
flyway {
driver = 'com.mysql.cj.jdbc.Driver'
url = 'jdbc:mysql://localhost:3306/aiming-hospital?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&useSSL=false'
user = 'root'
password = '123456'
// url = 'jdbc:mysql://175.24.172.212:3306/hospital-server?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&useSSL=false'
// driver = 'com.mysql.cj.jdbc.Driver'
// url = 'jdbc:mysql://localhost:3306/aiming-hospital?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&useSSL=false'
// user = 'root'
// password = 'jgx2vgk0p!15'
// password = '123456'
url = 'jdbc:mysql://175.24.172.212:3306/hospital-server?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&useSSL=false'
user = 'root'
password = 'jgx2vgk0p!15'
}
tasks.named('test') {
......
......@@ -15,6 +15,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.error.WxRuntimeException;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -33,6 +34,13 @@ import java.util.stream.Collectors;
public class WxMaConfiguration {
private final WxMaProperties properties;
@Value("${spring.data.redis.host}")
private String redisHost;
private int redisPort = 6379;;
private int redisTimeo = 2000;
@Value("${spring.data.redis.password}")
private String redisPassword;
@Autowired
public WxMaConfiguration(WxMaProperties properties) {
this.properties = properties;
......@@ -49,7 +57,7 @@ public class WxMaConfiguration {
configs.stream()
.map(a -> {
// WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
WxMaDefaultConfigImpl config = new WxMaRedisConfigImpl(new JedisPool(new GenericObjectPoolConfig(),"localhost",6379,2000,"123456"));
WxMaDefaultConfigImpl config = new WxMaRedisConfigImpl(new JedisPool(new GenericObjectPoolConfig(),redisHost,redisPort,redisTimeo,redisPassword));
// 使用上面的配置时,需要同时引入jedis-lock的依赖,否则会报类无法找到的异常
config.setAppid(a.getAppid());
config.setSecret(a.getSecret());
......
......@@ -19,4 +19,8 @@ public class DoctorInfoDto {
private int orderCount;
private int fansCount;
private List<DoctorServiceInfo> doctorServiceInfoList;
//是否关注
private Boolean attentionStatus;
private Long attentionId;
}
......@@ -8,5 +8,8 @@ import java.util.List;
@Data
public class PatientMiniAppHomeDto {
private Long doctorId;
private DoctorInfo doctorInfo;
private String DoctorName;
private String title;
private String departmentName;
private String avatar;
}
......@@ -27,7 +27,8 @@ public interface DoctorInfoMapper extends DoctorInfoBaseMapper {
List<DoctorDto> queryDoctorList(@Param("sickness")String sickness,
@Param("doctorName")String doctorName,
@Param("departmentId")Long departmentId);
@Param("departmentName")String departmentName,
@Param("departmentIdList") List<Long> departmentIdList);
DoctorInfoDto queryDoctorDetail(@Param("doctorId")Long doctorId);
......
......@@ -93,11 +93,24 @@ public class DepartmentInfoController extends BaseController<DepartmentInfoServi
*
* @param
*/
@PostMapping("/queryAllDepartment")
@GetMapping("/queryAllDepartment")
@Operation(summary = "查询科室列表")
public ApiResponse queryAllDepartment(@RequestParam(required = false) YesNoEnum showHidden) {
public ApiResponse queryAllDepartment(@RequestParam(value = "showHidden",required = false) YesNoEnum showHidden) {
return ApiResponse.ok(this.service.queryAllDepartment(showHidden));
}
/**
* 隐藏或展示科室
*
* @param
*/
@PostMapping("/hiddenDepartment")
@Operation(summary = "隐藏或展示科室")
public ApiResponse hiddenDepartment(@RequestParam("showHidden") YesNoEnum showHidden,
@RequestParam("departmentId") Long departmentId) {
return ApiResponse.ok(this.service.hiddenDepartment(showHidden,departmentId));
}
}
......@@ -112,7 +112,13 @@ public class OrderController extends BaseController<OrderService, Order, OrderPa
@Operation(summary = "创建订单")
@ApiCommon
public ApiResponse<Order> createOrder(@RequestBody CreateOrderDto createOrderDto, @AuthUser User user) {
return ApiResponse.ok( this.service.createOrder(createOrderDto));
Order order = this.service.createOrder(createOrderDto);
if(null == order){
return ApiResponse.fail(ApiCode.ORDER_CREATE_FAIL);
}else {
return ApiResponse.ok(order);
}
}
/**
......
......@@ -13,7 +13,8 @@ public enum ApiCode {
FAILED(-1, "fail"),
UNAUTHC(401, "You haven't signed in yet!"),
UNAUTHZ(403, "You are not authorized!"),
SERVER_ERROR(500, "server error!");
SERVER_ERROR(500, "server error!"),
ORDER_CREATE_FAIL(700,"订单创建失败");
private int code = 0;
private String message = "success";
......
......@@ -18,4 +18,6 @@ public interface DepartmentInfoService extends BaseService<DepartmentInfo> {
List queryAllDepartment(YesNoEnum showHidden);
boolean hiddenDepartment(YesNoEnum showHidden, Long departmentId);
}
package com.xwd.hospital.server.service;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import com.xwd.hospital.server.enums.PayPathEnum;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
public interface PaymentService {
String startPay(String orderNo, PayPathEnum payPath);
PrepayWithRequestPaymentResponse startPay(String orderNo, PayPathEnum payPath);
void payNotify(HttpServletRequest request, HttpServletResponse response);
......
......@@ -80,5 +80,26 @@ public class DepartmentInfoServiceImpl extends ServiceImpl<DepartmentInfoMapper,
return parentDepartmentList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean hiddenDepartment(YesNoEnum showHidden, Long departmentId) {
DepartmentInfo departmentInfo = this.getById(departmentId);
if (null == departmentInfo) {
return false;
}
departmentInfo.setHiddenStatus(showHidden);
this.updateById(departmentInfo);
//如果是一级菜单,同时隐藏或取消下面的二级菜单
if(departmentInfo.getDepartmentLevel() == DepartmentLevelEnum.FIRST_LEVEL){
List<DepartmentInfo> departmentInfoList = this.list(Wrappers.<DepartmentInfo>query()
.eq("parent_id", departmentInfo.getId()));
//从departmentInfoList中取出id生成新的list
for (DepartmentInfo childDepartment : departmentInfoList) {
childDepartment.setHiddenStatus(showHidden);
}
this.updateBatchById(departmentInfoList);
}
return true;
}
}
......@@ -13,14 +13,14 @@ import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import com.xwd.hospital.server.domain.ArticleInfo;
import com.xwd.hospital.server.domain.DepartmentInfo;
import com.xwd.hospital.server.domain.DoctorServiceInfo;
import cn.dev33.satoken.stp.StpUtil;
import com.xwd.hospital.server.domain.*;
import com.xwd.hospital.server.dto.DoctorDto;
import com.xwd.hospital.server.dto.DoctorInfoDto;
import com.xwd.hospital.server.enums.DepartmentLevelEnum;
import com.xwd.hospital.server.enums.YesNoEnum;
import com.xwd.hospital.server.rest.req.DoctorSearchParam;
import com.xwd.hospital.server.service.DepartmentInfoService;
import com.xwd.hospital.server.service.DoctorServiceInfoService;
import com.xwd.hospital.server.service.*;
import jakarta.annotation.Resource;
import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -29,10 +29,8 @@ import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xwd.hospital.server.service.DoctorInfoService;
import com.xwd.hospital.server.repository.DoctorInfoMapper;
import com.xwd.hospital.server.repository.base.DoctorInfoBaseMapper;
import com.xwd.hospital.server.domain.DoctorInfo;
import com.xwd.hospital.server.rest.req.DoctorInfoParam;
@Service
......@@ -41,6 +39,10 @@ public class DoctorInfoServiceImpl extends ServiceImpl<DoctorInfoMapper, DoctorI
private DepartmentInfoService departmentInfoService;
@Resource
private DoctorServiceInfoService doctorServiceInfoService;
@Resource
private UserAttentionInfoService userAttentionInfoService;
@Resource
private UserInfoService userInfoService;
@Override
public int updateAllFieldsById(DoctorInfo entity) {
......@@ -63,19 +65,53 @@ public class DoctorInfoServiceImpl extends ServiceImpl<DoctorInfoMapper, DoctorI
@Override
public List<DoctorDto> queryDoctorList(DoctorSearchParam param) {
if(!StringUtils.isBlank(param.getDepartmentName()) && null == param.getDepartmentId()){
DepartmentInfo department = departmentInfoService.getOne(Wrappers.<DepartmentInfo>query().eq("department_name", param.getDepartmentName()));
param.setDepartmentId(department.getId());
List<Long> departmentIdList = new ArrayList<>();
if( null != param.getDepartmentId()){
DepartmentInfo department = departmentInfoService.getById(param.getDepartmentId());
if (null != department && department.getHiddenStatus() == YesNoEnum.NO ){
if (department.getDepartmentLevel() == DepartmentLevelEnum.FIRST_LEVEL) {
//一级菜单id输入查询所以二级菜单列表
List<DepartmentInfo> departmentInfoList = departmentInfoService.list(Wrappers.<DepartmentInfo>query()
.eq("parent_id", param.getDepartmentId())
.eq("hidden_status", YesNoEnum.NO));
//从departmentInfoList中取出id生成新的list
for (DepartmentInfo departmentInfo : departmentInfoList) {
departmentIdList.add(departmentInfo.getId());
}
}else {
departmentIdList.add(param.getDepartmentId());
}
}
}
//param传入一级菜单departmentId,同时此一级菜单下无二级菜单,此时应无医生可查询出
if(departmentIdList.size() == 0){
departmentIdList.add(0L);
}
return this.getBaseMapper().queryDoctorList(param.getSickness(),param.getDoctorName(),param.getDepartmentId());
return this.getBaseMapper().queryDoctorList(param.getSickness(),param.getDoctorName(),param.getDepartmentName(),departmentIdList);
}
@Override
public DoctorInfoDto queryDoctorDetail(Long doctorId) {
//当前用户
Object userId = StpUtil.getExtra("userId");
UserInfo userInfo = userInfoService.getOne(Wrappers.<UserInfo>query().eq("user_id", Long.valueOf(userId.toString())));
if(null == userInfo){
return null;
}
DoctorInfoDto doctorInfoDto = this.getBaseMapper().queryDoctorDetail(doctorId);
List<DoctorServiceInfo> doctorServiceInfoList = doctorServiceInfoService.list(Wrappers.<DoctorServiceInfo>query().eq("doctor_id", doctorId));
doctorInfoDto.setDoctorServiceInfoList(doctorServiceInfoList);
UserAttentionInfo attentionInfo = userAttentionInfoService.getOne(Wrappers.<UserAttentionInfo>query().eq("doctor_id", doctorId)
.eq("user_info_id", userInfo.getId()));
if(null != attentionInfo){
doctorInfoDto.setAttentionStatus(true);
doctorInfoDto.setAttentionId(attentionInfo.getId());
}else {
doctorInfoDto.setAttentionStatus(false);
}
return doctorInfoDto;
}
}
......@@ -12,6 +12,7 @@ import com.wechat.pay.java.core.notification.NotificationConfig;
import com.wechat.pay.java.core.notification.NotificationParser;
import com.wechat.pay.java.core.notification.RequestParam;
import com.wechat.pay.java.service.payments.jsapi.JsapiService;
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
import com.wechat.pay.java.service.payments.jsapi.model.*;
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
import com.wechat.pay.java.service.payments.model.Transaction;
......@@ -56,7 +57,7 @@ import java.util.TimeZone;
@Slf4j
public class PaymentServiceImpl implements PaymentService {
public static JsapiService payService;
public static JsapiServiceExtension payService;
public static RefundService refundService;
@Resource
......@@ -93,7 +94,7 @@ public class PaymentServiceImpl implements PaymentService {
@Override
@Transactional(rollbackFor = Exception.class)
public String startPay(String orderNo, PayPathEnum payPath) {
public PrepayWithRequestPaymentResponse startPay(String orderNo, PayPathEnum payPath) {
if(payPath.equals(PayPathEnum.WX_PAY)){
//微信支付
// 使用自动更新平台证书的RSA配置
......@@ -108,7 +109,7 @@ public class PaymentServiceImpl implements PaymentService {
.build();
// 初始化服务
payService = new JsapiService.Builder().config(config).build();
payService = new JsapiServiceExtension.Builder().config(config).build();
Order order = orderService.getOne(Wrappers.<Order>query().eq("order_no", orderNo));
if(order.getOrderState() != OrderStateEnum.TO_PAY){
......@@ -137,9 +138,8 @@ public class PaymentServiceImpl implements PaymentService {
// 调用接口
try {
PrepayResponse response = prepay(order, orderPay);
log.info("微信支付串"+response.getPrepayId());
return response.getPrepayId();
PrepayWithRequestPaymentResponse response = prepay(order, orderPay);
return response;
} catch (Exception e) { // 发送HTTP请求失败
// 调用e.getHttpRequest()获取请求打印日志或上报监控,更多方法见HttpException定义
log.error(e.getMessage());
......@@ -353,7 +353,7 @@ public class PaymentServiceImpl implements PaymentService {
payService.closeOrder(request);
}
/** JSAPI支付下单 */
public PrepayResponse prepay(Order order,OrderPay orderPay) {
public PrepayWithRequestPaymentResponse prepay(Order order,OrderPay orderPay) {
PrepayRequest request = new PrepayRequest();
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
......@@ -386,7 +386,8 @@ public class PaymentServiceImpl implements PaymentService {
payer.setOpenid(order.getUserInfo().getUser().getOpenId());
request.setPayer(payer);
// 调用接口
return payService.prepay(request);
PrepayWithRequestPaymentResponse response = payService.prepayWithRequestPayment(request);
return response;
}
/** 微信支付订单号查询订单 */
public static Transaction queryOrderById() {
......
......@@ -21,20 +21,34 @@ knife4j:
wx:
miniapp:
configs:
- appid: #微信小程序的appid
secret: #微信小程序的Secret
- appid: wxc447fccb6a2745ce
secret: af277a664613a2276266eca024bff139
token: #微信小程序消息服务器配置的token
aesKey: #微信小程序消息服务器配置的EncodingAESKey
msgDataFormat: JSON
- appid: #微信小程序的appid
secret: #微信小程序的Secret
- appid: wxc447fccb6a2745ce
secret: af277a664613a2276266eca024bff139
token: #微信小程序消息服务器配置的token
aesKey: #微信小程序消息服务器配置的EncodingAESKey
msgDataFormat: JSON
pay:
wx:
appId:
merchantId:
keyPath:
merchantSerialNumber:
apiV3Key:
appId: wxc447fccb6a2745ce
merchantId: 1535738101
keyPath: /home/ubuntu/1535738101_20231012_cert/apiclient_key.pem
merchantSerialNumber: 52849767F52ACCC2743E0C5439F3EAFA816FA1D7
apiV3Key: YG1e4n9oBPhuuYZaP7arXy232ejma6FW
payNotifyUrl: http://175.24.172.212:8099/pay/notify
refundNotifyUrl: http://175.24.172.212:8099/pay/refund/notify
tencent:
cloud:
secretId: AKIDZzDD2e4IURBhy2sUrzsXxXu4zf7LL7ex
secretKey: A52lGXaTAev274oMk4CBzay9C6nIbjeM
sms:
sdkAppId: 1400859846
templateId: 1946431
ronglian:
cloud:
account: T00000029722
secret: 88275dd0-6667-11ee-a6e8-a9e02a8e273e
host: https://openapis.7moor.com
......@@ -11,7 +11,7 @@ spring:
application:
name: aiming-hospital-server
profiles:
active: dev
active: prod
jackson:
default-property-inclusion: non_null
date-format: yyyy-MM-dd HH:mm:ss
......@@ -57,7 +57,7 @@ spring:
max-file-size: 50MB
max-request-size: 100MB
server:
port: ${port:8088}
port: ${port:8099}
servlet:
encoding:
charset: UTF-8
......
......@@ -66,8 +66,14 @@
<if test="doctorName != null and doctorName != ''">
AND di.doctor_name = #{doctorName}
</if>
<if test="departmentId != null and departmentId != ''">
AND pmq.department_id = #{departmentId}
<if test="departmentName != null and departmentName != ''">
AND pmq.departmentName LIKE CONCAT('%', #{departmentName}, '%')
</if>
<if test="departmentIdList != null and departmentIdList != ''">
AND pmq.department_id in
<foreach collection="departmentIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY di.id, di.doctor_name, h.hospital_name, d.department_name, di.expertise_area, di.introduction, pmq.title, u.avatar, s.service_price
</select>
......
......@@ -6,9 +6,6 @@
</resultMap>
<resultMap id="ListResultMap" type="com.xwd.hospital.server.domain.Order" extends="com.xwd.hospital.server.repository.base.OrderBaseMapper.BaseResultMap">
</resultMap>
<resultMap id="RecommendDoctorResultMap" type="com.xwd.hospital.server.dto.PatientMiniAppHomeDto" extends="com.xwd.hospital.server.repository.base.OrderBaseMapper.RecommendDoctorResultMap">
</resultMap>
<!-- 根据主键查询 -->
<select id="selectById" parameterType="java.io.Serializable" resultMap="ResultMap">
......@@ -63,10 +60,15 @@
</if>
order by create_time desc
</select>
<select id="selectDoctorListByOrderCount" resultMap="RecommendDoctorResultMap">
select a.doctorId FROM
<select id="selectDoctorListByOrderCount" resultType="com.xwd.hospital.server.dto.PatientMiniAppHomeDto">
SELECT di.doctor_name,pmq.title,pdi.department_name,su.avatar,di.id as doctorId
FROM pms_doctor_info di
INNER JOIN pms_medical_qualifications pmq on pmq.doctor_id = di.id
INNER JOIN pms_department_info pdi on pdi.id = pmq.department_id
INNER JOIN sys_user su on su.obj_id = di.id
WHERE di.id = (select a.doctorId FROM
(SELECT count(o.id) orderNum, o.doctor_id doctorId
FROM pms_order o
WHERE 1=1 GROUP BY o.doctor_id ORDER BY orderNum desc LIMIT 3) a
WHERE 1=1 GROUP BY o.doctor_id ORDER BY orderNum desc LIMIT 3) a)
</select>
</mapper>
......@@ -41,7 +41,7 @@
select
ppi.*
from pms_patient_prescription_info ppi
inner join pms_prescription_order ppo on ppi..id = ppo..prescription_id
where ppo.id = #{orderId}
inner join pms_prescription_order_record ppo on ppi.id = ppo.prescription_id
where ppo.order_id = #{orderId}
</select>
</mapper>
......@@ -36,23 +36,19 @@
</resultMap>
<resultMap id="ResultMap" type="com.xwd.hospital.server.domain.Order" extends="BaseResultMap">
<result column="patient_self_introduce" jdbcType="VARCHAR" property="patientSelfIntroduce" />
<association column="user_info_id" property="userInfo" javaType="com.xwd.hospital.server.domain.PatientPrescriptionInfo"
select="com.xwd.hospital.server.repository.PatientPrescriptionInfoMapper.selectByOrderId" />
<association column="user_info_id" property="userInfo" javaType="com.xwd.hospital.server.domain.UserInfo"
select="com.xwd.hospital.server.repository.UserInfoMapper.selectById" />
<!-- <association column="doctor_id" property="doctor" javaType="com.xwd.hospital.server.domain.DoctorInfo"-->
<!-- select="com.xwd.hospital.server.repository.DoctorInfoMapper.selectById" />-->
<!-- <association column="patient_id" property="patient" javaType="com.xwd.hospital.server.domain.PatientInfo"-->
<!-- select="com.xwd.hospital.server.repository.PatientInfoMapper.selectById" />-->
<!-- <association column="user_coupon_id" property="userCoupon" javaType="com.xwd.hospital.server.domain.UserCouponInfo"-->
<!-- select="com.xwd.hospital.server.repository.UserCouponInfoMapper.selectById" />-->
<association column="id" property="patientPrescriptionInfo" javaType="com.xwd.hospital.server.domain.UserInfo"
select="com.xwd.hospital.server.repository.UserInfoMapper.selectById" />
<association column="id" property="patientPrescriptionInfo" javaType="com.xwd.hospital.server.domain.PatientPrescriptionInfo"
select="com.xwd.hospital.server.repository.PatientPrescriptionInfoMapper.selectByOrderId" />
<collection column="id" property="pictureList" javaType="list"
select="com.xwd.hospital.server.repository.OrderPictureMapper.selectByOrderId" />
</resultMap>
<resultMap id="RecommendDoctorResultMap" type="com.xwd.hospital.server.dto.PatientMiniAppHomeDto">
<association column="doctorId" property="doctorInfo" javaType="com.xwd.hospital.server.domain.DoctorInfo"
select="com.xwd.hospital.server.repository.DoctorInfoMapper.selectById" />
</resultMap>
<sql id="Base_Column_List">
`id`, `user_info_id`, `doctor_id`, `patient_id`, `order_no`, `order_state`, `order_type`, `order_price`, `order_discount`, `order_actual_pay`, `user_coupon_id`, `appointment_date`, `service_start_time`, `service_end_time`, `hospital_name`, `department_name`, `doctor_name`, `patient_name`, `patient_sex`, `patient_id_no`, `patient_phone_number`, `patient_born_date`, `cancel_reason`, `pay_time`, `confirm_time`, `complete_time`, `delete_status`, `editor_id`, `editor_name`, `create_time`, `update_time`
</sql>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论