Browse Source

云照护修改

LAPTOP-KB9HII50\70708 1 year ago
parent
commit
8cc6e6af5e

+ 20 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/common/CommonController.java

@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -55,6 +56,8 @@ public class CommonController extends EnvelopRestEndpoint {
    private WechatInfoService wechatInfoService;
    @Resource
    private WechatDao wechatDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @PostMapping(value = "open/getSign")
    @ApiOperation(value = "获取微信签名", notes = "获取微信签名")
@ -120,6 +123,23 @@ public class CommonController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "open/findArticle")
    @ApiOperation(value = "获取文章")
    public ObjEnvelop findArticle(@RequestParam(value = "articleId",required = true)String articleId) {
        try {
            //sign_illustrate 签约说明
            JSONObject json = new JSONObject();
            String sql = "SELECT title,content from wlyy_knowledge_article_dict WHERE id = '"+articleId+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            if(list.size()>0){
                json.put("title",list.get(0).get("title"));
                json.put("content",list.get(0).get("content"));
            }
            return ObjEnvelop.getSuccess("获取成功",json);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "open/saveRegisterInfo")
    @ApiOperation(value = "保存登记信息")

+ 7 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/dict/DictEndpoint.java

@ -44,7 +44,7 @@ public class DictEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private DictService dictService;
    @ApiOperation("查询字典")
    @ApiOperation("查询字典-通用字典接口")
    @GetMapping(value= "findDict")
    public MixEnvelop findDict(@ApiParam(name = "name", value = "name", required = false)
                               @RequestParam(value = "name", required = false)String name,
@ -58,8 +58,12 @@ public class DictEndpoint extends EnvelopRestEndpoint {
                               @RequestParam(value = "page", required = false) Integer page,
                               @ApiParam(name = "pageSize", value = "pageSize", required = false)
                               @RequestParam(value = "pageSize", required = false)Integer pageSize){
        return dictService.findDictsByNameCode(modelName,name,code,value,page,pageSize);
        try {
            return dictService.findDictsByNameCode(modelName,name,code,value,page,pageSize);
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询是吧",-1);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCommity)

+ 55 - 58
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java

@ -2,12 +2,9 @@ package com.yihu.jw.care.endpoint.patient;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.aop.RedisLock;
import com.yihu.jw.care.aop.ServicesAuth;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
@ -41,61 +38,61 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    private BasePatientDao patientDao;
    public int num = 20;
    @GetMapping(value = "testException")
    @ApiOperation(value = "测试异常")
    public String testException2(String type) throws Exception {
//        patientService.intiPatient();
        if("1".equals(type)){
            throw new NullPointerException();
        }else if("2".equals(type)){
            throw new ApiException("111");
        }
        return "获取成功";
    }
    @GetMapping(value = "testRedisLock")
    @RedisLock(key = "#patientDO.id")
    public Envelop testRedisLock(BasePatientDO patientDO) {
        try {
            String s = Thread.currentThread().getName() + "=====================" + patientDO.getId();
            if (num > 0) {
                System.out.println(s + "排号成功,号码是:" + num);
                num--;
            } else {
                System.out.println(s + "排号失败,号码已经被抢光");
            }
            return success(patientDO);
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @GetMapping(value = "testServicesAuth1")
    @ApiOperation(value = "测试居民服务项权限操作")
    @ServicesAuth(item = "auth")
    public Envelop testServicesAuth1(
            @ApiParam(name = "patientId", value = "居民id")
            @RequestParam(value = "patientId", required = true) String patientId) {
        try{
            return success("获取成功");
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @GetMapping(value = "testServicesAuth2")
    @ApiOperation(value = "测试居民服务项权限操作")
    @ServicesAuth(item = "healthEducation")
    public Envelop testServicesAuth2(
            @ApiParam(name = "patientId", value = "居民id")
            @RequestParam(value = "patientId", required = true) String patientId) {
        try{
            return success("获取成功");
        }catch (Exception e){
            return failedException2(e);
        }
    }
//    @GetMapping(value = "testException")
//    @ApiOperation(value = "测试异常")
//    public String testException2(String type) throws Exception {
////        patientService.intiPatient();
//        if("1".equals(type)){
//            throw new NullPointerException();
//        }else if("2".equals(type)){
//            throw new ApiException("111");
//        }
//
//        return "获取成功";
//    }
//
//    @GetMapping(value = "testRedisLock")
//    @RedisLock(key = "#patientDO.id")
//    public Envelop testRedisLock(BasePatientDO patientDO) {
//        try {
//            String s = Thread.currentThread().getName() + "=====================" + patientDO.getId();
//            if (num > 0) {
//                System.out.println(s + "排号成功,号码是:" + num);
//                num--;
//            } else {
//                System.out.println(s + "排号失败,号码已经被抢光");
//            }
//            return success(patientDO);
//        } catch (Exception e) {
//            return failedException2(e);
//        }
//    }
//
//    @GetMapping(value = "testServicesAuth1")
//    @ApiOperation(value = "测试居民服务项权限操作")
//    @ServicesAuth(item = "auth")
//    public Envelop testServicesAuth1(
//            @ApiParam(name = "patientId", value = "居民id")
//            @RequestParam(value = "patientId", required = true) String patientId) {
//        try{
//            return success("获取成功");
//        }catch (Exception e){
//            return failedException2(e);
//        }
//    }
//
//    @GetMapping(value = "testServicesAuth2")
//    @ApiOperation(value = "测试居民服务项权限操作")
//    @ServicesAuth(item = "healthEducation")
//    public Envelop testServicesAuth2(
//            @ApiParam(name = "patientId", value = "居民id")
//            @RequestParam(value = "patientId", required = true) String patientId) {
//        try{
//            return success("获取成功");
//        }catch (Exception e){
//            return failedException2(e);
//        }
//    }
    @GetMapping(value = "myPatientPage")
    @ApiOperation(value = "通讯录-我的居民分页")

+ 4 - 9
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PayEndpoint.java

@ -8,15 +8,11 @@ import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.care.service.pay.PayService;
import com.yihu.jw.care.util.WxpayUtil;
import com.yihu.jw.care.util.XMLUtil;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
@ -36,7 +32,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -135,7 +130,7 @@ public class PayEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop existWaitForPay(
            @ApiParam(name = "patient", value = "patient", required = true)
            @RequestParam(value = "patient") String patient,
            @ApiParam(name ="orderCategory",value = "订单分类 1招生,2 课程,3 上门辅导托幼) 4 生活照料")
            @ApiParam(name ="orderCategory",value = "订单分类 1招生,2 课程,3 上门辅导托幼 4 生活照料 5签约服务包")
            @RequestParam(value = "orderCategory")String orderCategory) {
        try{
            JSONObject result =  result = payService.existWaitForPay(patient,orderCategory);
@ -150,7 +145,7 @@ public class PayEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop getPayInfo(
            @ApiParam(name = "orderId", value = "工单id", required = true)
            @RequestParam String orderId,
            @ApiParam(name ="orderCategory",value = "3 上门辅导托幼 4 生活照料")
            @ApiParam(name ="orderCategory",value = "3 上门辅导托幼 4 生活照料 5签约服务包")
            @RequestParam(value = "orderCategory")String orderCategory) {
        try {
            JSONObject result = payService.getPayInfo(orderId,orderCategory);
@ -168,7 +163,7 @@ public class PayEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "微信wap支付")
    @ObserverRequired
    public ObjEnvelop wxWapPay(
            @ApiParam(name = "relationId", value = "业务id,如生活照料id 上面辅导id")
            @ApiParam(name = "relationId", value = "业务id,如生活照料id 上门辅导id 签约记录id")
            @RequestParam(value = "relationId", required = false) String relationId,
            @ApiParam(name = "orderId", value = "订单id")
            @RequestParam(value = "orderId", required = false) String orderId,HttpServletRequest request) {
@ -289,7 +284,7 @@ public class PayEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "微信native支付")
    @ObserverRequired
    public ObjEnvelop wxNativePay(
            @ApiParam(name = "relationId", value = "业务id,如生活照料id 上门辅导id")
            @ApiParam(name = "relationId", value = "业务id,如生活照料id 上门辅导id 签约服务包id")
            @RequestParam(value = "relationId", required = false) String relationId,
            @ApiParam(name = "orderId", value = "订单id")
            @RequestParam(value = "orderId", required = false) String orderId,HttpServletRequest request) {

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -51,6 +51,18 @@ public class SignEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ServicePackageService servicePackageService;
    @GetMapping(value = "mySignDoctor")
    @ApiOperation(value = "我的医养团队")
    public ObjEnvelop mySignDoctor(
            @ApiParam(name = "patientId", value = "居民id", required = true)
            @RequestParam String patientId) {
        try{
            return ObjEnvelop.getSuccess("查询成功",servicePackageService.mySignDoctor(patientId));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "allocationDoctor")
    @ObserverRequired
    @ApiOperation(value = "分配服务者")

+ 54 - 11
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/pay/PayService.java

@ -1,7 +1,6 @@
package com.yihu.jw.care.service.pay;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
@ -9,12 +8,16 @@ import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachFeeDetailDao;
import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachOrderDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareFeeDetailDao;
import com.yihu.jw.care.dao.lifeCare.LifeCareOrderDao;
import com.yihu.jw.care.dao.sign.ServicePackageItemDao;
import com.yihu.jw.care.dao.sign.ServicePackageSignRecordDao;
import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.care.service.lifeCare.LifeCareOrderService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.util.WxpayUtil;
import com.yihu.jw.care.util.XMLUtil;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.care.common.WxPayHttpLogDO;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachFeeDetailDO;
@ -22,13 +25,9 @@ import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
import com.yihu.jw.entity.care.lifeCare.LifeCareFeeDetailDO;
import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
@ -110,6 +109,14 @@ public class PayService {
    private LifeCareFeeDetailDao lifeCareFeeDetailDao;
    @Autowired
    private BaseDoorCoachFeeDetailDao doorCoachFeeDetailDao;
    @Autowired
    private ServicePackageService servicePackageService;
    @Autowired
    private ServicePackageSignRecordDao signRecordDao;
    @Autowired
    private ServicePackageItemDao servicePackageItemDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    /**
     * 顶部状态栏订单各分类总条数
@ -231,6 +238,9 @@ public class PayService {
        }else if("4".equals(type)){
            List<LifeCareFeeDetailDO> feeDetailDOList = lifeCareFeeDetailDao.findByOrderId(businessOrderDO.getRelationCode());
            resJson.put("fees",feeDetailDOList);
        }else if("5".equals(type)){
            List<ServicePackageItemDO> feeDetailDOList = servicePackageItemDao.findByServicePackageId(businessOrderDO.getRelationCode());
            resJson.put("fees",feeDetailDOList);
        }
        //退款信息
        if(status>2){
@ -367,6 +377,13 @@ public class PayService {
                result.put(ResponseContant.resultMsg, "支付工单不存在");
                return result;
            }
        }else if("5".equals(category)){
            ServicePackageSignRecordDO orderDO = signRecordDao.findOne(orderId);
            if (orderDO==null){
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg, "支付工单不存在");
                return result;
            }
        }
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderId);
        if (businessOrderDO==null){
@ -524,6 +541,10 @@ public class PayService {
                //desc = "生活照料服务";
                lifeCareOrderService.payOrderAfter(orderDO.getRelationCode());
                break;
            case "5":
                //签约服务包
                servicePackageService.payOrderAfter(orderDO.getRelationCode());
                break;
            default:
                break;
        }
@ -564,6 +585,10 @@ public class PayService {
                //desc = "生活照料服务";
                lifeCareOrderService.refundOrderAfter(businessOrderDO.getRelationCode());
                break;
            case "5":
                //签约服务包相关
                servicePackageService.refundOrderAfter(businessOrderDO.getRelationCode());
                break;
            default:
                break;
        }
@ -616,7 +641,12 @@ public class PayService {
        reqMap.put("mch_id", mchId);
        reqMap.put("nonce_str", noceStr);
        // 此路径是微信服务器调用支付结果通知路径
        reqMap.put("notify_url", "https://zhyzh.gongshu.gov.cn/cloudCare/pay/open/wxPayNotify");
        String notifyUrl ="https://zhyzh.gongshu.gov.cn/cloudCare/pay/open/wxPayNotify";
        WlyyHospitalSysDictDO dictDO = hospitalSysDictDao.findById("wxPayNotify");
        if(dictDO!=null){
            notifyUrl = dictDO.getDictValue();
        }
        reqMap.put("notify_url", notifyUrl);
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("spbill_create_ip", IpUtil.getOneIpAddress(request));
        reqMap.put("product_id", businessOrderDO.getOrderNo());
@ -696,7 +726,12 @@ public class PayService {
        reqMap.put("mch_id", mchId);
        reqMap.put("nonce_str", noceStr);
        // 此路径是微信服务器调用支付结果通知路径
        reqMap.put("notify_url", "https://zhyzh.gongshu.gov.cn/cloudCare/pay/open/wxPayNotify");
        String notifyUrl ="https://zhyzh.gongshu.gov.cn/cloudCare/pay/open/wxPayNotify";
        WlyyHospitalSysDictDO dictDO = hospitalSysDictDao.findById("wxPayNotify");
        if(dictDO!=null){
            notifyUrl = dictDO.getDictValue();
        }
        reqMap.put("notify_url", notifyUrl);
        reqMap.put("out_trade_no", businessOrderDO.getOrderNo());
        reqMap.put("spbill_create_ip", IpUtil.getOneIpAddress(request));
        reqMap.put("product_id", businessOrderDO.getOrderNo());
@ -744,7 +779,7 @@ public class PayService {
    /**
     * 提交支付订单
     * 订单类型 1招生,2 课程,3 上门辅导托幼) 4 生活照料
     * 订单类型 1招生,2 课程,3 上门辅导托幼) 4 生活照料 5签约服务包
     * @return
     */
    public BusinessOrderDO submitOrder(String patientId,String type,String relationCode,Double price){
@ -776,6 +811,10 @@ public class PayService {
                desc = "生活照料服务项目费";
                relateName = "生活照料";
                break;
            case "5":
                desc = "签约服务包费";
                relateName = "签约服务包";
                break;
            default:
                desc = "服务费";
                relateName = "服务";
@ -868,7 +907,7 @@ public class PayService {
            }
            if (businessOrderDO!=null){
                if (businessOrderDO.getStatus()==1){
                    throw new Exception("该处方已支付过");
                    throw new Exception("该订单已支付过");
                }
                String openId = "";
                if (StringUtils.isNotBlank(appletCode)){
@ -886,6 +925,10 @@ public class PayService {
                businessOrderDO.setOrderNo(getOrderNo());
                businessOrderDO= businessOrderDao.save(businessOrderDO);
                String notifyUrl ="https://zhyzh.gongshu.gov.cn/cloudCare/pay/open/cloudPayNotify";
                WlyyHospitalSysDictDO dictDO = hospitalSysDictDao.findById("cloudPayNotify");
                if(dictDO!=null){
                    notifyUrl = dictDO.getDictValue();
                }
                String totalFee =businessOrderDO.getPayPrice().intValue()+"";
                map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, depositType,openId,businessOrderDO.getOrderNo(),notifyUrl,businessOrderDO.getPatient());
            }

+ 71 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -8,6 +8,7 @@ import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.dao.sign.*;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.device.DeviceService;
import com.yihu.jw.care.service.pay.PayService;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -18,7 +19,9 @@ import com.yihu.jw.entity.base.servicePackage.*;
import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientMedicardCardService;
import com.yihu.jw.restmodel.ResponseContant;
@ -32,7 +35,6 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -75,7 +77,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    @Autowired
    private BasePatientMedicardCardService basePatientMedicardCardService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    private PayService payService;
    @Autowired
    private PatientBedApplyDao bedApplyDao;
    @Autowired
@ -90,6 +92,66 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    private BasePatientHelperDao patientHelperDao;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    //我的医养团队
    public List<Map<String,Object>> mySignDoctor(String patientId){
        String sql = "SELECT DISTINCT d.id,d.name,d.sex,d.mobile,d.idcard,d.photo,d.doctor_level level,di.dict_value levelName " +
                "from base_service_package_sign_record sr,base_service_package_record r,base_doctor d " +
                "LEFT JOIN wlyy_hospital_sys_dict di on di.dict_name='doctor_level' and di.dict_code=d.doctor_level " +
                "WHERE sr.patient = '"+patientId+"' and sr.`status`=1 and sr.id=r.sign_id and r.type='2' and r.doctor=d.id ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    //退款处理
    public JSONObject refundOrderAfter(String orderId) {
        JSONObject result = new JSONObject();
        ServicePackageSignRecordDO orderDO = servicePackageSignRecordDao.findOne(orderId);
        if (orderDO == null){
            String failMsg = "工单不存在";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, failMsg);
            return result;
        }
        orderDO.setPayStatus(2);//暂时只修改支付状态
        orderDO.setStatus(-5);//已退款
        servicePackageSignRecordDao.save(orderDO);
        String failMsg = "success";
        result.put(ResponseContant.resultFlag, ResponseContant.fail);
        result.put(ResponseContant.resultMsg, failMsg);
        return result;
    }
    //支付完成后开始订单
    public JSONObject payOrderAfter(String orderId) {
        JSONObject result = new JSONObject();
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderId);
        if (businessOrderDO==null){
            String failMsg = "未查询到该订单";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, failMsg);
            return result;
        }
        ServicePackageSignRecordDO orderDO = servicePackageSignRecordDao.findOne(orderId);
        if (orderDO!=null) {
            orderDO.setPayStatus(1);
            orderDO.setPayWay(1);
            orderDO.setPaymentTime(new Date());
            orderDO.setStatus(1);
            servicePackageSignRecordDao.save(orderDO);
            //设置到期时间
            setSignDate(null,orderDO);
        }else {
            String failMsg = "工单不存在";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, failMsg);
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, "success");
        return result;
    }
    //分配服务者
    @Transactional(rollbackFor = Exception.class)
@ -352,7 +414,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
            if(!isSignPackage(patientId,signRecordDO.getServicePackageId())){
                throw new ServiceException("您已经申请过该服务包,请勿重复申请");
            }
            signRecordDO.setPrice(servicePackageDO.getPrice());
            if("1".equals(servicePackageDO.getIsCheck())){
                //开启审核
                signRecordDO.setStatus(0);//待审核
@ -361,13 +423,15 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
            }else {
                signRecordDO.setStatus(2);//待支付
                //判断支付金额
                if(new BigDecimal(0).compareTo(servicePackageDO.getPrice())==0){
                if(new BigDecimal(0).compareTo(signRecordDO.getPrice())==0){
                    //不需要支付
                    signRecordDO.setStatus(1);//已签约
                    //设置到期时间
                    setSignDate(servicePackageDO,signRecordDO);
                }else{
                    signRecordDO.setPayTime("10");//10分钟
                    signRecordDO.setPayStatus(0);
                    payService.submitOrder(signRecordDO.getPatient(),"4",signRecordDO.getId(),signRecordDO.getPrice().doubleValue());
                }
            }
            signRecordDO.setCreateTime(new Date());
@ -398,6 +462,9 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    //设置签约的服务期限
    public void setSignDate(ServicePackageDO servicePackageDO,ServicePackageSignRecordDO signRecordDO){
        if(servicePackageDO == null){
            servicePackageDO = servicePackageDao.findOne(signRecordDO.getServicePackageId());
        }
        if("1".equals(servicePackageDO.getServerTimeType())){
            //固定期限
            String serverTime = servicePackageDO.getServerTime();