瀏覽代碼

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

yeshijie 7 年之前
父節點
當前提交
07c1f3883a
共有 32 個文件被更改,包括 1515 次插入275 次删除
  1. 10 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java
  2. 37 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionPay.java
  3. 138 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/ylz/PayConfigura.java
  4. 18 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  5. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java
  6. 255 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/DoctorFeldsherTemplateJob.java
  7. 57 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PrescriptionPayQueryJob.java
  8. 27 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientSchemeListDao.java
  9. 10 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java
  10. 17 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/ylz/PayConfiguraDao.java
  11. 249 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  12. 122 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/template/DoctorFeldsherTemplateService.java
  13. 36 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java
  14. 4 4
      patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml
  15. 5 0
      patient-co/patient-co-wlyy-job/src/main/resources/system.properties
  16. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/ylz/PayConfiguraDao.java
  17. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  18. 281 105
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  19. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  20. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  21. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/DoctorService.java
  22. 78 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorFeldsherTemplateService.java
  23. 0 129
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/common/Configure.java
  24. 0 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/model/BindCard.java
  25. 114 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  26. 7 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java
  27. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java
  28. 6 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java
  29. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  30. 0 6
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  31. 0 8
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  32. 0 6
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

+ 10 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java

@ -70,6 +70,8 @@ public class Doctor extends IdEntity {
    private Date certifiedOvertime; //CA证书过期时间
    private String certificateNum;     //CA证书编号
    private String openid; //医生微信openID
    public Double getEvaluateScore() {
        return evaluateScore;
    }
@ -428,4 +430,12 @@ public class Doctor extends IdEntity {
    public void setCertificateNum(String certificateNum) {
        this.certificateNum = certificateNum;
    }
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
}

+ 37 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionPay.java

@ -58,6 +58,43 @@ public class PrescriptionPay extends IdEntity {
    private String mxlist;//处方明细
    private Date createTime;//续方确认支付时间
    private Date czrq;//续方记录最后操作时间
    //    易联众新增查询返回字段v1.3.7
    private String medOrgNo;//医疗机构编号
    private String medOrgName;//医疗机构名称
    private Date traceTime;//交易成功时间
    private String traceNo;//支付平台跟踪号
    public Date getTraceTime() {
        return traceTime;
    }
    public void setTraceTime(Date traceTime) {
        this.traceTime = traceTime;
    }
    public String getTraceNo() {
        return traceNo;
    }
    public void setTraceNo(String traceNo) {
        this.traceNo = traceNo;
    }
    public String getMedOrgNo() {
        return medOrgNo;
    }
    public void setMedOrgNo(String medOrgNo) {
        this.medOrgNo = medOrgNo;
    }
    public String getMedOrgName() {
        return medOrgName;
    }
    public void setMedOrgName(String medOrgName) {
        this.medOrgName = medOrgName;
    }
    public Integer getAccountBalance() {
        return accountBalance;

+ 138 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/ylz/PayConfigura.java

@ -0,0 +1,138 @@
package com.yihu.wlyy.entity.ylz;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * 易联众支付相关配置参数
 * Created by Reece on 2017/9/9/009.
 */
@Entity
@Table(name = "ylz_pay_config")
public class PayConfigura extends IdEntity implements Serializable {
    //    基础配置参数
    private String onepayApi ;
    private String onepayAppId;
    private String onepayAppSecret;
    private int del; //配置状态 0无效 1有效
    //社保卡绑定及查询
    private String bindCardType;
    private String createSicardType;
    //家庭签约支付
    private String chargeType;
    private String chargeQueryType;
    private String receiveNotify;
    private String returnUrl;
    //续方长处方支付
    private String recipeChargeType;
    private String recipeReturnUrl;
    private String receiveRecipeNotify;
    public int getDel() {
        return del;
    }
    public void setDel(int del) {
        this.del = del;
    }
    public String getOnepayApi() {
        return onepayApi;
    }
    public void setOnepayApi(String onepayApi) {
        this.onepayApi = onepayApi;
    }
    public String getOnepayAppId() {
        return onepayAppId;
    }
    public void setOnepayAppId(String onepayAppId) {
        this.onepayAppId = onepayAppId;
    }
    public String getOnepayAppSecret() {
        return onepayAppSecret;
    }
    public void setOnepayAppSecret(String onepayAppSecret) {
        this.onepayAppSecret = onepayAppSecret;
    }
    public String getBindCardType() {
        return bindCardType;
    }
    public void setBindCardType(String bindCardType) {
        this.bindCardType = bindCardType;
    }
    public String getCreateSicardType() {
        return createSicardType;
    }
    public void setCreateSicardType(String createSicardType) {
        this.createSicardType = createSicardType;
    }
    public String getChargeType() {
        return chargeType;
    }
    public void setChargeType(String chargeType) {
        this.chargeType = chargeType;
    }
    public String getChargeQueryType() {
        return chargeQueryType;
    }
    public void setChargeQueryType(String chargeQueryType) {
        this.chargeQueryType = chargeQueryType;
    }
    public String getReceiveNotify() {
        return receiveNotify;
    }
    public void setReceiveNotify(String receiveNotify) {
        this.receiveNotify = receiveNotify;
    }
    public String getReturnUrl() {
        return returnUrl;
    }
    public void setReturnUrl(String returnUrl) {
        this.returnUrl = returnUrl;
    }
    public String getRecipeChargeType() {
        return recipeChargeType;
    }
    public void setRecipeChargeType(String recipeChargeType) {
        this.recipeChargeType = recipeChargeType;
    }
    public String getRecipeReturnUrl() {
        return recipeReturnUrl;
    }
    public void setRecipeReturnUrl(String recipeReturnUrl) {
        this.recipeReturnUrl = recipeReturnUrl;
    }
    public String getReceiveRecipeNotify() {
        return receiveRecipeNotify;
    }
    public void setReceiveRecipeNotify(String receiveRecipeNotify) {
        this.receiveRecipeNotify = receiveRecipeNotify;
    }
}

+ 18 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -98,6 +98,14 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("zy_execute_sick_settle_job reorder job job exist");
            }
            //处理当天支付,页面回调及异步回调失败的支付,每3分钟一次去主动查询并保存
            if (!quartzHelper.isExistJob("prescription_pay_query_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescription_pay_query_job");
                quartzHelper.addJob(PrescriptionPayQueryJob.class, trigger, "prescription_pay_query_job", new HashMap<String, Object>());
                logger.info("prescription_pay_query_job reorder job job success");
            } else {
                logger.info("prescription_pay_query_job reorder job job exist");
            }
            //居民24小时未回复的咨询自动关闭 每小时59分开始执行一次
            if (!quartzHelper.isExistJob("finish_consult_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("finish_consult_job");
@ -107,6 +115,16 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("finish_consult_job exist");
            }
            //提醒有监测方案的居民上传数据,每29分钟执行一次
            if (!quartzHelper.isExistJob("doctor_feldsher_template_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("doctor_feldsher_template_job");
                quartzHelper.addJob(DoctorFeldsherTemplateJob.class, trigger, "doctor_feldsher_template_job", new HashMap<String, Object>());
                logger.info("doctor_feldsher_template_job reorder job job success");
            } else {
                logger.info("doctor_feldsher_template_job reorder job job exist");
            }
            // 启动redis 消息队列线程
            logger.info("redis message start");
            new Thread(redisThread).start();

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -29,7 +29,7 @@ public interface DevicePatientHealthIndexDao
    Iterable<DevicePatientHealthIndex> findByPatienDate(String patientCode, int type, Date date);
    @Query("select a from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate between ?3 and ?4 and a.del = '1' group by recordDate order by recordDate asc")
    Iterable<DevicePatientHealthIndex> findByPatient(String user, int type, Date begin, Date end);
    List<DevicePatientHealthIndex> findByPatient(String user, int type, Date begin, Date end);
    @Query("select a.value1 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value1 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue1ByPatient(String user, int type, Date recordDate, Pageable pageRequest);

+ 255 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/DoctorFeldsherTemplateJob.java

@ -0,0 +1,255 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.entity.doctor.scheme.DoctorSchemeBloodPressure;
import com.yihu.wlyy.entity.doctor.scheme.DoctorSchemeBloodSugger;
import com.yihu.wlyy.entity.patient.PatientSchemeList;
import com.yihu.wlyy.health.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.patient.PatientSchemeListDao;
import com.yihu.wlyy.service.template.DoctorFeldsherTemplateService;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
 * 处理有监测方案的居民在一定时间范围内收到模板消息提醒
 * Created by Reece on 2017/8/29/029.
 */
@DisallowConcurrentExecution//解决执行频率和间隔时间的问题。到了执行时间点前一任务还在执行中,不会执行下一次任务,直至该次任务完成
public class DoctorFeldsherTemplateJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(DoctorFeldsherTemplateJob.class);
    @Autowired
    private PatientSchemeListDao schemeListDao;
    @Autowired
    private DoctorFeldsherTemplateService feldsherTemplateService;
    @Autowired
    WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private DevicePatientHealthIndexDao patientHealthIndexDao;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("DoctorFeldsherTemplateJob start ..........");
        try {
            //获取居民在监测方案的监测时间前30分钟未上传监测数据
            SimpleDateFormat formatHour = new SimpleDateFormat("HH:mm:ss");
            List<DoctorSchemeBloodSugger> patientCodeList = schemeListDao.findSuggerPatient();
            for (DoctorSchemeBloodSugger patientCodeLis : patientCodeList) {
                String schemecode = patientCodeLis.getCode();
                short beforeBreakfast = patientCodeLis.getBeforeBreakfast();
                Time beforeBreakfastTime = patientCodeLis.getBeforeBreakfastTime();
                short afterBreakfast = patientCodeLis.getAfterBreakfast();
                Time afterBreakfastTime = patientCodeLis.getAfterBreakfastTime();
                short beforeLunch = patientCodeLis.getBeforeLunch();
                Time beforeLunchTime = patientCodeLis.getBeforeLunchTime();
                short afterLunch = patientCodeLis.getAfterLunch();
                Time afterLunchTime = patientCodeLis.getAfterLunchTime();
                short beforeDinner = patientCodeLis.getBeforeDinner();
                Time beforeDinnerTime = patientCodeLis.getBeforeDinnerTime();
                short afterDinner = patientCodeLis.getAfterDinner();
                Time afterDinnerTime = patientCodeLis.getAfterDinnerTime();
                short beforeSleep = patientCodeLis.getBeforeSleep();
                Time beforeSleepTime = patientCodeLis.getBeforeSleepTime();
                String toDay = formatHour.format(new Date());
                long to = formatHour.parse(toDay).getTime();
                if (beforeBreakfast == 1) {
                    Time tempTime = Time.valueOf("00:00:00");
                    long tempTo = tempTime.getTime();
                    long from = beforeBreakfastTime.getTime();
                    int minutes = (int) ((from - tempTo) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,1,schemecode,tempTime,beforeBreakfastTime,"早餐前");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (afterBreakfast == 1) {
                    long from = afterBreakfastTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,1,schemecode,beforeBreakfastTime,afterBreakfastTime,"早餐后");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (beforeLunch == 1) {
                    long from = beforeLunchTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,1,schemecode,afterBreakfastTime,beforeLunchTime,"午餐前");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (afterLunch == 1) {
                    long from = afterLunchTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,1,schemecode,beforeLunchTime,afterLunchTime,"午餐后");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (beforeDinner == 1) {
                    long from = beforeDinnerTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,1,schemecode,afterLunchTime,beforeDinnerTime,"晚餐前");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (afterDinner == 1) {
                    long from = afterDinnerTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,1,schemecode,beforeDinnerTime,afterDinnerTime,"晚餐后");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (beforeSleep == 1) {
                    long from = beforeSleepTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,1,schemecode,afterDinnerTime,beforeSleepTime,"睡前");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
            }
            List<DoctorSchemeBloodPressure> patientCodes = schemeListDao.findPressurePatient();
            for (DoctorSchemeBloodPressure patientCodeLis : patientCodes) {
                String schemecode = patientCodeLis.getCode();
                short earlyMorning = patientCodeLis.getEarlyMorning();
                Time earlyMorningTime = patientCodeLis.getEarlyMorningTime();
                short morning = patientCodeLis.getMorning();
                Time morningTime = patientCodeLis.getMorningTime();
                short noon = patientCodeLis.getNoon();
                Time noonTime = patientCodeLis.getNoonTime();
                short afterNoon = patientCodeLis.getAfterNoon();
                Time afterNoonTime = patientCodeLis.getAfterNoonTime();
                short night = patientCodeLis.getNight();
                Time nightTime = patientCodeLis.getNightTime();
//                比较现在时间和监测时间《=30
                String toDay = formatHour.format(new Date());
                long to = formatHour.parse(toDay).getTime();
                if (earlyMorning == 1) {
                    Time tempTime = Time.valueOf("00:00:00");
                    long tempTo = tempTime.getTime();
                    long from = earlyMorningTime.getTime();
                    int minutes = (int) ((from - tempTo) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,2,schemecode,tempTime,earlyMorningTime,"");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (morning == 1) {
                    long from = morningTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,2,schemecode,earlyMorningTime,morningTime,"");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (noon == 1) {
                    long from = noonTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,2,schemecode,morningTime,noonTime,"");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (afterNoon == 1) {
                    long from = afterNoonTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,2,schemecode,noonTime,afterNoonTime,"");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
                if (night == 1) {
                    long from = nightTime.getTime();
                    int minutes = (int) ((from - to) / (1000 * 60));
                    try {
                        sendPatientHealth(minutes,2,schemecode,afterNoonTime,nightTime,"");
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                }
            }
            logger.info("DoctorFeldsherTemplateJob end ..........");
        } catch (Exception e) {
            e.printStackTrace();
            logger.info("DoctorFeldsherTemplateJob error ..........,message:" + e.getMessage());
        }
    }
    /**
     *
     * @param minutes 监测时间差值
     * @param type 监测类型 2为血压,1为血糖
     * @param schemecode 关联监测方案
     * @param beginTime 起始时间点
     * @param endTime 截止时间点
     * @param comment 血糖时间段名称
     * @throws Exception
     */
    private void sendPatientHealth(int minutes, int type, String schemecode, Time beginTime, Time endTime,String comment) throws Exception {
        SimpleDateFormat formatTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat formatDay = new SimpleDateFormat("yyyy-MM-dd ");
        Date today = new Date();
        if (minutes <= 30 && minutes > 0) {
            PatientSchemeList patient = schemeListDao.findPatientBySchemecode(schemecode, (short) 1);
            String patientCode = patient.getPatientcode();
            String day = formatDay.format(today);
            Date begin = formatTime.parse(day + beginTime);
            Date end = formatTime.parse(day + endTime);
            List<DevicePatientHealthIndex> healthIndices = patientHealthIndexDao.findByPatient(patientCode, type, begin, end);
            if (healthIndices==null || healthIndices.size()==0) {
                try {
                    //为居民发送监测代办事项提醒消息
                    feldsherTemplateService.sendChangeTemplate(type, patientCode, comment);
                } catch (Exception e) {
                    logger.info("DoctorFeldsherTemplateJob error ..........continue this JOB,CODE:" + patientCode + ",message:" + e.getMessage());
                }
            }
        }
    }
}

+ 57 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PrescriptionPayQueryJob.java

@ -0,0 +1,57 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.repository.prescription.PrescriptionPayDao;
import com.yihu.wlyy.service.app.prescription.PatientPrescriptionPayService;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
 * 处理当天支付,页面回调及异步回调失败的支付,每3分钟一次去主动查询并保存
 * Created by Reece on 2017/8/29/029.
 */
public class PrescriptionPayQueryJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(PrescriptionPayQueryJob.class);
    @Autowired
    private PrescriptionPayDao prescriptionPayDao;
    @Autowired
    private PatientPrescriptionPayService payService;
    @Autowired
    WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("PrescriptionPayQueryJob start ..........");
        try {
            String accesstoken =  weiXinAccessTokenUtils.getAccessToken();
            //获取支付完成,院内结算失败的 处方CODE 集合
            List<String> prescriptionCodeList = prescriptionPayDao.findTodayUnpay();
            if (!prescriptionCodeList.isEmpty()) {
                for (String code : prescriptionCodeList) {
                    try {
                        payService.chargeQuery(code,accesstoken);
                    } catch (Exception e) {
                        logger.info("PrescriptionPayQueryJob error ..........continue this JOB,CODE:" + code + ",message:" + e.getMessage());
                        continue;
                    }
                }
            }
            logger.info("PrescriptionPayQueryJob end ..........");
        } catch (Exception e) {
            e.printStackTrace();
            logger.info("PrescriptionPayQueryJob error ..........,message:" + e.getMessage());
        }
    }
}

+ 27 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientSchemeListDao.java

@ -0,0 +1,27 @@
package com.yihu.wlyy.repository.patient;
import com.yihu.wlyy.entity.doctor.scheme.DoctorSchemeBloodPressure;
import com.yihu.wlyy.entity.doctor.scheme.DoctorSchemeBloodSugger;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientSchemeList;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface PatientSchemeListDao extends PagingAndSortingRepository<PatientSchemeList, Long>, JpaSpecificationExecutor<PatientSchemeList> {
    //联合wlyy_patient_scheme_list和wlyy_doctor_scheme_blood_pressure查询有血糖监测方案且在监测时间前十分钟未上传监测数据
    @Query(value = " select s from PatientSchemeList p,DoctorSchemeBloodSugger s where p.schemecode=s.code and p.type = 1 and s.alertTag = 1 ")
    List<DoctorSchemeBloodSugger> findSuggerPatient();
    //联合wlyy_patient_scheme_list和wlyy_doctor_scheme_blood_pressure查询有血压监测方案且在监测时间前十分钟未上传监测数据
    @Query(" select s from PatientSchemeList p,DoctorSchemeBloodPressure s where p.schemecode=s.code and p.type=0 and s.alertTag = 1 ")
    List<DoctorSchemeBloodPressure> findPressurePatient();
    //根据schemecode查询患者监测方案
    @Query(" select p from PatientSchemeList p where p.schemecode = ?1 and p.type = ?2 ")
    PatientSchemeList findPatientBySchemecode(String schemecode,short type);
}

+ 10 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java

@ -5,10 +5,20 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionPayDao extends PagingAndSortingRepository<PrescriptionPay, Long>, JpaSpecificationExecutor<PrescriptionPay> {
    @Query("from PrescriptionPay p where p.prescriptionCode=?1 ")
    PrescriptionPay findByPrescriptionPay(String prescriptionCode);
    //查询支付记录
    @Query("from PrescriptionPay p where p.code=?1 ")
    PrescriptionPay findByCode(String code);
    //   查询当天支付,页面回调及异步回调均失败的支付 tradeStatus为空
    @Query(value = "SELECT t.`code` FROM wlyy_prescription_pay t WHERE t.trade_status is null AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY)", nativeQuery = true)
    List<String> findTodayUnpay();
}

+ 17 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/ylz/PayConfiguraDao.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.repository.ylz;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Reece on 2017/9/9.
 */
public interface PayConfiguraDao extends PagingAndSortingRepository<PayConfigura, Long>, JpaSpecificationExecutor<PayConfigura> {
    //查询有效支付相关配置(只有一条有效记录)
    @Query("select t from PayConfigura t where t.del = 1 ")
    PayConfigura findWorkConfigura();
}

+ 249 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -0,0 +1,249 @@
package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import com.yihu.wlyy.entity.zydict.ZyPushLog;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.repository.prescription.PrescriptionPayDao;
import com.yihu.wlyy.repository.ylz.PayConfiguraDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.SystemConf;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StreamUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * Created by Reece on 2017/7/28/028.
 * 患者支付
 */
@Service
public class PatientPrescriptionPayService extends BaseService {
    private Logger logger=LoggerFactory.getLogger(PatientPrescriptionPayService.class);
    //公共配置文件
    Properties systemConf = SystemConf.getInstance().getSystemProperties();
    //    各环境对应配置
    @Value("${server.server_url}")
    private String serverUrl;
    @Value("${wechat.accId}")
    private String accId;
    //    Java配置文件 后续删除
    private String signType = "MD5";
    private String encryptType = "AES";
    //    引入实例
    @Autowired
    private PayConfiguraDao configuraDao;
    @Autowired
    private PrescriptionPayDao payDao;
    @Autowired
    private HospitalMappingDao mappingDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    /**
     * 家庭医生签约支付查询
     */
    public String chargeQuery(String code, String accessToken) throws Exception {
        PayConfigura config = configuraDao.findWorkConfigura();
        int flag = 0;
        Boolean isSuccess = true;
        String msgBody = "";
        String response = "";
        String error = "";
        String result = null;
        PrescriptionPay charge = payDao.findByCode(code);
        String prescriptionCode = charge.getPrescriptionCode();
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        HospitalMapping hospitalMapping = mappingDao.findByCode(prescription.getHospital());
//          ***************************  测通流程 ***************************************
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), hospitalMapping.getAppId(), hospitalMapping.getAppSecret(), signType, encryptType);
        try {
            RequestParams requestParams = new RequestParams();
//            requestParams.setVersion();
//            requestParams.setSign();
//            requestParams.setEncryptData();
//            requestParams.setAppId(appId);
            requestParams.setAppId(hospitalMapping.getAppId());
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            requestParams.setTransType(config.getChargeQueryType());
            //业务参数
            JSONObject params = new JSONObject();
            params.put("outChargeNo", code);  //接入应用结算业务流水号
            params.put("wxToken", accessToken);
            requestParams.setParam(params);
            msgBody = JSON.toJSONString(requestParams);
//              ***************************  测通流程 ***************************************
            //执行支付 返回原生返回值
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            response = JSON.toJSONString(res);
            if (OnepayDefaultClient.isSuccessful(res)) {
                result = JSON.toJSONString(res.getParam());
//                新增保存数据
                JSONObject request = JSON.parseObject(result);
//                String tradeStatus = request.getString("tradeStatus");//交易状态
                String chargeStatus = request.getString("chargeStatus");//交易状态
                String chargeNo = request.getString("chargeNo");//支付平台流水号
                String chargeTime = request.getString("chargeTime");//支付平台交易成功时间
                String outChargeNo = request.getString("outChargeNo");//接入应用业务流水号
                String outChargeTime = request.getString("outChargeTime");//接入应用时间
                String medOrgNo = request.getString("medOrgNo");//医疗机构编号
                String medOrgName = request.getString("medOrgName");//医疗机构名称
                String billNo = request.getString("billNo");//待结算费用单据号
                String cardNo = request.getString("cardNo");//医保卡号
                String totalAmount = request.getString("totalAmount");//交易总金额
                String insuranceAmount = request.getString("insuranceAmount");//医保支付金额
                String selfPayAmount = request.getString("selfPayAmount");//自付金额
                String userId = request.getString("userId");//用户openID
                String userName = request.getString("userName");//用户名字
                String idNo = request.getString("idNo");//证件号码
                String idType = request.getString("idType");//证件类型
//                String appId = request.getString("appId");
//                String channel = request.getString("channel");//支付方式
//                String sign = request.getString("sign");
//                String signType = request.getString("signType");
//                String timestamp = request.getString("timestamp");
                JSONObject responseContents = request.getJSONObject("responseContent");//医保结构体
                PrescriptionPay prescriptionPay = payDao.findByCode(outChargeNo);
                if (responseContents != null) {
                    String miSettleNo = responseContents.getString("miSettleNo");//医保收费单据号 (医保签约号)
                    String miRegisterNo = responseContents.getString("miRegisterNo");//医保挂号
                    String miCollectDate = responseContents.getString("miCollectDate");//收费日期
                    String miCollectTime = responseContents.getString("miCollectTime");//收费时间
                    String miCollectorName = responseContents.getString("miCollectorName");//收费人姓名
                    String miTotalFee = responseContents.getString("miTotalFee");//本次报销总额
                    String selfPay = responseContents.getString("selfPay");//个人现金支付
                    String accountPay = responseContents.getString("accountPay");//个人账户支付
                    String heathPay = responseContents.getString("heathPay");//健康账户支付
                    String cadresPay = responseContents.getString("cadresPay");//公务员补助
                    String fundPay = responseContents.getString("fundPay");//基金支付
                    String healthCarePay = responseContents.getString("healthCarePay");//保健基金支付
                    String commercePay = responseContents.getString("commercePay");//商业保险支付
                    String familyPay = responseContents.getString("familyPay");//共济账户支付
                    String civilPay = responseContents.getString("civilPay");//民政补助金额
                    String civilZone = responseContents.getString("civilZone");//民政行政区号
                    String bdrugPay = responseContents.getString("bdrugPay");//乙类支付金额
                    String unlessAmount = responseContents.getString("unlessAmount");//非医保费用
                    String exceedAmount = responseContents.getString("exceedAmount");//超封顶线金额
                    String accountBalance = responseContents.getString("accountBalance");//个人账户余额
                    String healthBalance = responseContents.getString("healthBalance");//健康账户余额
                    prescriptionPay.setMiSettleNo(miSettleNo);//医保收费单据号
                    prescriptionPay.setMiRegisterNo(miRegisterNo);//医保挂号
                    SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMdd");
                    prescriptionPay.setMiCollectDate(formatDate.parse(miCollectDate));//收费日期
                    SimpleDateFormat formatTime = new SimpleDateFormat("HHmm");
                    prescriptionPay.setMiCollectTime(formatTime.parse(miCollectTime));//收费时间
                    prescriptionPay.setMiCollectorName(miCollectorName);//收费人姓名
                    prescriptionPay.setMiTotalFee(Integer.parseInt(miTotalFee));//本次报销总额
                    prescriptionPay.setSelfPay(Integer.parseInt(selfPay));//个人现金支付
                    prescriptionPay.setAccountPay(Integer.parseInt(accountPay));//个人账户支付
                    prescriptionPay.setHeathPay(Integer.parseInt(heathPay));//健康账户支付
                    prescriptionPay.setCadresPay(Integer.parseInt(cadresPay));//公务员补助
                    prescriptionPay.setFundPay(Integer.parseInt(fundPay));//基金支付
                    prescriptionPay.setHealthCarePay(Integer.parseInt(healthCarePay));//保健基金支付
                    prescriptionPay.setCommercePay(Integer.parseInt(commercePay));//商业保险支付
                    prescriptionPay.setFamilyPay(Integer.parseInt(familyPay));//共济账户支付
                    prescriptionPay.setCivilPay(Integer.parseInt(civilPay));//民政补助金额
                    prescriptionPay.setCivilZone(civilZone);//民政行政区号
                    prescriptionPay.setBdrugPay(Integer.parseInt(bdrugPay));//乙类支付金额
                    prescriptionPay.setUnlessAmount(Integer.parseInt(unlessAmount));//非医保费用
                    prescriptionPay.setExceedAmount(Integer.parseInt(exceedAmount));//超封顶线金额
                    prescriptionPay.setAccountBalance(Integer.parseInt(accountBalance));//个人账户余额
                    prescriptionPay.setHealthBalance(Integer.parseInt(healthBalance));//健康账户余额
                }
                if ("0".equals(chargeStatus) || "SUCCESS".equals(chargeStatus)) {
                    prescriptionPay.setTradeStatus("1");//交易状态 成功1 失败0
                }else {
                    prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
                }
                prescriptionPay.setChargeNo(chargeNo);//支付流水号
                SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMddHHmmss");
                prescriptionPay.setChargeTime(formatDate.parse(chargeTime));//支付平台交易成功时间
                prescriptionPay.setOutChargeTime(formatDate.parse(outChargeTime));//接入应用内业务时间
                prescriptionPay.setMedOrgNo(medOrgNo);//医疗机构编号
                prescriptionPay.setMedOrgName(medOrgName);//医疗机构名称
                prescriptionPay.setBillNo(billNo);//待结算费用单据号
                prescriptionPay.setCardNo(cardNo);//医保卡号
                prescriptionPay.setTotalAmount(Integer.parseInt(totalAmount));//交易总金额
                prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额
                prescriptionPay.setSelfPayAmount(Integer.parseInt(selfPayAmount));//自付金额
                prescriptionPay.setOpenid(userId);
                prescriptionPay.setUserName(userName);
                prescriptionPay.setIdType(idType);//证件类型
                prescriptionPay.setIdNo(idNo);//证件号码
                //        保存数据库更改记录
                payDao.save(prescriptionPay);
                logger.info("请求成功,返回参数: " + result);
            } else {
                isSuccess = false;
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
            }
        } catch (Exception ex) {
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
        }
        if (!isSuccess) {
            throw new Exception(error);
        }
        return result;
    }
}

+ 122 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/template/DoctorFeldsherTemplateService.java

@ -0,0 +1,122 @@
package com.yihu.wlyy.service.template;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 医生助手相关模板消息
 * <p>
 * Created by Reece on 2017/9/7/007.
 */
@Service
@Transactional
public class DoctorFeldsherTemplateService extends BaseService {
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    private static final Logger logger = LoggerFactory.getLogger(DoctorFeldsherTemplateService.class);
    /**
     * 医生为居民设置监测方案后实时为居民推送信息变更通知消息提醒
     *
     * @param type    监测类型 2为血压,1为血糖
     * @param patient 居民code
     * @param comment 血糖时间段名称
     * @throws Exception
     */
    public void sendChangeTemplate(int type, String patient, String comment) throws Exception {
        Patient people = patientDao.findByCode(patient);
        String openId = people.getOpenid();
        String name = people.getName();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        JSONArray jsonArray = null;
        JSONObject sendJson = new JSONObject();
        if (type == 1) {
            String url = "jkjl/html/health-index-add-bloodsugar.html?openid=" + openId + "&toUser=" + patient + "&toName=" +name+"&represented="+patient;
            String first = name + "您好,请按照您的血糖监测方案测量" + comment + "血糖数据。";
            String remark = "您可使用智能设备测量后自动上传数据,或点击详情手动上传测量数据";
            sendJson.put("keyword1", "血糖测量");
            sendJson.put("keyword2", dateFormat.format(new Date()));
            sendJson.put("first", first);
            sendJson.put("remark", remark);
            sendJson.put("url", url);//带参数的模板跳转链接
            pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
            //发送代理人
            jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
            if (jsonArray != null && jsonArray.length() > 0) {
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject j = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    int start = url.indexOf("&toUser=");
                    int end = url.indexOf("&", start + 1);
                    String touser = url.substring(start, end);
                    url = url.replace(touser, "&toUser=" + member.getCode());
                    int representedStart = url.indexOf("&represented=");
                    int representedEnd = url.length();
                    String represented = url.substring(representedStart, representedEnd);
                    url = url.replace(represented, "&represented=" + member.getCode());
                    //name患者姓名
                    sendJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
                    sendJson.put("url", url);
                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, sendJson);
                }
            }
            logger.info("sendJson: " + sendJson);
        }
        if (type == 2) {
            String url = "jkjl/html/health-index-add-bloodpressure.html?openid=" + openId + "&toUser=" + patient + "&toName=" +name+"&represented="+patient;
            String first = name + "您好,请按照您的血压监测方案测量血压数据。";
            String remark = "您可使用智能设备测量后自动上传数据,或点击详情手动上传测量数据";
            sendJson.put("keyword1", "血压测量");
            sendJson.put("keyword2", dateFormat.format(new Date()));
            sendJson.put("first", first);
            sendJson.put("remark", remark);
            sendJson.put("url", url);//带参数的模板跳转链接
            pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
            //发送代理人
            jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
            if (jsonArray != null && jsonArray.length() > 0) {
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject j = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    int start = url.indexOf("&toUser=");
                    int end = url.indexOf("&", start + 1);
                    String touser = url.substring(start, end);
                    url = url.replace(touser, "&toUser=" + member.getCode());
                    int representedStart = url.indexOf("&represented=");
                    int representedEnd = url.length();
                    String represented = url.substring(representedStart, representedEnd);
                    url = url.replace(represented, "&represented=" + member.getCode());
                    //name患者姓名
                    sendJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
                    sendJson.put("url", url);
                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, sendJson);
                }
            }
            logger.info("sendJson: " + sendJson);
        }
    }
}

+ 36 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java

@ -426,6 +426,7 @@ public class JobController extends BaseController {
    /**
     * 立即启动支付超时过期
     *
     * @Author Linyx
     * @params method
     * @Date 2017/8/14 11:07
@ -443,5 +444,40 @@ public class JobController extends BaseController {
            return error(-1, e.getMessage());
        }
    }
    /**
     * 遍历长处方支付但回调都失败的记录,主动查询易联众支付记录并保存
     *
     * @author wujunjie
     * @date 2017/8/30 14:16
     */
    @RequestMapping(value = "/prescriptionPayQueryJob", method = RequestMethod.POST)
    @ApiOperation("遍历长处方支付但回调都失败的记录,主动查询易联众支付记录并保存")
    public String PrescriptionPayQueryJob() {
        try {
            quartzHelper.startNow(PrescriptionPayQueryJob.class, "PRESCRIPTION-PAY_QUERY", null);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    //******************************长处方 end********************************
    /**
     * 居民监测方案提醒通知
     *
     * @author wujunjie
     * @date 2017/9/12 14:16
     */
    @RequestMapping(value = "/doctorFeldsherTemplateJob", method = RequestMethod.POST)
    @ApiOperation("提醒有监测方案的居民上传数据")
    public String DoctorFeldsherTemplateJob() {
        try {
            quartzHelper.startNow(DoctorFeldsherTemplateJob.class, "DOCTOR_FELDSHER_TEMPLATE", null);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
}

+ 4 - 4
patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml

@ -15,13 +15,13 @@ spring:
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
    password:
channel:
  redis:
    host: 59.61.92.90  # Redis server host.
    port: 9054 # Redis server port.
    password: jkzlehr
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
    password: jkzl_ehr
server:
  server_url: http://weixin.xmtyw.cn/wlyy-dev/

+ 5 - 0
patient-co/patient-co-wlyy-job/src/main/resources/system.properties

@ -89,10 +89,15 @@ zy_dict_job=0 0 1 * * ?
#遍历支付成功,院内结算失败的的记录,重新结算,10分钟跑一次
zy_execute_sick_settle_job=0 0/10 * * * ?
#处理当天支付,页面回调及异步回调失败的支付,每3分钟一次去主动查询并保存
prescription_pay_query_job=0 0/3 * * * ?
#居民24小时未回复的咨询自动关闭 每小时59分开始执行一次
finish_consult_job=* 59 * * * ?
#提醒有监测方案的居民上传数据,每29分钟执行一次
doctor_feldsher_template_job=0 0/29 * * * ?
#统一支付平台支付成功后页面跳转地址
return_url={server}/wx/html/qygl/html/pay_result.html

+ 17 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/ylz/PayConfiguraDao.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.repository.ylz;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Reece on 2017/9/9.
 */
public interface PayConfiguraDao extends PagingAndSortingRepository<PayConfigura, Long>, JpaSpecificationExecutor<PayConfigura> {
    //查询有效支付相关配置(只有一条有效记录)
    @Query("select t from PayConfigura t where t.del = 1 ")
    PayConfigura findWorkConfigura();
}

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -335,7 +335,7 @@ public class PatientInfoService extends BaseService {
    }
    public int createProfile(String doctorCode ,String patient,String jwCountryCode,String nation,String blood,String marry)throws Exception{
    public int createProfile(String doctorCode ,String patient,String brithday,String jwCountryCode,String nation,String blood,String marry,String adress)throws Exception{
        Patient p = patientDao.findByCode(patient);
@ -344,12 +344,12 @@ public class PatientInfoService extends BaseService {
        json.put("ARCHIVE_STATUS","3");//档案状态【1.未管理 2.死亡 3.正常 4.高危】
        json.put("SICK_NAME",p.getName());//姓名
        json.put("SICK_SEX",p.getSex());//性别【1.男 2.女 9 未知】
        json.put("BIRTHDAY",p.getBirthday());//出生日期
        json.put("BIRTHDAY",brithday);//出生日期
        json.put("ZONE_CODE",jwCountryCode);//所属社区【ZONE_DICT】
        json.put("IDENTITY_TYPE","1");//证件类型【IDENTITY_TYPE_DICT】
        json.put("IDENTITY_CARD_NO",p.getIdcard());//身份证号
        json.put("HOME_PHONE",p.getMobile());//本人电话
        json.put("HOME_ADDRESS","测试地址");//现住址
        json.put("HOME_ADDRESS",adress);//现住址
        json.put("ORG_ID","0");//新增默认传0
        json.put("RESIDENCE","1");//户籍【1.户籍 2.非户籍】
        json.put("NATIONAL",nation);//民族【NATION_DICT】

File diff suppressed because it is too large
+ 281 - 105
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java


+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -522,7 +522,7 @@ public class PrescriptionInfoService extends BaseService {
                " LEFT(pr.create_time,19) AS createTime, " +
                " pr.doctor, " +
                " pr.min_drug_day AS minDrugDay," +
                " pr.pres_create_time AS presCreateTime" +
                " LEFT(pr.pres_create_time,19) AS presCreateTime " +
                " FROM " +
                " wlyy_prescription pr " +
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` ");

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -28,6 +28,7 @@ import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.third.jw.JwArchivesService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.task.SignUploadTask;
import com.yihu.wlyy.util.*;
@ -128,6 +129,8 @@ public class FamilyContractService extends BaseService {
    private SignFamilyRenewDao signFamilyRenewDao;
    @Autowired
    private SignFamilyMappingDao signFamilyMappingDao;
    @Autowired
    private JwArchivesService jwArchivesService;
    @Autowired
    private ImUtill ImUtill;
@ -4055,4 +4058,13 @@ public class FamilyContractService extends BaseService {
        Integer patients = jdbcTemplate.queryForObject(sb.toString(), params.toArray(), Integer.class);
        return patients;
    }
    public String getSickArchiveFlag(String patient)throws Exception{
        Patient p = patientDao.findByCode(patient);
        String rs = jwArchivesService.getSickArchiveFlag(p.getIdcard());
        return rs ;
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/DoctorService.java

@ -139,7 +139,7 @@ public class DoctorService extends TokenService {
    }
    public Integer findDoctorCounts(String hospitalCode,String doctorName,Integer level) {
        String sql = "select * from wlyy_doctor where del=1 and status=1   ";
        String sql = "select count(*) from wlyy_doctor where del=1 and status=1   ";
        List<Object> args = new ArrayList<>();
        if (!org.springframework.util.StringUtils.isEmpty(hospitalCode)) {
            sql += " and hospital = ? ";

+ 78 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorFeldsherTemplateService.java

@ -0,0 +1,78 @@
package com.yihu.wlyy.service.template;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 医生助手相关模板消息
 * <p>
 * Created by Reece on 2017/9/7/007.
 */
public class DoctorFeldsherTemplateService extends BaseService {
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    private static final Logger logger = LoggerFactory.getLogger(DoctorFeldsherTemplateService.class);
    /**
     * 医生为居民设置监测方案后实时为居民推送信息变更通知消息提醒
     *
     * @param patient 居民code
     * @param url     带参数的跳转URL
     * @throws Exception
     */
    public void sendChangeTemplate(String patient, String url) throws Exception {
        Patient people = patientDao.findByCode(patient);
        String openId = people.getOpenid();
        String name = people.getName();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        JSONArray jsonArray = null;
        JSONObject sendJson = new JSONObject();
        String first = name + "您好,您的家庭医生已为您设置了血糖(血压)监测方案,请按照方案及时测量及上传您的体征数据。";
        String remark = "您可使用详情查看方案内容";
        sendJson.put("keyword1", name);
        sendJson.put("keyword2", dateFormat.format(new Date()));
        sendJson.put("keyword3", "血糖(血压)监测方案");
        sendJson.put("first", first);
        sendJson.put("remark", remark);
        sendJson.put("url", url);//带参数的模板跳转链接
        pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, openId, name, sendJson);
        //发送代理人
        jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
        if (jsonArray != null && jsonArray.length() > 0) {
            for (int i = 0; i < jsonArray.length(); i++) {
                JSONObject j = jsonArray.getJSONObject(i);
                Patient member = (Patient) j.get("member");
                int start = url.indexOf("&toUser=");
                int end = url.indexOf("&", start + 1);
                String touser = url.substring(start, end);
                url = url.replace(touser, "&toUser=" + member.getCode());
                //name患者姓名
                sendJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
                sendJson.put("url", url);
                pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, member.getOpenid(), name, sendJson);
            }
        }
        logger.info("sendJson: "+sendJson);
    }
}

+ 0 - 129
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/common/Configure.java

@ -1,129 +0,0 @@
package com.yihu.wlyy.service.weixin.wxpay.common;
import org.springframework.context.annotation.Configuration;
/**
 * User: hzp
 * Date: 20170518
 * 这里放置各种配置数据
 */
@Configuration
public class Configure {
	/******************************* 易联众统一支付平台 ***********************************************************/
//	private String onepayApi = "http://120.42.37.94:1301/onepay-web/";
//	private String onepayAppId = "1BGKM1UHM03P7B2CA8C000005626EB0E";
//	private String onepayAppSecret = "1BGKM1UHM03I7B2CA8C00000AB682E9A";
//			开发环境应用信息
//	private String onepayApi = "https://xmhealth.ylzpay.com:8080/";
	private String onepayApi = "http://xmhealth.ylzpay.com:8070/";
	private String onepayAppId = "1BLF5SEGN00087165F0A000027362BE5";
	private String onepayAppSecret = "1BLF5SCBO01V3E78A8C00000F3A0FFE7";
	private String bindCardType = "onepay.sicard.bind.info";
	private String chargeType = "onepay.trade.medical.charge";
	private String chargeQueryType = "onepay.trade.medical.charge.query";
	private String createSicardType = "onepay.sicard.createurl";
//	易联众异步回调
	private String receiveNotify = "wlyy.onepay.receiveNotify";
	private String returnUrl = "wlyy.onepay.returnUrl";
//  长处方系列
	private String recipeChargeType = "onepay.trade.long.recipe.charge";
	private String recipeReturnUrl = "wlyy.patient.prescription.pay.recipeReturnUrl";
	private String receiveRecipeNotify = "wlyy.patient.prescription.pay.receiveRecipeNotify";
	public String getRecipeChargeType() {
		return recipeChargeType;
	}
	public void setRecipeChargeType(String recipeChargeType) {
		this.recipeChargeType = recipeChargeType;
	}
	public String getRecipeReturnUrl() {
		return recipeReturnUrl;
	}
	public void setRecipeReturnUrl(String recipeReturnUrl) {
		this.recipeReturnUrl = recipeReturnUrl;
	}
	public String getReceiveRecipeNotify() {
		return receiveRecipeNotify;
	}
	public void setReceiveRecipeNotify(String receiveRecipeNotify) {
		this.receiveRecipeNotify = receiveRecipeNotify;
	}
	public String getReturnUrl() {
		return returnUrl;
	}
	public void setReturnUrl(String returnUrl) {
		this.returnUrl = returnUrl;
	}
	public String getReceiveNotify() {
		return receiveNotify;
	}
	public void setReceiveNotify(String receiveNotify) {
		this.receiveNotify = receiveNotify;
	}
	public String getOnepayApi() {
		return onepayApi;
	}
	public String getOnepayAppId() {
		return onepayAppId;
	}
	public String getOnepayAppSecret() {
		return onepayAppSecret;
	}
	public String getBindCardType() {
		return bindCardType;
	}
	public String getChargeType() {
		return chargeType;
	}
	public String getChargeQueryType() {
		return chargeQueryType;
	}
	public String getCreateSicardType() {
		return createSicardType;
	}
	/******************* 微信社保支付配置 ******************************************/
	//这个就是自己要保管好的私有Key了(切记只能放在自己的后台代码里,不能放在任何可能被看到源代码的客户端程序中)
	// 每次自己Post数据给API的时候都要用这个key来对所有字段进行签名,生成的签名会放在Sign这个字段,API收到Post数据的时候也会用同样的签名算法对Post过来的数据进行签名和验证
	// 收到API的返回的时候也要用这个key来对返回的数据算下签名,跟API的Sign数据进行比较,如果值不一致,有可能数据被第三方给篡改
	private String key = "2935b54b53a957d9516c920a544f2537";
	//微信分配的公众号ID(开通公众号之后可以获取到)
	private String appID = "wxd03f859efdf0873d";
	public String getKey(){
		return key;
	}
	public String getAppid(){
		return appID;
	}
	//获取token地址
	public String TOKEN_API = "https://api.weixin.qq.com/payinsurance/gettoken";
	//挂号/诊间支付统一下单 API 接口
	public String ORDER_API = "https://api.weixin.qq.com/payinsurance/unifiedorder?access_token ACCESS_TOKEN";
}

+ 0 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/model/BindCard.java

@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.service.third.httplog.LogService;
import com.yihu.wlyy.service.weixin.wxpay.common.Configure;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;

+ 114 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -9,13 +9,14 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.ylz.PayConfiguraDao;
import com.yihu.wlyy.service.third.httplog.LogService;
import com.yihu.wlyy.service.weixin.wxpay.common.Configure;
import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.util.SystemConf;
@ -24,7 +25,6 @@ import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import io.swagger.models.auth.In;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -47,7 +47,7 @@ import java.util.*;
public class OnePayService {
    @Autowired
    private Configure config;
    private PayConfiguraDao configuraDao;
    @Autowired
    private LogService logService;
@ -137,6 +137,7 @@ public class OnePayService {
        String error = "";
        List<BindCard> result = new ArrayList<BindCard>();
        PayConfigura config = configuraDao.findWorkConfigura();
        String appId = config.getOnepayAppId();
        String appSecret = config.getOnepayAppSecret();
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
@ -218,6 +219,7 @@ public class OnePayService {
        String result = "";
        String channel = "WX_MMP";   //  医保支付渠道
        String subject = "家庭医生签约支付";   //  订单名称
        PayConfigura config = configuraDao.findWorkConfigura();
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
//     未真正完成支付以前预存储支付信息到wlyy_charge表
@ -326,6 +328,8 @@ public class OnePayService {
            Map<String, String> map = new HashMap<>();
            map.put("feeType", "04");//家庭医生签约
            map.put("settleType", "03"); //健康账户支付
            //易联众新增字段v1.3.7
            map.put("principalCardNo", ssc); //实际签约卡号( 默认为绑卡主体卡号)
            params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体
            requestParams.setParam(params);
            msgBody = JSON.toJSONString(requestParams);
@ -373,6 +377,7 @@ public class OnePayService {
        String response = "";
        String error = "";
        String result = null;
        PayConfigura config = configuraDao.findWorkConfigura();
        WlyyCharge charge = chargeDao.findByCode(code);
        HospitalMapping hospitalMapping = hospitalMappingDao.findByCode(charge.getHospital());
@ -408,7 +413,109 @@ public class OnePayService {
//                result = JSON.toJavaObject(res.getParam(), Charge.class);
                result = JSON.toJSONString(res.getParam());
//                 返回医保机构体
//                 新增保存数据
                JSONObject request = JSON.parseObject(result);
//                String tradeStatus = request.getString("tradeStatus");//交易状态
                String chargeStatus = request.getString("chargeStatus");//交易状态
                String chargeNo = request.getString("chargeNo");//支付平台流水号
                String chargeTime = request.getString("chargeTime");//支付平台交易成功时间
                String outChargeNo = request.getString("outChargeNo");//接入应用业务流水号
                String outChargeTime = request.getString("outChargeTime");//接入应用时间
                String medOrgNo = request.getString("medOrgNo");//医疗机构编号
                String medOrgName = request.getString("medOrgName");//医疗机构名称
                String billNo = request.getString("billNo");//待结算费用单据号
                String cardNo = request.getString("cardNo");//医保卡号
                String totalAmount = request.getString("totalAmount");//交易总金额
                String insuranceAmount = request.getString("insuranceAmount");//医保支付金额
                String selfPayAmount = request.getString("selfPayAmount");//自付金额
                String userId = request.getString("userId");//用户openID
                String userName = request.getString("userName");//用户名字
                String idNo = request.getString("idNo");//证件号码
                String idType = request.getString("idType");//证件类型
//                String appId = request.getString("appId");
//                String channel = request.getString("channel");//支付方式
//                String sign = request.getString("sign");
//                String signType = request.getString("signType");
//                String timestamp = request.getString("timestamp");
                JSONObject responseContents = request.getJSONObject("responseContent");//医保结构体
                WlyyCharge prescriptionPay = chargeDao.findByCode(outChargeNo);
                if (responseContents != null) {
                    String miRegisterNo = responseContents.getString("miRegisterNo");//医保挂号
                    String miCollectDate = responseContents.getString("miCollectDate");//收费日期
                    String miCollectTime = responseContents.getString("miCollectTime");//收费时间
                    String miSettleNo = responseContents.getString("miSettleNo");//医保收费单据号 (医保签约号)
                    String miCollectStatus = responseContents.getString("miCollectStatus");//扣费状态
                    String miRegisterStatus = responseContents.getString("miRegisterStatus");//登记状态
                    String cadresPay = responseContents.getString("cadresPay");//公务员补助
                    String miTotalFee = responseContents.getString("miTotalFee");//本次报销总额
                    String healthCarePay = responseContents.getString("healthCarePay");//保健基金支付
                    String heathPay = responseContents.getString("heathPay");//健康账户支付
                    String accountPay = responseContents.getString("accountPay");//个人账户支付
                    String selfPay = responseContents.getString("selfPay");//个人现金支付
                    String civilPay = responseContents.getString("civilPay");//民政补助金额
                    /*String miCollectorName = responseContents.getString("miCollectorName");//收费人姓名
                    String fundPay = responseContents.getString("fundPay");//基金支付
                    String commercePay = responseContents.getString("commercePay");//商业保险支付
                    String familyPay = responseContents.getString("familyPay");//共济账户支付
                    String civilZone = responseContents.getString("civilZone");//民政行政区号
                    String bdrugPay = responseContents.getString("bdrugPay");//乙类支付金额
                    String unlessAmount = responseContents.getString("unlessAmount");//非医保费用
                    String exceedAmount = responseContents.getString("exceedAmount");//超封顶线金额
                    String accountBalance = responseContents.getString("accountBalance");//个人账户余额
                    String healthBalance = responseContents.getString("healthBalance");//健康账户余额*/
                    prescriptionPay.setMiRegisterNo(miRegisterNo);//医保挂号
                    /*prescriptionPay.setMiSettleNo(miSettleNo);//医保收费单据号
                    SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMdd");
                    prescriptionPay.setMiCollectDate(formatDate.parse(miCollectDate));//收费日期
                    SimpleDateFormat formatTime = new SimpleDateFormat("HHmm");
                    prescriptionPay.setMiCollectTime(formatTime.parse(miCollectTime));//收费时间
                    prescriptionPay.setMiCollectorName(miCollectorName);//收费人姓名
                    prescriptionPay.setMiTotalFee(Integer.parseInt(miTotalFee));//本次报销总额
                    prescriptionPay.setSelfPay(Integer.parseInt(selfPay));//个人现金支付
                    prescriptionPay.setAccountPay(Integer.parseInt(accountPay));//个人账户支付
                    prescriptionPay.setHeathPay(Integer.parseInt(heathPay));//健康账户支付
                    prescriptionPay.setCadresPay(Integer.parseInt(cadresPay));//公务员补助
                    prescriptionPay.setFundPay(Integer.parseInt(fundPay));//基金支付
                    prescriptionPay.setHealthCarePay(Integer.parseInt(healthCarePay));//保健基金支付
                    prescriptionPay.setCommercePay(Integer.parseInt(commercePay));//商业保险支付
                    prescriptionPay.setFamilyPay(Integer.parseInt(familyPay));//共济账户支付
                    prescriptionPay.setCivilPay(Integer.parseInt(civilPay));//民政补助金额
                    prescriptionPay.setCivilZone(civilZone);//民政行政区号
                    prescriptionPay.setBdrugPay(Integer.parseInt(bdrugPay));//乙类支付金额
                    prescriptionPay.setUnlessAmount(Integer.parseInt(unlessAmount));//非医保费用
                    prescriptionPay.setExceedAmount(Integer.parseInt(exceedAmount));//超封顶线金额
                    prescriptionPay.setAccountBalance(Integer.parseInt(accountBalance));//个人账户余额
                    prescriptionPay.setHealthBalance(Integer.parseInt(healthBalance));//健康账户余额*/
                }
                if ("0".equals(chargeStatus) || "SUCCESS".equals(chargeStatus)) {
                    prescriptionPay.setTradeStatus("1");//交易状态 成功1 失败0
                }else {
                    prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
                }
                prescriptionPay.setChargeNo(chargeNo);//支付流水号
                SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMddHHmmss");
                prescriptionPay.setChargeTime(chargeTime);//支付平台交易成功时间
//                prescriptionPay.setOutChargeTime(formatDate.parse(outChargeTime));//接入应用内业务时间
                prescriptionPay.setMedOrgNo(medOrgNo);//医疗机构编号
                prescriptionPay.setMedOrgName(medOrgName);//医疗机构名称
                prescriptionPay.setBillNo(billNo);//待结算费用单据号
                prescriptionPay.setSsc(cardNo);//医保卡号
                prescriptionPay.setTotalAmount(Integer.parseInt(totalAmount));//交易总金额
                prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额
                prescriptionPay.setSelfpayAmount(Integer.parseInt(selfPayAmount));//自付金额
                prescriptionPay.setOpenid(userId);
                prescriptionPay.setName(userName);
                prescriptionPay.setIdType(idType);//证件类型
                prescriptionPay.setIdNo(idNo);//证件号码
                //        保存数据库更改记录
                chargeDao.save(prescriptionPay);
//                System.out.println("请求成功,返回参数:" + result.getTradeStatus() + "  " + result.getUserName());
                LOGGER.info("请求成功,返回参数: "+result);
@ -443,6 +550,7 @@ public class OnePayService {
        String response = "";
        String error = "";
        String result = "";
        PayConfigura config = configuraDao.findWorkConfigura();
        String appId = config.getOnepayAppId();
        String appSecret = config.getOnepayAppSecret();
@ -461,6 +569,8 @@ public class OnePayService {
            JSONObject params = new JSONObject();
            params.put("openId", openid);
            params.put("accId", accId);  //微信公众号开发者ID
//           易联众新增字段代支付v1.3.7
            params.put("createType", "sicard");  //生成类型 sicard 个人电子社保卡 OR family 家庭成员绑卡 ( 默认 sicard)
            requestParams.setParam(params);
            requestParams.setTransType(config.getCreateSicardType());

+ 7 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java

@ -108,7 +108,8 @@ public class LoginController extends BaseController {
    public String doctor(@ApiParam(required = false, name = "mobile", value = "手机号") @RequestParam(required = false, value = "mobile") String mobile,
                         @ApiParam(required = false, name = "captcha", value = "短信验证码") @RequestParam(required = false) String captcha,
                         @ApiParam(required = false, name = "platform", value = "医生端pc,取药系统 或者对外系统") @RequestParam(required = false) Integer platform,
                         @ApiParam(required = false, name = "password", value = "密码") @RequestParam(required = false) String password) {
                         @ApiParam(required = false, name = "password", value = "密码") @RequestParam(required = false) String password,
                         @ApiParam(required = false, name = "password", value = "openid") @RequestParam(required = false) String openid) {
        String errorMessage;
        LoginLog loginLog = new LoginLog();
        loginLog.setCreateTime(new Date());
@ -170,6 +171,11 @@ public class LoginController extends BaseController {
                        return error(-1, errorMessage);
                    }
                    loginLogService.saveLog(loginLog);
                    if(StringUtils.isNotBlank(openid)){
                        doctor.setOpenid(openid);
                    }
                    return write(200, "登录成功", "data", map);
                } else {
                    errorMessage = "密码错误,登录失败";

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -85,13 +85,15 @@ public class PatientInfoController extends BaseController {
    @ObserverRequired
    public String createProfile(@ApiParam(value = "医生code", name = "doctorCode") @RequestParam(required = true)String doctorCode ,
                                @ApiParam(value = "患者code", name = "patient") @RequestParam(required = true)String patient,
                                @ApiParam(value = "生日(yyyy-MM-dd)", name = "brithday") @RequestParam(required = true)String brithday,
                                @ApiParam(value = "居委会", name = "jwCountryCode") @RequestParam(required = true)String jwCountryCode,
                                @ApiParam(value = "民族", name = "nation") @RequestParam(required = true)String nation,
                                @ApiParam(value = "血型", name = "blood") @RequestParam(required = true)String blood,
                                @ApiParam(value = "婚姻状况", name = "marry") @RequestParam(required = true)String marry){
                                @ApiParam(value = "婚姻状况", name = "marry") @RequestParam(required = true)String marry,
                                @ApiParam(value = "详细地址", name = "adress") @RequestParam(required = true)String adress){
        try {
            // 获取医生下的患者
            return write(200, "档案建立成功!", "data", patientInfoService.createProfile(doctorCode , patient, jwCountryCode, nation, blood, marry));
            return write(200, "档案建立成功!", "data", patientInfoService.createProfile(doctorCode , patient,brithday, jwCountryCode, nation, blood, marry,adress));
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取患者信息失败!");

+ 6 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -57,7 +57,6 @@ public class FamilyContractController extends BaseController {
    private DoctorPatientGroupInfoDao doctorPatientGroupInfoDao;
    @Autowired
    private SignWebService signWebService;
    /**
     * 得到患者的签约的医生的信息
     *
@ -395,6 +394,12 @@ public class FamilyContractController extends BaseController {
            if (StringUtils.isEmpty(doctor)) {
                return error(-1, "签约医生不能为空");
            }
            //===1.3.7 加入建档判断
            String flag = familyContractService.getSickArchiveFlag(patient);
            if("0".equals(flag)){
               return error(-2, "用户未建档");
            }
            //==1.3.7===end===
            int result = familyContractService.sign(doctor,patient,countryCode);

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java

@ -4,12 +4,13 @@ import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.ylz.PayConfiguraDao;
import com.yihu.wlyy.service.third.httplog.LogService;
import com.yihu.wlyy.service.weixin.wxpay.common.Configure;
import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
@ -69,7 +70,7 @@ public class OnePayController extends WeixinBaseController {
    @Autowired
    LogService logService;
    @Autowired
    private Configure config;
    private PayConfiguraDao configuraDao;
    @Autowired
    private HospitalMappingDao mappingDao;
    @Autowired
@ -262,6 +263,7 @@ public class OnePayController extends WeixinBaseController {
     */
    @RequestMapping(value = "/returnUrl")
    public void returnUrl(HttpServletRequest request, HttpServletResponse response) throws IOException, PayException {
        PayConfigura config = configuraDao.findWorkConfigura();
        Boolean isSuccess = false;
        String error = "";
        String responses = "";
@ -347,6 +349,7 @@ public class OnePayController extends WeixinBaseController {
     */
    @RequestMapping(value = "/receiveNotify")
    public void receiveNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, PayException {
        PayConfigura config = configuraDao.findWorkConfigura();
        Boolean isSuccess = false;
        String error = "";
        String responses = "";

+ 0 - 6
patient-co/patient-co-wlyy/src/main/resources/application-dev.yml

@ -82,12 +82,6 @@ images:
sign:
  check_upload: http://172.19.103.87:8011/wlyy_service
ylzpay:
  onepayApi: http://120.42.37.94:1301/onepay-web/
  onepayAppId: 1BGKM1UHM03P7B2CA8C000005626EB0E
  onepayAppSecret: 1BGKM1UHM03I7B2CA8C00000AB682E9A
express:
  sf_url: http://218.17.248.244:11080/bsp-oisp/sfexpressService
#  sf_url: https://bsp-ois.sit.sf-express.com:9443/bsp-ois/sfexpressServic

+ 0 - 8
patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

@ -78,14 +78,6 @@ images:
sign:
  check_upload: http://59.61.92.90:8072/wlyy_service
ylzpay:
#  onepayApi: https://xmhealth.ylzpay.com:8080/
  onepayApi: http://xmhealth.ylzpay.com:8070/
  onepayAppId: 1BLF5SEGN00087165F0A000027362BE5
  onepayAppSecret: 1BLF5SCBO01V3E78A8C00000F3A0FFE7
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService

+ 0 - 6
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -77,12 +77,6 @@ images:
sign:
  check_upload: http://172.19.103.88:8011/wlyy_service
ylzpay:
  onepayApi: http://120.42.37.94:1301/onepay-web/
  onepayAppId: 1BGKM1UHM03P7B2CA8C000005626EB0E
  onepayAppSecret: 1BGKM1UHM03I7B2CA8C00000AB682E9A
express:
  sf_url: http://218.17.248.244:11080/bsp-oisp/sfexpressService
#  sf_url: https://bsp-ois.sit.sf-express.com:9443/bsp-ois/sfexpressServic