Explorar el Código

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

liubing hace 2 años
padre
commit
8a0780c9bf

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

@ -730,6 +730,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("patientCancelValue", outpatientDO.getPatientCancelValue());
        rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark());
        rs.put("operator",outpatientDO.getOperator());
        rs.put("isPositive",outpatientDO.getIsPositive());
        rs.put("status",outpatientDO.getStatus());
        rs.put("fee",outpatientDO.getFee());
        rs.put("hisStatus",outpatientDO.getHisStatus());
@ -750,6 +751,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("birthday", DateUtil.dateToStr(basePatientDO.getBirthday(), "yyyy-MM-dd"));
        rs.put("diseaseCode",outpatientDO.getDiseaseCode());
        rs.put("diseaseName",outpatientDO.getDiseaseName());
        rs.put("inquirySign",outpatientDO.getInquirySign());
        String hisPatient="";
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(basePatientDO.getId());
        if(null!=patientMappingDO){
@ -14466,12 +14468,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    BigDecimal b4 = new BigDecimal(object1.getString("jzfp_pay"));
                    BigDecimal b5 = new BigDecimal(object1.getString("yljz_pay"));
                    BigDecimal b6 = new BigDecimal(object1.getString("other_pay"));
                    BigDecimal b7 = new BigDecimal(object1.getString("enterprise_supplement"));
                    Double price = b1.add(b2).add(b3).add(b4).add(b5).add(b6).add(b7).doubleValue();
                    if (Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice())==price){
                        ylzMedicalRelationDO.setStatus(1);
                    String payDateStr = object1.getString("pay_date");
                    Date payDate = DateUtil.strToDate(payDateStr);
                    Date now = DateUtil.getDateShort(new Date());
                    if (payDate.compareTo(now)==0){
                        BigDecimal b7 = new BigDecimal(object1.getString("enterprise_supplement"));
                        Double price = b1.add(b2).add(b3).add(b4).add(b5).add(b6).add(b7).doubleValue();
                        if (Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice())==price){
                            ylzMedicalRelationDO.setStatus(1);
                            ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                        }
                    }else {
                        ylzMedicalRelationDO.setStatus(0);
                        ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                    }
                }
            }
            if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){

+ 2 - 18
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -25,7 +25,6 @@ import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
@ -47,18 +46,11 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.sms.util.ykyy.util.HttpClient;
import com.yihu.jw.util.common.PwdUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.jw.utils.AES;
import com.yihu.jw.utils.SignUtil;
import com.yihu.jw.utils.encode.*;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.domain.ext.RefundResult;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.util.JSONTokener;
@ -66,13 +58,7 @@ import net.sf.json.xml.XMLSerializer;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.bouncycastle.crypto.digests.MD5Digest;
import org.bouncycastle.crypto.digests.SM3Digest;
import org.bouncycastle.crypto.macs.HMac;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -80,14 +66,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import sun.misc.BASE64Encoder;
import javax.transaction.Transactional;
import java.io.*;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Base64;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -431,10 +414,11 @@ public class EntranceService {
                                wlyyPrescriptionInfoVO.setDrugNo(null != jsonObjectBody.get("DRUG_CODE") ? jsonObjectBody.get("DRUG_CODE").toString() : "");
                                wlyyPrescriptionInfoVO.setDrugName(null != jsonObjectBody.get("DRUG_NAME") ? jsonObjectBody.get("DRUG_NAME").toString() : "");
                                wlyyPrescriptionInfoVO.setDispDeposite(null != jsonObjectBody.get("DISP_DEPOSITE") ? jsonObjectBody.get("DISP_DEPOSITE").toString() : "");
                                //YPYL00 药品用量  DCYYDW  单次用药单位
                                wlyyPrescriptionInfoVO.setDosage(null != jsonObjectBody.get("YPYL00") ? jsonObjectBody.get("YPYL00").toString() : "");
                                wlyyPrescriptionInfoVO.setUnitName(null != jsonObjectBody.get("DCYYDW") ? jsonObjectBody.get("DCYYDW").toString() : "");
                                wlyyPrescriptionInfoVO.setQuantity(null != jsonObjectBody.get("DRUG_QTY") ? jsonObjectBody.get("DRUG_QTY").toString() : "");
                                wlyyPrescriptionInfoVO.setUnit(null != jsonObjectBody.get("UNIT") ? jsonObjectBody.get("UNIT").toString() : "");
                                wlyyPrescriptionInfoVO.setUnitName(null != jsonObjectBody.get("DCYYDW") ? jsonObjectBody.get("DCYYDW").toString() : "");
                                wlyyPrescriptionInfoVO.setUsageName(null != jsonObjectBody.get("YPPL00") ? jsonObjectBody.get("YPPL00").toString() : "");
                                wlyyPrescriptionInfoVO.setSupplyName(null != jsonObjectBody.get("YPYF00") ? jsonObjectBody.get("YPYF00").toString() : "");
                                wlyyPrescriptionInfoVO.setUsageCode(null != jsonObjectBody.get("YPPLCODE") ? jsonObjectBody.get("YPPLCODE").toString() : "");

+ 26 - 2
business/base-service/src/main/java/com/yihu/jw/org/service/BaseOrgInfoService.java

@ -1,13 +1,14 @@
package com.yihu.jw.org.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
@ -27,4 +28,27 @@ public class BaseOrgInfoService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        return baseOrgDao.findByCode(orgCode);
    }
    //新增或修改医院
    public void addOrg(String jsonData){
        JSONObject json = JSON.parseObject(jsonData);
        String code = json.getString("code");
        String name = json.getString("name");
        String linkUrl = json.getString("linkUrl");
        String photo = json.getString("photo");
        BaseOrgDO orgDO = baseOrgDao.findByCode(code);
        if(orgDO==null){
            orgDO = new BaseOrgDO();
            orgDO.setCreateTime(new Date());
            orgDO.setCode(code);
            orgDO.setName(name);
            orgDO.setType("1");
            orgDO.setDel("1");
            orgDO.setOrgLevel(1);
            orgDO.setWinNo("-1");
        }
        orgDO.setOrgUrl(linkUrl);
        orgDO.setPhoto(photo);
        baseOrgDao.save(orgDO);
    }
}

+ 130 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/Test.java

@ -0,0 +1,130 @@
package com.yihu.jw.wechat.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.util.http.HttpClientUtil;
import org.hibernate.jdbc.Expectation;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by Trick on 2020/3/19.
 */
public class Test {
    public static void main(String[] args) throws Exception {
        String s ="53.68";
        String l = "53.680";
        if (s.equalsIgnoreCase(l)){
            System.out.print(true);
        }else {
            System.out.print(false);
        }
    }
        /** 7位ascii字符,也叫作iso646-us、unicode字符集的基本拉丁块 */
        public static final String us_ascii = "us-ascii";
        /** iso 拉丁字母表 no.1,也叫作 iso-latin-1 */
        public static final String iso_8859_1 = "iso-8859-1";
        /** 8 位 ucs 转换格式 */
        public static final String utf_8 = "utf-8";
        /** 16 位 ucs 转换格式,big endian(最低地址存放高位字节)字节顺序 */
        public static final String utf_16be = "utf-16be";
        /** 16 位 ucs 转换格式,little-endian(最高地址存放低位字节)字节顺序 */
        public static final String utf_16le = "utf-16le";
        /** 16 位 ucs 转换格式,字节顺序由可选的字节顺序标记来标识 */
        public static final String utf_16 = "utf-16";
        /** 中文超大字符集 */
        public static final String gbk = "gbk";
        /**
         * 将字符编码转换成us-ascii码
         */
        public static String toascii(String str) throws UnsupportedEncodingException{
            return changecharset(str, us_ascii);
        }
        /**
         * 将字符编码转换成iso-8859-1码
         */
        public static String toiso_8859_1(String str) throws UnsupportedEncodingException{
            return changecharset(str, iso_8859_1);
        }
        /**
         * 将字符编码转换成utf-8码
         */
        public static String toutf_8(String str) throws UnsupportedEncodingException{
            return changecharset(str, utf_8);
        }
        /**
         * 将字符编码转换成utf-16be码
         */
        public String toutf_16be(String str) throws  UnsupportedEncodingException {
            return this.changecharset(str, utf_16be);
        }
        /**
         * 将字符编码转换成utf-16le码
         */
        public String toutf_16le(String str) throws UnsupportedEncodingException{
            return this.changecharset(str, utf_16le);
        }
        /**
         * 将字符编码转换成utf-16码
         */
        public String toutf_16(String str) throws UnsupportedEncodingException{
            return this.changecharset(str, utf_16);
        }
        /**
         * 将字符编码转换成gbk码
         */
        public static String togbk(String str) throws UnsupportedEncodingException{
            return changecharset(str, gbk);
        }
        /**
         * 字符串编码转换的实现方法
         * @param str 待转换编码的字符串
         * @param newcharset 目标编码
         * @return
         * @throws Expectation
         */
        public static String changecharset(String str, String newcharset)
                throws  UnsupportedEncodingException {
            if (str != null) {
                //用默认字符编码解码字符串。
                byte[] bs = str.getBytes();
                //用新的字符编码生成字符串
                return new String(bs, newcharset);
            }
            return null;
        }
        /**
         * 字符串编码转换的实现方法
         * @param str 待转换编码的字符串
         * @param oldcharset 原编码
         * @param newcharset 目标编码
         * @return
         * @throws
         */
        public static String changecharset(String str, String oldcharset, String newcharset)
                throws Exception {
            if (str != null) {
                //用旧的字符编码解码字符串。解码可能会出现异常。
                byte[] bs = str.getBytes(oldcharset);
                //用新的字符编码生成字符串
                return new String(bs, newcharset);
            }
            return null;
        }
}

+ 88 - 2
business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java

@ -1,24 +1,29 @@
package com.yihu.jw.wechat.service;
import com.alibaba.fastjson.JSON;
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;
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.http.HttpClientUtil;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Consts;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
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;
import java.util.Map;
import java.util.*;
@Service
public class WechatInfoService {
@ -37,7 +42,11 @@ public class WechatInfoService {
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private HcyyEntranceService hcyyEntranceService;
    public static Map<String, String> tokenMap = new HashMap<>();
    @Value("${wlyy.url}")
    private String wlyyUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Value("${wechat.id}")
    private String wxId;
@ -117,6 +126,9 @@ public class WechatInfoService {
            //中山医院互联网医院
            if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)||"xm_hcyy_wx".equals(wxId)){
                jsapiTickets = wxAccessTokenService.findJsapiTicket(wxId);
            }else if("xm_ihealth_wx".equals(wxId)){
                //厦门i健康
                return getIjkTicket();
            }else{
                wxWechat = wxAccessTokenService.getWxInfo(wxId);
                jsapiTickets = wxAccessTokenService.findJsapiTicket(wxWechat.getAppOriginId());
@ -192,6 +204,80 @@ public class WechatInfoService {
        }
    }
    public String getIjkTicket(){
        String url = "/wlyygc/wx_jsapi_ticket";
        Map<String, Object> params = new HashMap<>();
        String response = sendGet(url,params);
        com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
        if(jsonObject.getInteger("status")==10000){
            return jsonObject.getString("result");
        }
        return null;
    }
    /**
     * 访问i健康接口,自带登录信息
     *
     * @param url
     * @return
     */
    private String sendGet(String url, Map<String, Object> params) {
        String response = null;
        try {
            params.put("accesstoken", getAccessToken());
            List<BasicNameValuePair> jsonParams = new ArrayList<>();
            //配置参数
            if (params != null) {
                for (String key : params.keySet()) {
                    if (!org.springframework.util.StringUtils.isEmpty(String.valueOf(params.get(key))) && !"null".equals(String.valueOf(params.get(key)))) {
                        jsonParams.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                    }
                }
            }
            response = httpClientUtil.get(wlyyUrl + url + "?" + URLEncodedUtils.format(jsonParams, Consts.UTF_8), "utf-8");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
    /**
     * 返回accessToken
     *
     * @return
     * @throws
     */
    private synchronized String getAccessToken() {
        String token = "";
        if (tokenMap.get("token") != null) {
            token = tokenMap.get("token");
            Long outTime = Long.valueOf(tokenMap.get("outTime"));
            if (new Date().getTime() < outTime) {
                return token;
            }
        }
        try {
            Map params = new HashMap();
            params.put("appid", "019bd04d-3cb2-433f-a530-03f0cdb083e5");
            params.put("appSecret", "08cc3ec2-736b-4732-a8f0-f99eb6f9d311");
            String url = "/gc/accesstoken";
            String response = HttpClientUtil.httpPost(wlyyUrl + url, params);
            com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(response);
            if (jsonObject.getInteger("status") == 10000) {
                String accesstoken = jsonObject.getJSONObject("result").getString("accesstoken");
                tokenMap.put("token", accesstoken);
                tokenMap.put("outTime", jsonObject.getJSONObject("result").getLong("outTime") + "");
                return accesstoken;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 根据小程序获取用户手机号
     *

+ 16 - 12
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -291,8 +291,8 @@ public class WlyyBusinessService {
            params.put("idcard",idcard);
            String patientCardNo = null;
            patientMedicareCardDao.deleteByPatientId(patientId);
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                patientMedicareCardDao.deleteByPatientId(patientId);
                net.sf.json.JSONArray array =prescriptionService.findPatientCard(patientId);
                for (int i=0;i<array.size();i++){
                    net.sf.json.JSONObject object = array.getJSONObject(i);
@ -316,6 +316,7 @@ public class WlyyBusinessService {
                    patientMedicareCardDao.save(patientMedicareCardDO);
                }
            }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                patientMedicareCardDao.deleteByPatientId(patientId);
                JSONArray array = xzzxEntranceService.selectPateintCard(patientId);
                for (int i=0;i<array.size();i++){
                    JSONObject jsonObject = array.getJSONObject(i);
@ -374,18 +375,21 @@ public class WlyyBusinessService {
            patientSccParams.put("sex",basePatientDO.getSex().toString());
            patientSccParams.put("phone",basePatientDO.getMobile());
            patientSccParams.put("birthday",DateUtil.dateToStrShort(basePatientDO.getBirthday()));
            //JSONObject object = wlyyHttpService.sendWlyyMes("wlyyFindAccountBySsc", null, patientSccParams);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatientAccetokenByIdcard",null,params);
            if(rs!=null){
                Integer status = rs.getInteger("status");
                if(200 == status){
                    JSONObject data = rs.getJSONObject("data");
                    result = data.getString("patientCode");
                }else{
                    logger.info(rs.toJSONString());
                    throw new Exception("请求i健康接口失败");
            JSONObject object = wlyyHttpService.sendWlyyMes("wlyyFindAccountBySsc", null, patientSccParams);
            try {
                JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatientAccetokenByIdcard",null,params);
                if(rs!=null){
                    Integer status = rs.getInteger("status");
                    if(200 == status){
                        JSONObject data = rs.getJSONObject("data");
                        result = data.getString("patientCode");
                    }else{
                        logger.info(rs.toJSONString());
                        throw new Exception("请求i健康接口失败");
                    }
                }
            }catch (Exception e){
                e.printStackTrace();
            }
            try {
                baseOperateLogService.saveOperateLog(doctorId,patientId,"JKDA","健康档案","","");

+ 6 - 0
common/common-entity/sql/sql记录

@ -2424,3 +2424,9 @@ CREATE TABLE `base_check_org` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构考核';
-- 2022-12-23   ysj
alter table wlyy_outpatient add column is_positive tinyint(1) DEFAULT NULL comment '是否新冠阳性 1是0否';
-- 2022-12-27 ysj wlyy_specialist
alter table wlyy_patient_rehabilitation_plan add column patient_info_code varchar(50) DEFAULT NULL COMMENT '自动下转关联code';
alter table wlyy_patient_rehabilitation_plan add column third_org_code varchar(50) DEFAULT NULL COMMENT '自动下转的医院code';

+ 1 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -25,9 +25,7 @@ public abstract class IntegerIdentityEntity implements Serializable {
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
/*
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
*/
/*   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 23 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -303,6 +303,20 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    private String diseaseCode;//特殊病种编码
    private String diseaseName;//特殊病种名称
    private Integer isPositive;//是否新冠阳性 1是0否
    private String inquirySign;//问诊标识1发热咨询0普通门诊
    @Column(name = "inquiry_sign")
    public String getInquirySign() {
        return inquirySign;
    }
    public void setInquirySign(String inquirySign) {
        this.inquirySign = inquirySign;
    }
    @Column(name = "disease_code")
    public String getDiseaseCode() {
        return diseaseCode;
@ -847,4 +861,13 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }
    @Column(name = "is_positive")
    public Integer getIsPositive() {
        return isPositive;
    }
    public void setIsPositive(Integer isPositive) {
        this.isPositive = isPositive;
    }
}

+ 21 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java

@ -62,6 +62,9 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntity implements S
    private Long adminTeamCode;//家签行政团队Id
    private String patientInfoCode;//自动下转关联code wlyy_rehabilitation_patient_info 的code
    private String thirdOrgCode;//自动下转的医院code wlyy_rehabilitation_patient_info的 hospital_code
    @Column(name = "is_verify")
    public String getIsVerify() {
        return isVerify;
@ -293,4 +296,22 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntity implements S
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    @Column(name = "patient_info_code")
    public String getPatientInfoCode() {
        return patientInfoCode;
    }
    public void setPatientInfoCode(String patientInfoCode) {
        this.patientInfoCode = patientInfoCode;
    }
    @Column(name = "third_org_code")
    public String getThirdOrgCode() {
        return thirdOrgCode;
    }
    public void setThirdOrgCode(String thirdOrgCode) {
        this.thirdOrgCode = thirdOrgCode;
    }
}

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

@ -1429,7 +1429,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                        JSONObject patient =  userDetailsService.getHLWyyUser(opid);
                        rs.put("idcard",patient.getString("idcard"));
                        rs.put("mobile",patient.getString("mobile"));
                    }else if("xm_ykyy_wx".equals(wxid)){
                        JSONObject patient =  userDetailsService.getHLWyyUser(opid);
                        rs.put("idcard",patient.getString("idcard"));
                        rs.put("mobile",patient.getString("mobile"));
                    }
                }else {
                    rs.put("openid",openid);
@ -2579,19 +2582,21 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (wlyyHospitalSysDictDO!=null){
            isNeedGeet=wlyyHospitalSysDictDO.getDictValue();
        }
        if (parameters.get("mobile")==null){
            if ("1".equalsIgnoreCase(isNeedGeet)){
                String geetestChallenge = parameters.get("geetestChallenge");
                String geetestValidate = parameters.get("geetestValidate");
                String geetestSeccode = parameters.get("geetestSeccode");
                JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"1");
                if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
                    throw new  Exception("验证失败");
        String wechatId = parameters.get("wechatId");
        if (!wechatId.equalsIgnoreCase("xm_ihealth_wx")){
            if (parameters.get("mobile")==null){
                if ("1".equalsIgnoreCase(isNeedGeet)){
                    String geetestChallenge = parameters.get("geetestChallenge");
                    String geetestValidate = parameters.get("geetestValidate");
                    String geetestSeccode = parameters.get("geetestSeccode");
                    JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"1");
                    if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
                        throw new  Exception("验证失败");
                    }
                }
            }
        }
        //图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
@ -2608,7 +2613,214 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        String wechatId = parameters.get("wechatId");
        if (wechatId.equalsIgnoreCase("xm_ihealth_wx")){
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("clientId", userDetailsService.getClientId()));
            ClientDetails clientDetails = clientDetailsService.loadClientByClientId(userDetailsService.getClientId());
            params.add(new BasicNameValuePair("clientSecret", clientDetails.getClientSecret()));
            params.add(new BasicNameValuePair("code", username));
            params.add(new BasicNameValuePair("openid", userDetailsService.getOpenid()));
            String result = null;
            try{
                logger.info("params"+params.toString());
                result = httpClientUtil.post(userDetailsService.getSynPath(userDetailsService.getWechatId()), params, "UTF-8");
            }catch (Exception e){
                logger.error("远程请求i健康用户信息异常:" + e.getMessage());
            }
            if(null == result){
            }
            JSONObject patient = JSONObject.parseObject(result);
            if(patient.getInteger("status") == -1){
                logger.error("去i健康查询用户信息失败:" + patient.getString("error"));
            }
            String mobile = patient.getString("mobile");
            parameters.put("grant_type", "ihealthCode");
          /*  KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
            String mobile = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("mobile"), keyPair);*/
            logger.info("mobile:"+mobile);
            String msg = "";
            String r =ykyyService.getRegisterUser(mobile,"123456","123456","a01522","xmijk","xmijk");
            if (!StringUtils.isEmpty(r)){
                JSONObject jsonObject = JSONObject.parseObject(r);
                if (null!=jsonObject.get("code")&&"200".equalsIgnoreCase(jsonObject.get("code").toString())){
                    JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("data").toString());
                }else if (null!=jsonObject.get("code")&&"199".equalsIgnoreCase(jsonObject.get("code").toString())){
                    msg = jsonObject.getString("msg");
                    logger.info("msg"+msg);
                }
            }
            String password = null;
            String res = ykyyService.getPatientPhone(mobile);
            if (res!=null&&res!=""){
                JSONObject object = JSONObject.parseObject(res);
                if (object.getString("code").equalsIgnoreCase("200")){
                    password = object.getString("data");
                }else {
                    WlyyUserSimple userSimple = new WlyyUserSimple();
                    return getFailedResponse(object.getString("msg"),-1,userSimple);
                }
            }
            String response = ykyyService.yktLogin(mobile,password);
            if (!StringUtils.isEmpty(response)){
                JSONObject object = JSONObject.parseObject(response);
                if (!object.getString("code").equalsIgnoreCase("200")){
                    throw new Exception(object.getString("msg"));
                }else {
                    JSONObject jsonObject = object.getJSONObject("data");
                    if (jsonObject!=null){
                        String userId= jsonObject.getString("ID");
                        String tel = jsonObject.getString("LOGINID");
                        List<BasePatientDO> basePatientDOS = basePatientDao.findByMobile(tel);
                        if (basePatientDOS==null||basePatientDOS.size()==0){
                            BasePatientDO basePatientDO = new BasePatientDO();
                            String familyList = ykyyService.getFamilyList(null,userId);
                            JSONObject familyJson = JSONObject.parseObject(familyList);
                            if (familyJson.getString("code").equalsIgnoreCase("200")){
                                JSONObject object1 = familyJson.getJSONObject("data");
                                JSONArray list = object1.getJSONArray("list");
                                List<String> iliness = new ArrayList<>();
                                if (list!=null&&list.size()!=0){
                                    for (int i=0;i<list.size();i++){
                                        JSONObject family = list.getJSONObject(i);
                                        iliness.add(family.getString("ILLNESS"));
                                        if (family.getString("ILLNESS").equalsIgnoreCase("本人")&&tel.equalsIgnoreCase(family.getString("TEL"))){
                                            basePatientDO.setDel("1");
                                            basePatientDO.setName(family.getString("NAME"));
                                            basePatientDO.setCreateTime(new Date());
                                            basePatientDO.setUpdateTime(new Date());
                                            basePatientDO.setYktId(family.getString("ID"));
                                            basePatientDO.setUserId(userId);
                                            basePatientDO.setIdcard(family.getString("IDCARD"));
                                            String idcard = family.getString("IDCARD");
                                            Integer age = IdCardUtil.getAgeForIdcard(idcard);
                                            String sex = IdCardUtil.getSexForIdcard_new(idcard);
                                            Integer sexx = null;
                                            if (org.apache.commons.lang3.StringUtils.isNoneBlank(sex)){
                                                sexx = Integer.parseInt(sex);
                                            }
                                            String birthDay = family.getString("BIRTHDAY");
                                            Date birthday = null;
                                            if (org.apache.commons.lang3.StringUtils.isNoneBlank(birthDay)){
                                                birthday = DateUtil.strToDate(birthDay+" 00:00:00");;
                                            }
                                            basePatientDO.setBirthday(birthday);
                                            basePatientDO.setSex(sexx);
                                            basePatientDO.setMobile(tel);
                                            String salt = UUID.randomUUID().toString().substring(0,5);
                                            String pw = idcard.substring(idcard.length()-6,idcard.length());
                                            basePatientDO.setIdcard(idcard);
                                            basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                                            basePatientDO.setSalt(salt);
                                            basePatientDO.setLocked(0);
                                            basePatientDO.setEnabled(1);
                                            basePatientDO.setVerifyCode(jsonObject.getString("TOKEN"));
                                            basePatientDO.setPatientStatus("1");
                                            basePatientDao.save(basePatientDO);
                                        }else {
                                            List<BasePatientDO> basePatientDOList = basePatientDao.findByMobile(tel);
                                            if(basePatientDOList==null||basePatientDOList.size()==0){
                                                basePatientDO.setDel("1");
                                                if (jsonObject.getString("USERNAME").length()>=2){
                                                    basePatientDO.setName(jsonObject.getString("USERNAME"));
                                                }else {
                                                    basePatientDO.setName(tel);
                                                }
                                                basePatientDO.setCreateTime(new Date());
                                                basePatientDO.setUpdateTime(new Date());
                                                basePatientDO.setYktId(jsonObject.getString("ID"));
                                                basePatientDO.setUserId(userId);
                                                basePatientDO.setMobile(tel);
                                                String salt = UUID.randomUUID().toString().substring(0,5);
                                                String pw = tel.substring(tel.length()-6,tel.length());
                                                basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                                                basePatientDO.setSalt(salt);
                                                basePatientDO.setLocked(0);
                                                basePatientDO.setEnabled(1);
                                                basePatientDO.setPatientStatus("1");
                                                basePatientDao.save(basePatientDO);
                                            }
                                        }
                                    }
                                }else {
                                    if (jsonObject.getString("USERNAME").length()>=2){
                                        basePatientDO.setName(jsonObject.getString("USERNAME"));
                                    }else {
                                        basePatientDO.setName(tel);
                                    }
                                    basePatientDO.setDel("1");
                                    basePatientDO.setCreateTime(new Date());
                                    basePatientDO.setUpdateTime(new Date());
                                    basePatientDO.setUserId(userId);
                                    basePatientDO.setMobile(tel);
                                    String salt = UUID.randomUUID().toString().substring(0,5);
                                    String pw = tel.substring(tel.length()-6,tel.length());
                                    basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                                    basePatientDO.setSalt(salt);
                                    basePatientDO.setLocked(0);
                                    basePatientDO.setEnabled(1);
                                    basePatientDO.setPatientStatus("1");
                                    basePatientDao.save(basePatientDO);
                                }
                                    /*String birdth = com.yihu.jw.util.idcard.IdCardUtil.getBirthdayForIdcardStr(basePatientDO.getIdcard());
                                    Integer age = com.yihu.jw.util.idcard.IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                                    Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                                    if (iliness!=null&&iliness.size()!=0){
                                        if (!iliness.contains("本人")){
                                            ykyyService.addFamily(basePatientDO.getUserId(),basePatientDO.getIdcard(),basePatientDO.getName(),sex+"",birdth,age+"",basePatientDO.getMobile());
                                        }
                                    }else {
                                        ykyyService.addFamily(basePatientDO.getUserId(),basePatientDO.getIdcard(),basePatientDO.getName(),sex+"",birdth,age+"",basePatientDO.getMobile());
                                    }*/
                            }
                        }else {
                            logger.info("======"+jsonObject.getString("USERNAME")+"======");
                            logger.info("tel"+jsonObject.getString("USERNAME"));
                            BasePatientDO basePatientDO1 = basePatientDOS.get(0);
                            if (basePatientDO1.getName()==null||basePatientDO1.getName()==""){
                                if (jsonObject.getString("USERNAME").length()>=2){
                                    basePatientDO1.setName(jsonObject.getString("USERNAME"));
                                }else {
                                    basePatientDO1.setName(tel);
                                }
                            }
                            basePatientDO1.setVerifyCode(jsonObject.getString("TOKEN"));
                            basePatientDO1.setUserId(userId);
                            basePatientDao.save(basePatientDO1);
                                /*String familyList = ykyyService.getFamilyList(null,userId);
                                JSONObject familyJson = JSONObject.parseObject(familyList);
                                if (familyJson.getString("code").equalsIgnoreCase("200")){
                                    JSONObject object1 = familyJson.getJSONObject("data");
                                    JSONArray list = object1.getJSONArray("list");
                                    List<String> iliness = new ArrayList<>();
                                    if (list!=null&&list.size()!=0){
                                        for (int i=0;i<list.size();i++) {
                                            JSONObject family = list.getJSONObject(i);
                                            iliness.add(family.getString("ILLNESS"));
                                        }
                                    }
                                    String birdth = null;
                                    Integer age = 0;
                                    if (org.apache.commons.lang3.StringUtils.isNoneBlank(basePatientDO1.getIdcard())){
                                        birdth = com.yihu.jw.util.idcard.IdCardUtil.getBirthdayForIdcardStr(basePatientDO1.getIdcard());
                                        age =com.yihu.jw.util.idcard.IdCardUtil.getAgeForIdcard(basePatientDO1.getIdcard());
                                    }
                                    Integer sex = basePatientDO1.getSex()!=null?basePatientDO1.getSex():0;
                                    if (iliness!=null&&iliness.size()!=0){
                                        if (!iliness.contains("本人")){
                                            ykyyService.addFamily(basePatientDO1.getUserId(),basePatientDO1.getIdcard(),basePatientDO1.getName(),sex+"",birdth,age+"",basePatientDO1.getMobile());
                                        }
                                    }else {
                                        ykyyService.addFamily(basePatientDO1.getUserId(),basePatientDO1.getIdcard(),basePatientDO1.getName(),sex+"",birdth,age+"",basePatientDO1.getMobile());
                                    }
                                }*/
                        }
                    }
                }
            }
            parameters.remove("password");
        }
        if (StringUtils.isEmpty(parameters.get("captcha"))) {
            parameters.put("grant_type", "ihealthCode");
            //解密密码

+ 12 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/DeptHomepageBannerEndpoint.java

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.endpoint.dict;
import com.yihu.jw.dict.service.DeptHomepageBannerService;
import com.yihu.jw.entity.hospital.manage.BaseDeptHomepageBannerDO;
import com.yihu.jw.org.service.BaseOrgInfoService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
@ -18,6 +19,17 @@ public class DeptHomepageBannerEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private DeptHomepageBannerService deptHomepageBannerService;
    @Autowired
    private BaseOrgInfoService orgInfoService;
    @ApiOperation("互联网医院入住i健康,新增医院")
    @PostMapping(value = "hlwyyAddOrg")
    public Envelop addOrg(@ApiParam(name = "jsonData", value = "jsonData", required = true)
                                         @RequestParam(value = "jsonData", required = true) String jsonData) {
        orgInfoService.addOrg(jsonData);
        return success();
    }
    @ApiOperation("删除疾病首页图标")
    @PostMapping(value = BaseHospitalRequestMapping.PatientNoLogin.delDeptHomepageBanner)