Forráskód Böngészése

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
wangzhinan 3 éve
szülő
commit
2764cdd47d
28 módosított fájl, 1776 hozzáadás és 181 törlés
  1. 115 20
      business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java
  2. 9 2
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  3. 93 19
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 22 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  5. 291 13
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  6. 75 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/HcyyEntranceService.java
  7. 15 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/ConvertUtil.java
  8. 143 1
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  9. 1 0
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  10. 2 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientDao.java
  11. 3 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientMedicareCardDao.java
  12. 31 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxAppletsAccessTokenDao.java
  13. 41 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java
  14. 127 1
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxAccessTokenService.java
  15. 4 0
      business/base-service/src/mqConfig/esbmq-config.xml
  16. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  17. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  18. 84 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxAppletsAccessTokenDO.java
  19. 12 0
      server/svr-authentication/pom.xml
  20. 1 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  21. 14 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/dao/WlyyHttpLogDao.java
  22. 145 114
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  23. 208 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/HcyyService.java
  24. 72 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/utils/WebserviceUtil.java
  25. 38 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  26. 30 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  27. 21 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  28. 156 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/QrcodeService.java

+ 115 - 20
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -3,6 +3,7 @@ package com.yihu.jw.healthCare.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sun.corba.se.spi.ior.IdentifiableFactory;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -12,21 +13,15 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.healthCare.*;
import com.yihu.jw.entity.hospital.httplog.YlzHttpLogDO;
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.*;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.healthCare.utils.AES;
import com.yihu.jw.healthCare.utils.SafeUtil;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.healthCare.*;
import com.yihu.jw.hospital.httplog.dao.YlzHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionExpressageDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -35,6 +30,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import net.sf.json.util.JSONTokener;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -93,6 +89,8 @@ public class HealthCareService {
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    private String ylzConfigUrl;
    private String ylzConfigAppid;
@ -389,6 +387,12 @@ public class HealthCareService {
            throw new Exception("门诊信息不存在");
        }
        BaseDoctorDO baseDoctorDO = doctorDao.findById(outpatientDO.getDoctor());
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode");
        if(hospitalSysDictDO == null){
            throw new Exception("未配置网点编号");
@ -416,22 +420,111 @@ public class HealthCareService {
                data.put("order_id",prescriptionId);
            }else if(wxId.equalsIgnoreCase("xm_zsyy_wx")){
                net.sf.json.JSONArray result = entranceService.BS15036(outpatientDO.getCardNo(),outpatientDO.getIdcard(),null,null,null,null,his_serial,false);
                /*if (StringUtils.isNoneBlank(result)){
                    JSONObject resultJSON = JSONObject.parseObject(result);
                    if (resultJSON!=null){
                        JSONObject msgInfoJson = resultJSON.getJSONObject("msgInfo");
                net.sf.json.JSONArray result = entranceService.BS10108(outpatientDO.getCardNo(),outpatientDO.getIdcard(),null,null,null,null,his_serial,false);
                if (result!=null&&result.size()!=0){
                    net.sf.json.JSONObject object = result.getJSONObject(0);
                    net.sf.json.JSONObject jsonObject = object.getJSONObject("retInfo");
                    net.sf.json.JSONObject msgInfoJson = object.getJSONObject("msgInfo");
                    if (jsonObject.getString("retCode").equalsIgnoreCase("00")){
                        if (msgInfoJson!=null){
                            JSONArray resultResult = msgInfoJson.getJSONArray("receipt");
                            if (resultResult!=null&&resultResult.size()!=0){
                                JSONObject receipt = resultResult.getJSONObject(0);
                                data.put("name",receipt.getString("xming0"));
                                data.put("cert_type",receipt.getString("01"));
                                data.put("region_code",receipt.getString("3502"));
                            net.sf.json.JSONObject resultJSON = msgInfoJson.getJSONObject("receipt");
                            if (resultJSON!=null){
                                data.put("name",resultJSON.getString("xming0"));
                                data.put("cert_type","01");
                                data.put("region_code","3502");
                                data.put("order_id",resultJSON.getString("xtgzh0"));
                                data.put("medical_mode","10");
                                data.put("prescription_code",resultJSON.getString("xtgzh0"));
                                data.put("idcard",resultJSON.getString("id0000"));
                                data.put("cert_type","01");
                                data.put("sex",resultJSON.getString("brnl00"));
                                data.put("birth", com.yihu.jw.util.idcard.IdCardUtil.getBirthdayForIdcardStr(resultJSON.getString("id0000")));
                                data.put("phone",outpatientDO.getMobile());
                                data.put("medical_type","11");
                                data.put("medical_type_name","普通门诊");
                                data.put("medical_time",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));
                                data.put("disease_code",outpatientDO.getIcd10());
                                data.put("dept_code",outpatientDO.getDept());
                                data.put("dept_name",outpatientDO.getDeptName());
                                data.put("doctor_idcard",baseDoctorDO.getIdcard());
                                data.put("doctor_code",doctorMappingDO.getMappingCode());
                                data.put("doctor_name",baseDoctorDO.getName());
                                data.put("prescription_date",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()));
                                data.put("prescription_counts",resultJSON.getString("cfxms0"));
                                data.put("prescription_source",0);
                                List<WlyyPrescriptionDiagnosisDO> diagnosisDOList = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1);
                                JSONArray diagnosisArray = new JSONArray();
                                for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOList){
                                    JSONObject diagnosisObj = new JSONObject();
                                    diagnosisObj.put("disease_code_icd10",diagnosisDO.getCode());
                                    diagnosisObj.put("disease_name_icd10",diagnosisDO.getName());
                                    diagnosisObj.put("disease_type","01");
                                    diagnosisObj.put("disease_order","01");
                                    diagnosisArray.add(diagnosisObj);
                                }
                                data.put("zdlist",diagnosisArray);
                                JSONArray infoList = new JSONArray();
                                Object json = new JSONTokener(resultJSON.getString("mxlists")).nextValue();
                                if(json instanceof JSONObject){
                                    JSONObject mxListJSON = (JSONObject)json;
                                    JSONObject mxlistObj = mxListJSON.getJSONObject("mxlist");
                                    JSONObject infoJson = new JSONObject();
                                    infoJson.put("his_item_name",mxlistObj.getString("xmmc00"));
                                    infoJson.put("his_item_code",mxlistObj.getString("xmbh00"));
                                    infoJson.put("item_name",mxlistObj.getString("xmmc00"));
                                    infoJson.put("item_code",mxlistObj.getString("xmbh00"));
                                    infoJson.put("his_drug_no",mxlistObj.getString("xmbh00"));
                                    infoJson.put("his_detail_sn",mxlistObj.getString("cfhao0"));
                                    infoJson.put("invoice_type","01");
                                    infoJson.put("specification_type",mxlistObj.getString("xmgg00"));
                                    infoJson.put("dosage_form",mxlistObj.getString("jx0000"));
                                    infoJson.put("charge_unit",mxlistObj.getString("xmdw00"));
                                    infoJson.put("price",mxlistObj.getString("xmdj00"));
                                    infoJson.put("amount",mxlistObj.getString("xmsl00"));
                                    infoJson.put("total_money",mxlistObj.getString("xmje00"));
                                    infoJson.put("single_dose",mxlistObj.getString("dcyydw"));
                                    infoJson.put("use_frequency",mxlistObj.getString("yppl00"));
                                    infoJson.put("medical_way",mxlistObj.getString("gytj00"));
                                    infoJson.put("prescription_date",mxlistObj.getString("jzrq"));
                                    infoJson.put("medication_days",mxlistObj.getString("ylts00"));
                                    infoJson.put("his_dept_code",outpatientDO.getDept());
                                    infoJson.put("his_dept_name",outpatientDO.getDeptName());
                                    infoJson.put("limit_type",mxlistObj.getString("sfybxm"));
                                    infoList.add(infoJson);
                                }else if (json instanceof JSONArray){
                                    JSONArray mxListArray = (JSONArray)json;
                                    for (int j=0;j<mxListArray.size();j++){
                                        JSONObject mxlistObj = mxListArray.getJSONObject(j);
                                        JSONObject infoJson = new JSONObject();
                                        infoJson.put("his_item_name",mxlistObj.getString("xmmc00"));
                                        infoJson.put("his_item_code",mxlistObj.getString("xmbh00"));
                                        infoJson.put("item_name",mxlistObj.getString("xmmc00"));
                                        infoJson.put("item_code",mxlistObj.getString("xmbh00"));
                                        infoJson.put("his_drug_no",mxlistObj.getString("xmbh00"));
                                        infoJson.put("his_detail_sn",mxlistObj.getString("cfhao0"));
                                        infoJson.put("invoice_type","01");
                                        infoJson.put("specification_type",mxlistObj.getString("xmgg00"));
                                        infoJson.put("dosage_form",mxlistObj.getString("jx0000"));
                                        infoJson.put("charge_unit",mxlistObj.getString("xmdw00"));
                                        infoJson.put("price",mxlistObj.getString("xmdj00"));
                                        infoJson.put("amount",mxlistObj.getString("xmsl00"));
                                        infoJson.put("total_money",mxlistObj.getString("xmje00"));
                                        infoJson.put("single_dose",mxlistObj.getString("dcyydw"));
                                        infoJson.put("use_frequency",mxlistObj.getString("yppl00"));
                                        infoJson.put("medical_way",mxlistObj.getString("gytj00"));
                                        infoJson.put("prescription_date",mxlistObj.getString("jzrq"));
                                        infoJson.put("medication_days",mxlistObj.getString("ylts00"));
                                        infoJson.put("his_dept_code",outpatientDO.getDept());
                                        infoJson.put("his_dept_name",outpatientDO.getDeptName());
                                        infoJson.put("limit_type",mxlistObj.getString("sfybxm"));
                                        infoList.add(infoJson);
                                    }
                                }
                                data.put("mxlist",infoList);
                            }
                        }
                    }
                }*/
                }
            }
        }
        YlzMedicalPrescriptionUploadDO uploadDO = new YlzMedicalPrescriptionUploadDO();
@ -461,6 +554,8 @@ public class HealthCareService {
        return result;
    }
    /**
     * 2.4.2	医师开方上传
     *

+ 9 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -534,8 +534,13 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        String familyAge = String.valueOf(IdCardUtil.getAgeForIdcard(patientDO.getIdcard()));
        result.setAge(familyAge);
        result.setDel(1);
        result.setIdType("1");
        result.setIdTypeName("身份证");
        if (StringUtils.isNotBlank(patientDO.getCardType())&&patientDO.getCardType().equalsIgnoreCase("1")){
            result.setIdType("1");
            result.setIdTypeName("身份证");
        }else {
            result.setIdType("0");
            result.setIdTypeName("其他");
        }
        result.setPatient(patientId);
        result.setIdcard(patientDO.getIdcard());
        result.setMobile(patientDO.getMobile());
@ -806,6 +811,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                                if (StringUtils.isNotBlank(jsonObject1.getString("TEL"))){
                                    List<BasePatientDO> listpatients=basePatientDao.findByMobileAndDel(jsonObject1.getString("TEL"),"1");
                                    if (listpatients!=null&&listpatients.size()>0){
                                    }else {
                                        patientDO.setMobile(jsonObject1.getString("TEL"));
                                    }
@ -822,6 +828,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                                }else{
                                    pw = idcard.substring(idcard.length()-6);
                                }
                                patientDO.setYktId(jsonObject1.getString("ID"));
                                patientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                                patientDO.setSalt(salt);
                                patientDO.setIdcard(jsonObject1.getString("IDCARD"));

+ 93 - 19
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -28,7 +28,6 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BaseNatPatientFamilyMemberDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
@ -102,7 +101,6 @@ import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.*;
import com.yihu.jw.utils.Pkis.PKIService_PortType;
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
import com.yihu.jw.utils.encode.Base64;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.utils.sfutils.HttpClientUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
@ -120,9 +118,6 @@ import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.trans.TransRequest;
import com.ylzinfo.ehc.trans.TransResponse;
import com.zaxxer.hikari.HikariDataSource;
import com.zaxxer.hikari.HikariPoolMXBean;
import jxl.format.*;
import jxl.format.VerticalAlignment;
import jxl.write.*;
import net.sf.json.JSONArray;
@ -144,14 +139,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.management.JMX;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.io.DataOutput;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.Boolean;
import java.lang.management.ManagementFactory;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLEncoder;
@ -160,7 +150,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
 * Created by Trick on 2019/5/17.
@ -733,7 +723,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("patientId", basePatientDO.getId());
        rs.put("idCard", basePatientDO.getIdcard());
        rs.put("sex", basePatientDO.getSex());
        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(), outpatientDO.getPatient(), "1");
        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByCodeAndPatientCodeAndDel(outpatientDO.getCardNo(), outpatientDO.getPatient());
        rs.put("ssc", cardDO);
        rs.put("age", IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        rs.put("address", basePatientDO.getAddress());
@ -4328,11 +4318,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs.size();
    }
    public Map<String, Object> findDoctorInfo(String doctor, String withWork,String patient) {
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
    public Map<String, Object> findDoctorInfo(String doctor,String idcard, String withWork,String patient) {
        BaseDoctorDO doctorDO = new BaseDoctorDO();
        if (StringUtils.isNoneBlank(doctor)){
            doctorDO = baseDoctorDao.findById(doctor);
        }else {
            doctorDO = baseDoctorDao.findByIdcardAndId(idcard);
        }
        Map<String, Object> rs = new HashedMap();
        if (doctorDO != null) {
            rs.put("doctor", doctor);
            rs.put("id", doctorDO.getId());
            rs.put("doctorSex", doctorDO.getSex());
            if (StringUtils.isNoneBlank(doctorDO.getIdcard())) {
                rs.put("doctorAge", IdCardUtil.getAgeForIdcard(doctorDO.getIdcard()));
@ -4362,6 +4358,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("sex",doctorDO.getSex());
            rs.put("popularity",doctorDO.getPopularity());
            rs.put("qrcode",doctorDO.getQrcode());
            rs.put("appletQrcode",doctorDO.getAppletQrCode());
            List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
            String sqlCharge = "SELECT\n" +
                    "\tm.req_fee as \"twfzFee\",\n" +
@ -8219,6 +8216,45 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return waitVideoCount;
    }
    /**
     * 根据类型获取总问诊量
     *
     * @param doctor
     * @param outpatient_type 1复诊  2协同
     * @param type            1图文 2视频
     * @return
     */
    public Long getVideoCount(String doctor, String type, String outpatient_type, String wxId) {
        String sql = "SELECT " +
                "count(outpatient.id) AS \"total\" " +
                "FROM " +
                "wlyy_outpatient outpatient," +
                "base_patient patient " +
                "WHERE " +
                "outpatient.patient=patient.id " +
                "AND outpatient.status in (0,1,2,3) " +
                "AND outpatient.doctor='" + doctor + "' " +
                "AND outpatient.pay_status = 1 " +
                "AND outpatient.outpatient_type= '" + outpatient_type + "'  ";
        if (!"xm_ihealth_wx".contains(wxId)){
            if ("1".equals(outpatient_type)||"3".equals(outpatient_type)) {//复诊
                sql = sql + " AND outpatient.type= '" + type + "' ";
            }
        }
        logger.info("接口名称:doctorReviewConsultCount-->sql="+sql);
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long waitVideoCount = 0l;
        if (rstotal != null && rstotal.size() > 0) {
            waitVideoCount = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        return waitVideoCount;
    }
    /**
     * 保存在线排班
     *
@ -12381,7 +12417,42 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            baseNatAppointmentDO.setRealOrder(realOrder);
                            baseNatAppointmentDO.setIsSuccess("1");
                            baseNatAppointmentDO.setVoucherNo(voucherNo);
                            if (chargeAmount.equalsIgnoreCase("0")){
                                baseNatAppointmentDO.setPayStatus("1");
                            }
                            baseNatAppointmentDO =baseNatAppointmentDao.save(baseNatAppointmentDO);
                            if (chargeAmount.equalsIgnoreCase("0")) {
                                BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId());
                                //发送预约成功通知
                                String name1 = patientDO.getName();
                                String idcard = patientDO.getIdcard();
                                String mobile1 = patientDO.getMobile();
                                String url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id=" + baseNatAppointmentDO.getId();
                                String date = DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime());
                                String first = "尊敬的用户" + baseNatAppointmentDO.getName() + ",您已完成线上自助核酸检测预约申请";
                                String contentMsg = "申请人:" + baseNatAppointmentDO.getName() + "\r\n 预约时间:" + date + " \r\n发票流水号:" + baseNatAppointmentDO.getRealOrder();
                                String remark = "1、请您持核酸预约申请信息和发票流水号、医保卡/就诊卡/电子健康卡,准时至我院五号楼北侧(急诊部后侧)核酸检测点领取标本试管窗口绑定检测。\r\n" +
                                        "2、核酸检测标本采集6-8小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                                String responseMsg = "";
                                responseMsg = entranceService.ehospitalNotice(
                                        name1,
                                        idcard,
                                        mobile1,
                                        first,
                                        url,
                                        contentMsg,
                                        remark);
                                logger.info("中山发送模板消息返回结果=" + responseMsg);
                                System.out.println("结束发送模板消息");
                                WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                                wlyyHttpLogDO.setRequest(url);
                                wlyyHttpLogDO.setName("核酸检测模板消息推送");
                                wlyyHttpLogDO.setCode(baseNatAppointmentDO.getId().toString());
                                wlyyHttpLogDO.setCreateTime(new Date());
                                wlyyHttpLogDO.setRequest(url);
                                wlyyHttpLogDO.setResponse(responseMsg);
                                wlyyHttpLogDao.save(wlyyHttpLogDO);
                            }
                            /*logger.info("模板消息推送标识pushFlag"+pushFlag);
                            if (!StringUtils.isNoneBlank(pushFlag)){
                                String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
@ -13951,27 +14022,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            object.put("deptName",outpatientDO.getPatientName());
            return object;
        }else {
            /*entranceService.BS10108()*/
            /*entrance(outpatientDO.getCardNo(),registerNo,sysDictDO.getDictValue());*/
            logger.info("获取患者待结算信息开始!");
            entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
            logger.info("获取患者待结算信息结束!");
            logger.info("医保挂号开始!");
            String register = healthCareService.register(registerNo);
            logger.info("医保挂号结束!");
            logger.info("医保费用明细上传开始!");
            String feeDetailUpload= healthCareService.feeDetailUploadToEntrance(registerNo);
            String feeDetailUpload= healthCareService.feeDetailUpload(registerNo);
            logger.info("医保费用明细上传结束!");
            logger.info("医保预结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(registerNo);
            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlement(registerNo);
            logger.info("医保预结算信息结束!");
            JSONObject object = new JSONObject();
            if (flag==1){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(registerNo);
                String getSettlementResultUrl = healthCareService.getSettlementResultUrl(registerNo);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrl",getSettlementResultUrl);
            }else if (flag==2){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64ToEntrance(registerNo);
                String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64(registerNo);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
            }

+ 22 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -21,6 +21,7 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
@ -32,6 +33,7 @@ import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
@ -127,6 +129,8 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private WlyyPatientFamilyMemberDao patientFamilyMemberDao;
    @Autowired
    private HttpClientUtil httpClientUtil;
@ -1113,4 +1117,22 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    }
    /**
     * 门诊费用
     * @param familyId
     * @param startDate
     * @param endDate
     * @return
     */
    public String GetFYQD(String familyId,String startDate,String endDate,String loginId){
        WlyyPatientFamilyMemberDO patientFamilyMemberDO =patientFamilyMemberDao.findByIdAndDel(familyId);
        BasePatientDO basePatientDO = basePatientDao.findById(loginId);
        if (patientFamilyMemberDO!=null){
            return ykyyService.GetFYQD(patientFamilyMemberDO.getYktFamilyId(),"7A585AB3-ED33-B40D-C3E3-A8BB0A1195D8",startDate,endDate,basePatientDO.getVerifyCode());
        }else {
            return "患者不存在";
        }
    }
}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 291 - 13
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java


+ 75 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/HcyyEntranceService.java

@ -125,6 +125,8 @@ public class HcyyEntranceService {
    private static String key="bvvsf3JA0mUXMU+mVnMaOQ==";
    private static String caKey = "bvvsf3JA0mUXMU+mVnMaOQ==";
    //发送微信模板消息
    /*@Value("${wechat.url}")*/
    private String sendMessageUrl="http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage";
@ -2921,5 +2923,78 @@ public class HcyyEntranceService {
    //===========================CA签名================================
    public String XMCA_DCS_UnifiedInterface(String apiName,String apiCode,String jsonData) throws Exception {
        String api = "XMCA_DCS_UnifiedInterface";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+caKey+"</certificate> " +
                "</root>";
        String condition ="{\"apiName\":\""+apiCode+"\",\"version\":\"v1\",\"jsonData\":\""+jsonData+"\"}";
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        wlyyHttpLogDO.setRequest(params.toString());
        logger.info(apiName+" params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("CallInterface",params,getCaServiceUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String jsonObject = xmlSerializer.read(xml).toString();
        wlyyHttpLogDO.setResponse(jsonObject);
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setCode(apiCode);
        wlyyHttpLogDO.setName(apiName);
        wlyyHttpLogDao.save(wlyyHttpLogDO);
        logger.info(apiName+" json:"+jsonObject);
        return jsonObject;
    }
    /**
     * 获取医生手写签名图片的base64编码
     *
     *
      * @param docIdcard 医生身份证
     * @return
     * @throws Exception
     */
    public String XMCA_downloadDoctorHandwrSignPicts(String docIdcard) throws Exception {
        String api = "XMCA_downloadDoctorHandwrSignPicts";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+caKey+"</certificate> " +
                "</root>";
        String condition ="<strUserFileName>"+docIdcard+".png</strUserFileName>";
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        wlyyHttpLogDO.setRequest(params.toString());
        logger.info("获取医生手写签名图片的base64编码 params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("CallInterface",params,getCaServiceUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String jsonObject = xmlSerializer.read(xml).toString();
        wlyyHttpLogDO.setResponse(jsonObject);
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setCode(api);
        wlyyHttpLogDO.setName("获取医生手写签名图片的base64编码");
        wlyyHttpLogDao.save(wlyyHttpLogDO);
        logger.info("获取医生手写签名图片的base64编码 json:"+jsonObject);
        return jsonObject;
    }
    //===========================CA签名==================================
}

+ 15 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/ConvertUtil.java

@ -75,6 +75,21 @@ public class ConvertUtil {
            return  null;
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public static  JSONArray convertListEnvelop(String obj)throws Exception{
        JSONObject jsonObject=JSONObject.fromObject(obj);
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=JSONArray.fromObject(jsonObject.get("MsgInfo"));
            return jsonObjectMgsInfo;
        }else {
            return  null;
        }
    }
    /**
     * 返回对象数组数据解析

+ 143 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -3,11 +3,18 @@ package com.yihu.jw.hospital.ykyy.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.ca.OauthCaConfigDO;
import com.yihu.jw.hospital.prescription.dao.OauthCaConfigDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.StringUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -15,6 +22,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
@ -37,7 +45,10 @@ public class YkyyService {
    private static String yktUrl = "http://www.yanketong.com:133/api/";
    private static String yktUrl_90 = "http://www.yanketong.com:90/";
    @Autowired
    private OauthCaConfigDao oauthCaConfigDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    public String selectCards(String patient) throws Exception {
@ -764,4 +775,135 @@ public class YkyyService {
        logger.info("修改眼科通家人关系结果"+response);
        return response;
    }
    /**
     * OAuth登陆-获取用户信息
     * @param qrCode
     * @return
     */
    public JSONObject getTokeninfo(String qrCode){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/pkiserver/v1/queryQRCode";
            }
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("qrCode",qrCode);
            String response = requestCaParams(url,jsonObject.toJSONString());
            logger.info("验证二维码 getQueryQRCode :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 业务数据签名
     * @param idCardNo
     * @param content
     * @param extInfo
     * @param type
     * @return
     */
    public JSONObject signTimeStamp(String idCardNo,String content,String extInfo,String type){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/signDataWithExtraInfo/signTimeStamp";
            }
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("idCardNo",idCardNo);
            jsonObject.put("inData",content);
            jsonObject.put("extInfo",extInfo);
            jsonObject.put("type",type);
            String response = requestCaParams(url,jsonObject.toJSONString());
            logger.info("业务数据签名 signTimeStamp :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 获取医生签名图片
     * @param doctor
     * @return
     */
    public JSONObject getSignPicture(String doctor){
        try {
            BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/pkiserver/v1/getSignPicture";
            }
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("idCardNo",doctorDO.getIdcard());
            String response = requestCaParams(url,jsonObject.toJSONString());
            JSONObject object = new JSONObject();
            if (StringUtils.isNoneBlank(response)){
                object = JSONObject.parseObject(response);
                if (object.getString("code").equalsIgnoreCase("200")){
                    JSONObject object1 = object.getJSONObject("data");
                    object.put("code","1000");
                    if (object1.getString("resultCode").equalsIgnoreCase("0")){
                        object1.put("image",object1.getString("picData"));
                    }
                }
            }
            logger.info("医生签名图片 getSignPicture :"+response);
            return object;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /**
     * CA签名服务调用方式
     * @param url
     * @param data
     * @return
     */
    public String requestCaParams(String url,String data) throws UnsupportedEncodingException {
        OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
        String time = DateUtil.getStringDateUpper();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("appid",oauthCaConfigDO.getClientId());
        System.out.println("业务数据为:" + data);
        String dataInfo = Base64.encodeBase64String(data.getBytes("utf-8"));
        jsonObject.put("data", dataInfo);
        jsonObject.put("timestamp",time);
        String digest = DigestUtils.sha256Hex((oauthCaConfigDO.getClientId() + dataInfo + time + oauthCaConfigDO.getClientSecret()));
        jsonObject.put("digest",digest);
        logger.info("请求url"+url+"请求参数"+jsonObject);
        String res = httpClientUtil.postBody(url,jsonObject);
        logger.info("返回参数"+res);
        return res;
    }
    /**
     *获取门诊费用清单
     * hospitalId = 7A585AB3-ED33-B40D-C3E3-A8BB0A1195D8
     * @return
     */
    public String GetFYQD(String patientId,String hospitalId,String startDate,String endDate,String verifyCode){
        String response="";
        String url = "http://www.yanketong.com:90/api/His/GetFYQD?patientId="+patientId+"&hospitalId="+hospitalId+"&beginDate="+URLEncoder.encode(startDate)+"&endDate="+URLEncoder.encode(endDate);
        Map<String,String> headerMap = new HashedMap();
        headerMap.put("VerifyCode",verifyCode);
        logger.info("获取门诊结算信息请求参数:"+url);
        response = httpClientUtil.sendGet(url,headerMap);
        logger.info("获取门诊结算信息:"+response);
        return response;
    }
}

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java

@ -171,6 +171,7 @@ public class YlzPayService {
            param.setWithdrawMode(withdrawMode);
            param.setOutChargeNo(outChargeNo);
            param.setOutRefundNo(outRefundNo);
            param.setRefundType("hisDecide");
            param.setIdNo(idNo);
            ResponseParams<RefundResult> response = onepayClient.refund(param);
            if (response.getRespCode().equals("000000")){

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientDao.java

@ -45,6 +45,8 @@ public interface BasePatientDao extends PagingAndSortingRepository<BasePatientDO
    
    BasePatientDO findByIdcard(String idcard);
    @Query("from BasePatientDO p where p.mobile = ?1 and p.mobile = ?2 and p.del=1")
    BasePatientDO findByIdcardAndMobile(String idcard,String mobile);
//    @Modifying
//    @Query(" update BasePatientDO a set a.openid=?2 where a.id=?1 ")
//    int updateOpenId(String id, String openId);

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientMedicareCardDao.java

@ -23,6 +23,9 @@ public interface BasePatientMedicareCardDao extends PagingAndSortingRepository<P
    @Query("from  PatientMedicareCardDO where  code= ?1 and patientCode = ?2")
    PatientMedicareCardDO findByCodeAndPatientCode(String code ,String patientCode);
    @Query("from  PatientMedicareCardDO where  code= ?1 and patientCode = ?2 and del=1")
    PatientMedicareCardDO findByCodeAndPatientCodeAndDel(String code ,String patientCode);
    PatientMedicareCardDO findByTypeAndPatientCodeAndDel(String Type,String patientCode,String del);
    boolean existsByCodeAndDel(String code,String del);

+ 31 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxAppletsAccessTokenDao.java

@ -0,0 +1,31 @@
package com.yihu.jw.wechat.dao;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxAppletsAccessTokenDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/5/18 0018.
 */
public interface WxAppletsAccessTokenDao extends PagingAndSortingRepository<WxAppletsAccessTokenDO, String>, JpaSpecificationExecutor<WxAppletsAccessTokenDO> {
    @Query("from WxAppletsAccessTokenDO w where w.wechatId =?1 order by w.addTimestamp desc")
    List<WxAppletsAccessTokenDO> getWxAccessTokenById(String wechatId);
    
    @Modifying
    @Query("delete from WxAppletsAccessTokenDO p where p.wechatId=?1 ")
    void deleteByWechatId(String wechatId);
    @Query("select p from WxAppletsAccessTokenDO p where p.code = ?1 order by p.addTimestamp desc")
    Iterable<WxAppletsAccessTokenDO> findAccessToken(String accId);
    @Modifying
    @Query("delete from WxAppletsAccessTokenDO p where p.code=?1 ")
    void deleteByAccId(String accId);
}

+ 41 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java

@ -1,5 +1,6 @@
package com.yihu.jw.wechat.service;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.wx.JsApiTicket;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
@ -7,13 +8,18 @@ import com.yihu.jw.hospital.prescription.service.entrance.HcyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.dao.WechatDao;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
public class WechatInfoService {
    private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(WechatInfoService.class);
    @Autowired
    private WechatDao wechatDao;
@ -29,6 +35,9 @@ public class WechatInfoService {
    @Autowired
    private HcyyEntranceService hcyyEntranceService;
    @Value("${wechat.id}")
    private String wxId;
    /**
     * 通过code获取判断openid
     *
@ -148,4 +157,36 @@ public class WechatInfoService {
            throw new Exception(e.getMessage());
        }
    }
    /**
     * 根据小程序获取用户手机号
     *
     * @param code
     * @return
     * @throws Exception
     */
    public String getUserPhoneByApplets(String code) throws Exception {
        System.out.println("code"+code);
        String token = wxAccessTokenService.getWxAppletsAccessTokenById(wxId).getAccessToken();
        System.out.println("token"+token);
        System.out.println("wxId"+wxId);
        if (StringUtils.isNoneBlank(code)){
            String token_url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + token;
            String params = "{\"code\": \""+code+"\"}";
            LOGGER.info("参数:"+params);
            String result = HttpUtil.sendPost(token_url, params);
            LOGGER.info("步骤1:"+result);
            if (StringUtils.isNoneBlank(result)){
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                if (object.getString("errcode").equalsIgnoreCase("0")){
                    com.alibaba.fastjson.JSONObject jsonObject= object.getJSONObject("phone_info");
                    return jsonObject.getString("phoneNumber");
                }
            }
            return null;
        }else {
            return null;
        }
    }
}

+ 127 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxAccessTokenService.java

@ -2,6 +2,7 @@ package com.yihu.jw.wechat.service;
import com.yihu.jw.entity.base.wx.JsApiTicket;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxAppletsAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
@ -10,6 +11,7 @@ import com.yihu.jw.rm.base.WechatRequestMapping;
import com.yihu.jw.wechat.dao.JsapiTicketDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxAccessTokenDao;
import com.yihu.jw.wechat.dao.WxAppletsAccessTokenDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpUtils;
import org.json.JSONObject;
@ -41,6 +43,8 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
    private JsapiTicketDao jsapiTicketDao;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private WxAppletsAccessTokenDao wxAppletsAccessTokenDao;
    public WxWechatDO getWxInfo(String wxId){
@ -118,7 +122,17 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
    public void deleteByWechatId(String wechatId){
        wxAccessTokenDao.deleteByWechatId(wechatId);
    }
    
    /**
     * wechatId 删除无效小程序token wechatId
     * @param wechatId
     */
    @Transactional
    public void deleteAppletsByWechatId(String wechatId){
        wxAppletsAccessTokenDao.deleteByWechatId(wechatId);
    }
    /**
     * 过期后删掉accesstoken,  重新获取
     * @param wechatId
@ -168,6 +182,55 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
        }
    }
    /**
     * 过期后删掉小程序accesstoken,  重新获取
     * @param wechatId
     * @return
     */
    @Transactional
    public String updateAppletsAccessToken(String wechatId){
        try {
            //根据wechatCode查找出appid和appSecret
            WxWechatDO wxWechat = wechatDao.findById(wechatId);
            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
            String appId="";
            String appSecret="";
            appId = wxWechat.getApplets();
            appSecret = wxWechat.getAppletsSecret();
            if (StringUtils.isEmpty(appId)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
            }
            if (StringUtils.isEmpty(appSecret)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
            }
            Map<String, Object> params = new HashMap<>();
            params.put("grant_type", "client_credential");
            params.put("appid", appId);
            params.put("secret", appSecret);
            String result = HttpUtils.doGet(token_url, params).getContent();
            logger.info("--------------wechat token return:"+result+"---------------");
            JSONObject json = new JSONObject(result);
            if (json.has("access_token")) {
                String token = json.get("access_token").toString();
                String expires_in = json.get("expires_in").toString();
                WxAppletsAccessTokenDO newaccessToken = new WxAppletsAccessTokenDO();
                newaccessToken.setAccessToken(token);
                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
                newaccessToken.setAddTimestamp(System.currentTimeMillis());
                newaccessToken.setCzrq(new Date());
                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
                newaccessToken.setWechatId(wechatId);
                wxAppletsAccessTokenDao.save(newaccessToken);
                return token;
            } else {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    public WxAccessTokenDO getWxAccessTokenById(String wechatId) {
        try {
            //根据wechatCode查找出appid和appSecret
@ -229,6 +292,69 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAcce
    }
    /**
     * 生成小程序token
     * @param wechatId
     * @return
     */
    public WxAppletsAccessTokenDO getWxAppletsAccessTokenById(String wechatId) {
        try {
            //根据wechatCode查找出appid和appSecret
            WxWechatDO wxWechat = wechatDao.findById(wechatId);
            List<WxAppletsAccessTokenDO> wxAccessTokens =  wxAppletsAccessTokenDao.getWxAccessTokenById(wechatId);
            if(wxWechat==null){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
            }
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
                for (WxAppletsAccessTokenDO accessToken : wxAccessTokens) {
                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
                        return accessToken;
                    } else {
                        wxAppletsAccessTokenDao.delete(accessToken);
                        break;
                    }
                }
            }
            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
            String appId="";
            String appSecret="";
            appId = wxWechat.getApplets();
            appSecret = wxWechat.getAppletsSecret();
            if (StringUtils.isEmpty(appId)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
            }
            if (StringUtils.isEmpty(appSecret)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
            }
            Map<String, Object> params = new HashMap<>();
            params.put("grant_type", "client_credential");
            params.put("appid", appId);
            params.put("secret", appSecret);
            String result = HttpUtils.doGet(token_url, params).getContent();
            logger.info("--------------wechat token return:"+result+"---------------");
            JSONObject json = new JSONObject(result);
            if (json.has("access_token")) {
                String token = json.get("access_token").toString();
                String expires_in = json.get("expires_in").toString();
                WxAppletsAccessTokenDO newaccessToken = new WxAppletsAccessTokenDO();
                newaccessToken.setAccessToken(token);
                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
                newaccessToken.setAddTimestamp(System.currentTimeMillis());
                newaccessToken.setCzrq(new Date());
                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
                newaccessToken.setWechatId(wechatId);
                wxAppletsAccessTokenDao.save(newaccessToken);
                return newaccessToken;
            } else {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 泰安获取token
     * @param wechatId

+ 4 - 0
business/base-service/src/mqConfig/esbmq-config.xml

@ -89,6 +89,10 @@
				<BS15036_0>EwellQ.S60.BS15036.PUT</BS15036_0>
				<BS15036_1>EwellQ.S60.BS15036.GET</BS15036_1>
				<!--诊间结算-->
				<BS10108_0>EwellQ.S60.BS10108.PUT</BS10108_0>
				<BS10108_1>EwellQ.S60.BS10108.GET</BS10108_1>
				<!--his退费接口-->
				<BS15051_0>EwellQ.S60.BS15051.PUT</BS15051_0>
				<BS15051_1>EwellQ.S60.BS15051.GET</BS15051_1>

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -294,6 +294,18 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    private String levelName;
    private String isSign;
    private Date lastSignTime;
    private String appletQrCode;
    @Column(name = "applet_qr_code")
    public String getAppletQrCode() {
        return appletQrCode;
    }
    public void setAppletQrCode(String appletQrCode) {
        this.appletQrCode = appletQrCode;
    }
    @Column(name = "is_sign")
    public String getIsSign() {
        return isSign;

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -294,6 +294,8 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String homeLatLon;//家庭经纬度
    private String verifyCode;//眼科token
    @Column(name = "medical_state")
    public String getMedicalState() {
@ -931,4 +933,13 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setHomeLatLon(String homeLatLon) {
        this.homeLatLon = homeLatLon;
    }
    @Column(name="verify_code")
    public String getVerifyCode() {
        return verifyCode;
    }
    public void setVerifyCode(String verifyCode) {
        this.verifyCode = verifyCode;
    }
}

+ 84 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxAppletsAccessTokenDO.java

@ -0,0 +1,84 @@
package com.yihu.jw.entity.base.wx;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.*;
import java.util.Date;
/**
 * 微信 accesstoken表
 */
@Entity
@Table(name = "wx_applets_access_token")
public class WxAppletsAccessTokenDO extends UuidIdentityEntity implements java.io.Serializable {
	// Fields
	private String wechatId;//关联的微信code 关联表 Wx_Wechat
	private String accessToken;//调用微信返回的accesstoken
	private Long addTimestamp;//创建时间 秒数
	private Long expiresIn;//凭证有效时间(秒)
	private Date czrq;//操作时间
	private String code;
	/** default constructor */
	public WxAppletsAccessTokenDO() {
	}
	@Column(name = "wechat_id", length = 64)
	public String getWechatId() {
		return wechatId;
	}
	public void setWechatId(String wechatId) {
		this.wechatId = wechatId;
	}
	@Column(name = "access_token", nullable = false, length = 300)
	public String getAccessToken() {
		return this.accessToken;
	}
	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}
	@Column(name = "add_timestamp", nullable = false, precision = 15, scale = 0)
	public long getAddTimestamp() {
		return this.addTimestamp;
	}
	public void setAddTimestamp(long addTimestamp) {
		this.addTimestamp = addTimestamp;
	}
	@Column(name = "expires_in", nullable = false)
	public Long getExpiresIn() {
		return this.expiresIn;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "czrq", nullable = false, length = 0)
	public Date getCzrq() {
		return this.czrq;
	}
	public void setCzrq(Date czrq) {
		this.czrq = czrq;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public void setExpiresIn(long expiresIn) {
		this.expiresIn = expiresIn;
	}
}

+ 12 - 0
server/svr-authentication/pom.xml

@ -77,6 +77,18 @@
            <!-- <scope>runtime</scope> -->
        </dependency>
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Redis  -->
        <dependency>
            <groupId>org.springframework.boot</groupId>

+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -861,7 +861,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        KeyPair keyPair = (KeyPair) request.getSession().getAttribute("privateKey");
        String idcard = com.yihu.jw.security.utils.RSAUtils.decryptBase64(request.getParameter("idcard"), keyPair);
        logger.info("idcard"+idcard);
        return idcard;
    }

+ 14 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/WlyyHttpLogDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.security.dao;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2019/6/25.
 */
public interface WlyyHttpLogDao extends PagingAndSortingRepository<WlyyHttpLogDO, String>, JpaSpecificationExecutor<WlyyHttpLogDO> {
}

+ 145 - 114
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -165,6 +165,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    private WlyyHospitalSysDictDao wlyyhospitalSysdictDao;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private HcyyService hcyyService;
    @PostConstruct
@ -260,136 +262,151 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
     */
    @RequestMapping(value = "/oauth/login", method = RequestMethod.POST)
    public ResponseEntity<Oauth2Envelop<WlyyUserSimple>> login(@RequestParam Map<String, String> parameters, HttpSession httpSession) throws Exception {
        try{
            logger.info("login:登录进入1");
            //图形验证码验证
            String key = parameters.get("key");
            String text = parameters.get("text");
        logger.info("login:登录进入1");
        //图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
            if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
                if(!verifyCaptcha(key,text)){
                    throw new ImgCaptchaException("img_captcha error");
                }
            }
        }
        logger.info("login:登录进入2");
            logger.info("login:登录进入2");
        String flag = parameters.get("flag");
            String flag = parameters.get("flag");
        String username = parameters.get("username");
        if (StringUtils.isEmpty(username)&&StringUtils.isEmpty(flag)) {
            throw new InvalidRequestException("username");
        }
        String client_id = parameters.get("client_id");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if("alipay".equals(flag)||"family".equals(flag)){
            //支付宝登录||家人登录
            parameters.put("grant_type", flag);
            String encdata = parameters.get("encdata");
            if("alipay".equals(flag)){
                encdata = AES.decrypt(encdata);
            }else{
                encdata = AesEncryptUtils.agDecrypt(encdata);
            }
            String data[] = encdata.split(":");
            username = data[1];
            parameters.put("username", username);
        }else if (StringUtils.isEmpty(parameters.get("captcha"))) {
            parameters.put("grant_type", "password");
            //解密密码
            if (parameters.get("password") != null) {
                KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
                String password = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("password"), keyPair);
                parameters.put("password", password);
            String username = parameters.get("username");
            logger.info(username);
            if (StringUtils.isEmpty(username)&&StringUtils.isEmpty(flag)) {
                throw new InvalidRequestException("username");
            }
            String client_id = parameters.get("client_id");
            if (StringUtils.isEmpty(client_id)) {
                throw new InvalidRequestException("client_id");
            }
            if("alipay".equals(flag)||"family".equals(flag)){
                //支付宝登录||家人登录
                parameters.put("grant_type", flag);
                String encdata = parameters.get("encdata");
                if("alipay".equals(flag)){
                    encdata = AES.decrypt(encdata);
                }else{
                    encdata = AesEncryptUtils.agDecrypt(encdata);
                }
                String data[] = encdata.split(":");
                username = data[1];
                parameters.put("username", username);
            }else if (StringUtils.isEmpty(parameters.get("captcha"))) {
                parameters.put("grant_type", "password");
                //解密密码
                if (parameters.get("password") != null) {
                    KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
                    String password = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("password"), keyPair);
                    parameters.put("password", password);
                } else {
                    //第三方同步账号模式登录
                    parameters.put("grant_type", "ihealthCode");
                }
            } else {
                //第三方同步账号模式登录
                parameters.put("grant_type", "ihealthCode");
                parameters.put("grant_type", "captcha");
            }
        } else {
            parameters.put("grant_type", "captcha");
        }
        logger.info("login:登录进入3");
            logger.info("login:登录进入3");
        ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
        if (null == authenticatedClient) {
            throw new InvalidRequestException("client_id");
        }
        logger.info("login:登录进入4"+authenticatedClient.getClientId());
            ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
            if (null == authenticatedClient) {
                throw new InvalidRequestException("client_id");
            }
            logger.info("login:登录进入4"+authenticatedClient.getClientId());
        TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
        oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
        OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
        if (token == null) {
            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
        }
            TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
            oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
            OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
            if (token == null) {
                throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
            }
        /*如果是移动端登陆则移除之前的token,
        在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
        实现同一账号只能在一处登陆*/
        if("1".equals(kickEachOther)){
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
                tokenStore.removeAccessToken(token.getValue());
                tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
                token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
           /* if("1".equals(kickEachOther)){
                logger.info("");
                HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
                if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
                    if (tokenStore.readAccessToken(token.getValue())!=null){
                        tokenStore.removeAccessToken(token.getValue());
                        tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
                        token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
                    }
                }
                if (token == null) {
                    throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
                }
            }*/
            WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
            if ("pad".equals(parameters.get("clientType"))&&!("1".equals(wlyyUserSimple.getArchiveType())) ){//医养平板端登录限制
                throw new InvalidGrantException("不允许登录该平台");
            }
            if (token == null) {
                throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
            logger.info("wlyyUserSimple::"+wlyyUserSimple);
            wlyyUserSimple.setAccessToken(token.getValue());
            wlyyUserSimple.setTokenType(token.getTokenType());
            wlyyUserSimple.setExpiresIn(token.getExpiresIn());
            wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
            wlyyUserSimple.setUser(parameters.get("username"));
            wlyyUserSimple.setState(parameters.get("state"));
            String loginType = parameters.get("login_type");
            String openid = parameters.get("openid");
            String wechatId = parameters.get("wechatId");
            logger.info("login:登录进入7");
            //更新患者openId
            BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
            logger.info("gengxin开始");
            if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && ("3".equals(loginType)||"4".equalsIgnoreCase(loginType))) {
                baseLoginLogDO.setOpenid(openid);
                logger.info("gengxin进入"+openid);
                userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
                if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                    logger.info("gengxin进入"+wechatId);
                    userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
                }
            }
        }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        if ("pad".equals(parameters.get("clientType"))&&!("1".equals(wlyyUserSimple.getArchiveType())) ){//医养平板端登录限制
            throw new InvalidGrantException("不允许登录该平台");
        }
        wlyyUserSimple.setAccessToken(token.getValue());
        wlyyUserSimple.setTokenType(token.getTokenType());
        wlyyUserSimple.setExpiresIn(token.getExpiresIn());
        wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
        wlyyUserSimple.setUser(parameters.get("username"));
        wlyyUserSimple.setState(parameters.get("state"));
        String loginType = parameters.get("login_type");
        String openid = parameters.get("openid");
        String wechatId = parameters.get("wechatId");
        logger.info("login:登录进入7");
        //更新患者openId
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        logger.info("gengxin开始");
        if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && ("3".equals(loginType)||"4".equalsIgnoreCase(loginType))) {
            baseLoginLogDO.setOpenid(openid);
            logger.info("gengxin进入"+openid);
            userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
            if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                logger.info("gengxin进入"+wechatId);
                userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
            if (parameters.get("password") != null) {
                //使用密码登录成功后, 更新失败次数为 0
                userDetailsService.addFailureCount(username, 0);
            }
        }
        if (parameters.get("password") != null) {
            //使用密码登录成功后, 更新失败次数为 0
            userDetailsService.addFailureCount(username, 0);
        }
        userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
            logger.info("login:登录进入8");
        String clientType = parameters.get("clientType");
        baseLoginLogDO.setUserId(wlyyUserSimple.getId());
        baseLoginLogDO.setCreateTime(new Date());
        String userAgent = JSONObject.toJSONString(wlyyUserSimple);
        baseLoginLogDO.setUserAgent(userAgent);
        baseLoginLogDO.setLoginType(loginType);
        baseLoginLogDO.setName(wlyyUserSimple.getName());
        baseLoginLogDO.setClientType(clientType);
        baseLoginLogService.save(baseLoginLogDO);
            userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
        //个推 clientId
        String clientId = parameters.get("getuiClientId");
        String getuiClientType = parameters.get("getuiClientType");
        String padImei = parameters.get("padImei");
        //客户端类型 app,wx,pad,pc
        userDetailsService.updateInfo(clientId,getuiClientType,padImei,loginType,wlyyUserSimple.getId(),baseLoginLogDO);
            logger.info("login:登录进入9");
            String clientType = parameters.get("clientType");
            baseLoginLogDO.setUserId(wlyyUserSimple.getId());
            baseLoginLogDO.setCreateTime(new Date());
            String userAgent = JSONObject.toJSONString(wlyyUserSimple);
            baseLoginLogDO.setUserAgent(userAgent);
            baseLoginLogDO.setLoginType(loginType);
            baseLoginLogDO.setName(wlyyUserSimple.getName());
            baseLoginLogDO.setClientType(clientType);
            baseLoginLogService.save(baseLoginLogDO);
            logger.info("login:登录进入10");
                  /*  //个推 clientId
                    String clientId = parameters.get("getuiClientId");
                    String getuiClientType = parameters.get("getuiClientType");
                    String padImei = parameters.get("padImei");
                    //客户端类型 app,wx,pad,pc
                    userDetailsService.updateInfo(clientId,getuiClientType,padImei,loginType,wlyyUserSimple.getId(),baseLoginLogDO);
            */
            return getResponse(wlyyUserSimple);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
        return getResponse(wlyyUserSimple);
    }
@ -1443,6 +1460,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            return ObjEnvelop.getSuccess("success", xzzxService.getQRCode());
        }else if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            return ObjEnvelop.getSuccess("success", ykyyService.getQRCode());
        }else if (wechatId.equalsIgnoreCase("xm_hcyy_wx")){
            return ObjEnvelop.getSuccess("success", hcyyService.getQRCode());
        }else {
            return ObjEnvelop.getSuccess("success", null);
        }
@ -1500,6 +1519,17 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            openId = jsonObject.getString("userJobNum");
            jsonObject.put("qrCodeStatus",jsonObject.getString("qrCodeStatus"));
            rs.put("code",1000);
        }else if (wechatId.equalsIgnoreCase("xm_hcyy_wx")){
            rs = hcyyService.getTokeninfo(qrcode);
            JSONObject jsonObject = rs.getJSONObject("data");
            logger.info("查询登录信息"+rs);
            String qrCodeStatus = rs.getString("code");
            if(!"10000".equalsIgnoreCase(qrCodeStatus)){
                return ObjEnvelop.getSuccess("error",rs);
            }
            username = jsonObject.getString("idcard");
            jsonObject.put("qrCodeStatus","LoginQrCodeBeenScan");
            rs.put("code",1000);
        }
        if (org.apache.commons.lang.StringUtils.isNotBlank(username)){
@ -2379,6 +2409,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                                                basePatientDO.setSalt(salt);
                                                basePatientDO.setLocked(0);
                                                basePatientDO.setEnabled(1);
                                                basePatientDO.setVerifyCode(jsonObject.getString("TOKEN"));
                                                basePatientDO.setPatientStatus("1");
                                                basePatientDao.save(basePatientDO);
                                            }else {
@ -2449,7 +2480,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                                        basePatientDO1.setName(tel);
                                    }
                                }
                                basePatientDO1.setVerifyCode(jsonObject.getString("TOKEN"));
                                basePatientDO1.setUserId(userId);
                                basePatientDao.save(basePatientDO1);
                                /*String familyList = ykyyService.getFamilyList(null,userId);

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 208 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/HcyyService.java


+ 72 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/utils/WebserviceUtil.java

@ -0,0 +1,72 @@
package com.yihu.jw.security.utils;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.namespace.QName;
import java.util.Map;
/**
 * Created by hzp on 2017/7/31.
 * webservice调用服务
 **/
public class WebserviceUtil {
    private static Logger logger = LoggerFactory.getLogger(WebserviceUtil.class);
    /**
     * webservice 调用接口
     */
    public static String post(String urlString,String namespace,String api, Map<String,String> params) throws Exception {
        try {
            logger.info("ca_url:"+urlString);
            logger.info("ca_namespace:"+namespace);
            logger.info("api:"+api);
            Service service = new Service();
            logger.info("=======>通过service创建call对象");
            Call call = (Call) service.createCall();// 通过service创建call对象
            logger.info("=======>设置service所在URL");
            // 设置service所在URL
            call.setTargetEndpointAddress(new java.net.URL(urlString));
            call.setOperationName(new QName(namespace, api));
            call.setUseSOAPAction(true);
            Object[] objs = null;
            logger.info("=======>组装参数:"+params.size());
            if(params!=null && params.size()>0)
            {
                logger.info("=======>遍历参数");
                objs = new Object[params.size()];
                int i=0;
                for(String key : params.keySet())
                {
                    logger.info("=======>参数key:"+key);
                    logger.info("=======>接口参数:"+key);
                    call.addParameter(new QName(key), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的参数
                    logger.info("=======>参数值:"+params.get(key));
                    objs[i] = params.get(key);
                    i++;
                }
            }
            logger.info("=======>设置返回类型");
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
            logger.info("=======>开始请求");
            String  ret = (String)call.invoke(objs);
            logger.info("=======>请求结果:"+ret);
            logger.info("=======>请求结果.toString():"+ret.toString());
            return ret.toString();
        } catch (Exception e) {
            logger.info("=======>CA请求报错:"+e.getMessage());
            e.printStackTrace();
            throw e;
        }
    }
}

+ 38 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -150,8 +150,6 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private WechatInfoService wechatInfoService;
    @Value("${wechat.id}")
    private String wxId;
    @Value("${pay.flag}")
@ -246,6 +244,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private String isClose;
    @Value("${testPattern.remote_inner_url}")
    private String remote_inner_url;
    @Autowired
    private WechatInfoService wechatInfoService;
@ -402,13 +402,15 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorInfo)
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    public Envelop findDoctorInfo(@ApiParam(name = "doctor", value = "医生code")
                                     @RequestParam(value = "doctor", required = true)String doctor,
                                     @RequestParam(value = "doctor", required = false)String doctor,
                                  @ApiParam(name = "idcard", value = "医生身份证")
                                  @RequestParam(value = "idcard", required = false)String idcard,
                                     @ApiParam(name = "withWork", value = "传1带排班,其他不带")
                                     @RequestParam(value = "withWork", required = false)String withWork,
                                     @ApiParam(name = "patient", value = "患者code")
                                         @RequestParam(value = "patient", required = false)String patient)throws Exception{
        try {
            return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
            return success(prescriptionService.findDoctorInfo(doctor,idcard,withWork,patient));
        }catch (Exception e){
            return  failedException(e);
        }
@ -992,6 +994,32 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "setXcxQrCode")
    @ApiOperation(value = "生成医生小程序二维码")
    public Envelop setXcxQrCode(@ApiParam(name = "doctor", value = "doctor", required = false)
                             @RequestParam(value = "doctor", required = true)String doctor) throws Exception{
        try {
            String uri = qrcodeService.makeSpecialistXcxQrcode(doctor);
            return success("操作成功",uri);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = "getUserPhoneApplets")
    @ApiOperation(value = "根据小程序获取用户手机号")
    public Envelop getUserPhoneApplets(@ApiParam(name = "code", value = "code", required = true)
                                @RequestParam(value = "code", required = true)String code) throws Exception{
        try {
            String uri = wechatInfoService.getUserPhoneByApplets(code);
            return success("操作成功",uri);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setUrlCode)
    @ApiOperation(value = "生成链接推送")
    public Envelop setUrlCode(@ApiParam(name = "flag", value = "flag", required = true)
@ -2239,11 +2267,17 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
        logger.info("action:doctorReviewConsultCount--start:doctor"+doctor);
        result.put("imgCount",prescriptionService.getWaitVideoCount(doctor,"1","1",wxId));//图文复诊数量
        result.put("imgTotal",prescriptionService.getVideoCount(doctor,"1","1",wxId));//图文复诊总数量
        result.put("videoCount",prescriptionService.getWaitVideoCount(doctor,"2","1",wxId));//视频复诊数量
        result.put("videoTotal",prescriptionService.getVideoCount(doctor,"2","1",wxId));//视频复诊总数量
        result.put("xtCount",prescriptionService.getWaitVideoCount(doctor,"","2",wxId));//协同门诊候诊数量
        result.put("xtTotal",prescriptionService.getVideoCount(doctor,"","2",wxId));//协同门诊候诊总数量
        result.put("imgConsultCount",prescriptionService.getWaitVideoCount(doctor,"1","3",wxId));//图文咨询数量
        result.put("imgConsultTotal",prescriptionService.getVideoCount(doctor,"1","3",wxId));//图文咨询总数量
        result.put("videoConsultCount",prescriptionService.getWaitVideoCount(doctor,"2","3",wxId));//视频咨询数量
        result.put("videoConsultTotal",prescriptionService.getVideoCount(doctor,"2","3",wxId));//视频咨询总数量
        result.put("homeConsultCount",prescriptionService.getWaitVideoCount(doctor,"3","3",wxId));//家医咨询数量
        result.put("homeConsultTotal",prescriptionService.getVideoCount(doctor,"3","3",wxId));//家医咨询总数量
        Integer unreadMessageCount = imService.SessionsUnreadMessageCount(doctor,"1");
        result.put("zjUnreadMessageCount",unreadMessageCount);//专家咨询未读数
        if ("sd_tnzyy_wx".equalsIgnoreCase(wxId)){

+ 30 - 5
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -30,6 +30,8 @@ import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.*;
import com.yihu.jw.hospital.prescription.service.entrance.*;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.hospital.service.consult.QrcodeService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.util.ImUtil;
@ -160,6 +162,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public ImUtil imUtil;
    @Autowired
    private HcyyEntranceService hcyyEntranceService;
    @Autowired
    private YkyyService ykyyService;
    @Autowired
    private QrcodeService qrcodeService;
    @PostMapping(value = "updPrescriptionExpressage")
    @ApiOperation(value = "修改续方收货信息")
@ -569,7 +575,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "chargeType", required = false) String chargeType) throws Exception {
        try {
   /*     try {*/
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson, expressageJson, registerJson, chargeType);
            if (wlyyOutpatientDO != null && null == wlyyOutpatientDO.getId() && !wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")) {
                ObjEnvelop objEnvelop = new ObjEnvelop();
@ -611,9 +617,9 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                return success(BaseHospitalRequestMapping.Prescription.api_success, wlyyOutpatientDO);
            }
        } catch (Exception e) {
     /*   } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
        }*/
    }
@ -1091,12 +1097,25 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                     @ApiParam(name = "patient", value = "患者code")
                                     @RequestParam(value = "patient", required = false) String patient) {
        try {
            return success(prescriptionService.findDoctorInfo(doctor, withWork, patient));
            return success(prescriptionService.findDoctorInfo(doctor,null, withWork, patient));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "setXcxQrCode")
    @ApiOperation(value = "生成医生小程序二维码")
    public Envelop setXcxQrCode(@ApiParam(name = "doctor", value = "doctor", required = false)
                                @RequestParam(value = "doctor", required = true)String doctor) throws Exception{
        try {
            String uri = qrcodeService.makeSpecialistXcxQrcode(doctor);
            return success("操作成功",uri);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateDoctorInfo)
    @ApiOperation(value = "更新医生信息", notes = "更新医生信息")
    public ObjEnvelop updateDoctorInfo(@ApiParam(name = "id", value = "医生id")
@ -1799,7 +1818,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取医生签名")
    public ObjEnvelop getDoctorPreSign(@ApiParam(name = "doctor", value = "医生编码")
                                       @RequestParam(value = "doctor", required = false) String doctor) throws Exception {
        return success(doctorPreSignService.getDoctorSign(doctor));
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            return success(doctorPreSignService.getDoctorSign(doctor));
        }else if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
            return success(ykyyService.getSignPicture(doctor));
        }else {
            return success("功能尚未开通","500");
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDoctorIntroduction)

+ 21 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

@ -11,6 +11,7 @@ import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -419,4 +420,24 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "GetFYQD")
    @ApiOperation(value = "门诊费用查询", notes = "门诊费用查询")
    public Envelop GetFYQD(@ApiParam(name = "familyId", value = "家庭关系id")
                                         @RequestParam(value = "familyId", required = false)String familyId,
                           @ApiParam(name = "loginId", value = "登录用户")
                           @RequestParam(value = "loginId", required = false)String loginId,
                           @ApiParam(name = "startDate", value = "开始时间")
                                         @RequestParam(value = "startDate", required = false)String startDate,
                           @ApiParam(name = "endDate", value = "结束时间")
                                         @RequestParam(value = "endDate", required = false)String endDate)throws Exception {
        try {
            return success("ok",prescriptionService.GetFYQD(familyId,startDate,endDate,loginId));
        }catch (Exception e) {
            return  failedListEnvelopException(e);
        }
    }
}

+ 156 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/QrcodeService.java

@ -28,13 +28,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import javax.transaction.Transactional;
import java.io.InputStream;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@ -171,6 +173,69 @@ public class QrcodeService {
        }
    }
    /**
     * 生成某个医生的小程序二维码
     *
     * @param doctor
     * @return
     * @throws Exception
     */
    public String makeSpecialistXcxQrcode(String doctor) throws Exception {
        System.out.println("doctorID"+doctor);
        String token = wxAccessTokenService.getWxAppletsAccessTokenById(wxId).getAccessToken();
        System.out.println("token"+token);
        System.out.println("wxId"+wxId);
        if (StringUtils.isNoneBlank(doctor)){
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
            if (null!=baseDoctorDO){
                if (null==baseDoctorDO.getAppletQrCode()||"".equals(baseDoctorDO.getAppletQrCode())){
                    // 二维码图片文件名
                    String fileName = baseDoctorDO.getId()+".png";
                    System.out.println("fileName"+fileName);
                    // 通过微信接口生成医生二维码
                    String page = "pages/patient/index";
                    String scene = "_t=doc&_c="+baseDoctorDO.getIdcard()+"";
                    String uri = makeXcxQrcodeFromWx(fileName,page,scene,token);
                    System.out.println("uri"+uri);
                    baseDoctorDO.setAppletQrCode(uri);
                    baseDoctorDao.save(baseDoctorDO);
                    return uri;
                }else {
                    return baseDoctorDO.getAppletQrCode();
                }
            } else {
                throw new Exception("找不到对应医生信息!");
            }
        }else {
            Iterable<BaseDoctorDO> doctors = baseDoctorDao.findByDel();
            for (BaseDoctorDO doctorDO : doctors) {
                if (null!=doctorDO){
                    if (null==doctorDO.getAppletQrCode()||"".equals(doctorDO.getAppletQrCode())){
                        // 二维码图片文件名
                        String fileName = doctorDO.getId()+".png";
                /*String path = QrcodeService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
                        + File.separator + "qrcode";*/
                        System.out.println("fileName"+fileName);
                        // 通过微信接口生成医生二维码
                        String page = "pages/patient/index";
                        String scene = "_t=doc&_c="+doctorDO.getIdcard()+"";
                        String uri = makeXcxQrcodeFromWx(fileName,page,scene,token);
                        System.out.println("uri"+uri);
                        doctorDO.setAppletQrCode(uri);
                        baseDoctorDao.save(doctorDO);
                        return uri;
                    }else {
                        return doctorDO.getAppletQrCode();
                    }
                } else {
                    throw new Exception("找不到对应医生信息!");
                }
            }
        }
        return null;
    }
    public String makeUrlQrcode(String flag) throws Exception {
        System.out.println("flag"+flag);
@ -273,6 +338,96 @@ public class QrcodeService {
        }
        return null;
    }
    /**
     * 从微信生成小程序二维码并下载到本地
     * @param fileName
     * @param page
     * @param scene
     * @param accessToken
     * @return
     */
     public String makeXcxQrcodeFromWx(String fileName, String page, String scene, String accessToken) {
           try {
           /*    String token_url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
               String params = "{\n" +
                       " \"page\": \""+page+"\",\n" +
                       " \"scene\": \""+scene+"\",\n" +
                       " \"check_path\": true,\n" +
                       " \"env_version\": \"release\"\n" +
                       "}";
               LOGGER.info("参数:"+params);
               String result = HttpUtil.sendPost(token_url, params);
               LOGGER.info("步骤1:"+result);*/
               //调用微信接口生成二维码
               URL url = new URL("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken);
               HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
               httpURLConnection.setRequestMethod("POST");// 提交模式
               // conn.setConnectTimeout(10000);//连接超时 单位毫秒
               // conn.setReadTimeout(2000);//读取超时 单位毫秒
               // 发送POST请求必须设置如下两行
               httpURLConnection.setDoOutput(true);
               httpURLConnection.setDoInput(true);
               // 获取URLConnection对象对应的输出流
               PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream());
               // 发送请求参数
               JSONObject paramJson = new JSONObject();
               //这就是你二维码里携带的参数 String型  名称不可变
               paramJson.put("scene", scene);
               //注意该接口传入的是page而不是path
               paramJson.put("page", page);
               paramJson.put("width", 430);
               //这是设置扫描二维码后跳转的页面
           /*    paramJson.put("width", 430);*/
              /* paramJson.put("is_hyaline", false);*/
            /*   paramJson.put("auto_color", true);*/
               printWriter.write(paramJson.toString());
               // flush输出流的缓冲
               printWriter.flush();
               /*BufferedInputStream bis = new BufferedInputStream(httpURLConnection.getInputStream());
               OutputStream os = new FileOutputStream(new File("C:/Users/wangzhinan/Desktop/1.png"));
               int len;
               byte[] arr = new byte[1024];
               while ((len = bis.read(arr)) != -1) {
                    os.write(arr, 0, len);
                    os.flush();
               }
               os.close();*/
               //开始获取数据
               InputStream inputStream = httpURLConnection.getInputStream();
               UploadVO uploadVO = new UploadVO();
               MultipartFile multipartFile = new MockMultipartFile(fileName,fileName,"", inputStream);
               if (isClose.equalsIgnoreCase("1")){
                   System.out.println("isClose"+1);
                   Map<String, Object> map = fileUploadService.uploadImg(multipartFile);
                   uploadVO.setFullUri(map.get("accessory").toString());
               }else if(isClose.equals("2")){
                   System.out.println("isClose"+2);
                   String originalFilename = multipartFile.getOriginalFilename();
                   String[] fs = originalFilename.split("\\.");
                   String type = fs[1];
                   //内网上传
                   String rs = fileUploadService.request(remote_inner_url,multipartFile,type);
                   System.out.println("rs"+rs);
                   com.alibaba.fastjson.JSONObject rsJson = JSON.parseObject(rs);
                   uploadVO = objectMapper.readValue(rsJson.getJSONObject("obj").toJSONString(),UploadVO.class);
                   inputStream.close();
               }else {
                   // 上传服务器
                   uploadVO = fileUploadService.uploadStream(multipartFile.getInputStream(),fileName,fastdfs_file_url);
               }
               return uploadVO.getFullUri();
           }catch (Exception e){
               e.printStackTrace();
           }
           return null;
     }
    public ObjEnvelop getWXUserInfo(String patient) throws Exception{
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        ObjEnvelop objEnvelop = new ObjEnvelop();