Explorar o código

Merge remote-tracking branch 'origin/master'

ct hai 1 semana
pai
achega
e8ab9e25ba
Modificáronse 22 ficheiros con 787 adicións e 125 borrados
  1. 52 0
      fs-admin/src/main/java/com/fs/his/controller/FsInquiryPatientInfoController.java
  2. 6 5
      fs-redis/src/main/java/com/fs/framework/config/MyBatisConfig.java
  3. 12 3
      fs-service/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java
  4. 26 12
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseOrderServiceImpl.java
  5. 27 12
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java
  6. 28 12
      fs-service/src/main/java/com/fs/course/service/impl/FsUserVipOrderServiceImpl.java
  7. 94 0
      fs-service/src/main/java/com/fs/his/domain/FsInquiryPatientInfo.java
  8. 1 1
      fs-service/src/main/java/com/fs/his/dto/PayConfigDTO.java
  9. 16 0
      fs-service/src/main/java/com/fs/his/mapper/FsInquiryPatientInfoMapper.java
  10. 2 2
      fs-service/src/main/java/com/fs/his/mapper/FsUserIntegralLogsMapper.java
  11. 88 0
      fs-service/src/main/java/com/fs/his/param/FsInquiryPatientParam.java
  12. 19 0
      fs-service/src/main/java/com/fs/his/service/IFsInquiryPatientInfoService.java
  13. 61 0
      fs-service/src/main/java/com/fs/his/service/impl/FsInquiryPatientInfoServiceImpl.java
  14. 3 26
      fs-service/src/main/java/com/fs/his/service/impl/FsIntegralOrderServiceImpl.java
  15. 25 8
      fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java
  16. 26 9
      fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java
  17. 45 28
      fs-service/src/main/java/com/fs/his/service/impl/FsStorePaymentServiceImpl.java
  18. 44 0
      fs-service/src/main/java/com/fs/his/vo/DoctorAdviceVO.java
  19. 76 0
      fs-service/src/main/java/com/fs/his/vo/FsInquiryPatientVO.java
  20. 108 0
      fs-service/src/main/resources/mapper/his/FsInquiryPatientInfoMapper.xml
  21. 2 2
      fs-service/src/main/resources/mapper/his/FsUserMapper.xml
  22. 26 5
      fs-user-app/src/main/java/com/fs/app/controller/InquiryOrderController.java

+ 52 - 0
fs-admin/src/main/java/com/fs/his/controller/FsInquiryPatientInfoController.java

@@ -0,0 +1,52 @@
+package com.fs.his.controller;
+
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.his.param.FsInquiryPatientParam;
+import com.fs.his.service.IFsInquiryPatientInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 问诊患者信息(FsInquiryPatientInfo)
+ */
+@RestController
+@RequestMapping("/his/inquiryPatientInfo")
+public class FsInquiryPatientInfoController extends BaseController {
+
+
+    @Autowired
+    private IFsInquiryPatientInfoService patientInfoService;
+
+
+
+
+    /**
+     * 新增患者问诊信息
+     */
+    @PreAuthorize("@ss.hasPermi('his:inquiryPatientInfo:add')")
+    @Log(title = "患者问诊信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsInquiryPatientParam param){
+        return toAjax(patientInfoService.insertFsInquiryPatientInfo(param));
+    }
+
+    /**
+     * 修改患者问诊信息
+     */
+    @PreAuthorize("@ss.hasPermi('his:inquiryPatientInfo:edit')")
+    @Log(title = "患者问诊信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsInquiryPatientParam param){
+        return toAjax(patientInfoService.updateFsInquiryPatientInfo(param));
+    }
+
+    @GetMapping("/detail/{inquiryOrderId}")
+    public AjaxResult get(@PathVariable("inquiryOrderId") Long inquiryOrderId){
+        return AjaxResult.success(patientInfoService.selectFsInquiryPatientInfo(inquiryOrderId));
+    }
+}

+ 6 - 5
fs-redis/src/main/java/com/fs/framework/config/MyBatisConfig.java

@@ -1,5 +1,6 @@
 package com.fs.framework.config;
 
+import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
 import com.fs.common.utils.StringUtils;
 import org.apache.ibatis.io.VFS;
 import org.apache.ibatis.session.SqlSessionFactory;
@@ -117,16 +118,16 @@ public class MyBatisConfig
     @Bean
     public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
     {
-        String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
-        String mapperLocations = env.getProperty("mybatis.mapperLocations");
-        String configLocation = env.getProperty("mybatis.configLocation");
+        String typeAliasesPackage = env.getProperty("mybatis-plus.typeAliasesPackage");
+        String mapperLocations = env.getProperty("mybatis-plus.mapperLocations");
+        String configLocation = env.getProperty("mybatis-plus.configLocation");
         typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
         VFS.addImplClass(SpringBootVFS.class);
 
-        final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
+        final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
         sessionFactory.setDataSource(dataSource);
         sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
-        sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
+        sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
         sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
         return sessionFactory.getObject();
     }

+ 12 - 3
fs-service/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -405,7 +405,16 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
     public Long getFsUserVideoDuration(Long videoId){
         //将视频时长也存到redis
         String videoRedisKey = "h5wxuser:video:duration:" + videoId;
-        Long videoDuration = redisCache.getCacheObject(videoRedisKey);
+        Long videoDuration=0L;
+        try {
+            videoDuration = redisCache.getCacheObject(videoRedisKey);
+        }catch (Exception e){
+            String string = redisCache.getCacheObject(videoRedisKey);
+            videoDuration=Long.parseLong(string);
+            log.error("key中id为S:{}", videoDuration);
+        }
+
+        
         if (videoDuration==null){
             FsUserCourseVideo video = courseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
             videoDuration=video.getDuration();
@@ -1022,8 +1031,8 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
             if(ObjectUtils.isNotNull(item.getUserId())) {
                 FsUser fsUser = fsUserCacheService.selectFsUserById(item.getUserId());
                 if(ObjectUtils.isNotNull(fsUser)){
-                    item.setExternalUserName(String.format("%s_%d",fsUser.getNickname(),fsUser.getUserId()));
-                    item.setFsNickName(fsUser.getNickname());
+                    item.setExternalUserName(String.format("%s_%d",fsUser.getNickName(),fsUser.getUserId()));
+                    item.setFsNickName(fsUser.getNickName());
                     item.setFsAvatar(fsUser.getAvatar());
                 }
             }

+ 26 - 12
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseOrderServiceImpl.java

@@ -6,6 +6,8 @@ import java.util.*;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
@@ -24,10 +26,7 @@ import com.fs.his.domain.*;
 import com.fs.his.dto.PayConfigDTO;
 import com.fs.his.enums.FsPackageOrderStatusEnum;
 import com.fs.his.enums.FsUserIntegralLogTypeEnum;
-import com.fs.his.mapper.FsStorePaymentErrorMapper;
-import com.fs.his.mapper.FsStorePaymentMapper;
-import com.fs.his.mapper.FsUserIntegralLogsMapper;
-import com.fs.his.mapper.FsUserMapper;
+import com.fs.his.mapper.*;
 import com.fs.his.param.FsPackageOrderDoPayParam;
 import com.fs.his.param.FsUserAddIntegralTemplateParam;
 import com.fs.his.service.IFsCouponService;
@@ -128,6 +127,8 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
     private TzBankService tzBankService;
     @Autowired
     private IFsUserIntegralLogsService userIntegralLogsService;
+    @Autowired
+    private FsUserWxMapper fsUserWxMapper;
 
 
 
@@ -372,13 +373,26 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
             return R.error("非法操作");
         }
         FsUser user=fsUserMapper.selectFsUserByUserId(param.getUserId());
-        if(user!=null&& StringUtils.isNotEmpty(user.getMaOpenId())) {
+
+        String json = configService.selectConfigByKey("his.pay");
+        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+
+        String openId = Objects.isNull(user) ? "" : user.getMaOpenId();
+        if (StringUtils.isBlank(openId)){
+            Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
+                    .eq(FsUserWx::getFsUserId, param.getUserId())
+                    .eq(FsUserWx::getAppId, payConfigDTO.getAppId());
+            FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
+            if (Objects.nonNull(fsUserWx)){
+                openId = fsUserWx.getOpenId();
+            }
+        }
+
+        if(user!=null&& StringUtils.isNotEmpty(openId)) {
             if (order.getPayMoney().compareTo(new BigDecimal(0)) == 0) {
                 this.payConfirm(order.getOrderCode(), "", "", "", 2);
                 return R.ok().put("isPay", 1);
             } else {
-                String json = configService.selectConfigByKey("his.pay");
-                PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
                 String payCode =  OrderCodeUtils.getOrderSn();
                 if(StringUtils.isEmpty(payCode)){
                     return R.error("订单生成失败,请重试");
@@ -393,7 +407,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                 storePayment.setPayTypeCode("weixin");
                 storePayment.setBusinessType(4);
                 storePayment.setRemark("课程订单支付");
-                storePayment.setOpenId(user.getMaOpenId());
+                storePayment.setOpenId(openId);
                 storePayment.setUserId(user.getUserId());
                 storePayment.setBusinessId(order.getOrderId().toString());
                 if (storePaymentService.insertFsStorePayment(storePayment) > 0) {
@@ -411,7 +425,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                         payConfig.setNotifyUrl(wxPayProperties.getNotifyUrl());
                         wxPayService.setConfig(payConfig);
                         WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
-                        orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
+                        orderRequest.setOpenid(openId);//公众号支付提供用户openid
                         orderRequest.setBody("课程订单支付");
                         orderRequest.setOutTradeNo("course-" + storePayment.getPayCode());
                         orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
@@ -433,7 +447,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                         p.setLowOrderId("course-" + storePayment.getPayCode());
                         p.setBody("课程订单支付");
                         p.setIsMinipg("1");
-                        p.setOpenId(user.getMaOpenId());
+                        p.setOpenId(openId);
                         p.setAttach("");
                         p.setStoreid("0");
                         CreateWxOrderResult wxOrder = payService.createWxOrder(p);
@@ -457,7 +471,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                         }
                         o.setPayerName("微信用户" + phone);
                         o.setGoodsInfo("课程订单支付"); // 订单信息
-                        o.setOpenId(user.getMaOpenId());
+                        o.setOpenId(openId);
                         o.setOrderType(4);
                         o.setOrderId(order.getOrderId().toString());
                         TzBankResult<PayCreateOrderResult> result = tzBankService.createOrder(o);
@@ -469,7 +483,7 @@ public class FsUserCourseOrderServiceImpl implements IFsUserCourseOrderService
                     } else if (payConfigDTO.getType().equals("hf")) {
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_MINIAPP");
-                        o.setOpenid(user.getMaOpenId());
+                        o.setOpenid(openId);
                         o.setReqSeqId("course-" + storePayment.getPayCode());
                         o.setTransAmt(storePayment.getPayMoney().toString());
                         o.setGoodsDesc("课程订单支付");

+ 27 - 12
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -942,22 +942,28 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
             logger.error("未答题:{}",param.getUserId());
             return R.error("未答题");
         }
-        if (log.getRewardType() != null) {
-            FsCourseRedPacketLog fsCourseRedPacketLog = redPacketLogMapper.selectUserFsCourseRedPacketLog(param.getVideoId(), param.getUserId(),param.getPeriodId());
-            if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 1) {
-                return R.error("已领取该课程奖励,不可重复领取!");
-            }
-            if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 0) {
-                if(StringUtils.isNotEmpty(fsCourseRedPacketLog.getResult())){
-                    R r = JSON.parseObject(fsCourseRedPacketLog.getResult(), R.class);
-                    return r;
-                } else {
-                    return R.error("操作频繁,请稍后再试!");
+        if (log.getRewardType() != null ) {
+            if (log.getRewardType() == 1){
+                FsCourseRedPacketLog fsCourseRedPacketLog = redPacketLogMapper.selectUserFsCourseRedPacketLog(param.getVideoId(), param.getUserId(),param.getPeriodId());
+                if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 1) {
+                    return R.error("已领取该课程奖励,不可重复领取!");
+                }
+                if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 0) {
+                    if(StringUtils.isNotEmpty(fsCourseRedPacketLog.getResult())){
+                        R r = JSON.parseObject(fsCourseRedPacketLog.getResult(), R.class);
+                        return r;
+                    } else {
+                        return R.error("操作频繁,请稍后再试!");
+                    }
                 }
+            }else if (log.getRewardType() == 2){
+                return R.error("已领取该课程奖励,不可重复领取!");
             }
+
         }
 
 
+
         // 获取视频信息
         FsUserCourseVideo video = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(param.getVideoId());
 
@@ -1802,7 +1808,16 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 
         //将视频时长也存到redis
         String videoRedisKey = "h5wxuser:video:duration:" + param.getVideoId();
-        Long videoDuration = redisCache.getCacheObject(videoRedisKey);
+
+        Long videoDuration=0L;
+        try {
+            videoDuration = redisCache.getCacheObject(videoRedisKey);
+        }catch (Exception e){
+            String string = redisCache.getCacheObject(videoRedisKey);
+            videoDuration=Long.parseLong(string);
+            log.error("key中id为String:{}", videoDuration);
+        }
+
         if (videoDuration == null) {
             redisCache.setCacheObject(videoRedisKey, courseVideoDetails != null ? courseVideoDetails.getDuration() != null ? courseVideoDetails.getDuration() : 0 : 0);
         }

+ 28 - 12
fs-service/src/main/java/com/fs/course/service/impl/FsUserVipOrderServiceImpl.java

@@ -6,9 +6,12 @@ import java.time.ZoneId;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
@@ -24,14 +27,12 @@ import com.fs.course.param.FsUserVipOrderCreateUParam;
 import com.fs.course.param.FsUserVipOrderParam;
 import com.fs.course.param.FsUserVipOrderPayUParam;
 import com.fs.course.vo.FsUserVipOrderListPVO;
-import com.fs.his.domain.FsPayConfig;
-import com.fs.his.domain.FsStorePayment;
-import com.fs.his.domain.FsStorePaymentError;
-import com.fs.his.domain.FsUser;
+import com.fs.his.domain.*;
 import com.fs.his.dto.PayConfigDTO;
 import com.fs.his.mapper.FsStorePaymentErrorMapper;
 import com.fs.his.mapper.FsStorePaymentMapper;
 import com.fs.his.mapper.FsUserMapper;
+import com.fs.his.mapper.FsUserWxMapper;
 import com.fs.his.service.IFsStorePaymentService;
 import com.fs.huifuPay.domain.HuiFuCreateOrder;
 import com.fs.huifuPay.domain.HuifuCreateOrderResult;
@@ -111,6 +112,8 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
 
     @Autowired
     private IPayService payService;
+    @Autowired
+    private FsUserWxMapper fsUserWxMapper;
 
 
     /**
@@ -229,13 +232,26 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
             return R.error("非法操作");
         }
         FsUser user = userMapper.selectFsUserByUserId(param.getUserId());
-        if(user!=null&& StringUtils.isNotEmpty(user.getMaOpenId())) {
+
+        String json = configService.selectConfigByKey("his.pay");
+        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+
+        String openId = Objects.isNull(user) ? "" : user.getMaOpenId();
+        if (StringUtils.isBlank(openId)){
+            Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
+                    .eq(FsUserWx::getFsUserId, param.getUserId())
+                    .eq(FsUserWx::getAppId, payConfigDTO.getAppId());
+            FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
+            if (Objects.nonNull(fsUserWx)){
+                openId = fsUserWx.getOpenId();
+            }
+        }
+
+        if(user!=null&& StringUtils.isNotEmpty(openId)) {
             if (order.getPayMoney().compareTo(new BigDecimal(0)) == 0) {
                 this.payConfirm(order.getOrderCode(), "", "", "", 2);
                 return R.ok().put("isPay", 1);
             } else {
-                String json = configService.selectConfigByKey("his.pay");
-                PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
                 String payCode =  OrderCodeUtils.getOrderSn();
                 if(StringUtils.isEmpty(payCode)){
                     return R.error("订单生成失败,请重试");
@@ -250,7 +266,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                 storePayment.setPayTypeCode("weixin");
                 storePayment.setBusinessType(5);
                 storePayment.setRemark("会员开通订单支付");
-                storePayment.setOpenId(user.getMaOpenId());
+                storePayment.setOpenId(openId);
                 storePayment.setUserId(user.getUserId());
                 storePayment.setBusinessId(order.getOrderId().toString());
                 if (storePaymentService.insertFsStorePayment(storePayment) > 0) {
@@ -268,7 +284,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                         payConfig.setNotifyUrl(wxPayProperties.getNotifyUrl());
                         wxPayService.setConfig(payConfig);
                         WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
-                        orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
+                        orderRequest.setOpenid(openId);//公众号支付提供用户openid
                         orderRequest.setBody("会员开通订单支付");
                         orderRequest.setOutTradeNo("appvip-" + storePayment.getPayCode());
                         orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
@@ -290,7 +306,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                         p.setLowOrderId("appvip-" + storePayment.getPayCode());
                         p.setBody("会员开通订单支付");
                         p.setIsMinipg("1");
-                        p.setOpenId(user.getMaOpenId());
+                        p.setOpenId(openId);
                         p.setAttach("");
                         p.setStoreid("0");
                         CreateWxOrderResult wxOrder = payService.createWxOrder(p);
@@ -314,7 +330,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                         }
                         o.setPayerName("微信用户" + phone);
                         o.setGoodsInfo("会员开通订单支付"); // 订单信息
-                        o.setOpenId(user.getMaOpenId());
+                        o.setOpenId(openId);
                         o.setOrderType(5);
                         o.setOrderId(order.getOrderId().toString());
                         TzBankResult<PayCreateOrderResult> result = tzBankService.createOrder(o);
@@ -326,7 +342,7 @@ public class FsUserVipOrderServiceImpl implements IFsUserVipOrderService
                     } else if (payConfigDTO.getType().equals("hf")) {
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_MINIAPP");
-                        o.setOpenid(user.getMaOpenId());
+                        o.setOpenid(openId);
                         o.setReqSeqId("appvip-" + storePayment.getPayCode());
                         o.setTransAmt(storePayment.getPayMoney().toString());
                         o.setGoodsDesc("会员开通订单支付");

+ 94 - 0
fs-service/src/main/java/com/fs/his/domain/FsInquiryPatientInfo.java

@@ -0,0 +1,94 @@
+package com.fs.his.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class FsInquiryPatientInfo extends BaseEntity {
+
+    /** ID */
+    private Long id;
+
+    /**
+     * 患者id
+     */
+    private Long patientId;
+
+    /**
+     * 销售id
+     */
+    private Long companyUserId;
+    /**
+     * 患者会员id
+     */
+    private Long userId;
+    /**
+     * 问诊订单id
+     */
+    private Long inquiryOrderId;
+    /**
+     * 课程id
+     */
+    private Long courseId;
+
+    /**
+     * 就诊状态 1-初诊 2-复诊
+     */
+    private Integer diagnosisStatus;
+
+    /**
+     * 客户标签
+     */
+    private String tag;
+
+    /**
+     * 课程/档期
+     */
+    private String courseName;
+
+    /**
+     * 患者病情主诉
+     */
+    private String patientCondition;
+
+    /**
+     * 部门负责人
+     */
+    private String deptManager;
+
+    /**
+     * 医生建议及处置
+     */
+    private String doctorAdviceJson;
+
+    /**
+     * 禁忌
+     */
+    private String taboo;
+    /**
+     * 客户需求
+     */
+    private String customerRequire;
+
+    /**
+     * 职业医生
+     */
+    private String professionalDoctor;
+
+    /**
+     * 助理医生
+     */
+    private String assistantDoctor;
+
+    /**
+     * 预约时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date subTime;
+
+    private Long subDoctorId;
+
+}

+ 1 - 1
fs-service/src/main/java/com/fs/his/dto/PayConfigDTO.java

@@ -15,7 +15,7 @@ public class PayConfigDTO implements Serializable {
     private String tzAppKey;
     private String tzPlatformPublicKey;
     private String tzPrivateKey;
-
+    private String appId;
 
 
 }

+ 16 - 0
fs-service/src/main/java/com/fs/his/mapper/FsInquiryPatientInfoMapper.java

@@ -0,0 +1,16 @@
+package com.fs.his.mapper;
+
+import com.fs.his.domain.FsInquiryPatientInfo;
+import com.fs.his.vo.FsInquiryPatientVO;
+import org.apache.ibatis.annotations.Select;
+
+public interface FsInquiryPatientInfoMapper {
+
+    int insertFsInquiryPatientInfo(FsInquiryPatientInfo fsInquiryPatientInfo);
+
+    int updateFsInquiryPatientInfo(FsInquiryPatientInfo fsInquiryPatientInfo);
+
+    FsInquiryPatientInfo selectFsInquiryPatientInfoInquiryOrderId(Long inquiryOrderId);
+
+    FsInquiryPatientVO selectUserAndCompanyUserByInquiryOrderId(Long inquiryOrderId);
+}

+ 2 - 2
fs-service/src/main/java/com/fs/his/mapper/FsUserIntegralLogsMapper.java

@@ -88,10 +88,10 @@ public interface FsUserIntegralLogsMapper
             "and l.user_id = #{maps.userId}  " +
             "</if>" +
             "<if test = 'maps.type != null and maps.type==1       '> " +
-            "and (l.log_type =1 or l.log_type =2)  " +
+            "and l.integral &gt;= 0  " +
             "</if>" +
             "<if test = 'maps.type != null and maps.type==2       '> " +
-            "and (l.log_type =3 or l.log_type =4)  " +
+            "and l.integral &lt; 0  " +
             "</if>" +
             " order by l.id desc "+
             "</script>"})

+ 88 - 0
fs-service/src/main/java/com/fs/his/param/FsInquiryPatientParam.java

@@ -0,0 +1,88 @@
+package com.fs.his.param;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.his.vo.DoctorAdviceVO;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class FsInquiryPatientParam {
+    private Long id;
+
+    /**
+     * 患者id
+     */
+    private Long patientId;
+
+    /**
+     * 销售id
+     */
+    private Long companyUserId;
+    /**
+     * 患者会员id
+     */
+    private Long userId;
+    /**
+     * 问诊订单id
+     */
+    private Long inquiryOrderId;
+    /**
+     * 课程id
+     */
+    private Long courseId;
+
+    /**
+     * 就诊状态 1-初诊 2-复诊
+     */
+    private Integer diagnosisStatus;
+
+    /**
+     * 客户标签
+     */
+    private String tag;
+
+    /**
+     * 课程/档期
+     */
+    private String courseName;
+
+    /**
+     * 患者病情主诉
+     */
+    private String patientCondition;
+
+    /**
+     * 部门负责人
+     */
+    private String deptManager;
+
+    /**
+     * 医生建议及处置
+     */
+    private DoctorAdviceVO doctorAdviceJson;
+
+    /**
+     * 禁忌
+     */
+    private String taboo;
+    /**
+     * 客户需求
+     */
+    private String customerRequire;
+
+    /**
+     * 职业医生
+     */
+    private String professionalDoctor;
+
+    /**
+     * 助理医生
+     */
+    private String assistantDoctor;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date subTime;
+
+    private Long subDoctorId;
+}

+ 19 - 0
fs-service/src/main/java/com/fs/his/service/IFsInquiryPatientInfoService.java

@@ -0,0 +1,19 @@
+package com.fs.his.service;
+
+import com.fs.his.domain.FsInquiryPatientInfo;
+import com.fs.his.param.FsInquiryPatientParam;
+import com.fs.his.vo.FsInquiryPatientVO;
+
+/**
+ * 问诊患者信息Service接口
+ */
+public interface IFsInquiryPatientInfoService {
+
+
+    int insertFsInquiryPatientInfo(FsInquiryPatientParam fsInquiryPatientInfo);
+
+    int updateFsInquiryPatientInfo(FsInquiryPatientParam fsInquiryPatientInfo);
+
+    FsInquiryPatientVO selectFsInquiryPatientInfo(Long inquiryOrderId);
+
+}

+ 61 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsInquiryPatientInfoServiceImpl.java

@@ -0,0 +1,61 @@
+package com.fs.his.service.impl;
+
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
+import com.fs.common.BeanCopyUtils;
+import com.fs.common.exception.CustomException;
+import com.fs.his.domain.FsInquiryPatientInfo;
+import com.fs.his.mapper.FsInquiryOrderMapper;
+import com.fs.his.mapper.FsInquiryPatientInfoMapper;
+import com.fs.his.param.FsInquiryPatientParam;
+import com.fs.his.service.IFsInquiryPatientInfoService;
+import com.fs.his.vo.DoctorAdviceVO;
+import com.fs.his.vo.FsInquiryPatientVO;
+import org.checkerframework.checker.units.qual.A;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 问诊患者信息Service业务层处理
+ */
+@Service
+public class FsInquiryPatientInfoServiceImpl implements IFsInquiryPatientInfoService {
+    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Autowired
+    private FsInquiryPatientInfoMapper fsInquiryPatientInfoMapper;
+
+    @Autowired
+    private FsInquiryOrderMapper inquiryOrderMapper;
+    @Override
+    public int insertFsInquiryPatientInfo(FsInquiryPatientParam param) {
+        FsInquiryPatientInfo fsInquiryPatientInfo = new FsInquiryPatientInfo();
+        BeanCopyUtils.copy(param, fsInquiryPatientInfo);
+        fsInquiryPatientInfo.setDoctorAdviceJson(JSON.toJSONString(param.getDoctorAdviceJson()));
+        return fsInquiryPatientInfoMapper.insertFsInquiryPatientInfo(fsInquiryPatientInfo);
+    }
+
+    @Override
+    public int updateFsInquiryPatientInfo(FsInquiryPatientParam param) {
+        if (param.getId() == null) {
+            throw new CustomException("更新患者问诊信息错误");
+        }
+        FsInquiryPatientInfo fsInquiryPatientInfo = new FsInquiryPatientInfo();
+        BeanCopyUtils.copy(param, fsInquiryPatientInfo);
+        fsInquiryPatientInfo.setDoctorAdviceJson(JSON.toJSONString(param.getDoctorAdviceJson()));
+        return fsInquiryPatientInfoMapper.updateFsInquiryPatientInfo(fsInquiryPatientInfo);
+    }
+
+    @Override
+    public FsInquiryPatientVO selectFsInquiryPatientInfo(Long inquiryOrderId) {
+        FsInquiryPatientVO inquiryPatientVO = fsInquiryPatientInfoMapper.selectUserAndCompanyUserByInquiryOrderId(inquiryOrderId);
+        FsInquiryPatientInfo fsInquiryPatientInfo = fsInquiryPatientInfoMapper.selectFsInquiryPatientInfoInquiryOrderId(inquiryOrderId);
+        if (fsInquiryPatientInfo != null) {
+            BeanCopyUtils.copy(fsInquiryPatientInfo, inquiryPatientVO);
+            inquiryPatientVO.setDoctorAdviceJson(JSONUtil.toBean(fsInquiryPatientInfo.getDoctorAdviceJson(), DoctorAdviceVO.class));
+        }
+        return inquiryPatientVO;
+    }
+}

+ 3 - 26
fs-service/src/main/java/com/fs/his/service/impl/FsIntegralOrderServiceImpl.java

@@ -14,13 +14,9 @@ import com.fs.common.core.redis.RedisCache;
 import com.fs.common.exception.CustomException;
 import com.fs.common.exception.ServiceException;
 import com.fs.common.utils.DateUtils;
-import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.StringUtils;
-import com.fs.common.utils.ip.IpUtils;
-import com.fs.core.config.WxPayProperties;
 import com.fs.core.utils.OrderCodeUtils;
 import com.fs.his.domain.*;
-import com.fs.his.dto.PayConfigDTO;
 import com.fs.his.enums.BusinessTypeEnum;
 import com.fs.his.enums.FsUserIntegralLogTypeEnum;
 import com.fs.his.enums.PaymentMethodEnum;
@@ -30,43 +26,23 @@ import com.fs.his.service.IFsIntegralCartService;
 import com.fs.his.service.IFsIntegralOrderService;
 import com.fs.his.service.IFsStorePaymentService;
 import com.fs.his.service.IFsUserIntegralLogsService;
-import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.FsIntegralOrderListUVO;
 import com.fs.his.vo.FsIntegralOrderListVO;
 import com.fs.his.vo.FsIntegralOrderPVO;
 import com.fs.his.vo.FsStoreProductDeliverExcelVO;
-import com.fs.huifuPay.domain.HuiFuCreateOrder;
-import com.fs.huifuPay.domain.HuifuCreateOrderResult;
-import com.fs.huifuPay.service.HuiFuService;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.mapper.QwUserMapper;
-import com.fs.system.domain.SysConfig;
-import com.fs.system.service.ISysConfigService;
-import com.fs.tzBankPay.TzBankService.TzBankService;
-import com.fs.tzBankPay.doman.PayCreateOrder;
-import com.fs.tzBankPay.doman.PayCreateOrderResult;
 import com.fs.tzBankPay.doman.PayType;
-import com.fs.tzBankPay.doman.TzBankResult;
-import com.fs.ybPay.domain.CreateWxOrderResult;
 import com.fs.ybPay.domain.OrderResult;
 import com.fs.ybPay.dto.OrderQueryDTO;
-import com.fs.ybPay.dto.WxJspayDTO;
 import com.fs.ybPay.service.IPayService;
-import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
-import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
-import com.github.binarywang.wxpay.config.WxPayConfig;
-import com.github.binarywang.wxpay.exception.WxPayException;
-import com.github.binarywang.wxpay.service.WxPayService;
-import com.google.gson.Gson;
 import lombok.extern.slf4j.Slf4j;
-import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
@@ -242,6 +218,7 @@ public class FsIntegralOrderServiceImpl implements IFsIntegralOrderService
             throw new CustomException("库存不足");
         }
 
+        integralGoods.setNum(1);
         List<FsIntegralGoods> goodsItem = new ArrayList<>();
         goodsItem.add(integralGoods);
 
@@ -481,10 +458,10 @@ public class FsIntegralOrderServiceImpl implements IFsIntegralOrderService
         // 还原库存
         if (order.getItemJson().startsWith("[") && order.getItemJson().endsWith("]")){
             List<FsIntegralGoods> goodsItem = JSONUtil.toBean(order.getItemJson(), new TypeReference<List<FsIntegralGoods>>(){}, true);
-            goodsItem.forEach(goods -> fsIntegralGoodsMapper.addStock(goods.getGoodsId(), goods.getNum()));
+            goodsItem.forEach(goods -> fsIntegralGoodsMapper.addStock(goods.getGoodsId(), Objects.isNull(goods.getNum()) ? 1 : goods.getNum()));
         } else {
             FsIntegralGoods integralGoods = JSONUtil.toBean(order.getItemJson(), FsIntegralGoods.class);
-            fsIntegralGoodsMapper.addStock(integralGoods.getGoodsId(), 1);
+            fsIntegralGoodsMapper.addStock(integralGoods.getGoodsId(), Objects.isNull(integralGoods.getNum()) ? 1 : integralGoods.getNum());
         }
 
         // 还原积分

+ 25 - 8
fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java

@@ -14,6 +14,8 @@ import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.constant.FsConstants;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
@@ -160,6 +162,8 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
     private IPayService ybPayService;
     @Autowired
     private IFsUserService fsUserService;
+    @Autowired
+    private FsUserWxMapper fsUserWxMapper;
 
     /**
      * 查询套餐订单
@@ -878,10 +882,23 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
         }
 
         FsUser user=userService.selectFsUserByUserId(param.getUserId());
-        if(user!=null&& StringUtils.isNotEmpty(user.getMaOpenId())){
+
+        String json = configService.selectConfigByKey("his.pay");
+        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+
+        String openId = Objects.isNull(user) ? "" : user.getMaOpenId();
+        if (StringUtils.isBlank(openId)){
+            Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
+                    .eq(FsUserWx::getFsUserId, param.getUserId())
+                    .eq(FsUserWx::getAppId, payConfigDTO.getAppId());
+            FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
+            if (Objects.nonNull(fsUserWx)){
+                openId = fsUserWx.getOpenId();
+            }
+        }
+
+        if(user!=null&& StringUtils.isNotEmpty(openId)){
             if(fsPackageOrder.getPayMoney().compareTo(new BigDecimal(0))==1){
-                String json = configService.selectConfigByKey("his.pay");
-                PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
                 String payCode =  OrderCodeUtils.getOrderSn();
                 if(StringUtils.isEmpty(payCode)){
                     return R.error("订单生成失败,请重试");
@@ -898,7 +915,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                 storePayment.setCompanyId(fsPackageOrder.getCompanyId());
                 storePayment.setCompanyUserId(fsPackageOrder.getCompanyUserId());
                 storePayment.setRemark("套餐包订单支付");
-                storePayment.setOpenId(user.getMaOpenId());
+                storePayment.setOpenId(openId);
                 storePayment.setUserId(user.getUserId());
                 storePayment.setStoreId(fsPackageOrder.getStoreId());
                 storePayment.setBusinessId(fsPackageOrder.getOrderId().toString());
@@ -917,7 +934,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         payConfig.setNotifyUrl(wxPayProperties.getNotifyUrl());
                         wxPayService.setConfig(payConfig);
                         WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
-                        orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
+                        orderRequest.setOpenid(openId);//公众号支付提供用户openid
                         orderRequest.setBody("套餐包订单支付");
                         orderRequest.setOutTradeNo("package-" + storePayment.getPayCode());
                         orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
@@ -939,7 +956,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         p.setLowOrderId("package-" + storePayment.getPayCode());
                         p.setBody("套餐包订单支付");
                         p.setIsMinipg("1");
-                        p.setOpenId(user.getMaOpenId());
+                        p.setOpenId(openId);
                         p.setAttach("");
                         p.setStoreid("0");
                         CreateWxOrderResult wxOrder = payService.createWxOrder(p);
@@ -969,7 +986,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         }
                         o.setPayerName("微信用户"+phone);
                         o.setGoodsInfo("套餐包订单支付"); // 订单信息
-                        o.setOpenId(user.getMaOpenId());
+                        o.setOpenId(openId);
                         o.setOrderType(3);
                         o.setOrderId(fsPackageOrder.getOrderId().toString());
                         TzBankResult<PayCreateOrderResult> result = tzBankService.createOrder(o);
@@ -982,7 +999,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
                         logger.info("创建汇付订单");
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_MINIAPP");
-                        o.setOpenid(user.getMaOpenId());
+                        o.setOpenid(openId);
                         o.setReqSeqId("package-"+storePayment.getPayCode());
                         o.setTransAmt(storePayment.getPayMoney().toString());
                         o.setGoodsDesc("套餐包订单支付");

+ 26 - 9
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -6,6 +6,8 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.exception.CustomException;
@@ -252,6 +254,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
     private IFsPrescribeService fsPrescribeService;
     @Autowired
     private FsStoreOrderDfMapper fsStoreOrderDfMapper;
+    @Autowired
+    private FsUserWxMapper fsUserWxMapper;
 
     @Value("${express.omsCode}")
     private String expressOmsCode;
@@ -2567,15 +2571,28 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         }
 
         FsUser user = userService.selectFsUserByUserId(param.getUserId());
-        if (user != null && StringUtils.isNotEmpty(user.getMaOpenId())) {
+
+        //在线支付
+        String json = configService.selectConfigByKey("his.pay");
+        PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
+
+        String openId = Objects.isNull(user) ? "" : user.getMaOpenId();
+        if (StringUtils.isBlank(openId)){
+            Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
+                    .eq(FsUserWx::getFsUserId, param.getUserId())
+                    .eq(FsUserWx::getAppId, payConfigDTO.getAppId());
+            FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
+            if (Objects.nonNull(fsUserWx)){
+                openId = fsUserWx.getOpenId();
+            }
+        }
+
+        if (user != null && StringUtils.isNotEmpty(openId)) {
 
             if (order.getPayMoney().compareTo(new BigDecimal(0)) == 0) {
                 this.payConfirm(order.getOrderCode(), "", "", "", 2);
                 return R.ok().put("data", param.getOrderId()).put("isPay", "1");
             } else {
-                //在线支付
-                String json = configService.selectConfigByKey("his.pay");
-                PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
                 String payCode = OrderCodeUtils.getOrderSn();
                 if (StringUtils.isEmpty(payCode)) {
                     return R.error("订单生成失败,请重试");
@@ -2590,7 +2607,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 storePayment.setPayTypeCode("weixin");
                 storePayment.setBusinessType(2);
                 storePayment.setRemark("药品订单支付");
-                storePayment.setOpenId(user.getMaOpenId());
+                storePayment.setOpenId(openId);
                 storePayment.setUserId(user.getUserId());
                 storePayment.setCompanyId(order.getCompanyId());
                 storePayment.setCompanyUserId(order.getCompanyUserId());
@@ -2612,7 +2629,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                         payConfig.setNotifyUrl(wxPayProperties.getNotifyUrl());
                         wxPayService.setConfig(payConfig);
                         WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
-                        orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
+                        orderRequest.setOpenid(openId);//公众号支付提供用户openid
                         orderRequest.setBody("药品订单支付");
                         orderRequest.setOutTradeNo("store-" + storePayment.getPayCode());
                         orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
@@ -2634,7 +2651,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                         p.setLowOrderId("store-" + storePayment.getPayCode());
                         p.setBody("药品订单支付");
                         p.setIsMinipg("1");
-                        p.setOpenId(user.getMaOpenId());
+                        p.setOpenId(openId);
                         p.setAttach("");
                         p.setStoreid("0");
                         CreateWxOrderResult wxOrder = payService.createWxOrder(p);
@@ -2663,7 +2680,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                         }
                         o.setPayerName("微信用户" + phone);
                         o.setGoodsInfo("药品订单支付"); // 订单信息
-                        o.setOpenId(user.getMaOpenId());
+                        o.setOpenId(openId);
                         o.setOrderType(2);
                         o.setOrderId(order.getOrderId().toString());
                         TzBankResult<PayCreateOrderResult> result = tzBankService.createOrder(o);
@@ -2675,7 +2692,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                     } else if (payConfigDTO.getType().equals("hf")) {
                         HuiFuCreateOrder o = new HuiFuCreateOrder();
                         o.setTradeType("T_MINIAPP");
-                        o.setOpenid(user.getMaOpenId());
+                        o.setOpenid(openId);
                         o.setReqSeqId("store-" + storePayment.getPayCode());
                         o.setTransAmt(storePayment.getPayMoney().toString());
                         o.setGoodsDesc("药品订单支付");

+ 45 - 28
fs-service/src/main/java/com/fs/his/service/impl/FsStorePaymentServiceImpl.java

@@ -8,6 +8,8 @@ import java.util.*;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.annotation.DataScope;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.domain.AjaxResult;
@@ -30,15 +32,13 @@ import com.fs.course.service.IFsCourseRedPacketLogService;
 import com.fs.course.service.IFsUserCourseOrderService;
 import com.fs.course.service.IFsUserVipOrderService;
 import com.fs.erp.dto.ErpRefundUpdateRequest;
-import com.fs.his.domain.FsExportTask;
-import com.fs.his.domain.FsPayConfig;
-import com.fs.his.domain.FsStorePayment;
-import com.fs.his.domain.FsUser;
+import com.fs.his.domain.*;
 import com.fs.his.dto.PayConfigDTO;
 import com.fs.his.enums.PaymentMethodEnum;
 import com.fs.his.mapper.FsExportTaskMapper;
 import com.fs.his.mapper.FsStorePaymentMapper;
 import com.fs.his.mapper.FsUserMapper;
+import com.fs.his.mapper.FsUserWxMapper;
 import com.fs.his.param.FsStoreOrderParam;
 import com.fs.his.param.FsStorePaymentParam;
 import com.fs.his.param.PayOrderParam;
@@ -149,6 +149,8 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     private CompanyConfigMapper companyConfigMapper;
     @Autowired
     private FsUserMapper userMapper;
+    @Autowired
+    private FsUserWxMapper userWxMapper;
 
     /**
      * 查询支付明细
@@ -824,17 +826,17 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
             throw new CustomException("用户不存在");
         }
 
+        String json = configService.selectConfigByKey("his.pay");
+        logger.debug("支付配置 his.pay: {}", json);
+        FsPayConfig payConfig = JSONUtil.toBean(json, FsPayConfig.class);
+
         if (isWechatPayment(payOrderParam.getPaymentMethod())) {
-            String openId = getOpenIdForPaymentMethod(user, payOrderParam.getPaymentMethod());
+            String openId = getOpenIdForPaymentMethod(user, payOrderParam.getPaymentMethod(), payConfig);
             if (StringUtils.isBlank(openId)){
                 throw new CustomException("用户OPENID不存在");
             }
         }
 
-        String json = configService.selectConfigByKey("his.pay");
-        logger.debug("支付配置 his.pay: {}", json);
-        FsPayConfig payConfig = JSONUtil.toBean(json, FsPayConfig.class);
-
         // 创建记录
         FsStorePayment storePayment = createStorePayment(payConfig, user, payOrderParam);
 
@@ -848,13 +850,13 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     private R createThirdPartyPayment(FsPayConfig payConfig, FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam) {
         switch (payConfig.getType()) {
             case "wx":
-                return createWxPayment(payConfig, storePayment, user, payOrderParam);
+                return createWxPayment(storePayment, user, payOrderParam, payConfig);
             case "yb":
-                return createYbPayment(storePayment, user, payOrderParam);
+                return createYbPayment(storePayment, user, payOrderParam, payConfig);
             case "tz":
-                return createTzPayment(storePayment, user, payOrderParam);
+                return createTzPayment(storePayment, user, payOrderParam, payConfig);
             case "hf":
-                return createHfPayment(storePayment, user, payOrderParam);
+                return createHfPayment(storePayment, user, payOrderParam, payConfig);
             default:
                 throw new CustomException("不支持的支付方式");
         }
@@ -863,7 +865,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     /**
      * 汇付
      */
-    private R createHfPayment(FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam) {
+    private R createHfPayment(FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam, FsPayConfig payConfig) {
         logger.debug("创建汇付订单");
 
         HuiFuCreateOrder order = new HuiFuCreateOrder();
@@ -874,7 +876,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
 
         // 微信支付需要设置openid
         if (isWechatPayment(payOrderParam.getPaymentMethod())) {
-            order.setOpenid(getOpenIdForPaymentMethod(user, payOrderParam.getPaymentMethod()));
+            order.setOpenid(getOpenIdForPaymentMethod(user, payOrderParam.getPaymentMethod(), payConfig));
         }
 
         HuifuCreateOrderResult result = huiFuService.createOrder(order);
@@ -904,8 +906,8 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     /**
      * 台州银行
      */
-    private R createTzPayment(FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam) {
-        PayCreateOrder payOrder = buildTzPayOrder(storePayment, user, payOrderParam);
+    private R createTzPayment(FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam, FsPayConfig payConfig) {
+        PayCreateOrder payOrder = buildTzPayOrder(storePayment, user, payOrderParam, payConfig);
         TzBankResult<PayCreateOrderResult> result = tzBankService.createOrder(payOrder);
 
         updateStorePaymentTradeNo(storePayment.getPaymentId(), result.getBody().getOrderFlowNo());
@@ -915,7 +917,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     /**
      * 构建台州银行支付
      */
-    private PayCreateOrder buildTzPayOrder(FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam) {
+    private PayCreateOrder buildTzPayOrder(FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam, FsPayConfig payConfig) {
         PayCreateOrder payOrder = new PayCreateOrder();
         payOrder.setOrderNo(payOrderParam.getBusinessType().getPrefix() + "-" + storePayment.getPayCode());
         payOrder.setTrxAmt(storePayment.getPayMoney().doubleValue());
@@ -936,7 +938,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
         }
 
         if (isWechatPayment(payOrderParam.getPaymentMethod())) {
-            payOrder.setOpenId(getOpenIdForPaymentMethod(user, payOrderParam.getPaymentMethod()));
+            payOrder.setOpenId(getOpenIdForPaymentMethod(user, payOrderParam.getPaymentMethod(), payConfig));
         }
 
         return payOrder;
@@ -987,7 +989,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     /**
      * 易宝支付
      */
-    private R createYbPayment(FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam) {
+    private R createYbPayment(FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam, FsPayConfig payConfig) {
         PaymentMethodEnum paymentMethod = payOrderParam.getPaymentMethod();
         if (paymentMethod == PaymentMethodEnum.ALIPAY || paymentMethod == PaymentMethodEnum.H5_ALIPAY
                 || paymentMethod == PaymentMethodEnum.H5_WECHAT) {
@@ -999,7 +1001,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
         payDto.setLowOrderId(payOrderParam.getBusinessType().getPrefix() + "-" + storePayment.getPayCode());
         payDto.setBody(payOrderParam.getBusinessType().getDesc());
         payDto.setIsMinipg("1");
-        payDto.setOpenId(getOpenIdForPaymentMethod(user, paymentMethod));
+        payDto.setOpenId(getOpenIdForPaymentMethod(user, paymentMethod, payConfig));
         payDto.setAttach("");
         payDto.setStoreid("0");
 
@@ -1027,7 +1029,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     /**
      * 微信支付
      */
-    private R createWxPayment(FsPayConfig payConfig, FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam) {
+    private R createWxPayment(FsStorePayment storePayment, FsUser user, PayOrderParam payOrderParam, FsPayConfig payConfig) {
         PaymentMethodEnum paymentMethod = payOrderParam.getPaymentMethod();
         if (paymentMethod != PaymentMethodEnum.MINIAPP_WECHAT) {
             logger.debug("微信支付 PaymentMethod: {}", paymentMethod.name());
@@ -1038,7 +1040,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
         wxPayService.setConfig(wxPayConfig);
 
         WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
-        orderRequest.setOpenid(getOpenIdForPaymentMethod(user, paymentMethod));
+        orderRequest.setOpenid(getOpenIdForPaymentMethod(user, paymentMethod, payConfig));
         orderRequest.setBody(payOrderParam.getBusinessType().getDesc());
         orderRequest.setOutTradeNo(payOrderParam.getBusinessType().getPrefix() + "-" + storePayment.getPayCode());
         orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));
@@ -1081,15 +1083,30 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     /**
      * 根据支付方式获取对应的openId
      */
-    private String getOpenIdForPaymentMethod(FsUser user, PaymentMethodEnum method) {
+    private String getOpenIdForPaymentMethod(FsUser user, PaymentMethodEnum method, FsPayConfig payConfig) {
+        String openId;
         switch (method) {
             case MINIAPP_WECHAT:
-                return user.getMaOpenId();
+                openId = user.getMaOpenId();
+                break;
             case H5_WECHAT:
-                return user.getMpOpenId();
+                openId = user.getMpOpenId();
+                break;
             default:
-                return null;
+                openId = null;
         }
+
+        if (StringUtils.isBlank(openId)) {
+            Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
+                    .eq(FsUserWx::getFsUserId, user.getUserId())
+                    .eq(FsUserWx::getAppId, payConfig.getAppId());
+            FsUserWx fsUserWx = userWxMapper.selectOne(queryWrapper);
+            if (Objects.nonNull(fsUserWx)) {
+                openId = fsUserWx.getOpenId();
+            }
+        }
+
+        return openId;
     }
 
     /**
@@ -1119,7 +1136,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
 
         // 设置openId(如果是微信支付)
         if (isWechatPayment(payOrderParam.getPaymentMethod())) {
-            storePayment.setOpenId(getOpenIdForPaymentMethod(user, payOrderParam.getPaymentMethod()));
+            storePayment.setOpenId(getOpenIdForPaymentMethod(user, payOrderParam.getPaymentMethod(), payConfig));
         }
 
         if (fsStorePaymentMapper.insertFsStorePayment(storePayment) <= 0) {

+ 44 - 0
fs-service/src/main/java/com/fs/his/vo/DoctorAdviceVO.java

@@ -0,0 +1,44 @@
+package com.fs.his.vo;
+
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 医生建议
+ */
+@Data
+public class DoctorAdviceVO {
+
+    /**
+     * 诊断
+     */
+    private String diagnosis;
+
+    /**
+     * 饮食方面
+     */
+    private String foodAdvice;
+
+    /**
+     * 运动方面
+     */
+    private String sportAdvice;
+
+    /**
+     * 保健方面
+     */
+    private String healthAdvice;
+
+    /**
+     * 治疗方面
+     */
+    private List<TreatAdvice> treatmentAdvice;
+    @Data
+    static
+    class TreatAdvice{
+        private String content;
+        private String advice;
+    }
+}

+ 76 - 0
fs-service/src/main/java/com/fs/his/vo/FsInquiryPatientVO.java

@@ -0,0 +1,76 @@
+package com.fs.his.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class FsInquiryPatientVO {
+
+    private Long id;
+
+    /**
+     * 患者会员手机号
+     */
+    private String userPhone;
+
+    /**
+     * 客服姓名(销售姓名)
+     */
+    private String companyUserName;
+
+    /**
+     * 就诊状态 1-初诊 2-复诊
+     */
+    private Integer diagnosisStatus;
+
+    /**
+     * 客户标签
+     */
+    private String tag;
+
+    /**
+     * 课程/档期
+     */
+    private String courseName;
+
+    /**
+     * 患者病情主诉
+     */
+    private String patientCondition;
+
+    /**
+     * 部门负责人
+     */
+    private String deptManager;
+
+    /**
+     * 医生建议及处置
+     */
+    private DoctorAdviceVO doctorAdviceJson;
+
+    /**
+     * 禁忌
+     */
+    private String taboo;
+    /**
+     * 客户需求
+     */
+    private String customerRequire;
+
+    /**
+     * 职业医生
+     */
+    private String professionalDoctor;
+
+    /**
+     * 助理医生
+     */
+    private String assistantDoctor;
+
+    private Long subDoctorId;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date subTime;
+}

+ 108 - 0
fs-service/src/main/resources/mapper/his/FsInquiryPatientInfoMapper.xml

@@ -0,0 +1,108 @@
+<?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.fs.his.mapper.FsInquiryPatientInfoMapper">
+
+    <resultMap type="FsInquiryPatientInfo" id="FsInquiryPatientInfoResult">
+        <result property="id"    column="id"    />
+        <result property="patientId"    column="patient_id"    />
+        <result property="companyUserId"    column="company_user_id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="inquiryOrderId"    column="inquiry_order_id"    />
+        <result property="courseId"    column="course_id"    />
+        <result property="diagnosisStatus"    column="diagnosis_status"    />
+        <result property="tag"    column="tag"    />
+        <result property="courseName"    column="course_name"    />
+        <result property="patientCondition"    column="patient_condition"    />
+        <result property="deptManager"    column="dept_manager"    />
+        <result property="doctorAdviceJson"    column="doctor_advice_json"    />
+        <result property="taboo"    column="taboo"    />
+        <result property="customerRequire"    column="customer_require"    />
+        <result property="professionalDoctor"    column="professional_doctor"    />
+        <result property="assistantDoctor"    column="assistant_doctor"    />
+        <result property="subTime"    column="sub_time"    />
+    </resultMap>
+
+    <sql id="selectFsInquiryPatientInfoVo">
+        select id, patient_id, company_user_id, user_id, inquiry_order_id, course_id, diagnosis_status, tag, course_name, patient_condition, dept_manager, doctor_advice_json, taboo, customer_require, professional_doctor, assistant_doctor, sub_time from fs_inquiry_patient_info
+    </sql>
+
+    <select id="selectFsInquiryPatientInfoInquiryOrderId" parameterType="Long" resultMap="FsInquiryPatientInfoResult">
+        <include refid="selectFsInquiryPatientInfoVo"/>
+        where inquiry_order_id = #{inquiryOrderId}
+    </select>
+
+    <insert id="insertFsInquiryPatientInfo" parameterType="FsInquiryPatientInfo" useGeneratedKeys="true" keyProperty="id">
+        insert into fs_inquiry_patient_info
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="patientId != null">patient_id,</if>
+            <if test="companyUserId != null">company_user_id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="inquiryOrderId != null">inquiry_order_id,</if>
+            <if test="courseId != null">course_id,</if>
+            <if test="diagnosisStatus != null">diagnosis_status,</if>
+            <if test="tag != null">tag,</if>
+            <if test="courseName != null">course_name,</if>
+            <if test="patientCondition != null">patient_condition,</if>
+            <if test="deptManager != null">dept_manager,</if>
+            <if test="doctorAdviceJson != null">doctor_advice_json,</if>
+            <if test="taboo != null">taboo,</if>
+            <if test="customerRequire != null">customer_require,</if>
+            <if test="professionalDoctor != null">professional_doctor,</if>
+            <if test="assistantDoctor != null">assistant_doctor,</if>
+            <if test="subTime != null">sub_time,</if>
+            <if test="subDoctorId != null">sub_doctor_id</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="patientId != null">#{patientId},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="inquiryOrderId != null">#{inquiryOrderId},</if>
+            <if test="courseId != null">#{courseId},</if>
+            <if test="diagnosisStatus != null">#{diagnosisStatus},</if>
+            <if test="tag != null">#{tag},</if>
+            <if test="courseName != null">#{courseName},</if>
+            <if test="patientCondition != null">#{patientCondition},</if>
+            <if test="deptManager != null">#{deptManager},</if>
+            <if test="doctorAdviceJson != null">#{doctorAdviceJson},</if>
+            <if test="taboo != null">#{taboo},</if>
+            <if test="customerRequire != null">#{customerRequire},</if>
+            <if test="professionalDoctor != null">#{professionalDoctor},</if>
+            <if test="assistantDoctor != null">#{assistantDoctor},</if>
+            <if test="subTime != null">#{subTime},</if>
+            <if test="subDoctorId != null">#{subDoctorId},</if>
+        </trim>
+    </insert>
+
+    <update id="updateFsInquiryPatientInfo" parameterType="FsInquiryPatientInfo">
+        update fs_inquiry_patient_info
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="patientId != null">patient_id = #{patientId},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="inquiryOrderId != null">inquiry_order_id = #{inquiryOrderId},</if>
+            <if test="courseId != null">course_id = #{courseId},</if>
+            <if test="diagnosisStatus != null">diagnosis_status = #{diagnosisStatus},</if>
+            <if test="tag != null">tag = #{tag},</if>
+            <if test="courseName != null">course_name = #{courseName},</if>
+            <if test="patientCondition != null">patient_condition = #{patientCondition},</if>
+            <if test="deptManager != null">dept_manager = #{deptManager},</if>
+            <if test="doctorAdviceJson != null">doctor_advice_json = #{doctorAdviceJson},</if>
+            <if test="taboo != null">taboo = #{taboo},</if>
+            <if test="customerRequire != null">customer_require = #{customerRequire},</if>
+            <if test="professionalDoctor != null">professional_doctor = #{professionalDoctor},</if>
+            <if test="assistantDoctor != null">assistant_doctor = #{assistantDoctor},</if>
+            <if test="subTime != null">sub_time = #{subTime},</if>
+            <if test="subDoctorId != null">sub_doctor_id = #{subDoctorId},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <select id="selectUserAndCompanyUserByInquiryOrderId" resultType="com.fs.his.vo.FsInquiryPatientVO">
+        SELECT cu.nick_name companyUserName ,u.phone userPhone FROM fs_inquiry_order io
+        LEFT JOIN company_user cu ON cu.user_id = io.company_user_id
+        LEFT JOIN fs_user u ON u.user_id = io.user_id
+        WHERE io.order_id = #{inquiryOrderId}
+    </select>
+</mapper>

+ 2 - 2
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -1009,7 +1009,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT
         (
         SELECT
-        count(fs_user.user_id )
+        count(distinct fs_user.user_id )
         FROM
         fs_course_answer_logs
         LEFT JOIN fs_user ON fs_user.user_id = fs_course_answer_logs.user_id
@@ -1043,7 +1043,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ) AS answerNum,
         (
         SELECT
-        count(fs_user.user_id )
+        count(distinct fs_user.user_id )
         FROM
         fs_course_answer_logs
         LEFT JOIN fs_user ON fs_user.user_id = fs_course_answer_logs.user_id

+ 26 - 5
fs-user-app/src/main/java/com/fs/app/controller/InquiryOrderController.java

@@ -3,6 +3,8 @@ package com.fs.app.controller;
 
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.app.annotation.Login;
 import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.domain.R;
@@ -18,6 +20,7 @@ import com.fs.his.domain.*;
 import com.fs.his.dto.FsInquiryOrderPatientDTO;
 import com.fs.his.dto.PayConfigDTO;
 import com.fs.his.enums.FsInquiryOrderStatusEnum;
+import com.fs.his.mapper.FsUserWxMapper;
 import com.fs.his.param.*;
 import com.fs.his.service.*;
 import com.fs.his.utils.PhoneUtil;
@@ -103,6 +106,8 @@ public class InquiryOrderController extends  AppBaseController {
     Logger logger= LoggerFactory.getLogger(getClass());
     @Autowired
     private ICompanyService companyService;
+    @Autowired
+    private FsUserWxMapper fsUserWxMapper;
 
     @Autowired
     private ISysConfigService configService;
@@ -244,6 +249,22 @@ public class InquiryOrderController extends  AppBaseController {
         FsInquiryOrder order=inquiryOrderService.selectFsInquiryOrderByOrderId(param.getOrderId());
 
         FsUser user=userService.selectFsUserByUserId(Long.parseLong(getUserId()));
+
+        String openId = Objects.isNull(user) ? "" : user.getMaOpenId();
+        if (StringUtils.isBlank(openId)){
+            Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
+                    .eq(FsUserWx::getFsUserId, Long.parseLong(getUserId()))
+                    .eq(FsUserWx::getAppId, payConfigDTO.getAppId());
+            FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
+            if (Objects.nonNull(fsUserWx)){
+                openId = fsUserWx.getOpenId();
+            }
+        }
+
+        if (StringUtils.isBlank(openId)){
+            return R.error("用户OPENID不存在");
+        }
+
         if(order.getPayMoney().compareTo(new BigDecimal(0))==0){
             inquiryOrderService.payConfirm(order.getOrderSn(),"","","",2);
             return R.ok().put("isPay",1);
@@ -265,7 +286,7 @@ public class InquiryOrderController extends  AppBaseController {
             storePayment.setPayTypeCode("weixin");
             storePayment.setBusinessType(1);
             storePayment.setRemark("问诊订单支付");
-            storePayment.setOpenId(user.getMaOpenId());
+            storePayment.setOpenId(openId);
             storePayment.setUserId(user.getUserId());
             storePayment.setBusinessId(order.getOrderId().toString());
             if(storePaymentService.insertFsStorePayment(storePayment)>0){
@@ -283,7 +304,7 @@ public class InquiryOrderController extends  AppBaseController {
                     payConfig.setNotifyUrl(wxPayProperties.getNotifyUrl());
                     wxPayService.setConfig(payConfig);
                     WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
-                    orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
+                    orderRequest.setOpenid(openId);//公众号支付提供用户openid
                     orderRequest.setBody("问诊订单支付");
                     orderRequest.setOutTradeNo("inquiry-"+storePayment.getPayCode());
                     orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
@@ -306,7 +327,7 @@ public class InquiryOrderController extends  AppBaseController {
                     p.setLowOrderId("inquiry-"+storePayment.getPayCode());
                     p.setBody("问诊订单支付");
                     p.setIsMinipg("1");
-                    p.setOpenId(user.getMaOpenId());
+                    p.setOpenId(openId);
                     p.setAttach("");
                     p.setStoreid("0");
                     CreateWxOrderResult wxOrder = payService.createWxOrder(p);
@@ -337,7 +358,7 @@ public class InquiryOrderController extends  AppBaseController {
                     }
                     o.setPayerName("微信用户"+phone);
                     o.setGoodsInfo("问诊订单支付"); // 订单信息
-                    o.setOpenId(user.getMaOpenId());
+                    o.setOpenId(openId);
                     o.setOrderType(1);
                     o.setOrderId(order.getOrderId().toString());
                     TzBankResult<PayCreateOrderResult> result = tzBankService.createOrder(o);
@@ -349,7 +370,7 @@ public class InquiryOrderController extends  AppBaseController {
                 }else if(payConfigDTO.getType().equals("hf")){
                     HuiFuCreateOrder o = new HuiFuCreateOrder();
                     o.setTradeType("T_MINIAPP");
-                    o.setOpenid(user.getMaOpenId());
+                    o.setOpenid(openId);
                     o.setReqSeqId("inquiry-"+storePayment.getPayCode());
                     o.setTransAmt(storePayment.getPayMoney().toString());
                     o.setGoodsDesc("问诊订单支付");