Bladeren bron

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

 Conflicts:
	svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java
liubing 3 jaren geleden
bovenliggende
commit
f40697fc19
44 gewijzigde bestanden met toevoegingen van 2588 en 320 verwijderingen
  1. 140 30
      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. 135 41
      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. 435 98
      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. 11 0
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  10. 3 1
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  11. 2 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientDao.java
  12. 3 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientMedicareCardDao.java
  13. 31 1
      business/base-service/src/main/java/com/yihu/jw/utils/PinYinUtils.java
  14. 31 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxAppletsAccessTokenDao.java
  15. 41 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java
  16. 127 1
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxAccessTokenService.java
  17. 12 0
      business/base-service/src/mqConfig/esbmq-config.xml
  18. 4 1
      common/common-entity/sql记录
  19. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  20. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/login/BaseLoginLogDO.java
  21. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  22. 84 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxAppletsAccessTokenDO.java
  23. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  24. 12 0
      server/svr-authentication/pom.xml
  25. 1 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  26. 14 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/dao/WlyyHttpLogDao.java
  27. 145 114
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  28. 208 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/HcyyService.java
  29. 1 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java
  30. 72 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/utils/WebserviceUtil.java
  31. 21 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/common/BaseLoginLogDao.java
  32. 8 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/apply/PatientBedApplyEndPoint.java
  33. 41 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java
  34. 45 9
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java
  35. 78 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java
  36. 20 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java
  37. 24 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  38. 16 4
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/birthday/BirthdayWishesService.java
  39. 162 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/common/PermissionService.java
  40. 4 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/healthCare/HealthCareEndPoint.java
  41. 38 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  42. 61 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  43. 21 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  44. 229 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/QrcodeService.java

+ 140 - 30
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,16 @@ 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;
import com.yihu.jw.util.common.LatitudeUtils;
@ -34,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;
@ -90,6 +87,10 @@ public class HealthCareService {
    private YlzMedicailMxDao ylzMedicailMxDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    private String ylzConfigUrl;
    private String ylzConfigAppid;
@ -386,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("未配置网点编号");
@ -395,30 +402,131 @@ public class HealthCareService {
        String his_serial = outpatientDO.getRegisterNo();
        String org_code = hospitalSysDictDO.getDictCode();
        JSONObject data;
        JSONObject data = new JSONObject();
        if (StringUtils.isNoneBlank(wxId)){
            if (wxId.equalsIgnoreCase("xm_xzzx_wx")){}
        }
        //获取his处方信息
        JSONObject infoObject= xzzxEntranceService.presUploadToEntrance(icCardNo,his_serial,org_code);
       /* if (infoObject!=null){
            if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                //获取his处方信息
                JSONObject infoObject= xzzxEntranceService.presUploadToEntrance(icCardNo,his_serial,org_code);
                JSONObject info = infoObject.getJSONArray("data").getJSONObject(0);
                if("0".equals(info.getString("ret_code"))){
                    data = info;
                }else {
                    throw new Exception("获取his处方信息失败:"+infoObject.getString("ret_mess"));
                }
        }*/
       JSONObject info = infoObject.getJSONArray("data").getJSONObject(0);
        if("0".equals(info.getString("ret_code"))){
            data = info;
        }else {
            throw new Exception("获取his处方信息失败:"+infoObject.getString("ret_mess"));
                data.remove("ret_code");
                data.remove("ret_mess");
                data.remove("log_no");
                data.put("order_id",prescriptionId);
            }else if(wxId.equalsIgnoreCase("xm_zsyy_wx")){
                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){
                            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);
                            }
                        }
                    }
                }
            }
        }
        data.remove("ret_code");
        data.remove("ret_mess");
        data.remove("log_no");
        data.put("order_id",prescriptionId);
        YlzMedicalPrescriptionUploadDO uploadDO = new YlzMedicalPrescriptionUploadDO();
        uploadDO.setOrgCode(org_code);
        uploadDO.setIcCardNo(icCardNo);
@ -427,7 +535,7 @@ public class HealthCareService {
        uploadDO.setPrescriptionId(prescriptionId);
        uploadDO.setRegionCode(data.getString("region_code"));
        uploadDO.setName(data.getString("name"));
        uploadDO.setIdcard(data.getString("idcard"));
        uploadDO.setIdcard(outpatientDO.getIdcard());
        uploadDO.setCertType(data.getString("cert_type"));
        uploadDO.setDataSource("53");//53移动支付
        uploadDO.setInsuranceSerial(data.getString("insurance_serial"));
@ -446,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"));

+ 135 - 41
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");
@ -12543,26 +12614,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if(StringUtils.isNoneBlank(itemPrice)){
                natFee= Double.parseDouble(itemPrice)*100;
            }
            //先预约号源
            Date format2 = null;
            format2 = new SimpleDateFormat("yyyy-MM-dd").parse(natTime);
            String shortDate = new SimpleDateFormat("yyyyMMdd").format(format2);
            System.out.println("yyyy-MM-dd转yyyyMMdd:"+shortDate);
            String regRes=tasyNatService.saveRegOrder(regDept,shortDate,pm,preNo,cardNo,mobile,name,"3");
            com.alibaba.fastjson.JSONObject regObj = com.alibaba.fastjson.JSONObject.parseObject(regRes);
            String HisSeqNo="";
            String orderNum="";
            if (regObj!=null){
                if ("true".equalsIgnoreCase(regObj.getString("success"))){
                    com.alibaba.fastjson.JSONObject dataObj = com.alibaba.fastjson.JSONObject.parseObject(regObj.getString("data"));
                    HisSeqNo=dataObj.getString("HisSeqNo").trim();
                    orderNum=dataObj.getString("OrderNumber").trim();
                }else {
                    returnMap.put("msg",regObj.getString("data"));
                    returnMap.put("status","-1");
                    return  returnMap;
            WlyyHospitalSysDictDO tasyTime = wlyyHospitalSysDictDao.findById("natTime");
            if (tasyTime!=null){
                String natTimeC   = tasyTime.getDictValue();
                if (natTimeC.equalsIgnoreCase("1")){
                    //先预约号源
                    Date format2 = null;
                    format2 = new SimpleDateFormat("yyyy-MM-dd").parse(natTime);
                    String shortDate = new SimpleDateFormat("yyyyMMdd").format(format2);
                    System.out.println("yyyy-MM-dd转yyyyMMdd:"+shortDate);
                    String regRes=tasyNatService.saveRegOrder(regDept,shortDate,pm,preNo,cardNo,mobile,name,"3");
                    com.alibaba.fastjson.JSONObject regObj = com.alibaba.fastjson.JSONObject.parseObject(regRes);
                    if (regObj!=null){
                        if ("true".equalsIgnoreCase(regObj.getString("success"))){
                            com.alibaba.fastjson.JSONObject dataObj = com.alibaba.fastjson.JSONObject.parseObject(regObj.getString("data"));
                            HisSeqNo=dataObj.getString("HisSeqNo").trim();
                            orderNum=dataObj.getString("OrderNumber").trim();
                        }else {
                            returnMap.put("msg",regObj.getString("data"));
                            returnMap.put("status","-1");
                            return  returnMap;
                        }
                    }
                }
            }
            //先进行核算检测预约
            String realOrder="";
            String addressNow=provinceName+cityName+townName+streetName+address;
@ -12577,7 +12657,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    if ("0".equalsIgnoreCase(returnCode)){
                        returnMap.put("msg",object.getString("data"));
                        returnMap.put("status","-1");
                        tasyNatService.cancleOrder(cardNo,HisSeqNo,orderNum);
                        if (tasyTime.getDictValue().equalsIgnoreCase("1")){
                            tasyNatService.cancleOrder(cardNo,HisSeqNo,orderNum);
                        }
                        return  returnMap;
                    }else {
                        flag = true;
@ -12600,7 +12682,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                baseNatAppointmentDO.setCardType(cardType);
                baseNatAppointmentDO.setIdnoType(idnoType);
                baseNatAppointmentDO.setAddress(address);
                baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                if (tasyTime.getDictValue().equalsIgnoreCase("1")){
                    baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                }else {
                    baseNatAppointmentDO.setAppointmentTime(new Date());
                }
                baseNatAppointmentDO.setOderNum(orderNum);
                baseNatAppointmentDO.setCityName(cityName);
                baseNatAppointmentDO.setFirstJobCode(firstJobCode);
@ -13153,10 +13239,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }else if("xm_tasy_wx".equalsIgnoreCase(wechatId)){
                        if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                            logger.info("同步his订单状态"+baseNatAppointmentDO.getRealOrder());
                            //取消号源
                            String registerCancel =tasyNatService.cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                            com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(registerCancel);
                            String isSuccess=jsonObject.getString("success");
                            WlyyHospitalSysDictDO tasyTime = wlyyHospitalSysDictDao.findById("natTime");
                            if (tasyTime!=null){
                                if (tasyTime.getDictValue().equalsIgnoreCase("1")){
                                    //取消号源
                                    String registerCancel =tasyNatService.cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                                    com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(registerCancel);
                                    String isSuccess=jsonObject.getString("success");
                                }
                            }
                            String natCancel=tasyNatService.cancelNat(baseNatAppointmentDO.getRealOrder(),baseNatAppointmentDO.getMedicare().trim(),baseNatAppointmentDO.getName());
                            com.alibaba.fastjson.JSONObject jsonObject1 = JSON.parseObject(natCancel);
                            String returnCode=jsonObject1.getString("ReturnCode");
@ -13931,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 "患者不存在";
        }
    }
}

File diff suppressed because it is too large
+ 435 - 98
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;
    }
}

+ 11 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1851,6 +1851,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            }
            businessOrderDO.setPayType(4);
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setDepositType(depositType);
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
@ -1888,6 +1889,16 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    response = object.toJSONString();
                }
            }else {
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                }
            }
        }else {
            return "找不到订单!";

+ 3 - 1
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")){
@ -516,6 +517,7 @@ public class YlzPayService {
            param.setIdNo(idNo);
            param.setUserName(userName);
            ResponseParams<RefundResult> respnse = onepayClient.refund(param);
            System.out.println("易联众退款结果:"+JSON.toJSONString(respnse));
            if (respnse.getRespCode().equals("000000")){
                jsonObject = JSON.toJSONString(respnse);
            }else {
@ -530,7 +532,7 @@ public class YlzPayService {
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.refund", "互联网预交金退款", "POST", null,JSON.toJSONString(param), jsonObject, error, logService.shoppatType);
        logService.saveHttpLog(isSuccess, "hop.trade.refund", "互联网预交金退款", "POST", null,null, jsonObject, error, logService.shoppatType);
        return jsonObject;
    }

+ 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 - 1
business/base-service/src/main/java/com/yihu/jw/utils/PinYinUtils.java

@ -1,5 +1,6 @@
package com.yihu.jw.utils;
import com.alibaba.fastjson.JSONArray;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
@ -134,7 +135,36 @@ public class PinYinUtils {
	}
	public static void main(String[] args)  throws  Exception{
		System.out.println(getFirstSpell("广西"));
		/*String r = "[\"钟公庙街道\",\n" +
				"\"中河街道\",\n" +
				"\"章水镇\",\n" +
				"\"云龙镇\",\n" +
				"\"鄞江镇\",\n" +
				"\"曕岐镇\",\n" +
				"\"咸祥镇\",\n" +
				"\"下应街道\",\n" +
				"\"五乡镇\",\n" +
				"\"塘溪镇\",\n" +
				"\"首南街道\",\n" +
				"\"石碶\",\n" +
				"\"邱隘镇\",\n" +
				"\"梅墟\",\n" +
				"\"龙观乡\",\n" +
				"\"姜山镇\",\n" +
				"\"集士港镇\",\n" +
				"\"横溪镇\",\n" +
				"\"横街镇\",\n" +
				"\"古林镇\",\n" +
				"\"高桥镇\",\n" +
				"\"洞桥镇\",\n" +
				"\"东吴镇\",\n" +
				"\"东钱湖镇\"]";
		JSONArray array = JSONArray.parseArray(r);
		for (int i=0;i<array.size();i++){
			System.out.println(getFirstSpell(array.getString(i)));
		}
*/
		System.out.print(getFirstSpell("曕岐镇"));
	}
}

+ 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

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

@ -85,6 +85,18 @@
				<BS10008_0>EwellQ.S60.BS10008.PUT</BS10008_0>
				<BS10008_1>EwellQ.S60.BS10008.GET</BS10008_1>
				<!--查询待扣费处方信息-->
				<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>
				<!--检查检验start-->
				<BS20030_0>EwellQ.S60.BS20030.PUT</BS20030_0>
				<BS20030_1>EwellQ.S60.BS20030.GET</BS20030_1>

+ 4 - 1
common/common-entity/sql记录

@ -1693,4 +1693,7 @@ CREATE TABLE `base_patient_helper` (
--
ALTER table base_visit add COLUMN `device_maintenance` VARCHAR(500) DEFAULT NULL COMMENT '设备维护';
ALTER table base_visit add COLUMN `health` VARCHAR(500) DEFAULT NULL COMMENT '健康情况';
ALTER table base_visit add COLUMN `life_consult` VARCHAR(500) DEFAULT NULL COMMENT '生活咨询';
ALTER table base_visit add COLUMN `life_consult` VARCHAR(500) DEFAULT NULL COMMENT '生活咨询';
-- 2022-03-14 ysj
ALTER TABLE base_login_log ADD token varchar(50) COMMENT '登录token 做权限验证用' ;

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

@ -295,6 +295,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;

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/login/BaseLoginLogDO.java

@ -22,6 +22,7 @@ public class BaseLoginLogDO extends UuidIdentityEntity implements java.io.Serial
	private Date operateTime;
	private String name;//用户姓名
	private String clientType;//客服端类型app,wx,pad,pc
	private String token;//登录token 做权限验证用
	@Column(name="operate_time")
@ -96,4 +97,13 @@ public class BaseLoginLogDO extends UuidIdentityEntity implements java.io.Serial
	public void setClientType(String clientType) {
		this.clientType = clientType;
	}
	@Column(name="token")
	public String getToken() {
		return token;
	}
	public void setToken(String token) {
		this.token = token;
	}
}

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

@ -295,6 +295,8 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String homeLatLon;//家庭经纬度
    private Integer homeState;//居家状态 1居家0离家;
    private String verifyCode;//眼科token
    @Column(name = "medical_state")
    public String getMedicalState() {
@ -941,4 +943,13 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setHomeState(Integer homeState) {
        this.homeState = homeState;
    }
    @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;
	}
}

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -55,6 +55,8 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private String traceNo;//支付平台的订单号
    private Long lastPayTime;//订单截至支付日期 13位时间戳
    private String historyOrder;
    private String depositType; //原充值类型
    @Column(name = "history_order")
    public String getHistoryOrder() {
        return historyOrder;
@ -312,4 +314,13 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    public void setLastPayTime(Long lastPayTime) {
        this.lastPayTime = lastPayTime;
    }
    @Column(name = "deposit_type")
    public String getDepositType() {
        return depositType;
    }
    public void setDepositType(String depositType) {
        this.depositType = depositType;
    }
}

+ 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);

File diff suppressed because it is too large
+ 208 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/HcyyService.java


+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java

@ -356,7 +356,7 @@ public class YkyyService {
    public String getRegisterUser(String telephone,String patientPwd,String code,String inviteCode,String equipmentType,String equipmentGuid){
        String response="";
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
                "&equipment_guid="+equipmentGuid;
                "&equipment_guid="+equipmentGuid+"&createsource=hlwyy";
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通用户注册:"+response);
        return response;

+ 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;
        }
    }
}

+ 21 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/common/BaseLoginLogDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.care.dao.common;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface BaseLoginLogDao extends PagingAndSortingRepository<BaseLoginLogDO, String>, JpaSpecificationExecutor<BaseLoginLogDO> {
    @Query("from BaseLoginLogDO l where l.openid=?1 order by l.createTime desc")
    List<BaseLoginLogDO> findByOpenId(String openid);
    @Query("from BaseLoginLogDO l where l.userId=?1 order by l.createTime desc")
    List<BaseLoginLogDO> findByUserId(String openid);
    @Query(value = "SELECT a.* from base_login_log a WHERE a.token=?1 ORDER BY a.create_time desc LIMIT 1",nativeQuery = true)
    BaseLoginLogDO findByToken(String token);
}

+ 8 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/apply/PatientBedApplyEndPoint.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.endpoint.apply;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.apply.PatientBedApplyService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -23,6 +24,8 @@ public class PatientBedApplyEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private PatientBedApplyService patientBedApplyService;
    @Autowired
    private PermissionService permissionService;
    @PostMapping("/apply")
    @ApiOperation("居民申请机构床位")
@ -47,6 +50,11 @@ public class PatientBedApplyEndPoint extends EnvelopRestEndpoint {
    public ListEnvelop getApplyList(@ApiParam(name = "doctor", value = "doctor", required = true)
                                    @RequestParam(value = "doctor") String doctor) {
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ListEnvelop.getError("该操作没有权限");
            }
            return ListEnvelop.getSuccess("查询成功", patientBedApplyService.getApplyList(doctor));
        } catch (Exception e) {
            return failedListEnvelopException2(e);

+ 41 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.aop.ServicesAuth;
import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -28,6 +29,8 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    private EmergencyAssistanceService assistanceService;
    @Autowired
    private SecurityMonitoringOrderService securityMonitoringOrderService;
    @Autowired
    private PermissionService permissionService;
    @PostMapping(value = "newOrder")
    @ApiOperation(value = "居民发起新的紧急救助")
@ -59,6 +62,11 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "doctor") String doctor
    ){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            JSONObject result = assistanceService.doctorGetOrderDetail(orderId,doctor);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
@ -102,6 +110,13 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
            if (StringUtils.isNotBlank(patient)&&StringUtils.isNotBlank(doctor)){
                return ObjEnvelop.getError("请求参数错误");
            }
            if(StringUtils.isNotBlank(doctor)){
                JSONObject param = new JSONObject();
                param.put("doctorId",doctor);
                if(permissionService.noPermission(1,param)){
                    return ObjEnvelop.getError("该操作没有权限");
                }
            }
            JSONObject result = assistanceService.getTabStatusCounts(patient,doctor);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
@ -147,6 +162,13 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
            if (StringUtils.isBlank(patientId)&&StringUtils.isBlank(doctor)){
                return ListEnvelop.getError("请求参数错误");
            }
            if(StringUtils.isNotBlank(doctor)){
                JSONObject param = new JSONObject();
                param.put("doctorId",doctor);
                if(permissionService.noPermission(1,param)){
                    return ListEnvelop.getError("该操作没有权限");
                }
            }
            return ListEnvelop.getSuccess( "查询成功",assistanceService.getOrderList(patientId,patientName,doctor,status,page,pageSize,"desc"));
        }catch (Exception e){
            return failedListEnvelopException2(e);
@ -169,6 +191,13 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
            if (StringUtils.isBlank(patientId)&&StringUtils.isBlank(doctor)){
                return ListEnvelop.getError("请求参数错误");
            }
            if(StringUtils.isNotBlank(doctor)){
                JSONObject param = new JSONObject();
                param.put("doctorId",doctor);
                if(permissionService.noPermission(1,param)){
                    return ListEnvelop.getError("该操作没有权限");
                }
            }
            return ListEnvelop.getSuccess( "查询成功",assistanceService.doctorGetOrderList(patientId,doctor,"1",page,pageSize,"asc"));
        }catch (Exception e){
            return failedListEnvelopException2(e);
@ -207,7 +236,8 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
                                       @ApiParam(value = "服务小结", name = "conclusion_img")
                                       @RequestParam(value = "conclusion_img", required = false) String conclusion_img){
        try {
            JSONObject result = assistanceService.updateConclusion(emergency_reason,treatment_status, orderId,conclusion,conclusion_img,getUID());
            String uid = permissionService.getUID();
            JSONObject result = assistanceService.updateConclusion(emergency_reason,treatment_status, orderId,conclusion,conclusion_img,uid);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
@ -231,6 +261,11 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
                                       @ApiParam(name="doctorLon",value = "医生当前定位经度")
                                       @RequestParam(value = "doctorLon") String doctorLon){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            JSONObject result = assistanceService.updateDoctorLocation(doctor,orderId,doctorAddress,doctorLat,doctorLon);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
@ -293,6 +328,11 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
            @ApiParam(value = "doctor", name = "doctor")
            @RequestParam(value = "doctor", required = false) String doctor) {
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            JSONObject result = assistanceService.responseOrder(orderId, doctor);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));

+ 45 - 9
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java

@ -5,11 +5,15 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.birthday.BirthdayWishesService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.care.birthday.BirthDayWishesToPatient;
import com.yihu.jw.entity.care.birthday.BirthdayWishesTemplate;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -50,6 +54,8 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
    private SystemMessageDao systemMessageDao;
    @Autowired
    private ImUtil imUtil;
    @Autowired
    private PermissionService permissionService;
    @RequestMapping(value = "/createTemplate", method = RequestMethod.POST)
    @ApiOperation(value = "创建模板")
@ -63,7 +69,8 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                                 @ApiParam(name = "isDefault", value = "是否是默认模板")
                                 @RequestParam(required = false) Integer isDefault) {
        try {
            return write(200, "更新成功!", "data", birthdayWishesService.create(getUID(), content, applicableRange, id, isDefault));
            String uid = permissionService.getUID();
            return write(200, "更新成功!", "data", birthdayWishesService.create(uid, content, applicableRange, id, isDefault));
        } catch (Exception e) {
            return errorResult(e);
        }
@ -75,7 +82,12 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                                      @RequestParam(required = false) String doctor) {
        try {
            if(StringUtils.isBlank(doctor)){
                doctor = getUID();
                doctor = permissionService.getUID();
            }
            com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return error(-1,"该操作没有权限");
            }
            return write(200, "查询成功!", "data", birthdayWishesService.getTemplateByDoctor(doctor));
        } catch (Exception e) {
@ -88,7 +100,13 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
    public String getTemplateById(@ApiParam(name = "id", value = "模板id")
                                  @RequestParam(required = true) Long id) {
        try {
            return write(200, "查询成功!", "data", birthdayWishesService.getTemplateById(id));
            String isAdmin = permissionService.isAdmin();
            BirthdayWishesTemplate template = birthdayWishesService.getTemplateById(id);
            if(!"0".equals(isAdmin)&& org.apache.commons.lang.StringUtils.isNotBlank(template.getCreateUser())&&!isAdmin.equals(template.getCreateUser())){
                return error(-1,"没有权限");
            }
            return write(200, "查询成功!", "data", template);
        } catch (Exception e) {
            return errorResult(e);
        }
@ -100,6 +118,12 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
    public String deleteTemplateById(@ApiParam(name = "id", value = "模板id")
                                     @RequestParam(required = true) Long id) {
        try {
            String isAdmin = permissionService.isAdmin();
            BirthdayWishesTemplate template = birthdayWishesService.getTemplateById(id);
            if(!"0".equals(isAdmin)&&!isAdmin.equals(template.getCreateUser())){
                return error(-1,"没有权限");
            }
            birthdayWishesService.deleteTemplateById(id);
            return write(200, "删除成功!");
        } catch (Exception e) {
@ -114,7 +138,16 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
            @ApiParam(name = "id", value = "模板ID",required = true)
            @RequestParam Long id) {
        try {
            return write(200, "设置成功!", "data", birthdayWishesService.setDefalutTemplateById(getUID(), id));
            String isAdmin = permissionService.isAdmin();
            BirthdayWishesTemplate template = birthdayWishesService.getTemplateById(id);
            if(!"0".equals(isAdmin)&&!isAdmin.equals(template.getCreateUser())){
                return error(-1,"没有权限");
            }
            String uid = permissionService.getUID();
            return write(200, "设置成功!", "data", birthdayWishesService.setDefalutTemplateById(uid, template));
        } catch (Exception e) {
            return errorResult(e);
        }
@ -124,7 +157,8 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
    @RequestMapping(value = "getPatientByDoctor", method = RequestMethod.GET)
    public String getPatientByDoctor(){
        try {
            return write(200, "查询成功", "data", birthdayWishesService.getPatientByDoctor(getUID()));
            String uid = permissionService.getUID();
            return write(200, "查询成功", "data", birthdayWishesService.getPatientByDoctor(uid));
        } catch (Exception e) {
            return errorResult(e);
        }
@ -134,7 +168,8 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
    @RequestMapping(value = "getPatientByDoctorCount", method = RequestMethod.GET)
    public String getPatientByDoctorCount(){
        try {
            return write(200, "查询成功", "data", birthdayWishesService.getPatientByDoctorCount(getUID()));
            String uid = permissionService.getUID();
            return write(200, "查询成功", "data", birthdayWishesService.getPatientByDoctorCount(uid));
        } catch (Exception e) {
            return errorResult(e);
        }
@ -167,7 +202,8 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                                         @ApiParam(name = "pageSize", value = "页面大小")
                                         @RequestParam Integer pageSize){
        try {
            return write(200, "查询成功", "data", birthdayWishesService.getBirthdayPatientList(getUID(), patientName, signYear, startDate, endDate, status, currentUserRole, currentUserRoleLevel, roleType, page, pageSize, teamId, isLeader));
            String uid = permissionService.getUID();
            return write(200, "查询成功", "data", birthdayWishesService.getBirthdayPatientList(uid, patientName, signYear, startDate, endDate, status, currentUserRole, currentUserRoleLevel, roleType, page, pageSize, teamId, isLeader));
        } catch (Exception e) {
            return errorResult(e);
        }
@ -199,10 +235,10 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
            if(StringUtils.isEmpty(currentUserRoleLevel)){
                currentUserRoleLevel = getCurrentRoleLevel();
            }
            String uid = permissionService.getUID();
            JSONObject json = new JSONObject();
            json.put("patient", patient);
            json.put("doctorCode", getUID());
            json.put("doctorCode", uid);
            json.put("sendType", 1);
            json.put("birthday", dateString);
            json.put("currentUserRole", currentUserRole);

+ 78 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.endpoint.doctor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.doctor.CareDoctorService;
import com.yihu.jw.care.service.doctor.DoctorServicePermissionsService;
@ -17,8 +18,10 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@ -42,6 +45,9 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
    private EntranceUtil entranceUtil;
    @Autowired
    private DoctorServicePermissionsService doctorServicePermissionsService;
    @Autowired
    private PermissionService permissionService;
    @PostMapping(value = "updOnline")
    @ApiOperation(value = "更新在线状态")
@ -52,6 +58,12 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
                             @RequestParam(value = "online", required = true)String online){
        try{
            JSONObject param = new JSONObject();
            param.put("doctorId",doctorId);
            if(permissionService.noPermission(1,param)){
                return Envelop.getError("该操作没有权限");
            }
            doctorService.updOnline(doctorId,online);
            return success("成功");
        }catch (Exception e){
@ -85,6 +97,12 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "isRole", value = "是否返回角色(1是 0否)", required = false)
            @RequestParam(value = "isRole",required = false) String isRole){
        try{
            JSONObject param = new JSONObject();
            param.put("doctorId",doctorId);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorService.doctorInfo(doctorId,isRole));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -97,6 +115,12 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam(value = "doctorId",required = true) String doctorId) {
        try{
            JSONObject param = new JSONObject();
            param.put("doctorId",doctorId);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorServicePermissionsService.findByDoctor(doctorId));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -109,6 +133,11 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam(value = "doctorId",required = true) String doctorId){
        try{
            JSONObject param = new JSONObject();
            param.put("doctorId",doctorId);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",capacityAssessmentRecordService.getPatientNum(doctorId));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -123,6 +152,13 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "baseDoctorVo") String baseDoctorVo){
        try {
            JSONObject jsonObject = JSONObject.parseObject(baseDoctorVo);
            JSONObject param = new JSONObject();
            param.put("doctorId",jsonObject.get("doctorId").toString());
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            Boolean update = doctorService.update(jsonObject);
            if (!update){
                return failed("保存失败,参数不可为空");
@ -144,7 +180,11 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "orgType",defaultValue = "1,2") String orgType
    ){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctorId);
            if(permissionService.noPermission(1,param)){
                return ListEnvelop.getError("该操作没有权限");
            }
            return ListEnvelop.getSuccess("查询成功", doctorService.getOrgList(doctorId,orgType));
        }catch (Exception e){
            return failedListEnvelopException2(e);
@ -205,6 +245,12 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "size") int size
    ){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return PageEnvelop.getError("该操作没有权限");
            }
            return doctorService.getTeacherChildren(doctor,searchType,name,page,size);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
@ -217,6 +263,11 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor",required = true) String doctor){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorService.getTeacherChildrenCount(doctor));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -230,6 +281,11 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
//            ,@ApiParam(name = "type", value = "type", defaultValue = "0") @RequestParam(value = "type",required = false) Integer type
    ){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorService.getNotificationCount(doctor));//,type
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -249,6 +305,9 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "size")
                                      @RequestParam(value = "size",required = true)Integer size){
        try {
            if(permissionService.noPermission(0,null)){
                return PageEnvelop.getError("该操作没有权限");
            }
            return doctorService.getArchiveList(type, signStatus,name,page, size);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
@ -259,6 +318,9 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "管理员获取居民tab数量")
    public ObjEnvelop getArchiveNum(){
        try {
            if(permissionService.noPermission(0,null)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorService.getArchiveNum()) ;
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -269,6 +331,11 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "首页养老服务数量获取")
    public ObjEnvelop baseInfoCount(@ApiParam(name="doctor")@RequestParam(value = "doctor")String doctor){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorService.baseInfoCount(doctor)) ;
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -303,6 +370,11 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "首页养老服务数量获取")
    public ObjEnvelop baseHelperInfoCount(@ApiParam(name="doctor")@RequestParam(value = "doctor")String doctor){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorService.baseHelperInfoCount(doctor)) ;
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -315,6 +387,11 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam(value = "doctorId",required = true) String doctorId){
        try{
            JSONObject param = new JSONObject();
            param.put("doctorId",doctorId);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",capacityAssessmentRecordService.getHelperPatientNum(doctorId));
        }catch (Exception e){
            return failedObjEnvelopException2(e);

+ 20 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java

@ -1,5 +1,7 @@
package com.yihu.jw.care.endpoint.doctor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
@ -26,6 +28,8 @@ public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private DoctorMessageService doctorMessageService;
    @Autowired
    private PermissionService permissionService;
    @GetMapping(value = "todowork")
    @ApiOperation("待办工作")
@ -36,6 +40,11 @@ public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
                               @ApiParam(name = "doctor", value = "doctor")
                               @RequestParam(value = "doctor", required = true) String doctor){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.getPreventLost(doctor,id,serviceSype));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -47,6 +56,11 @@ public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop  todoworkTotal(@ApiParam(name = "doctor", value = "doctor")
                                         @RequestParam(value = "doctor", required = true) String doctor){
        try {
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.todoworkTotal(doctor));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
@ -79,7 +93,12 @@ public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
                               @ApiParam(name = "doctor", value = "doctor")
                               @RequestParam(value = "doctor", required = true) String doctor){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.helperTodoWork(doctor,id,serviceSype));
            JSONObject param = new JSONObject();
            param.put("doctorId",doctor);
            if(permissionService.noPermission(1,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.getHelperPreventLost(doctor,id,serviceSype));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }

+ 24 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -14,6 +14,7 @@ import com.yihu.jw.care.dao.security.EmergencyWarnDoctorResponseDao;
import com.yihu.jw.care.dao.sign.ServicePackageSignRecordDao;
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.contacts.ContactsService;
import com.yihu.jw.care.service.device.PatientDeviceService;
@ -131,6 +132,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    private BaseOrgDao orgDao;
    @Autowired
    private DeviceDetailDao deviceDetailDao;
    @Autowired
    private PermissionService permissionService;
    /**
     * 获取百度天气
@ -621,6 +624,13 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        String orgCode = permissionService.getDoctorOrg(doctor);
        if (!orgCode.equals(assistanceDO.getOrgCode())){
            String failMsg = "该操作无权限";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        return getOrderDetail(orderID,doctor);
    }
@ -891,6 +901,12 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        if(!doctor.equals(assistanceDO.getDoctor())){
            String failMsg = "该操作没有权限";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        EmergencyWarnConclusionDO doorConclusion =  emergencyWarnConclusionDao.findByOrderId(orderId);
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        if (doctorDO==null){
@ -1040,6 +1056,14 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put("resultMsg", failMsg);
            return result;
        }
        String orgCode = permissionService.getDoctorOrg(doctor);
        if(!orgCode.equals(one.getOrgCode())){
            String failMsg = "该操作没权限" ;
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            return result;
        }
        if (emergencyWarnDoctorResponseDao.findByDoctorAndOrderId(doctor,orderId)==null){
            EmergencyWarnDoctorResponseDO responseDO = new EmergencyWarnDoctorResponseDO();
            responseDO.setOrderId(orderId);

+ 16 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/birthday/BirthdayWishesService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.birthday;
import com.yihu.jw.care.dao.birthday.BirthDayWishesToPatientDao;
import com.yihu.jw.care.dao.birthday.BirthdayWishesTemplateDao;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -10,6 +11,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.birthday.BirthDayWishesToPatient;
import com.yihu.jw.entity.care.birthday.BirthdayWishesTemplate;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang.StringUtils;
@ -49,6 +51,8 @@ public class BirthdayWishesService {
    private BaseDoctorHospitalDao hospitalDao;
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private PermissionService permissionService;
//    /**
//     * 发送到mq
@ -77,12 +81,21 @@ public class BirthdayWishesService {
     * @param isDefault
     */
    public Long create(String doctor, String content, Integer applicableRange, Long id, Integer isDefault) {
        String isAdmin = permissionService.isAdmin();
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        BirthdayWishesTemplate template = null;
        //判断是编辑还是创建
        if(id != null){
            template = bwTemplateDao.findOne(id);
            if(!"0".equals(isAdmin)&&StringUtils.isNotBlank(template.getCreateUser())&&!isAdmin.equals(template.getCreateUser())){
                return null;
            }
        }else {
            if(!"0".equals(isAdmin)&&!doctor.equals(isAdmin)){
                return null;
            }
            template = new BirthdayWishesTemplate();
            template.setCode(UUID.randomUUID().toString().replace("-",""));
            template.setType(2);
@ -135,12 +148,11 @@ public class BirthdayWishesService {
     * 根据ID设置为默认模板
     *
     * @param doctor
     * @param id
     * @param template
     * @return
     */
    @Transactional
    public BirthdayWishesTemplate setDefalutTemplateById(String doctor, Long id) {
        BirthdayWishesTemplate template = bwTemplateDao.findOne(id);
    public BirthdayWishesTemplate setDefalutTemplateById(String doctor, BirthdayWishesTemplate template) {
        //先取消该医生自创的默认模板
        BirthdayWishesTemplate docTemplate = bwTemplateDao.findByCreateUserAndApplicableRangeAndIsDefault(doctor, template.getApplicableRange(), 1);
        if(docTemplate != null){
@ -148,7 +160,7 @@ public class BirthdayWishesService {
        }
        //如果不是系统模板,就添加默认模板标识
        if(template.getType() != 1){
            bwTemplateDao.setDefalutTemplateById(id, 1);
            bwTemplateDao.setDefalutTemplateById(template.getId(), 1);
        }
        return template;
    }

+ 162 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/common/PermissionService.java

@ -0,0 +1,162 @@
package com.yihu.jw.care.service.common;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.common.BaseLoginLogDao;
import com.yihu.jw.care.dao.role.DoctorRoleDao;
import com.yihu.jw.care.endpoint.consult.PatientConsultEndpoint;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.care.role.DoctorRole;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.sms.dao.HospitalSysDictDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 * Created by yeshijie on 2022/3/14.
 */
@Service
public class PermissionService {
    private static final Logger logger = LoggerFactory.getLogger(PermissionService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseLoginLogDao baseLoginLogDao;
    @Autowired
    private DoctorRoleDao doctorRoleDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private HospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    /**
     * 获取医生机构
     * @param doctor
     * @return
     */
    public String getDoctorOrg(String doctor){
        List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctor);
        if(doctorHospitalDOs.size()>0){
            return doctorHospitalDOs.get(0).getOrgCode();
        }
        return "";
    }
    /**
     * 是否管理员
     * @return 0没开启验证或是管理员(或非医生) 1没权限 userId实际登录者id
     */
    public String isAdmin(){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("noPermission");
        if(wlyyHospitalSysDictDO==null||"0".equals(wlyyHospitalSysDictDO.getDictCode())){
            return "0";
        }
        BaseLoginLogDO loginLogDO = getLoginLog();
        if(loginLogDO == null){
            //该操作没有权限"
            return "1";
        }
        String userId = loginLogDO.getUserId();
        //目前只判断医生端
        if("3".equals(loginLogDO.getLoginType())){
            //是否管理员
            List<DoctorRole> roleList = doctorRoleDao.findUserRole(userId);
            if(roleList.size()>0){
                //管理员不做权限验证
                return "0";
            }
            return userId;
        }
        return "0";
    }
    /**
     * 判断是否有权限
     *  loginType 1user 登录 2医生登录 3居民登录 4第三方同步患者账号 5支付宝登录 6第三方登录-医联康护 7家人登录
     *  type 类型 0只能管理员访问,1doctor相关 2生日祝福模板
     *  param 参数 不同类型参数不一样
     * @return true表示没权限
     */
    public boolean noPermission(int type, JSONObject param){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("noPermission");
        if(wlyyHospitalSysDictDO==null||"0".equals(wlyyHospitalSysDictDO.getDictCode())){
            return false;
        }
        BaseLoginLogDO loginLogDO = getLoginLog();
        if(loginLogDO == null){
            logger.info("loginLogDO=null,该操作没有权限");
            return true;
        }
        String userId = loginLogDO.getUserId();
        //目前只判断医生端
        if("3".equals(loginLogDO.getLoginType())){
            //是否管理员
            List<DoctorRole> roleList = doctorRoleDao.findUserRole(userId);
            if(roleList.size()>0){
                //管理员不做权限验证
                return false;
            }
            if(type == 0){
                return true;
            }
            if(type == 1){
                String doctorId = param.getString("doctorId");
                if(!"doctorId".equals(doctorId)){
                    return true;
                }
            }
//            BaseDoctorDO doctorDO = doctorDao.findById(userId);
            //判断角色 1社区医生,2社工, 3教师,4助老员
        }
        return false;
    }
    public String getUID(){
        BaseLoginLogDO loginLogDO = getLoginLog();
        if(loginLogDO != null){
            return loginLogDO.getUserId();
        }
        return null;
    }
    private BaseLoginLogDO getLoginLog(){
        String accessToken = this.extractToken(getRequest());
        BaseLoginLogDO loginLogDO = baseLoginLogDao.findByToken(accessToken);
        return loginLogDO;
    }
    private String extractToken(HttpServletRequest request) {
        String accessToken = request.getHeader("token");
        if (null == accessToken) {
            accessToken = request.getParameter("token");
        }
        return accessToken;
    }
    public HttpServletRequest getRequest(){
        return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
    }
}

+ 4 - 1
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/healthCare/HealthCareEndPoint.java

@ -10,6 +10,7 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
/**
@ -26,6 +27,8 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private HealthCareService healthCareService;
    @Value("${wechat.id}")
    private String wechatId;
    @GetMapping(value = "doctorAuthentication")
@ -67,7 +70,7 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "医师开方上传", notes = "医师开方上传")
    public ObjEnvelop doctorPrescriptionUpload(@ApiParam(name = "prescriptionId", value = "处方id", required = true)
                                               @RequestParam(value = "prescriptionId",required = true) String prescriptionId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.doctorPrescriptionUpload(prescriptionId));
        return ObjEnvelop.getSuccess("ok",healthCareService.doctorPrescriptionUpload(prescriptionId,wechatId));
    }
    @GetMapping(value = "doctorPrescriptionUploadCancle")

+ 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)){

+ 61 - 6
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")
@ -1183,7 +1202,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
                    String msgUrl = "https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId=" + outPatientId;
                    prescriptionService.sendZsMsgFlow("OL_WZ_CANCEL", outPatientId, "", msgUrl, "取消问诊(用户)");
                    String refund = entranceService.hisRefund(outPatientId);
                    //String refund = entranceService.hisRefund(outPatientId);
                }
            } catch (Exception e) {
@ -1198,6 +1217,36 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "yjjRefund")
    @ApiOperation(value = "预交金退费", notes = "预交金退费")
    public ListEnvelop yjjRefund(@ApiParam(name = "outPatientId", value = "门诊记录")
                                     @RequestParam(value = "outPatientId", required = false) String outPatientId,
                                 @ApiParam(name = "sys", value = "是否系统取消")
                                    @RequestParam(value = "sys", required = false) boolean sys) {
        try {
            return success(entranceService.hisRefund(outPatientId,sys));
        } catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "ylzRefund")
    @ApiOperation(value = "易联众预交金退费", notes = "易联众预交金退费")
    public Envelop ylzRefund(@ApiParam(name = "outPatientId", value = "门诊记录")
                                 @RequestParam(value = "outPatientId", required = false) String outPatientId,
                                 @ApiParam(name = "sys", value = "是否系统取消")
                                 @RequestParam(value = "sys", required = false) boolean sys) {
        try {
            return success(entranceService.ylzRefund(outPatientId,sys));
        } catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCancelReasonList)
    @ApiOperation(value = "获取居民取消原因字典", notes = "获取居民取消原因字典")
    public ListEnvelop findCancelReasonList() {
@ -1769,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);
        }
    }
}

File diff suppressed because it is too large
+ 229 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/QrcodeService.java