提交 8ea24dfa authored 作者: zhu's avatar zhu

1.增加测试微信支付配置配置

2.接口逻辑丰富
上级 34794915
......@@ -69,6 +69,8 @@ dependencies {
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.tencentcloudapi:tencentcloud-sdk-java:3.1.874'
implementation 'org.redisson:redisson-spring-boot-starter:3.23.5'
annotationProcessor "org.projectlombok:lombok:${lombokPluginVersion}"
......
......@@ -8,10 +8,12 @@ package com.xwd.hospital.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
@EnableTransactionManagement
@EnableScheduling
public class ServerApplication {
public static void main(String[] args) {
......
package com.xwd.hospital.server.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
@Configuration
@EnableAsync
public class AsyncConfig {
private int corePoolSize = 5;
private int maxPoolSize = 10;
private int queueCapacity = 10;
@Bean
public Executor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.initialize();
return executor;
}
}
......@@ -43,6 +43,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
.excludePathPatterns("/v1/system/user/wxUpdate")
.excludePathPatterns("/v1/system/user/getPhoneNumber")
.excludePathPatterns("/v1/system/sms/sendSms")
.excludePathPatterns("/v1/system/home/patientMiniAppHome")
// swagger 放行
.excludePathPatterns("/webjars/**")
.excludePathPatterns("/doc.html")
......
......@@ -43,7 +43,7 @@ public class CouponInfo extends BaseDomain {
*/
@TableField(value = "coupon_name")
@Schema(description = "优惠券名称", nullable = false)
private Long couponName;
private String couponName;
/**
* 优惠券类型
*/
......
......@@ -181,7 +181,7 @@ public class Order extends BaseDomain {
* 身份证号码
*/
@TableField(value = "patient_id_no")
@Schema(description = "身份证号码", nullable = false)
@Schema(description = "身份证号码")
private String patientIdNo;
/**
* 就诊人手机号码
......@@ -261,6 +261,16 @@ public class Order extends BaseDomain {
@Schema(description = "更新时间", nullable = false)
private java.util.Date updateTime;
/**
* 患者自述图片链接
*/
private List<String> pictureList;
/**
* 患者所提交的处方
*/
private PatientPrescriptionInfo patientPrescriptionInfo;
/**
* 设置默认值
*/
......@@ -397,12 +407,6 @@ public class Order extends BaseDomain {
}
return false;
}
if (this.getPatientIdNo() == null) {
if (throwException) {
throw new ApiCode.ApiException(-1, "身份证号码不能为空!");
}
return false;
}
if (this.getPatientBornDate() == null) {
if (throwException) {
throw new ApiCode.ApiException(-1, "就诊人出生日期不能为空!");
......
......@@ -107,6 +107,11 @@ public class PatientPrescriptionInfo extends BaseDomain {
@Schema(description = "更新时间", nullable = false)
private java.util.Date updateTime;
/**
* 图片列表
*/
private List<String> pictureList;
/**
* 设置默认值
*/
......
......@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.xwd.hospital.server.base.BaseDomain;
import com.xwd.hospital.server.enums.CouponTypeEnum;
import com.xwd.hospital.server.enums.YesNoEnum;
import com.xwd.hospital.server.enums.CouponUseStateEnum;
import com.xwd.hospital.server.domain.UserInfo;
import com.xwd.hospital.server.domain.CouponInfo;
......@@ -69,7 +69,7 @@ public class UserCouponInfo extends BaseDomain {
*/
@TableField(value = "coupon_name")
@Schema(description = "优惠券名称", nullable = false)
private Long couponName;
private String couponName;
/**
* 优惠券类型
*/
......@@ -101,7 +101,7 @@ public class UserCouponInfo extends BaseDomain {
*/
@TableField(value = "coupon_use_state")
@Schema(description = "优惠券可用状态", nullable = false)
private YesNoEnum couponUseState;
private CouponUseStateEnum couponUseState;
/**
* 操作人Id
*/
......@@ -138,7 +138,7 @@ public class UserCouponInfo extends BaseDomain {
this.setCouponType(CouponTypeEnum.FULL_DISCOUNT);
}
if (this.getCouponUseState() == null) {
this.setCouponUseState(YesNoEnum.YES);
this.setCouponUseState(CouponUseStateEnum.USEABLE);
}
if (this.getEditorId() == null) {
this.setEditorId(1L);
......
package com.xwd.hospital.server.dto;
import lombok.Data;
import java.util.List;
@Data
public class ConsumerCouponInfoDto {
private List<Long> consumerList;
private Long couponId;
private Boolean isAll;
}
......@@ -18,4 +18,6 @@ public class CreateOrderDto {
private Date appointmentDate;
private String patientSelfIntroduce;
private List<String> pictureList;
//处方id
private Long patientPrescriptionId;
}
......@@ -9,6 +9,7 @@ import java.util.Date;
@Data
public class OrderDto {
private Long orderId;
private String orderNo;
private String hospitalName;
private String doctorName;
......
......@@ -7,5 +7,6 @@ import java.util.List;
@Data
public class PatientMiniAppHomeDto {
private List<DoctorInfo> recommendedDoctor;
private Long doctorId;
private DoctorInfo doctorInfo;
}
......@@ -19,4 +19,6 @@ public class UpdateUserInfoDto {
private String expertiseArea;
private String introduction;
private Boolean defaultFlag = false;
}
/**
* 项目:互联网医疗
* @Author: xiongwei
* @Date: 2023-09-05 09:42:00
*/
package com.xwd.hospital.server.enums;
/**
* 优惠券状态
*/
public enum CouponUseStateEnum {
USEABLE("待使用"),
USED("已使用"),
EXPIRED("已过期");
CouponUseStateEnum(String name) {
this.name = name;
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
/**
* 项目:互联网医疗
* @Author: xiongwei
* @Date: 2023-09-05 09:42:00
*/
package com.xwd.hospital.server.enums;
/**
* 审核状态
*/
public enum UseStateEnum {
USED("不可用"),
USEABLE("可用");
UseStateEnum(String name) {
this.name = name;
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -14,8 +14,11 @@ import java.util.List;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xwd.hospital.server.dto.OrderDto;
import com.xwd.hospital.server.dto.PatientMiniAppHomeDto;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import com.xwd.hospital.server.domain.Order;
......@@ -24,5 +27,7 @@ import com.xwd.hospital.server.repository.base.OrderBaseMapper;
@Repository
public interface OrderMapper extends OrderBaseMapper {
List<OrderDto> queryOrderListForMiniApp(@Param("userInfoId")Long userInfoId, @Param("state")String state);
IPage<OrderDto> queryOrderListForMiniApp(@Param("page") Page<OrderDto> page, @Param("userInfoId")Long userInfoId, @Param("state")String state);
List<PatientMiniAppHomeDto> selectDoctorListByOrderCount();
}
......@@ -23,5 +23,5 @@ import com.xwd.hospital.server.repository.base.OrderPictureBaseMapper;
@Repository
public interface OrderPictureMapper extends OrderPictureBaseMapper {
List<String> selectByOrderId(Long orderId);
}
......@@ -24,4 +24,5 @@ import com.xwd.hospital.server.repository.base.PatientPrescriptionInfoBaseMapper
public interface PatientPrescriptionInfoMapper extends PatientPrescriptionInfoBaseMapper {
PatientPrescriptionInfo selectByOrderId(Long orderId);
}
......@@ -23,5 +23,6 @@ import com.xwd.hospital.server.repository.base.PatientPrescriptionInfoPictureBas
@Repository
public interface PatientPrescriptionInfoPictureMapper extends PatientPrescriptionInfoPictureBaseMapper {
List<String> selectByPrescriptionId(Long prescriptionId);
}
......@@ -22,6 +22,7 @@ import com.xwd.hospital.server.annotation.ApiCommon;
import com.xwd.hospital.server.annotation.AuthUser;
import com.xwd.hospital.server.base.BaseController;
import com.xwd.hospital.server.domain.User;
import com.xwd.hospital.server.dto.ConsumerCouponInfoDto;
import com.xwd.hospital.server.rest.res.ApiCode;
import com.xwd.hospital.server.domain.CouponInfo;
import com.xwd.hospital.server.rest.req.CouponInfoParam;
......@@ -65,6 +66,9 @@ public class CouponInfoController extends BaseController<CouponInfoService, Coup
entity.setEditorId(user.getId());
entity.setEditorName(user.getUsername());
entity.setDefault().validate(true);
if(!entity.getCouponEndDate().after(entity.getCouponStartDate())){
return ApiResponse.fail(ApiCode.FAILED);
}
this.service.save(entity);
return ApiResponse.ok(this.service.getById(entity.getId()));
}
......@@ -87,5 +91,11 @@ public class CouponInfoController extends BaseController<CouponInfoService, Coup
return ApiResponse.ok(this.service.saveBatch(entityList));
}
@PostMapping("/consumerCoupons")
@Operation(summary = "发放优惠券")
public ApiResponse<Boolean> consumerCoupons(@RequestBody ConsumerCouponInfoDto dto, @AuthUser User user) {
return ApiResponse.ok(this.service.consumerCoupons(dto));
}
}
......@@ -39,7 +39,7 @@ public class HomeController {
@Operation(summary = "患者端首页")
@PostMapping("/patientMiniAppHome")
@ApiCommon
public ApiResponse<PatientMiniAppHomeDto> patientMiniAppHome() {
public ApiResponse patientMiniAppHome() {
return ApiResponse.ok(homeService.patientMiniAppHome());
}
......
......@@ -93,15 +93,15 @@ public class OrderController extends BaseController<OrderService, Order, OrderPa
* 小程序端订单列表
*
*/
@PostMapping("/queryOrderListForMiniApp")
@GetMapping("/queryOrderListForMiniApp")
@Operation(summary = "小程序端订单列表")
public ApiResponse queryOrderListForMiniApp(@RequestParam(value = "status",required = false)OrderStateEnum status,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<OrderDto> page = new Page<>(pageNum, pageSize);
List<OrderDto> orderDtoList = this.service.queryOrderListForMiniApp(status);
page.setRecords(orderDtoList);
return ApiResponse.ok(page);
// List<OrderDto> orderDtoList = this.service.queryOrderListForMiniApp(status);
// page.setRecords(orderDtoList);
return ApiResponse.ok(this.service.queryOrderListForMiniApp(page,status));
}
/**
......
......@@ -87,5 +87,15 @@ public class UserCouponInfoController extends BaseController<UserCouponInfoServi
return ApiResponse.ok(this.service.saveBatch(entityList));
}
/**
* 查看我的可用优惠券列表
* @return boolean 成功或失败
*/
@GetMapping("/queryMyCouponList")
@Operation(summary = "查看我的可用优惠券列表")
public ApiResponse queryMyCouponList(@AuthUser User user) {
return ApiResponse.ok(this.service.queryMyCouponList());
}
}
......@@ -41,7 +41,7 @@ public class CouponInfoParam extends BaseParam<CouponInfo> {
* 优惠券名称
*/
@Parameter(description = "优惠券名称")
private Long couponName;
private String couponName;
/**
* 优惠券类型
*/
......@@ -167,7 +167,17 @@ public class CouponInfoParam extends BaseParam<CouponInfo> {
QueryWrapper<CouponInfo> wrapper = Wrappers.<CouponInfo>query();
wrapper.eq(this.getId() != null, columnPrefix + "id", this.getId());
wrapper.in(this.getIdList() != null && this.getIdList().size() > 0, columnPrefix + "id", this.getIdList());
wrapper.eq(this.getCouponName() != null, columnPrefix + "coupon_name", this.getCouponName());
if (this.getCouponName() != null) {
if (this.getCouponName().startsWith("%") && this.getCouponName().endsWith("%")) {
wrapper.like(columnPrefix + "coupon_name", this.getCouponName().substring(1, this.getCouponName().length() - 1));
} else if (this.getCouponName().startsWith("%") && !this.getCouponName().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "coupon_name", this.getCouponName().substring(1));
} else if (this.getCouponName().endsWith("%")) {
wrapper.likeRight(columnPrefix + "coupon_name", this.getCouponName().substring(0, this.getCouponName().length() - 1));
} else {
wrapper.eq(columnPrefix + "coupon_name", this.getCouponName());
}
}
wrapper.eq(this.getCouponType() != null, columnPrefix + "coupon_type", this.getCouponType());
wrapper.in(this.getCouponTypeList() != null && this.getCouponTypeList().size() > 0, columnPrefix + "coupon_type", this.getCouponTypeList());
wrapper.eq(this.getCouponDiscount() != null, columnPrefix + "coupon_discount", this.getCouponDiscount());
......
......@@ -45,6 +45,11 @@ public class PrescriptionOrderRecordParam extends BaseParam<PrescriptionOrderRec
*/
@Parameter(description = "订单号")
private String orderNo;
/**
* 患者提交处方id
*/
@Parameter(description = "患者提交处方id")
private Long prescriptionId;
/**
* 处方说明
*/
......@@ -131,6 +136,7 @@ public class PrescriptionOrderRecordParam extends BaseParam<PrescriptionOrderRec
wrapper.eq(columnPrefix + "order_no", this.getOrderNo());
}
}
wrapper.eq(this.getPrescriptionId() != null, columnPrefix + "prescription_id", this.getPrescriptionId());
if (this.getPrescriptionIntroduce() != null) {
if (this.getPrescriptionIntroduce().startsWith("%") && this.getPrescriptionIntroduce().endsWith("%")) {
wrapper.like(columnPrefix + "prescription_introduce", this.getPrescriptionIntroduce().substring(1, this.getPrescriptionIntroduce().length() - 1));
......
......@@ -18,7 +18,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import com.xwd.hospital.server.base.BaseParam;
import com.xwd.hospital.server.enums.CouponTypeEnum;
import com.xwd.hospital.server.enums.YesNoEnum;
import com.xwd.hospital.server.enums.CouponUseStateEnum;
import com.xwd.hospital.server.domain.UserCouponInfo;
@Data
......@@ -51,7 +51,7 @@ public class UserCouponInfoParam extends BaseParam<UserCouponInfo> {
* 优惠券名称
*/
@Parameter(description = "优惠券名称")
private Long couponName;
private String couponName;
/**
* 优惠券类型
*/
......@@ -107,7 +107,7 @@ public class UserCouponInfoParam extends BaseParam<UserCouponInfo> {
* 优惠券可用状态
*/
@Parameter(description = "优惠券可用状态")
private YesNoEnum couponUseState;
private CouponUseStateEnum couponUseState;
/**
* 优惠券可用状态 IN值List
*/
......@@ -179,7 +179,17 @@ public class UserCouponInfoParam extends BaseParam<UserCouponInfo> {
wrapper.in(this.getIdList() != null && this.getIdList().size() > 0, columnPrefix + "id", this.getIdList());
wrapper.eq(this.getUserInfoId() != null, columnPrefix + "user_info_id", this.getUserInfoId());
wrapper.eq(this.getCouponId() != null, columnPrefix + "coupon_id", this.getCouponId());
wrapper.eq(this.getCouponName() != null, columnPrefix + "coupon_name", this.getCouponName());
if (this.getCouponName() != null) {
if (this.getCouponName().startsWith("%") && this.getCouponName().endsWith("%")) {
wrapper.like(columnPrefix + "coupon_name", this.getCouponName().substring(1, this.getCouponName().length() - 1));
} else if (this.getCouponName().startsWith("%") && !this.getCouponName().endsWith("%")) {
wrapper.likeLeft(columnPrefix + "coupon_name", this.getCouponName().substring(1));
} else if (this.getCouponName().endsWith("%")) {
wrapper.likeRight(columnPrefix + "coupon_name", this.getCouponName().substring(0, this.getCouponName().length() - 1));
} else {
wrapper.eq(columnPrefix + "coupon_name", this.getCouponName());
}
}
wrapper.eq(this.getCouponType() != null, columnPrefix + "coupon_type", this.getCouponType());
wrapper.in(this.getCouponTypeList() != null && this.getCouponTypeList().size() > 0, columnPrefix + "coupon_type", this.getCouponTypeList());
wrapper.eq(this.getCouponDiscount() != null, columnPrefix + "coupon_discount", this.getCouponDiscount());
......
......@@ -11,8 +11,10 @@ package com.xwd.hospital.server.service;
import java.util.List;
import com.xwd.hospital.server.base.BaseService;
import com.xwd.hospital.server.domain.CouponInfo;
import com.xwd.hospital.server.dto.ConsumerCouponInfoDto;
import com.xwd.hospital.server.rest.req.CouponInfoParam;
public interface CouponInfoService extends BaseService<CouponInfo> {
boolean consumerCoupons(ConsumerCouponInfoDto dto);
}
......@@ -4,8 +4,10 @@ import com.xwd.hospital.server.domain.PatientInfo;
import com.xwd.hospital.server.dto.DoctorMiniAppHomeDto;
import com.xwd.hospital.server.dto.PatientMiniAppHomeDto;
import java.util.List;
public interface HomeService {
PatientMiniAppHomeDto patientMiniAppHome();
List<PatientMiniAppHomeDto> patientMiniAppHome();
DoctorMiniAppHomeDto doctorMiniAppHome(Long doctorId);
}
......@@ -9,6 +9,9 @@
package com.xwd.hospital.server.service;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xwd.hospital.server.base.BaseService;
import com.xwd.hospital.server.domain.Order;
import com.xwd.hospital.server.dto.*;
......@@ -18,7 +21,7 @@ import org.springframework.data.domain.jaxb.SpringDataJaxb;
public interface OrderService extends BaseService<Order> {
List<OrderDto> queryOrderListForMiniApp(OrderStateEnum state);
IPage<OrderDto> queryOrderListForMiniApp(Page page, OrderStateEnum state);
Order createOrder(CreateOrderDto createOrderDto);
......
......@@ -15,4 +15,5 @@ import com.xwd.hospital.server.rest.req.UserCouponInfoParam;
public interface UserCouponInfoService extends BaseService<UserCouponInfo> {
List<UserCouponInfo> queryMyCouponList();
}
......@@ -8,27 +8,31 @@
package com.xwd.hospital.server.service.impl;
import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import jakarta.annotation.Resource;
import com.xwd.hospital.server.domain.UserCouponInfo;
import com.xwd.hospital.server.dto.ConsumerCouponInfoDto;
import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.xwd.hospital.server.enums.CouponUseStateEnum;
import com.xwd.hospital.server.enums.YesNoEnum;
import com.xwd.hospital.server.service.UserCouponInfoService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xwd.hospital.server.service.CouponInfoService;
import com.xwd.hospital.server.repository.CouponInfoMapper;
import com.xwd.hospital.server.repository.base.CouponInfoBaseMapper;
import com.xwd.hospital.server.domain.CouponInfo;
import com.xwd.hospital.server.rest.req.CouponInfoParam;
@Service
public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponInfo> implements CouponInfoService {
@Resource
private UserCouponInfoService userCouponInfoService;
@Override
public int updateAllFieldsById(CouponInfo entity) {
return this.getBaseMapper().updateAllFieldsById(entity);
......@@ -48,5 +52,32 @@ public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponI
return executeBatch(entityList, batchSize, (sqlSession, entity) -> sqlSession.insert(sqlStatement, entity));
}
@Override
public boolean consumerCoupons(ConsumerCouponInfoDto dto) {
CouponInfo couponInfo = this.getById(dto.getCouponId());
//todo 全体发优惠券
if(dto.getIsAll()){
}else {
if(null != dto.getConsumerList()
&& dto.getConsumerList().size()>0){
ArrayList<UserCouponInfo> list = new ArrayList<>(dto.getConsumerList().size());
for (Long consumerId:dto.getConsumerList()) {
UserCouponInfo userCouponInfo = new UserCouponInfo();
userCouponInfo.setUserInfoId(consumerId);
userCouponInfo.setCouponId(dto.getCouponId());
userCouponInfo.setCouponName(couponInfo.getCouponName());
userCouponInfo.setCouponType(couponInfo.getCouponType());
userCouponInfo.setCouponDiscount(couponInfo.getCouponDiscount());
userCouponInfo.setCouponStartDate(couponInfo.getCouponStartDate());
userCouponInfo.setCouponEndDate(couponInfo.getCouponEndDate());
userCouponInfo.setCouponUseState(CouponUseStateEnum.USEABLE);
list.add(userCouponInfo);
}
userCouponInfoService.saveBatch(list);
}
}
return true;
}
}
......@@ -8,6 +8,7 @@ import com.xwd.hospital.server.domain.User;
import com.xwd.hospital.server.dto.DoctorMiniAppHomeDto;
import com.xwd.hospital.server.dto.PatientMiniAppHomeDto;
import com.xwd.hospital.server.enums.OrderStateEnum;
import com.xwd.hospital.server.repository.OrderMapper;
import com.xwd.hospital.server.service.ArticleInfoService;
import com.xwd.hospital.server.service.DoctorInfoService;
import com.xwd.hospital.server.service.HomeService;
......@@ -25,11 +26,15 @@ public class HomeServiceImpl implements HomeService {
private OrderService orderService;
@Resource
private ArticleInfoService articleInfoService;
@Resource
private OrderMapper orderMapper;
@Override
public PatientMiniAppHomeDto patientMiniAppHome() {
return null;
public List<PatientMiniAppHomeDto> patientMiniAppHome() {
//查询订单表,完成订单中数量最多的三名医生
//订单数量需统计
List<PatientMiniAppHomeDto> patientMiniAppHomeDtoList= orderMapper.selectDoctorListByOrderCount();
return patientMiniAppHomeDtoList;
}
@Override
......
......@@ -39,6 +39,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.BufferedReader;
import java.io.IOException;
......@@ -67,30 +68,31 @@ public class PaymentServiceImpl implements PaymentService {
/** 商户号 */
@Value("$(pay.wx.merchantId)")
public static String merchantId = "190000****";
@Value("${pay.wx.merchantId}")
private String merchantId;
/** 商户API私钥路径 */
@Value("$(pay.wx.keyPath)")
public static String privateKeyPath = "/path/apiclient_key.pem";
@Value("${pay.wx.keyPath}")
private String privateKeyPath;
/** 商户证书序列号 */
@Value("$(pay.wx.merchantSerialNumber)")
public static String merchantSerialNumber = "5157F09EFDC096DE15EBE81A47057A72********";
@Value("${pay.wx.merchantSerialNumber}")
private String merchantSerialNumber;
/** 商户APIV3密钥 */
@Value("$(pay.wx.apiV3Key)")
public static String apiV3Key = "...";
@Value("${pay.wx.apiV3Key}")
private String apiV3Key;
/** appId */
@Value("$(pay.wx.appId)")
public static String appId = "...";
@Value("${pay.wx.appId}")
private String appId;
/** 支付回调地址 */
@Value("$(pay.wx.payNotifyUrl)")
public static String payNotifyUrl = "...";
@Value("${pay.wx.payNotifyUrl}")
private String payNotifyUrl;
@Value("$(pay.wx.refundNotifyUrl)")
public static String refundNotifyUrl = "...";
@Value("${pay.wx.refundNotifyUrl}")
private static String refundNotifyUrl;
public static int PAY_DELAY_TIME = 30;
@Override
@Transactional(rollbackFor = Exception.class)
public String startPay(String orderNo, PayPathEnum payPath) {
if(payPath.equals(PayPathEnum.WX_PAY)){
//微信支付
......@@ -127,23 +129,20 @@ public class PaymentServiceImpl implements PaymentService {
orderPay.setPayState(PayStateEnum.TO_PAY);
orderPay.setPayPath(PayPathEnum.WX_PAY);
orderPay.setPayMoney(order.getOrderActualPay());
orderPay.setEditorId(StpUtil.getLoginIdAsLong());
}
orderPay.setPayTime(new Date());
orderPayService.save(orderPay);
orderPayService.saveOrUpdate(orderPay);
// 调用接口
try {
PrepayResponse response = prepay(order, orderPay);
log.info("微信支付串"+response.getPrepayId());
return response.getPrepayId();
} catch (HttpException e) { // 发送HTTP请求失败
} catch (Exception e) { // 发送HTTP请求失败
// 调用e.getHttpRequest()获取请求打印日志或上报监控,更多方法见HttpException定义
} catch (ServiceException e) { // 服务返回状态小于200或大于等于300,例如500
// 调用e.getResponseBody()获取返回体打印日志或上报监控,更多方法见ServiceException定义
} catch (MalformedMessageException e) { // 服务返回成功,返回体类型不合法,或者解析返回体失败
// 调用e.getMessage()获取信息打印日志或上报监控,更多方法见MalformedMessageException定义
log.error(e.getMessage());
}
}else if(payPath.equals(PayPathEnum.ALI_PAY)){
......@@ -203,12 +202,12 @@ public class PaymentServiceImpl implements PaymentService {
OrderPay orderPay = orderPayService.getOne(Wrappers.<OrderPay>query().eq("pay_no", outTradeNo));
orderPay.setPayState(PayStateEnum.PAYED);
orderPay.setPayTime(new Date());
orderPayService.save(orderPay);
orderPayService.saveOrUpdate(orderPay);
Order order = orderService.getById(orderPay.getOrderId());
order.setOrderState(OrderStateEnum.TO_CONFIRM);
order.setPayTime(new Date());
orderService.save(order);
orderService.saveOrUpdate(order);
response.getWriter().write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
......@@ -273,7 +272,7 @@ public class PaymentServiceImpl implements PaymentService {
OrderRefund orderRefund = orderRefundService.getOne(Wrappers.<OrderRefund>query().eq("refund_no", refundNo));
orderRefund.setRefundState(RefundStateEnum.REFUNDED);
orderRefund.setRefundTime(new Date());
orderRefundService.save(orderRefund);
orderRefundService.saveOrUpdate(orderRefund);
response.getWriter().write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
}
......@@ -344,7 +343,7 @@ public class PaymentServiceImpl implements PaymentService {
/** 关闭订单 */
public static void closeOrder(OrderPay orderPay) {
public void closeOrder(OrderPay orderPay) {
CloseOrderRequest request = new CloseOrderRequest();
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
......@@ -354,7 +353,7 @@ public class PaymentServiceImpl implements PaymentService {
payService.closeOrder(request);
}
/** JSAPI支付下单 */
public static PrepayResponse prepay(Order order,OrderPay orderPay) {
public PrepayResponse prepay(Order order,OrderPay orderPay) {
PrepayRequest request = new PrepayRequest();
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
......
package com.xwd.hospital.server.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
......@@ -11,12 +12,15 @@ import com.tencentcloudapi.sms.v20210111.SmsClient;
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
import com.xwd.hospital.server.constants.Constant;
import com.xwd.hospital.server.domain.PhoneOrderRecord;
import com.xwd.hospital.server.domain.Setting;
import com.xwd.hospital.server.dto.CallDto;
import com.xwd.hospital.server.enums.SysSettingEnum;
import com.xwd.hospital.server.enums.UseStateEnum;
import com.xwd.hospital.server.enums.YesNoEnum;
import com.xwd.hospital.server.rest.thirdPartReq.BindNumberReq;
import com.xwd.hospital.server.rest.thirdPartReq.UnbindNumberReq;
import com.xwd.hospital.server.service.CallApiService;
import com.xwd.hospital.server.service.RedisService;
import com.xwd.hospital.server.service.SmsService;
import com.xwd.hospital.server.service.*;
import com.xwd.hospital.server.util.CallUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
......@@ -44,6 +48,10 @@ import java.util.concurrent.TimeUnit;
public class SmsServiceImpl implements SmsService {
@Resource
private RedisService redisService;
@Resource
private PhoneOrderRecordService phoneOrderRecordService;
@Resource
private SettingService settingService;
@Value("${tencent.cloud.secretId}")
private String secretId;
......@@ -230,16 +238,29 @@ public class SmsServiceImpl implements SmsService {
calledArea, caller,calledShow, connectTime, result,
releaseTime, account, mappingId, appId, callDuration,
userData, answerTime, smallNumberType, calldisplay);
log.info("容联通话回调:------");
if(result.equals("0")){//通话成功
//解绑
unbindPhone(calledShow,mappingId);
//根据mappingId查询phone_order_record表
PhoneOrderRecord record = phoneOrderRecordService.getOne(Wrappers.<PhoneOrderRecord>query().eq("mapping_id", mappingId));
if(null != record){
//解绑
unbindPhone(calledShow,mappingId);
//修改sys_setting表,小号状态
Setting setting = settingService.getOne(Wrappers.<Setting>query().eq("code", SysSettingEnum.PROXY_PHONE)
.eq("remark", UseStateEnum.USED.getName())
.eq("value", calledShow));
if(null != setting){
setting.setRemark(UseStateEnum.USEABLE.getName());
settingService.saveOrUpdate(setting);
}
//修改phone_order_record表状态
record.setMappingState(YesNoEnum.YES);
record.setPhoneContactTime(connectTime);
record .setPhoneReleaseTime(releaseTime);
phoneOrderRecordService.saveOrUpdate(record);
}
//todo 修改sys_setting表,小号状态
//todo 修改phone——order——record表状态
}
log.info("容联通话回调:------");
return false;
return true;
}
}
......@@ -9,10 +9,19 @@
package com.xwd.hospital.server.service.impl;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.xwd.hospital.server.domain.User;
import com.xwd.hospital.server.domain.UserInfo;
import com.xwd.hospital.server.enums.CouponUseStateEnum;
import com.xwd.hospital.server.service.UserInfoService;
import com.xwd.hospital.server.service.UserService;
import jakarta.annotation.Resource;
import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -29,6 +38,11 @@ import com.xwd.hospital.server.rest.req.UserCouponInfoParam;
@Service
public class UserCouponInfoServiceImpl extends ServiceImpl<UserCouponInfoMapper, UserCouponInfo> implements UserCouponInfoService {
@Resource
private UserService userService;
@Resource
private UserInfoService userInfoService;
@Override
public int updateAllFieldsById(UserCouponInfo entity) {
return this.getBaseMapper().updateAllFieldsById(entity);
......@@ -48,5 +62,23 @@ public class UserCouponInfoServiceImpl extends ServiceImpl<UserCouponInfoMapper,
return executeBatch(entityList, batchSize, (sqlSession, entity) -> sqlSession.insert(sqlStatement, entity));
}
@Override
public List<UserCouponInfo> queryMyCouponList() {
List<UserCouponInfo> userCouponInfoList;
//当前用户
Object userId = StpUtil.getExtra("userId");
UserInfo userInfo = userInfoService.getOne(Wrappers.<UserInfo>query().eq("user_id", Long.valueOf(userId.toString())));
if(null == userInfo){
return null;
}
Date now = new Date();
userCouponInfoList = this.list(Wrappers.<UserCouponInfo>query()
.eq("user_info_id",userInfo.getId())
.ge("coupon_end_date", now)
.le("coupon_start_date", now)
.eq("coupon_use_state", CouponUseStateEnum.USEABLE));
return userCouponInfoList;
}
}
......@@ -405,16 +405,23 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
}
userInfoService.saveOrUpdate(userInfo);
// //同时创建自身的就诊人
// PatientInfo patientInfo = new PatientInfo();
// patientInfo.setUserInfoId(userInfo.getId());
// patientInfo.setRelation(PatientRelationEnum.SELF);
// patientInfo.setPatientName(userInfo.getName());
// patientInfo.setSex(userInfo.getSex());
// patientInfo.setIdNo(userInfo.getIdNo());
// patientInfo.setPhoneNumber(userInfo.getPhoneNumber());
// patientInfo.setBornDate(userInfo.getBornDate());
// patientInfoService.save(patientInfo);
if(updateUserDto.getDefaultFlag()){
PatientInfo patientInfo = patientInfoService.getOne(Wrappers.<PatientInfo>query().eq("user_info_id", userInfo.getId())
.eq("relation", PatientRelationEnum.SELF));
if(null == patientInfo){
//同时创建自身的就诊人
patientInfo = new PatientInfo();
patientInfo.setUserInfoId(userInfo.getId());
patientInfo.setRelation(PatientRelationEnum.SELF);
patientInfo.setPatientName(userInfo.getName());
patientInfo.setSex(userInfo.getSex());
patientInfo.setIdNo(userInfo.getIdNo());
patientInfo.setPhoneNumber(userInfo.getPhoneNumber());
patientInfo.setBornDate(userInfo.getBornDate());
patientInfoService.save(patientInfo);
}
}
user.setObjId(userInfo.getId());
userDto.setUserInfo(userInfo);
......@@ -438,7 +445,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
user.setObjId(doctorInfo.getId());
userDto.setDoctorInfo(doctorInfo);
}
user.setAvatar(updateUserDto.getHeadUrl());
this.saveOrUpdate(user);
userDto.setUser(user);
return userDto;
......
package com.xwd.hospital.server.task;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xwd.hospital.server.domain.UserCouponInfo;
import com.xwd.hospital.server.enums.CouponUseStateEnum;
import com.xwd.hospital.server.service.UserCouponInfoService;
import jakarta.annotation.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
@Component
@Async
public class CouponTask {
@Resource
private UserCouponInfoService userCouponInfoService;
/**
* 每天0点清理过期优惠券
*/
@Scheduled(cron = "0 0 0 * * ?")
public void expireUserCoupon(){
Date now = new Date();
Date oneSecond = DateUtil.offsetSecond(now, 1);
List<UserCouponInfo> list = userCouponInfoService.list(Wrappers.<UserCouponInfo>query()
.le("coupon_end_date", oneSecond)
.eq("coupon_use_state", CouponUseStateEnum.USEABLE));
if(null != list
&& list.size()>0){
for (UserCouponInfo userCouponInfo:list) {
userCouponInfo.setCouponUseState(CouponUseStateEnum.EXPIRED);
}
userCouponInfoService.saveBatch(list);
}
}
}
package com.xwd.hospital.server.task;
public class OrderTask {
}
......@@ -21,10 +21,10 @@ knife4j:
wx:
miniapp:
configs:
- appid: 11111
secret: 123456
token: 123
aesKey: 123
- appid: wxc447fccb6a2745ce
secret: af277a664613a2276266eca024bff139
token: #微信小程序消息服务器配置的token
aesKey: #微信小程序消息服务器配置的EncodingAESKey
msgDataFormat: JSON
- appid: wxc447fccb6a2745ce
secret: af277a664613a2276266eca024bff139
......@@ -33,11 +33,13 @@ wx:
msgDataFormat: JSON
pay:
wx:
appId: 123
merchantId: 123
keyPath: 123
merchantSerialNumber: 123
apiV3Key: 123
appId: wxc447fccb6a2745ce
merchantId: 1535738101
keyPath: /Users/zhuweidong/Documents/xinwangdao/1535738101_20231012_cert/apiclient_key.pem
merchantSerialNumber: 52849767F52ACCC2743E0C5439F3EAFA816FA1D7
apiV3Key: YG1e4n9oBPhuuYZaP7arXy232ejma6FW
payNotifyUrl: http://112.134.24.1:8080/pay/notify
refundNotifyUrl: http://112.134.24.1:8080/pay/refund/notify
tencent:
cloud:
secretId: AKIDZzDD2e4IURBhy2sUrzsXxXu4zf7LL7ex
......
......@@ -235,7 +235,7 @@ drop table if exists `pms_coupon_info`;
create table `pms_coupon_info`
(
id int(11) auto_increment not null comment 'Id',
coupon_name int(11) not null comment '优惠券名称',
coupon_name varchar(64) not null comment '优惠券名称',
coupon_type varchar(50) not null default 'FULL_DISCOUNT' comment '优惠券类型 [FULL_DISCOUNT.满减券]',
coupon_discount decimal(12, 2) not null comment '优惠金额/折扣',
coupon_start_date datetime not null comment '优惠券开始时间',
......@@ -254,12 +254,12 @@ create table `pms_user_coupon_info`
id int(11) auto_increment not null comment 'Id',
user_info_id int(11) not null comment '用户Id',
coupon_id int(11) not null comment '优惠券Id',
coupon_name int(11) not null comment '优惠券名称',
coupon_name varchar(64) not null comment '优惠券名称',
coupon_type varchar(50) not null default 'FULL_DISCOUNT' comment '优惠券类型 [FULL_DISCOUNT.满减券]',
coupon_discount decimal(12, 2) not null comment '优惠金额/折扣',
coupon_start_date datetime not null comment '优惠券开始时间',
coupon_end_date datetime not null comment '优惠券结束时间',
coupon_use_state varchar(50) not null default 'YES' comment '优惠券可用状态 [YES.是 NO.否]',
coupon_use_state varchar(50) not null default 'USEABLE' comment '优惠券可用状态 [USEABLE.退款中 USED.已退款 EXPIRED.已退款]',
editor_id int(11) not null default 1 comment '操作人Id',
editor_name varchar(255) not null default 'admin' comment '操作人',
create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
......@@ -352,7 +352,7 @@ create table `pms_order`
doctor_name varchar(255) not null comment '医生姓名',
patient_name varchar(255) not null comment '就诊人姓名',
patient_sex varchar(50) not null default 'MALE' comment '性别 [MALE.男 FEMALE.女]',
patient_id_no varchar(255) not null comment '身份证号码',
patient_id_no varchar(255) null comment '身份证号码',
patient_phone_number varchar(255) null comment '就诊人手机号码',
patient_born_date varchar(64) not null comment '就诊人出生日期',
patient_self_introduce varchar(255) not null comment '患者自述',
......@@ -431,8 +431,9 @@ create table `pms_prescription_order_record`
id int(11) auto_increment not null comment 'Id',
order_id int(11) not null comment '订单id',
order_no varchar(255) not null comment '订单号',
prescription_introduce varchar(255) not null comment '处方说明',
prescription_image varchar(255) not null comment '处方图片',
prescription_id int(11) not null comment '患者提交处方id',
prescription_introduce varchar(255) null comment '处方说明',
prescription_image varchar(255) null comment '处方图片',
editor_id int(11) not null default 1 comment '操作人Id',
editor_name varchar(255) not null default 'admin' comment '操作人',
create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
......
......@@ -6,6 +6,9 @@
</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">
......@@ -39,6 +42,7 @@
<select id="queryOrderListForMiniApp" resultType="com.xwd.hospital.server.dto.OrderDto">
select
id as orderId,
order_no,
hospital_name,
doctor_name,
......@@ -54,9 +58,15 @@
<if test="state != null and state != 'COMPLETED'">
AND order_state = #{state}
</if>
<if test="state != null and state != '' ">
AND ( order_state = '已取消'or order_state = 'REJECTED' or order_state = 'COMPLETED' )
<if test="state != null and state == 'COMPLETED' ">
AND ( order_state = 'CANCELED'or order_state = 'REJECTED' or order_state = 'COMPLETED' )
</if>
order by create_time desc
</select>
<select id="selectDoctorListByOrderCount" resultMap="RecommendDoctorResultMap">
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
</select>
</mapper>
......@@ -36,4 +36,11 @@
from pms_order_picture
${ew.customSqlSegment}
</select>
<select id="selectByOrderId" resultType="string">
select
patient_self_image
from pms_order_picture
where order_id = #{orderId}
</select>
</mapper>
......@@ -36,4 +36,12 @@
from pms_patient_prescription_info
${ew.customSqlSegment}
</select>
<select id="selectByOrderId" resultMap="ResultMap">
select
ppi.*
from pms_patient_prescription_info ppi
inner join pms_prescription_order ppo on ppi..id = ppo..prescription_id
where ppo.id = #{orderId}
</select>
</mapper>
......@@ -36,4 +36,11 @@
from pms_patient_prescription_info_picture
${ew.customSqlSegment}
</select>
<select id="selectByPrescriptionId" resultType="string">
select
prescription_picture
from pms_patient_prescription_info_picture
where patient_prescription_info_id = #{prescriptionId}
</select>
</mapper>
......@@ -3,7 +3,7 @@
<mapper namespace="com.xwd.hospital.server.repository.base.CouponInfoBaseMapper">
<resultMap id="BaseResultMap" type="com.xwd.hospital.server.domain.CouponInfo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="coupon_name" jdbcType="BIGINT" property="couponName" />
<result column="coupon_name" jdbcType="VARCHAR" property="couponName" />
<result column="coupon_type" jdbcType="VARCHAR" property="couponType" />
<result column="coupon_discount" jdbcType="DECIMAL" property="couponDiscount" />
<result column="coupon_start_date" jdbcType="TIMESTAMP" property="couponStartDate" />
......@@ -29,14 +29,14 @@
values
<foreach collection="records" item="record" separator=",">
(
#{record.couponName, jdbcType=BIGINT}, #{record.couponType, jdbcType=VARCHAR}, #{record.couponDiscount, jdbcType=DECIMAL}, #{record.couponStartDate, jdbcType=TIMESTAMP}, #{record.couponEndDate, jdbcType=TIMESTAMP}, #{record.deleteStatus, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR}
#{record.couponName, jdbcType=VARCHAR}, #{record.couponType, jdbcType=VARCHAR}, #{record.couponDiscount, jdbcType=DECIMAL}, #{record.couponStartDate, jdbcType=TIMESTAMP}, #{record.couponEndDate, jdbcType=TIMESTAMP}, #{record.deleteStatus, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR}
)
</foreach>
</insert>
<update id="updateAllFieldsById" parameterType="com.xwd.hospital.server.domain.CouponInfo">
update pms_coupon_info set
<trim suffixOverrides=",">
coupon_name = #{et.couponName, jdbcType=BIGINT},
coupon_name = #{et.couponName, jdbcType=VARCHAR},
coupon_type = #{et.couponType, jdbcType=VARCHAR},
coupon_discount = #{et.couponDiscount, jdbcType=DECIMAL},
coupon_start_date = #{et.couponStartDate, jdbcType=TIMESTAMP},
......
......@@ -36,14 +36,22 @@
</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.UserInfo"
<association column="user_info_id" property="userInfo" javaType="com.xwd.hospital.server.domain.PatientPrescriptionInfo"
select="com.xwd.hospital.server.repository.PatientPrescriptionInfoMapper.selectByOrderId" />
<!-- <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="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" />
<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`
......
......@@ -15,8 +15,10 @@
</resultMap>
<resultMap id="ResultMap" type="com.xwd.hospital.server.domain.PatientPrescriptionInfo" extends="BaseResultMap">
<result column="prescription_introduce" jdbcType="VARCHAR" property="prescriptionIntroduce" />
<association column="patient_id" property="patient" javaType="com.xwd.hospital.server.domain.PatientInfo"
select="com.xwd.hospital.server.repository.PatientInfoMapper.selectById" />
<!-- <association column="patient_id" property="patient" javaType="com.xwd.hospital.server.domain.PatientInfo"-->
<!-- select="com.xwd.hospital.server.repository.PatientInfoMapper.selectById" />-->
<collection column="id" property="pictureList" javaType="list"
select="com.xwd.hospital.server.repository.PatientPrescriptionInfoPictureMapper.selectByPrescriptionId" />
</resultMap>
<sql id="Base_Column_List">
`id`, `patient_id`, `hospital_name`, `department_name`, `prescription_time`, `delete_status`, `editor_id`, `editor_name`, `create_time`, `update_time`
......
......@@ -5,6 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="order_no" jdbcType="VARCHAR" property="orderNo" />
<result column="prescription_id" jdbcType="BIGINT" property="prescriptionId" />
<result column="prescription_image" jdbcType="VARCHAR" property="prescriptionImage" />
<result column="editor_id" jdbcType="BIGINT" property="editorId" />
<result column="editor_name" jdbcType="VARCHAR" property="editorName" />
......@@ -15,27 +16,29 @@
<result column="prescription_introduce" jdbcType="VARCHAR" property="prescriptionIntroduce" />
<association column="order_id" property="order" javaType="com.xwd.hospital.server.domain.Order"
select="com.xwd.hospital.server.repository.OrderMapper.selectById" />
<association column="prescription_id" property="prescription" javaType="com.xwd.hospital.server.domain.PatientPrescriptionInfo"
select="com.xwd.hospital.server.repository.PatientPrescriptionInfoMapper.selectById" />
</resultMap>
<sql id="Base_Column_List">
`id`, `order_id`, `order_no`, `prescription_image`, `editor_id`, `editor_name`, `create_time`, `update_time`
`id`, `order_id`, `order_no`, `prescription_id`, `prescription_image`, `editor_id`, `editor_name`, `create_time`, `update_time`
</sql>
<sql id="Base_Column_List_With_Prefix">
t.`id`, t.`order_id`, t.`order_no`, t.`prescription_image`, t.`editor_id`, t.`editor_name`, t.`create_time`, t.`update_time`
t.`id`, t.`order_id`, t.`order_no`, t.`prescription_id`, t.`prescription_image`, t.`editor_id`, t.`editor_name`, t.`create_time`, t.`update_time`
</sql>
<sql id="Base_Column_List_Full">
`id`, `order_id`, `order_no`, `prescription_introduce`, `prescription_image`, `editor_id`, `editor_name`, `create_time`, `update_time`
`id`, `order_id`, `order_no`, `prescription_id`, `prescription_introduce`, `prescription_image`, `editor_id`, `editor_name`, `create_time`, `update_time`
</sql>
<sql id="Base_Column_List_Full_With_Prefix">
t.`id`, t.`order_id`, t.`order_no`, t.`prescription_introduce`, t.`prescription_image`, t.`editor_id`, t.`editor_name`, t.`create_time`, t.`update_time`
t.`id`, t.`order_id`, t.`order_no`, t.`prescription_id`, t.`prescription_introduce`, t.`prescription_image`, t.`editor_id`, t.`editor_name`, t.`create_time`, t.`update_time`
</sql>
<insert id="batchInsert">
insert into pms_prescription_order_record (
`order_id`, `order_no`, `prescription_introduce`, `prescription_image`, `editor_id`, `editor_name`
`order_id`, `order_no`, `prescription_id`, `prescription_introduce`, `prescription_image`, `editor_id`, `editor_name`
)
values
<foreach collection="records" item="record" separator=",">
(
#{record.orderId, jdbcType=BIGINT}, #{record.orderNo, jdbcType=VARCHAR}, #{record.prescriptionIntroduce, jdbcType=VARCHAR}, #{record.prescriptionImage, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR}
#{record.orderId, jdbcType=BIGINT}, #{record.orderNo, jdbcType=VARCHAR}, #{record.prescriptionId, jdbcType=BIGINT}, #{record.prescriptionIntroduce, jdbcType=VARCHAR}, #{record.prescriptionImage, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR}
)
</foreach>
</insert>
......@@ -44,6 +47,7 @@
<trim suffixOverrides=",">
order_id = #{et.orderId, jdbcType=BIGINT},
order_no = #{et.orderNo, jdbcType=VARCHAR},
prescription_id = #{et.prescriptionId, jdbcType=BIGINT},
prescription_introduce = #{et.prescriptionIntroduce, jdbcType=VARCHAR},
prescription_image = #{et.prescriptionImage, jdbcType=VARCHAR},
editor_id = #{et.editorId, jdbcType=BIGINT},
......
......@@ -5,7 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_info_id" jdbcType="BIGINT" property="userInfoId" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="coupon_name" jdbcType="BIGINT" property="couponName" />
<result column="coupon_name" jdbcType="VARCHAR" property="couponName" />
<result column="coupon_type" jdbcType="VARCHAR" property="couponType" />
<result column="coupon_discount" jdbcType="DECIMAL" property="couponDiscount" />
<result column="coupon_start_date" jdbcType="TIMESTAMP" property="couponStartDate" />
......@@ -35,7 +35,7 @@
values
<foreach collection="records" item="record" separator=",">
(
#{record.userInfoId, jdbcType=BIGINT}, #{record.couponId, jdbcType=BIGINT}, #{record.couponName, jdbcType=BIGINT}, #{record.couponType, jdbcType=VARCHAR}, #{record.couponDiscount, jdbcType=DECIMAL}, #{record.couponStartDate, jdbcType=TIMESTAMP}, #{record.couponEndDate, jdbcType=TIMESTAMP}, #{record.couponUseState, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR}
#{record.userInfoId, jdbcType=BIGINT}, #{record.couponId, jdbcType=BIGINT}, #{record.couponName, jdbcType=VARCHAR}, #{record.couponType, jdbcType=VARCHAR}, #{record.couponDiscount, jdbcType=DECIMAL}, #{record.couponStartDate, jdbcType=TIMESTAMP}, #{record.couponEndDate, jdbcType=TIMESTAMP}, #{record.couponUseState, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR}
)
</foreach>
</insert>
......@@ -44,7 +44,7 @@
<trim suffixOverrides=",">
user_info_id = #{et.userInfoId, jdbcType=BIGINT},
coupon_id = #{et.couponId, jdbcType=BIGINT},
coupon_name = #{et.couponName, jdbcType=BIGINT},
coupon_name = #{et.couponName, jdbcType=VARCHAR},
coupon_type = #{et.couponType, jdbcType=VARCHAR},
coupon_discount = #{et.couponDiscount, jdbcType=DECIMAL},
coupon_start_date = #{et.couponStartDate, jdbcType=TIMESTAMP},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论