Procházet zdrojové kódy

Merge branch 'dev' of trick9191/wlyy2.0 into dev

trick9191 před 5 roky
rodič
revize
d3bdbb56c4

+ 97 - 47
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java

@ -7,15 +7,11 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.enterprise.WxEnterpriseDO;
import com.yihu.jw.entity.hospital.enterprise.WxEnterpriseTokenDO;
import com.yihu.jw.entity.hospital.enterprise.WxEnterpriseUserDO;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.enterprise.dao.WxEnterpriseDao;
import com.yihu.jw.wechat.enterprise.dao.WxEnterpriseTokenDao;
import com.yihu.jw.wechat.enterprise.dao.WxEnterpriseUserDao;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -24,8 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
/**
 * Created by Trick on 2020/2/8.
@ -59,10 +54,16 @@ public class EnterpriseService {
        WxEnterpriseDO wxEnterpriseDO = wxEnterpriseDao.findOne(enterpriseId);
        WxEnterpriseTokenDO wxEnterpriseTokenDO = wxEnterpriseTokenDao.findByCode(wxEnterpriseDO.getCorpid());
        List<WxEnterpriseTokenDO> wxEnterpriseTokenDOs = wxEnterpriseTokenDao.findByCodeOrderByCreateTimeDesc(wxEnterpriseDO.getCorpid());
        if(wxEnterpriseTokenDO!=null&&wxEnterpriseTokenDO.getExpiresTime().after(new Date())){
            return wxEnterpriseTokenDO.getAccessToken();
        if(wxEnterpriseTokenDOs!=null&&wxEnterpriseTokenDOs.size()>0) {
            logger.info("token size:"+wxEnterpriseTokenDOs.size());
            WxEnterpriseTokenDO tokenDO = wxEnterpriseTokenDOs.get(0);
            if (tokenDO.getExpiresTime().after(new Date())) {
                return tokenDO.getAccessToken();
            }else{
                wxEnterpriseTokenDao.delete(wxEnterpriseTokenDOs);
            }
        }
        String result = HttpUtil.sendGet("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+wxEnterpriseDO.getCorpid()+"&corpsecret="+wxEnterpriseDO.getCorpsecret());
@ -71,17 +72,13 @@ public class EnterpriseService {
        JSONObject json = JSONObject.parseObject(result);
        if(wxEnterpriseTokenDO!=null){
            wxEnterpriseTokenDao.delete(wxEnterpriseTokenDO);
        }
        //保存当前token
        WxEnterpriseTokenDO token = new WxEnterpriseTokenDO();
        Date date = new Date();
        token.setAccessToken(json.getString("access_token"));
        token.setCreateTime(date);
        token.setExpiresTime(DateUtil.setDateHours(date,2));
        token.setCode(corpid);
        token.setCode(wxEnterpriseDO.getCorpid());
        wxEnterpriseTokenDao.save(token);
        return token.getAccessToken();
@ -115,6 +112,27 @@ public class EnterpriseService {
        return rs;
    }
    public String sendMKMesByDoctor(String enterpriseId,String doctor,String content)throws Exception {
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
        if (baseDoctorDO != null && StringUtils.isNotBlank(baseDoctorDO.getMobile())) {
            WxEnterpriseUserDO user = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(enterpriseId, baseDoctorDO.getMobile());
            if (user != null) {
                return sendMKMes(enterpriseId, user.getUserid(), content);
            }
        }
        return "";
    }
    public String sendMKMesByMobile(String enterpriseId,String mobile,String content)throws Exception{
        WxEnterpriseUserDO user = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(enterpriseId,mobile);
        if(user!=null){
            return sendMKMes(enterpriseId,user.getUserid(),content);
        }
        return "";
    }
    public String sendTWMesByDoctor(String enterpriseId,String doctor,String title,String description,String url)throws Exception{
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
@ -166,6 +184,8 @@ public class EnterpriseService {
        param.put("enable_id_trans",0);
        param.put("enable_duplicate_check",0);
        logger.info("TWparam:"+param.toJSONString());
        String rs = HttpUtil.sendPost(mesurl,param.toJSONString());
        logger.info("TWMes:"+rs);
@ -192,7 +212,7 @@ public class EnterpriseService {
        if(depts!=null&&depts.size()>0){
            for(int i=0;i<depts.size();i++){
                JSONObject dept = (JSONObject) depts.get(i);
                deptStr+=dept.getString("id")+"|";
                deptStr+=dept.getString("id")+",";
            }
            deptStr = deptStr.substring(0,deptStr.length()-1);
        }
@ -201,9 +221,38 @@ public class EnterpriseService {
        return deptStr;
    }
    public String sendMKMes(String enterpriseId,String userId,String content)throws Exception{
        String mesurl = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token="+getToken(enterpriseId);
        JSONObject param = new JSONObject();
        param.put("touser",userId);
        param.put("toparty","");
        param.put("totag","");
        param.put("msgtype","markdown");
        WxEnterpriseDO wxEnterpriseDO = wxEnterpriseDao.findOne(enterpriseId);
        param.put("agentid",wxEnterpriseDO.getAgentid());
        JSONObject markdown = new JSONObject();
        markdown.put("content",content);
        param.put("markdown",markdown);
        param.put("enable_duplicate_check",0);
        logger.info("MKparam:"+param.toJSONString());
        String rs = HttpUtil.sendPost(mesurl,param.toJSONString());
        logger.info("MKMes:"+rs);
        return rs;
    }
    public JSONArray getUserInfo(String enterpriseId,String dept)throws Exception{
        logger.info("getUserInfo");
        logger.info("getUserInfo dept:"+dept);
        if(StringUtils.isNotBlank(dept)){
@ -229,7 +278,8 @@ public class EnterpriseService {
        String depts = getDeptsId(enterpriseId);
        if(StringUtils.isNotBlank(depts)){
            //多部门过滤
            String dept[] = depts.split("|");
            String dept[] = depts.split(",");
            logger.info("dept size:"+dept.length);
            if(dept!=null&&dept.length>0){
                for(String dp : dept){
                    JSONArray usrs = getUserInfo(enterpriseId,dp);
@ -283,16 +333,16 @@ public class EnterpriseService {
//        param.put("touser","MuOu");
//        param.put("toparty","");
//        param.put("totag","");
//        param.put("msgtype","text");
//        param.put("msgtype","markdown");
//        param.put("agentid",agentId);
//        JSONObject markdown = new JSONObject();
//
//        JSONObject text = new JSONObject();
//        text.put("content","测试MuOu成员企业推送");
//        param.put("text",text);
//        param.put("safe",0);
//        param.put("enable_id_trans",0);
//        markdown.put("content","dd[查看详情](www.baidu.com)");
//
//        param.put("markdown",markdown);
//        param.put("enable_duplicate_check",0);
//
//
//        String rs = HttpUtil.sendPost(url,param.toJSONString());
//
//        System.out.println(rs);
@ -343,18 +393,18 @@ public class EnterpriseService {
//
//    }
//    public static void main(String args[])throws Exception{
//
//        String corpsecret = "SKuRnq7cZqE5ax1YxwBwkCa-jdujkzbpMjWDCYU2raE";
//
//        String corpid = "wwd7335a5d80a9b14f";
//
//        String result = HttpUtil.sendGet("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+corpid+"&corpsecret="+corpsecret);
//
//        JSONObject json = JSONObject.parseObject(result);
//
//        String token = json.getString("access_token");
//
    public static void main(String args[])throws Exception{
        String corpsecret = "Uo-QnbYthpUC0tZt--l71n3QEafT3g2oH_j4mLjCokU";
        String corpid = "ww4bf28f7a26e67fee";
        String result = HttpUtil.sendGet("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+corpid+"&corpsecret="+corpsecret);
        JSONObject json = JSONObject.parseObject(result);
        String token = json.getString("access_token");
//        String url = "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token="+token;
//
//        String rs = HttpUtil.sendGet(url);
@ -373,18 +423,18 @@ public class EnterpriseService {
//           deptStr = deptStr.substring(0,deptStr.length()-1);
//        }
//        System.out.println("deptStr"+deptStr);
//
//        String userUrl ="https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token="+token+"&department_id="+deptStr+"&fetch_child=FETCH_CHILD";
//
//        String users = HttpUtil.sendGet(userUrl);
//
//        JSONObject us = JSONObject.parseObject(users);
//
//        JSONArray list = us.getJSONArray("userlist");
//
//        System.out.println("list"+list.size());
//
//    }
        String userUrl ="https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token="+token+"&department_id=20&fetch_child=FETCH_CHILD";
        String users = HttpUtil.sendGet(userUrl);
        JSONObject us = JSONObject.parseObject(users);
        JSONArray list = us.getJSONArray("userlist");
        System.out.println("list"+list.size());
    }
}

+ 3 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/dao/WxEnterpriseTokenDao.java

@ -5,10 +5,12 @@ import com.yihu.jw.entity.hospital.enterprise.WxEnterpriseTokenDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2020/2/8.
 */
public interface WxEnterpriseTokenDao extends PagingAndSortingRepository<WxEnterpriseTokenDO, String>, JpaSpecificationExecutor<WxEnterpriseTokenDO> {
    WxEnterpriseTokenDO findByCode(String code);
    List<WxEnterpriseTokenDO> findByCodeOrderByCreateTimeDesc(String code);
}

+ 1 - 10
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -231,7 +231,6 @@ public class ImService {
	 * @param patient 患者标识
	 * @param id 会话ID(等同IM表topicId)
	 * @param type 咨询会话类型
	 * @param pagesize 分页大小
	 * @param title 标题关键字
	 * @return
	 */
@ -460,7 +459,7 @@ public class ImService {
		
		for (ConsultTeamLogDo log : logs) {
//                String response = ImUtill.sendTopicIM(getUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent());
			String response = imUtil.sendTopicIM(patientcode, patient.getName(), consult, String.valueOf(log.getType()), log.getContent(),null,patient.getName(),patient.getSex(), IdCardUtil.getAgeForIdcard(patient.getIdcard()));
			String response = imUtil.sendTopicIM(patientcode, patient.getName(), consult, String.valueOf(log.getType()), log.getContent(),null,patient.getName(),Integer.parseInt(IdCardUtil.getSexForIdcard_new(patient.getIdcard())), IdCardUtil.getAgeForIdcard(patient.getIdcard()));
			
			if (org.apache.commons.lang3.StringUtils.isNotEmpty(response)) {
				JSONObject resObj = JSON.parseObject(response);
@ -948,7 +947,6 @@ public class ImService {
	 *
	 * @param outpatientCode
	 * @param patient
	 * @param agent
	 * @param doctorCode
	 * @param reason
	 * @return
@ -1643,7 +1641,6 @@ public class ImService {
	 * @param id 会话ID(等同IM表topicId)
	 * @param type 咨询会话类型
	 * @param status 咨询状态:0全部,1候诊中,2就诊中,3结束
	 * @param pagesize 分页大小
	 * @param title 标题关键字
	 * @param start_time 开始时间
	 * @param end_time 结束时间
@ -1745,9 +1742,6 @@ public class ImService {
	
	/**
	 * 更新会话成员(新增或删除)
	 * @param sessionId 会话id
	 * @param user 新增的成员id
	 * @param oldUserId  删除的成员id
	 */
	public String updateParticipant(String sessionid, String userid, String olduserid)throws Exception {
		return imUtil.updateParticipant(sessionid,userid,olduserid);
@ -1775,7 +1769,6 @@ public class ImService {
	 * @param when
	 * @param symptoms
	 * @param images
	 * @param consult
	 * @return
	 */
	public String generalAddExpertConsult(String patient_code, String general_doctor, String special_doctor, String when, String symptoms, String images, ConsultTeamDo ct) throws Exception {
@ -1929,7 +1922,6 @@ public class ImService {
	 * @param title 标题关键字
	 * @param start_time 开始时间
	 * @param end_time 结束时间
	 * @param patient 居民CODE
	 * @return
	 */
	public List<ConsultVO>  findexpertConsultRecordByDoctor(String doctor, String id,
@ -2016,7 +2008,6 @@ public class ImService {
	 * @param id 会话ID(等同IM表topicId)
	 * @param type 咨询会话类型
	 * @param status 咨询状态:0全部,1候诊中,2就诊中,3结束
	 * @param pagesize 分页大小
	 * @param title 标题关键字
	 * @param start_time 开始时间
	 * @param end_time 结束时间

+ 13 - 1
gateway/ag-basic/src/main/resources/application.yml

@ -155,4 +155,16 @@ spring:
  redis:
    host: 172.16.100.240 # Redis server host.
    port: 6380 # Redis server port.
    password: q4YaQemf
    password: q4YaQemf
---
## 卫计委配置
spring:
  profiles: xmjwprod
  datasource:
    url: jdbc:mysql://59.61.92.90:9409/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: wlyy
    password: qY#j2n5O
  redis:
    host: 59.61.92.90 # Redis server host.
    port: 9054  # Redis server port.
    password: jkzlehr

+ 9 - 2
gateway/ag-basic/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: ag-basic-lyx
    name: ag-basic
  cloud:
    config:
      failFast: true
@ -13,7 +13,7 @@ eureka:
    healthcheck:
      enabled: false #监控检查
    serviceUrl:
      defaultZone: http://jw:jkzl@192.0.33.26:8761/eureka/
      defaultZone: http://jw:jkzl@192.168.120.210:8761/eureka/
  instance:
    prefer-ip-address: false
    instance-id: ${spring.cloud.client.ipAddress}:${server.port}
@ -61,4 +61,11 @@ spring:
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://172.16.100.63:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: xmjwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://121.104.171.156:1221}
      label: ${wlyy.spring.config.label:master}

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

@ -6,6 +6,7 @@ import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.utils.HttpClientUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
@ -198,8 +199,8 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                                        MD5.md5Hex(pw + "{" + salt + "}"),
                                        salt,
                                        patient.getString("name"),
                                        patient.getDate("birthday"),
                                        patient.getInteger("sex"),
                                        IdCardUtil.getBirthdayForIdcard(patient.getString("idcard")),
                                        Integer.parseInt(IdCardUtil.getSexForIdcard_new(patient.getString("idcard"))),
                                        patient.getString("mobile"),
                                        patient.getString("province"),
                                        patient.getString("provinceName"),
@ -280,8 +281,8 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                                            MD5.md5Hex(pw + "{" + salt + "}"),
                                            salt,
                                            patient.getString("name"),
                                            patient.getDate("birthday"),
                                            patient.getInteger("sex"),
                                            IdCardUtil.getBirthdayForIdcard(patient.getString("idcard")),
                                            Integer.parseInt(IdCardUtil.getSexForIdcard_new(patient.getString("idcard"))),
                                            mobile,
                                            null,
                                            null,
@ -614,9 +615,9 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        return null;
    }
//    public static void main(String arg[]){
//
//        String ps = MD5.md5Hex("12401X" + "{" + "Ar8f2" + "}");
//        System.out.println(ps);
//    }
    public static void main(String arg[]){
        String ps = MD5.md5Hex("123456" + "{" + "Ar8f2" + "}");
        System.out.println(ps);
    }
}

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

@ -117,9 +117,17 @@ public class OauthWlyyConfigService {
                        if(roleDOs!=null&&roleDOs.size()>0){
                            //不新增
                        }else{
                            Integer level =  doctorJson.getInteger("level");
                            BaseDoctorRoleDO role = new BaseDoctorRoleDO();
                            role.setDoctorCode(doctorDO.getId());
                            role.setRoleCode("generalDoctor");
                            if(level!=null&&level==1){
                                role.setRoleCode("specialist");
                            }else {
                                role.setRoleCode("generalDoctor");
                            }
                            baseDoctorRoleDao.save(role);
                        }
@ -157,7 +165,13 @@ public class OauthWlyyConfigService {
                        hospitalDO.setDel("1");
                        baseDoctorHospitalDao.save(hospitalDO);
                        Integer level =  doctorJson.getInteger("level");
                        BaseDoctorRoleDO role = new BaseDoctorRoleDO();
                        if(level!=null&&level==1){
                            role.setRoleCode("specialist");
                        }else {
                            role.setRoleCode("generalDoctor");
                        }
                        role.setDoctorCode(temp.getId());
                        role.setRoleCode("generalDoctor");
                        baseDoctorRoleDao.save(role);

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

@ -0,0 +1,218 @@
package com.yihu.jw.security.utils;
import org.apache.commons.lang3.StringUtils;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
 * Created by Trick on 2018/9/3.
 */
public class IdCardUtil {
    public static String level_sex_1="1";
    public static String level_sex_2="2";
    public static String level_sex_3="3";
//    public static String level_sex_1_name="男";
//    public static String level_sex_2_name="女";
//    public static String level_sex_3_name="未知";
    /**
     * 根据身份证的号码算出当前身份证持有者的年龄
     *
     * @param
     * @throws Exception
     */
    public static int getAgeForIdcard(String idcard) {
        try {
            int age = 0;
            if (StringUtils.isEmpty(idcard)) {
                return age;
            }
            String birth = "";
            if (idcard.length() == 18) {
                birth = idcard.substring(6, 14);
            } else if (idcard.length() == 15) {
                birth = "19" + idcard.substring(6, 12);
            }
            int year = Integer.valueOf(birth.substring(0, 4));
            int month = Integer.valueOf(birth.substring(4, 6));
            int day = Integer.valueOf(birth.substring(6));
            Calendar cal = Calendar.getInstance();
            age = cal.get(Calendar.YEAR) - year;
            //周岁计算
            if (cal.get(Calendar.MONTH) < (month - 1) || (cal.get(Calendar.MONTH) == (month - 1) && cal.get(Calendar.DATE) < day)) {
                age--;
            }
            return age;
        } catch (Exception e) {
        }
        return -1;
    }
    /**
     * 身份证提取出身日期
     *
     * @param card
     * @return
     * @throws Exception
     */
    public static Date getBirthdayForIdcard(String card)
            throws Exception {
        Date b = null;
        if (card.length() == 18) {
            String year = card.substring(6).substring(0, 4);// 得到年份
            String yue = card.substring(10).substring(0, 2);// 得到月份
            String ri = card.substring(12).substring(0, 2);// 得到日
            // String day=CardCode.substring(12).substring(0,2);//得到日
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            b = format.parse(year + "-" + yue + "-" + ri);
        } else if (card.length() == 15) {
            String uyear = "19" + card.substring(6, 8);// 年份
            String uyue = card.substring(8, 10);// 月份
            String uri = card.substring(10, 12);// 得到日
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            b = format.parse(uyear + "-" + uyue + "-" + uri);
        }
        return b;
    }
    /**
     * 身份证提取出身日期
     *
     * @param card
     * @return
     * @throws Exception
     */
    public static String getBirthdayForIdcardStr(String card)
            throws Exception {
        if (card.length() == 18) {
            String year = card.substring(6).substring(0, 4);// 得到年份
            String yue = card.substring(10).substring(0, 2);// 得到月份
            String ri = card.substring(12).substring(0, 2);// 得到日
            // String day=CardCode.substring(12).substring(0,2);//得到日
            return year + yue + ri;
        } else if (card.length() == 15) {
            String uyear = "19" + card.substring(6, 8);// 年份
            String uyue = card.substring(8, 10);// 月份
            String uri = card.substring(10, 12);// 得到日
            return uyear + uyue + uri;
        }
        return null;
    }
    /**
     * 根据身份证的号码算出当前身份证持有者的性别
     * 1 女 2 男 3未知
     *
     * @return
     * @throws Exception
     */
//    public static String getSexForIdcard(String CardCode)
//            throws Exception {
//        String sex = level_sex_3;
//        if (CardCode.length() == 18) {
//            if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
//                // modifid by lyr 2016-09-29
//                // sex =  Constant.level_sex_2;
//                sex =level_sex_1;
//                // modifid by lyr 2016-09-29
//            } else {
//                // modifid by lyr 2016-09-29
//                // sex =  Constant.level_sex_1;
//                sex = level_sex_2;
//                // modifid by lyr 2016-09-29
//            }
//        } else if (CardCode.length() == 15) {
//            String usex = CardCode.substring(14, 15);// 用户的性别
//            if (Integer.parseInt(usex) % 2 == 0) {
//                // sex =  Constant.level_sex_2;
//                sex = level_sex_1;
//            } else {
//                // sex =  Constant.level_sex_1;
//                sex = level_sex_2;
//            }
//        }
//        return sex;
//    }
    /**
     * 根据身份证的号码算出当前身份证持有者的性别
     * 1 男 2 女 3未知
     *
     * @return
     * @throws Exception
     */
    public static String getSexForIdcard_new(String CardCode)
            throws Exception {
        String sex = level_sex_3;
        try {
            if (CardCode.length() == 18) {
                if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                    // modifid by lyr 2016-09-29
                    sex = level_sex_2;
                    // modifid by lyr 2016-09-29
                } else {
                    // modifid by lyr 2016-09-29
                    sex = level_sex_1;
                    // modifid by lyr 2016-09-29
                }
            } else if (CardCode.length() == 15) {
                String usex = CardCode.substring(14, 15);// 用户的性别
                if (Integer.parseInt(usex) % 2 == 0) {
                    sex = level_sex_2;
                } else {
                    sex = level_sex_1;
                }
            }
            return sex;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sex;
    }
    
    /**
     * 根据身份证的号码算出当前身份证持有者的性别,返回性别文字
     * 1 男 2 女 3未知
     *
     * @return
     * @throws Exception
     */
    public static String getSexForIdcardReturnName(String CardCode)
            throws Exception {
        String sex = "未知";
        try {
            if (CardCode.length() == 18) {
                if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                    // modifid by lyr 2016-09-29
                    sex = "女";
                    // modifid by lyr 2016-09-29
                } else {
                    // modifid by lyr 2016-09-29
                    sex = "男";
                    // modifid by lyr 2016-09-29
                }
            } else if (CardCode.length() == 15) {
                String usex = CardCode.substring(14, 15);// 用户的性别
                if (Integer.parseInt(usex) % 2 == 0) {
                    sex = "女";
                } else {
                    sex = "男";
                }
            }
            return sex;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sex;
    }
}

+ 2 - 1
server/svr-configuration/src/main/resources/application.yml

@ -18,7 +18,8 @@ eureka:
#      defaultZone: http://jw:jkzl@172.16.1.42:8761/eureka # 中山医院
#      defaultZone: http://jw:jkzl@192.0.33.26:8762/eureka
#      defaultZone: http://jw:jkzl@192.168.33.199:8761/eureka
      defaultZone: http://jw:jkzl@172.16.100.63:8761/eureka  # 心脏中心外网
#      defaultZone: http://jw:jkzl@172.16.100.63:8761/eureka  # 心脏中心外网
      defaultZone: http://jw:jkzl@192.168.120.210:8761/eureka  # 心脏中心外网
  instance:
    #eurika使用IP不使用host
    prefer-ip-address: true

+ 14 - 1
server/svr-configuration/src/main/resources/bootstrap.yml

@ -89,4 +89,17 @@ spring:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.103.150:3000/jkzl/config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:in_master}
        default-label: ${wlyy.spring.config.git.label:in_master}
---
## 卫计委
spring:
  profiles: xmjwprod
##git配置
  cloud:
    config:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.120.210:3000/jkzl/config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:master}

+ 7 - 0
svr/svr-internet-hospital-entrance/pom.xml

@ -174,6 +174,13 @@
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <!--oracle驱动-->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
    </dependencies>
    <build>

+ 24 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/EnterpriseController.java

@ -54,6 +54,30 @@ public class EnterpriseController extends EnvelopRestEndpoint {
        return success(enterpriseService.sendTWMesByDoctor( enterpriseId, doctor, title, description, url));
    }
    @PostMapping(value = "/sendMKMesByDoctor")
    @ApiOperation(value = "发送MK消息")
    public Envelop sendMKMesByDoctor(
            @ApiParam(name = "enterpriseId", value = "企业id", required = true)
            @RequestParam(value = "enterpriseId") String enterpriseId,
            @ApiParam(name = "doctor", value = "医生code", required = true)
            @RequestParam(value = "doctor")String doctor,
            @ApiParam(name = "content", value = "描述", required = true)
            @RequestParam(value = "content")String content) throws Exception{
        return success(enterpriseService.sendMKMesByDoctor(enterpriseId,doctor,content));
    }
    @PostMapping(value = "/sendMKMesByMobile")
    @ApiOperation(value = "发送MK消息")
    public Envelop sendMKMesByMobile(
            @ApiParam(name = "enterpriseId", value = "企业id", required = true)
            @RequestParam(value = "enterpriseId") String enterpriseId,
            @ApiParam(name = "mobile", value = "手机号", required = true)
            @RequestParam(value = "mobile")String mobile,
            @ApiParam(name = "content", value = "描述", required = true)
            @RequestParam(value = "content")String content) throws Exception{
        return success(enterpriseService.sendMKMesByMobile(enterpriseId,mobile,content));
    }
    @PostMapping(value = "/saveAllUser")
    @ApiOperation(value = "拉取用户信息")
    public Envelop saveAllUser(

+ 32 - 0
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -127,5 +127,37 @@ hospital:
im:
  im_list_get: http://172.16.1.42:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
---
# 眼科医院前置机
spring:
  profiles: ykjzOracleProd
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@192.168.20.55:1521:orcl
    username: system
    password: hxyk9573
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle10gDialect
        show_sql: true
    database: oracle
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.16.1.42:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/

+ 6 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -335,10 +335,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			try{
				BaseDoctorDO d = baseDoctorDao.findById(re.getString("doctor"));
				BasePatientDO p = basePatientDao.findById(re.getString("patient"));
				String description ="收到一条线上咨询信息,请及时回复";
				String url = "https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/chatroom?_rs_title="+p.getName()+" 专家咨询&type=1&sessionId="+re.getString("sessiond_id");
				String url = "https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/chatroom?rstitle="+p.getName()+"%20专家咨询&type=1&sessionId="+re.getString("sessiond_id");
				logger.info("url:"+url);
				enterpriseService.sendTWMesBymobile("zsyy",d.getMobile(),"您的专家咨询有新的消息,请您尽快回复", description, url);
				enterpriseService.sendMKMesByMobile("zsyy",d.getMobile(),"您的专家咨询有新的消息,请您尽快回复[查看详情]("+url+")");
			}catch (Exception e){
				logger.info("发送企业号失败"+e.toString());
			}
@ -346,13 +345,16 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		}
		return success("操作成功", consult);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.patientInfo)
	@ApiOperation(value = "根据居民ID获取居民详情信息", notes = "根据居民ID获取居民详情信息")
	public Envelop patientInfo(
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = false) String patient) throws Exception {
		BasePatientDO result = basePatientService.findByIdAndDel(patient);
		//---居民性别取身份证字段--
		result.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(result.getIdcard())));
		return success(result);
	}