Przeglądaj źródła

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

huangwenjie 7 lat temu
rodzic
commit
5f76b74c41
34 zmienionych plików z 454 dodań i 897 usunięć
  1. 10 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  2. 1 0
      edu-article/JkEdu/src/com/yihu/jk/dao/ArticleDao.java
  3. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/BaseController.java
  4. 2 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java
  5. 1 1
      patient-co/patient-co-wlyy/pom.xml
  6. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamMemberDao.java
  7. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  8. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorGuidanceTempLabelDao.java
  9. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  10. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  11. 20 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java
  12. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/RoleService.java
  13. 14 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  14. 36 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java
  15. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java
  16. 121 97
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/YLZUserService.java
  17. 0 64
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZAccessToken.java
  18. 0 126
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZRequestParams.java
  19. 0 360
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZUser.java
  20. 0 137
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZUserCard.java
  21. 24 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/IdCardUtil.java
  22. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java
  23. 98 39
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  24. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/messages/ImMessageController.java
  25. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java
  26. 7 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java
  27. 2 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java
  28. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorGuidanceTempLabelController.java
  29. 20 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorTeamGuidanceController.java
  30. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java
  31. 33 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdCheckUserController.java
  32. 5 5
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  33. 8 5
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  34. 7 5
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

Plik diff jest za duży
+ 10 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 1 - 0
edu-article/JkEdu/src/com/yihu/jk/dao/ArticleDao.java

@ -460,6 +460,7 @@ public class ArticleDao {
			DB.me().insert(MyDatabaseEnum.JkEduDB, sql);
			json.put("Code", 10000);
			json.put("Message", "添加成功");
			json.put("Data", orgArticleVo.getArticleId());
			return json;
		} catch (Exception e) {
			return new JSONObject(StringUtil.jsonResult(-1, Utils.getException(e)));

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/BaseController.java

@ -630,7 +630,7 @@ public class BaseController {
            // 总条数
            map.put("totalCount", total);
            // 总页数
            map.put("totalPage", 1);
            map.put("totalPage", Math.ceil((double)total/(rows)));
            // 结果集
            map.put("detailModelList", list);
            return mapper.writeValueAsString(map);

+ 2 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java

@ -140,7 +140,7 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
//        }
        String f = filter.toString();
//        System.out.println("sql:"+sql+f+" order by i.czrq desc "+" limit "+(page-1)+","+pageSize);
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql+f+" order by i.czrq desc "+" limit "+(page-1)+","+pageSize);
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql+f+" order by i.czrq desc "+" limit "+(page-1)*pageSize+","+pageSize);
        if(resultList.size()<=0){
            return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
        }
@ -279,7 +279,7 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
//        }
        String f = filter.toString();
//        System.out.println("sql:"+sql+f+" order by i.czrq desc "+" limit "+(page-1)+","+pageSize);
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql+f+" order by i.czrq desc "+" limit "+(page-1)+","+pageSize);
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql+f+" order by i.czrq desc "+" limit "+(page-1)*pageSize+","+pageSize);
        if(resultList.size()<=0){
            return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
        }

+ 1 - 1
patient-co/patient-co-wlyy/pom.xml

@ -491,7 +491,7 @@
        <dependency>
            <groupId>com.ylz</groupId>
            <artifactId>ehc-empi-java-sdk</artifactId>
            <version>20180522</version>
            <version>20180528</version>
        </dependency>
    </dependencies>
    <build>

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamMemberDao.java

@ -28,6 +28,10 @@ public interface DoctorAdminTeamMemberDao extends
            "AND t.id = m.teamId AND t.available = true AND m.available = true")
    List<AdminTeam> findDoctorTeams(@Param(value = "doctorCode") String doctorCode);
    @Query("SELECT t FROM  AdminTeam t WHERE t.leaderCode = :doctorCode " +
            " AND t.available = true ")
    List<AdminTeam> findDoctorLeaderTeam(@Param(value = "doctorCode") String doctorCode);
    @Query("SELECT d FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m.teamId " +
            "AND m.doctorCode = d.code AND t.available = true AND m.available = true ORDER BY d.level")
    List<Doctor> findAllMembers(@Param(value = "teamId") long teamId);

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -60,13 +60,13 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    int updateHealthIndexMessageByPatient(String doctor, String patient, String type);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7,12,101) order by a.czrq desc")
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7,12,101,14,15) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.prescriptionStatus=?2 and a.type in (6,7) order by a.createTime desc")
    List<Message> getSysTemMessageByPrescription(String doctor, String prescriptionStatus);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12,101) and (a.del = '1' or a.del is null) ")
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12,101,14,15) and (a.del = '1' or a.del is null) ")
    List<Message> getSystemMessage(String doctor, Pageable pageRequest);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 and a.prescriptionStatus='0' ")
@ -111,9 +111,9 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and relationCode = ?1  ")
    List<Message> findByCallServiceRelationCode(String relationCode);
    @Query(" select a from Message a where a.type=14 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1'")
    List<Message> findEduArticle(String receiver);
    @Query(" select a from Message a where a.type=?2 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1' order by a.createTime desc ")
    List<Message> findEduArticle(String receiver,Integer type);
    @Query(" select a from Message a where a.type=14 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1'")
    List<Message> findEduArticle(String receiver, Pageable pageRequest);
    @Query(" select a from Message a where a.type=?2 and a.del='1'  and a.receiver=?1 ")
    List<Message> findEduArticle(String receiver,Integer type, Pageable pageRequest);
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorGuidanceTempLabelDao.java

@ -20,8 +20,8 @@ public interface DoctorGuidanceTempLabelDao extends PagingAndSortingRepository<D
    @Query("select t from DoctorGuidanceTempLabel t where t.teamId = ?1 and t.del=1 order by t.createTime desc ")
    List<DoctorGuidanceTempLabel> findByTeamId(Integer teamId);
    @Query("select t from DoctorGuidanceTempLabel t where t.code = ?1 and t.del=1 ")
    DoctorGuidanceTempLabel findByCodeWithDel(String code);
    @Query("select t from DoctorGuidanceTempLabel t where t.teamId=?1 and  t.name = ?2 and t.del=1 ")
    DoctorGuidanceTempLabel findByNameWithDel(Integer teamId,String name);
    @Query("select t from DoctorGuidanceTempLabel t where t.code = ?1 ")
    DoctorGuidanceTempLabel findByCode(String code);

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

@ -1751,7 +1751,7 @@ public class PatientInfoService extends BaseService {
       /* String sql = "SELECT p.code,p.name,CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END sex,p.idcard,f.doctor_name" +
                " FROM wlyy_patient p  LEFT JOIN wlyy_sign_family f ON p.code = f.patient" +
                " WHERE f.status = 1 AND p.name LIKE '%"+keyWord+"%' OR p.idcard LIKE '%"+keyWord+"%' and f.hospital = '"+hospital+"'"+" limit ?,?";*/
       String sql ="SELECT f.patient as code,f.name,f.idcard,f.doctor_name FROM wlyy_sign_family f where f.status > 0 AND f.hospital = '"+hospital+"' AND f.name LIKE '%"+keyWord+"%' OR f.idcard LIKE '%"+keyWord+"%' limit ?,?";
        String sql ="SELECT f.patient as code,f.name,f.idcard,f.doctor_name FROM wlyy_sign_family f where f.status > 0 AND f.hospital = '"+hospital+"' AND f.name LIKE '%"+keyWord+"%' OR f.idcard LIKE '%"+keyWord+"%' limit ?,?";
        patientList = jdbcTemplate.queryForList(sql ,new Object[]{start,pageSize});
        String patientDeviceSql = "SELECT user as patientCode FROM wlyy_patient_device WHERE device_sn='"+deviceSn+"'";

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -100,7 +100,7 @@ public class MessageService extends BaseService {
    /**
     * 查询医生未读消息和最后消息
     */
    public JSONObject findDoctorAllMessage(String doctor) throws Exception {
    public JSONObject findDoctorAllMessage(String doctor,Integer type) throws Exception {
        // 签约未读消息总数
        int sign = messageDao.amountUnreadByReceiver(doctor);
        JSONObject signJson = new JSONObject();
@ -192,7 +192,7 @@ public class MessageService extends BaseService {
        }
        //文章审核消息
        List<Message> articleMes = messageDao.findEduArticle(doctor);
        List<Message> articleMes = messageDao.findEduArticle(doctor,type);
        JSONObject articleMesJson = new JSONObject();
        if (articleMes != null && articleMes.size() > 0) {
            articleMesJson.put("amount", articleMes.size());
@ -509,12 +509,12 @@ public class MessageService extends BaseService {
     * @return
     * @throws Exception
     */
    public List<Message> getEduArticleMessage(String receiver ,Integer page, Integer pagesize) throws Exception{
    public List<Message> getEduArticleMessage(String receiver ,Integer type,Integer page, Integer pagesize) throws Exception{
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        Sort sort = new Sort(Sort.Direction.DESC, "read","over","createTime");
        // 分页信息
        Pageable pageRequest = new PageRequest(page - 1, pagesize, sort);
        return messageDao.findEduArticle(receiver,pageRequest);
        return messageDao.findEduArticle(receiver,type,pageRequest);
    }
    /**

+ 20 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java

@ -470,7 +470,26 @@ public class PrenatalInspectorPreCardService extends BaseService {
                data = json.getJSONObject("data").getJSONArray("DATA");
            }
            if (data != null && data.size() > 0) {
                return data;
                //排序 智业接口返回的记录没有按检查时间排序
                List<JSONObject> list = new ArrayList<JSONObject>(data.size());
                for (int i=0;i<data.size();i++){
                    list.add(data.getJSONObject(i));
                }
                Collections.sort(list, new Comparator<JSONObject>() {
                    @Override
                    public int compare(JSONObject o1, JSONObject o2) {
                        String time1 = o1.getString("EXAM_TIME");//检查时间
                        String time2 = o2.getString("EXAM_TIME");
                        return time2.compareTo(time1);
                    }
                });
                JSONArray ja = new JSONArray();
                list.forEach(one->{
                    ja.add(one);
                });
                return ja;
            }
            return re;
        } catch (Exception e) {

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/RoleService.java

@ -161,9 +161,9 @@ public class RoleService extends TokenService {
                List<Map<String, Object>> list = doctorInfoService.getDoctorManagerRole(user,"Manage_Article_Authentication");
                if(list.size()>0&&!StringUtils.isEmpty(list.get(0).get("code"))){
                    map.put("authOperate", "1");
                    map.put("doctorAuthOperate", "1");
                }else{
                    map.put("authOperate", "0");
                    map.put("doctorAuthOperate", "0");
                }
                re.add(map);
            }

+ 14 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -1164,11 +1164,11 @@ public class JMJkEduArticleService extends BaseService {
                isAuthentication = 1;
            }
        }
        boolean b = thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
        String  b = thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
                secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,operatorRoleCode,opertorRoleLevel,
                userScope,isAuthentication,articleId,roleType);
        //如果文章需要审核且文章保存数据库成功,推送消息通知给审核的管理员
        if(isAuthentication==0&&b){
        if(isAuthentication==0&&!StringUtils.isEmpty(b)){
            Doctor doctor = doctorDao.findByCode(userCode);
            List<Map<String,Object>> list = doctorInfoService.getDoctorManager(operatorRoleCode);
            for(Map<String,Object> one:list){
@ -1177,7 +1177,7 @@ public class JMJkEduArticleService extends BaseService {
                message.setCzrq(new Date());
                message.setCreateTime(new Date());
                message.setTitle("新增文章审核消息");
                message.setContent(doctor.getName()+"医生提交了文章审核,您可以点击前往处理");
                message.setContent(doctor.getName()+"医生提交了文章审核,请您前往电脑端处理");
                message.setRead(1);//设置未读
                message.setReceiver(one.get("code")+"");//设置接受医生的code()
                message.setSender(userCode);//设置发送的医生
@ -1188,6 +1188,8 @@ public class JMJkEduArticleService extends BaseService {
                message.setReadonly(1);//是否只读消息
                message.setSex(doctor.getSex());
                message.setOver("1");//未处理
                message.setDel("1");
                message.setData(b);
                messageDao.save(message);
                if(messageService.getMessageNoticeSettingByMessageType(one.get("code")+"","1", MessageNoticeSetting.MessageTypeEnum.signSwitch.getValue())){
                    // 发送消息给医生
@ -1328,23 +1330,27 @@ public class JMJkEduArticleService extends BaseService {
                message.setCzrq(new Date());
                message.setCreateTime(new Date());
                message.setTitle("新增文章审核消息");
                if("0".equals(isAuthentication)){
                if("2".equals(isAuthentication)){
                    message.setContent("健康文章审核不通过,原因:"+reasonContent);
                }else{
                }else if("1".equals(isAuthentication)){
                    message.setContent("健康文章审核通过。");
                }else {
                    message.setContent("健康文章取消认证。");
                }
                JSONObject article = thirdJkEduArticleService.getArticalById(one,"","");
                Doctor receiveDoctor = doctorDao.findByCode(article.getString("OperatorId"));
                Doctor receiveDoctor = doctorDao.findByCode(article.getString("operatorId"));
                message.setRead(1);//设置未读
                message.setReceiver(article.getString("OperatorId"));//设置接受医生的code()
                message.setReceiver(article.getString("operatorId"));//设置接受医生的code()
                message.setSender(sender);//设置发送的医生
                message.setSenderName(doctor.getName());
                message.setCode(getCode());
                message.setSenderPhoto(doctor.getPhoto());
                message.setType(14);//新增健康文章审核信息
                message.setType(15);//新增健康文章审核结果信息
                message.setReadonly(1);//是否只读消息
                message.setSex(doctor.getSex());
                message.setOver("1");//未处理
                message.setDel("1");
                message.setData(article.get("articleId")+"");
                messageDao.save(message);
                if(messageService.getMessageNoticeSettingByMessageType(receiveDoctor.getCode(),"1", MessageNoticeSetting.MessageTypeEnum.signSwitch.getValue())){
                    // 发送消息给医生

+ 36 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java

@ -341,6 +341,42 @@ public class DoctorTeamGuidanceService extends BaseService {
        return teamList;
    }
    /**
     * 获取此医生所在的团队列表。
     *
     * @param doctorCode
     * @param filter 搜索关键字
     * @return
     */
    public List findDoctorLeaderTeam(String doctorCode,String filter) throws Exception{
        List teamList = null;
        try {
            List<AdminTeam> doctorTeams = memberDao.findDoctorLeaderTeam(doctorCode);
            teamList = new ArrayList();
            for (AdminTeam AdminTeam : doctorTeams){
                Map map = new HashMap();
                String teamName = AdminTeam.getName();
                Long teamId = AdminTeam.getId();
                map.put("teamName", teamName);
                map.put("teamId", teamId);
                if (StringUtils.isNotEmpty(filter)){
                    List<DoctorTeamGuidanceTemplate> guidances = doctorTeamGuidanceTemplateDao.countTeamListByTile(Integer.valueOf(teamId.toString()),"%"+filter+"%");
                    map.put("amount", guidances.size());
                }else {
                    List<DoctorTeamGuidanceTemplate> listGuidances = doctorTeamGuidanceTemplateDao.countGuidanceByTeamId(Integer.valueOf(teamId.toString()));
                    map.put("amount", listGuidances.size());
                }
                teamList.add(map);
            }
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
        return teamList;
    }
    /**
     * 根据团队模板编码获取单个 有效的 模板详情
     *

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import springfox.documentation.spring.web.json.Json;
@ -403,6 +404,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @param articleId 文章id
     * @return
     */
    @Transactional
    public JSONObject getArticalById(String articleId,String userId,String userType,String messageCode) throws Exception {
        JSONObject re = new JSONObject();
        JSONObject json = null;
@ -447,7 +449,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @return
     * @throws Exception
     */
    public boolean saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String newUrl,
    public String saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String newUrl,
                                 String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,
                                 String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication,String articleId,Integer roleType) throws Exception {
@ -513,11 +515,12 @@ public class ThirdJkEduArticleService extends BaseService {
//            }
            response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(saveArticle, param.toString(), "1"));
            json = JSON.parseObject(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
        if ("10000".equals(json.getString("Code"))) {
            return true;
            return json.get("Data")+"";
        } else {
            throw new Exception(json.getString("Message"));
        }

+ 121 - 97
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/YLZUserService.java

@ -1,36 +1,31 @@
package com.yihu.wlyy.service.third.ylz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.third.ylz.model.YLZAccessToken;
import com.yihu.wlyy.service.third.ylz.model.YLZUser;
import com.yihu.wlyy.service.third.ylz.model.YLZUserCard;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
import com.yihu.wlyy.util.IdCardUtil;
import com.ylzinfo.ehc.empi.sdk.EhcEmpiClient;
import com.ylzinfo.ehc.empi.sdk.domain.ResponseParams;
import com.ylzinfo.ehc.empi.sdk.dto.request.AuthorizationTokenRequest;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.exception.PayException;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import com.ylzinfo.onepay.sdk.utils.SecurityUtil;
import com.ylzinfo.onepay.sdk.utils.Signature;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import com.ylzinfo.ehc.empi.sdk.dto.request.UserInfoRequest;
import com.ylzinfo.ehc.empi.sdk.dto.response.AuthorizationTokenResponse;
import com.ylzinfo.ehc.empi.sdk.dto.response.UserInfoResponse;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2018/5/16 0016.
 */
@Service
public class YLZUserService {
    Logger logger = LoggerFactory.getLogger(YLZUserService.class);
    Logger logger = LoggerFactory.getLogger("elasticsearch_logger");
    //网关地址
    @Value("${ylz.gateway.url}")
    private String gatewayURL;
@ -43,33 +38,46 @@ public class YLZUserService {
    @Value("${ylz.appId}")
    private String appId;
    @Value("${ylz.termId}")
    private String termId;
    private String termId = "01";
    @Value("${ylz.appSecret}")
    private String appSecret;
    @Value("${ylz.redirectUrl}")
    private String redirectUrl;
    @Value("${server.server_url}")
    private String server_url;
    @Autowired
    private SocialSecurityInfoDao socialSecurityInfoDao;
    private String signType = "MD5";
    private String encryptType = "AES";
    private String responseType = "token";
    @Autowired
    private HttpClientUtil httpClientUtil;
    private final String responseType = "token";
    private final String version = "1.0";
    public String getAccessToken() {
    public AuthorizationTokenResponse getAccessToken(String openId) {
        try {
            EhcEmpiClient empiClient = new EhcEmpiClient(gatewayURL, appId, appSecret, termId, "1.0", signType, encryptType);
            EhcEmpiClient empiClient = new EhcEmpiClient(gatewayURL, appId, appSecret, termId, version, signType, encryptType);
            logger.info(net.sf.json.JSONObject.fromObject(empiClient).toString());
            try {
                AuthorizationTokenRequest params = new AuthorizationTokenRequest();
                params.setRedirectUrl(redirectUrl);
                params.setUserName("48");
                String url = empiClient.createUrl("gatewayPage", empiUimcAuthorization, params);
                String responseStr = httpClientUtil.get(url, "UTF-8");
                net.sf.json.JSONObject responseJSON = net.sf.json.JSONObject.fromObject(responseStr);
                Map params = new HashMap();
                params.put("response_type", responseType);
                params.put("redirect_url", redirectUrl);
                params.put("auth_type", "IXM");
                params.put("domain_cust_id", "openId");
                logger.info(net.sf.json.JSONObject.fromObject(params).toString());
                //params 为自行解析回调参数。 key值参考文档
                ResponseParams<AuthorizationTokenResponse> response = empiClient.checkResponseParams(params, AuthorizationTokenResponse.class);
                if (empiClient.isSuccessful(response)) {
                    AuthorizationTokenResponse authorizationTokenResponse = response.getBizContent();
                    logger.info(net.sf.json.JSONObject.fromObject(authorizationTokenResponse).toString());
                    return authorizationTokenResponse;
                } else {
                    logger.error(new StringBuffer("调用易联众接口失败: " + empiUimcAuthorization + "," + net.sf.json.JSONObject.fromObject(response)).toString());
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -80,61 +88,28 @@ public class YLZUserService {
        return null;
    }
    private String initParams(RequestParams requestParams) throws PayException {
        String sign = Signature.createSign(requestParams, this.appSecret);
        requestParams.setSign(sign);
        String requestMessage;
        try {
            logger.info("加密前报文:" + JSONObject.toJSONString(requestParams));
            requestMessage = SecurityUtil.encrypt(JSONObject.toJSONString(requestParams.getParam()), this.encryptType, this.appSecret, this.appId);
            logger.info("加密后报文:" + requestMessage);
            requestParams.setEncryptData(requestMessage);
        } catch (Exception var11) {
            throw new PayException("请求报文加密失败");
        }
        requestParams.setParam((Object) null);
        requestMessage = JSON.toJSONString(requestParams);
        System.out.println("请求参数报文:" + requestMessage);
        return requestMessage;
    }
    /**
     * 此方式仅应用到注册回调
     */
    public YLZUser getUserByToken(String token) {
    public UserInfoResponse getUserByToken(String token) {
        EhcEmpiClient empiClient = new EhcEmpiClient(gatewayURL, appId, appSecret, termId, version, signType, encryptType);
        try {
            String result = null;
            OnepayDefaultClient onepayClient = new OnepayDefaultClient(
                    empiUimcQuery,
                    appId,
                    appSecret, signType, encryptType);
            RequestParams requestParams = new RequestParams();
            requestParams.setAppId(appId);
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            //业务参数
            JSONObject params = new JSONObject();
            params.put("token", token);  //注册回调的token
            requestParams.setParam(params);
            logger.info("requestParams:" + requestParams.toString());
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            if (OnepayDefaultClient.isSuccessful(res)) {
                result = JSON.toJSONString(res.getParam());
                logger.info("易联众返回结果:" + result);
//             新增保存数据
                JSONObject userJson = JSON.parseObject(result).getJSONObject("biz_content");
                YLZUser user = getYLZUser(userJson);
                YLZUserCard userCard = getYLZUserCard(userJson.getJSONArray("card_info"));
                user.setYlzUserCard(userCard);
                return user;
            logger.info(net.sf.json.JSONObject.fromObject(empiClient).toString());
            UserInfoRequest params = new UserInfoRequest();
            params.setAccessToken(token);
            logger.info(net.sf.json.JSONObject.fromObject(params).toString());
            ResponseParams<UserInfoResponse> response = empiClient.queryUserInfo(params);
            if (empiClient.isSuccessful(response)) {
                UserInfoResponse userInfoResponse = response.getBizContent();
                logger.info(net.sf.json.JSONObject.fromObject(userInfoResponse).toString());
                return userInfoResponse;
            } else {
                logger.error("调用易联众接口失败:" + res.toString());
                logger.error(new StringBuffer("调用易联众接口失败: " + empiUimcAuthorization + "," + net.sf.json.JSONObject.fromObject(response)).toString());
            }
            return null;
        } catch (Exception e) {
@ -143,26 +118,75 @@ public class YLZUserService {
        }
    }
    private YLZUserCard getYLZUserCard(JSONArray card_infos) {
        YLZUserCard ylzUserCard = null;
        for (int i = 0; i < card_infos.size(); i++) {
            JSONObject jo = card_infos.getJSONObject(i);
            if ("normal ".equals(jo.getString("state"))) {
                ylzUserCard = JSON.parseObject(jo.toJSONString(), YLZUserCard.class);
                break;
    public String securityURL(String openId) {
        String url = "";
        try {
            EhcEmpiClient empiClient = new EhcEmpiClient(gatewayURL, appId, appSecret, termId, version, signType, encryptType);
            try {
                logger.info(net.sf.json.JSONObject.fromObject(empiClient).toString());
                AuthorizationTokenRequest params = new AuthorizationTokenRequest();
                params.setRedirectUrl(server_url + redirectUrl);
                params.setAuthType("IXM");
                params.setDomainCustId(openId);
                params.setResponseType(responseType);
                url = empiClient.createUrl("gatewayPage", "empi.uimc.authorization", params);
                logger.info(url);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ylzUserCard;
        return url;
    }
    private YLZUser getYLZUser(JSONObject userJson) {
        YLZUser ylzUserCard = JSON.parseObject(userJson.toJSONString(), YLZUser.class);
        return ylzUserCard;
    @Transactional
    public  Map<String, String> synchronousBSInfo(String params) {
        logger.info(params);
        EhcEmpiClient empiClient = new EhcEmpiClient(gatewayURL, appId, appSecret, termId, version, signType, encryptType);
        try {
            //获取get params 入参 转换 并解密验签
            ResponseParams<AuthorizationTokenResponse> response = empiClient.checkURLResponseParams(params, AuthorizationTokenResponse.class);
            UserInfoResponse userInfoResponse = getUserByToken(response.getBizContent().getAccessToken());
            List<UserInfoResponse.CardInfo> cards = userInfoResponse.getCardInfo();
            UserInfoResponse.CardInfo ssc = null;
            for (UserInfoResponse.CardInfo card : cards) {
                //如果患者有正常状态的社保卡
                if ("01".equals(card.getCardType()) && "normal".equals(card.getState().toLowerCase())) {
                    ssc = card;
                    break;
                }
            }
            //同步社保卡号
            SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(userInfoResponse.getIdNo());
            //如果我们表没有记录那就新增一条记录
            if(socialSecurityInfo==null){
                socialSecurityInfo=new SocialSecurityInfo();
                socialSecurityInfo.setXming0(userInfoResponse.getName());
                socialSecurityInfo.setXbie00(IdCardUtil.getSexForIdcard(userInfoResponse.getIdNo()));
                socialSecurityInfo.setCsrqi0(IdCardUtil.getBirthdayForIdcardStr(userInfoResponse.getIdNo()));
                socialSecurityInfo.setSfzh18(userInfoResponse.getIdNo());
                socialSecurityInfo.setGrsfen("8");
                socialSecurityInfo.setId0000(userInfoResponse.getIdNo());
                socialSecurityInfo.setGzztai("01");
                socialSecurityInfo.setCardno(ssc.getCardNo());
                socialSecurityInfo.setCard16(userInfoResponse.getIdNo().substring(0,16));
                socialSecurityInfoDao.save(socialSecurityInfo);
            }
            //如果医保卡不一致更新{
            if(!socialSecurityInfo.getCardno().equals(ssc.getCardNo())){
                socialSecurityInfo.setCardno(ssc.getCardNo());
            }
            Map<String, String> checkReturnModel=new HashMap<>();
            checkReturnModel.put("name",userInfoResponse.getName());
            checkReturnModel.put("mobile",userInfoResponse.getTelephone());
            checkReturnModel.put("idCard",userInfoResponse.getIdNo());
            checkReturnModel.put("ssc",ssc.getCardNo());
            return checkReturnModel;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    public static void main(String[] args) {
        String str = "{\"card_no\":\"111111\"}";
        YLZUserCard ylzUserCard = JSON.parseObject(str, YLZUserCard.class);
        System.out.println(ylzUserCard);
    }
}

+ 0 - 64
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZAccessToken.java

@ -1,64 +0,0 @@
package com.yihu.wlyy.service.third.ylz.model;
import java.util.Date;
/**
 * Created by chenweida on 2018/5/16 0016.
 */
public class YLZAccessToken {
    private String accessToken; //授权token	String(32)
    private String tokenType;
    private Integer expiresIn;// token过期时间  3600 秒
    private Date createTime;// token过期时间  3600 秒
    private String state;
    public String getAccessToken() {
        return accessToken;
    }
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }
    public String getTokenType() {
        return tokenType;
    }
    public void setTokenType(String tokenType) {
        this.tokenType = tokenType;
    }
    public Integer getExpiresIn() {
        return expiresIn;
    }
    public void setExpiresIn(Integer expiresIn) {
        this.expiresIn = expiresIn;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public boolean isNotOutTime() {
        long interval = (new Date().getTime() - this.getCreateTime().getTime()) / 1000;
        if (interval > (expiresIn - 120)) {
            return false;
        } else {
            return true;
        }
    }
}

+ 0 - 126
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZRequestParams.java

@ -1,126 +0,0 @@
//package com.yihu.wlyy.service.third.ylz.model;
//
//import com.alibaba.fastjson.annotation.JSONField;
//import net.sf.json.JSONObject;
//
///**
// * Created by chenweida on 2018/5/22 0022.
// */
//public class YLZRequestParams {
//    @JSONField(name = "timestamp")
//    private String timestamp;
//    @JSONField(name = "sign")
//    private String sign;
//    @JSONField(name = "biz_content")
//    private String bizContent;
//    @JSONField(name = "enc_type")
//    private String signType = "MD5";
//    @JSONField(name = "term_id")
//    private String termId;
//    @JSONField(name = "method")
//    private String method;
//    @JSONField(name = "app_id")
//    private String appId;
//    @JSONField(name = "version")
//    private String version = "1.0";
//    @JSONField(name = "sign_type")
//    private String encType = "AES";
//
//
//    public String getTimestamp() {
//        return timestamp;
//    }
//
//    public void setTimestamp(String timestamp) {
//        this.timestamp = timestamp;
//    }
//
//    public String getSign() {
//        return sign;
//    }
//
//    public void setSign(String sign) {
//        this.sign = sign;
//    }
//
//    public String getBizContent() {
//        return bizContent;
//    }
//
//    public void setBizContent(String bizContent) {
//        this.bizContent = bizContent;
//    }
//
//    public String getSignType() {
//        return signType;
//    }
//
//    public void setSignType(String signType) {
//        this.signType = signType;
//    }
//
//    public String getTermId() {
//        return termId;
//    }
//
//    public void setTermId(String termId) {
//        this.termId = termId;
//    }
//
//    public String getMethod() {
//        return method;
//    }
//
//    public void setMethod(String method) {
//        this.method = method;
//    }
//
//    public String getAppId() {
//        return appId;
//    }
//
//    public void setAppId(String appId) {
//        this.appId = appId;
//    }
//
//    public String getVersion() {
//        return version;
//    }
//
//    public void setVersion(String version) {
//        this.version = version;
//    }
//
//    public String getEncType() {
//        return encType;
//    }
//
//    public void setEncType(String encType) {
//        this.encType = encType;
//    }
//
//    /**
//     * 1. 筛选
//     获取所有请求参数,不包括字节类型参数,如文件、字节流,剔除sign字段。
//     (app_id.、term_id、method、version、timestamp、sign_type、enc_type、)
//     2. 排序
//     将筛选的参数按照第一个字符的键值ASCII码递增排序(字母升序排序),如果遇到相同字符则按照第二个字符的键值ASCII码递增排序,以此类推。
//
//     3. 拼接
//     将排序后的参数与其对应值,组合成“参数=参数值”的格式,并且把这些参数用&字符连接起来,最后拼接上应用密钥在“…参数=参数值key=你的密钥”,此时生成的字符串为待签名字符串,将待签名字符串MD5运算,即是签名(sign)的值。
//     * @return
//     */
//    public String initSign(){
//        JSONObject jo=new JSONObject();
//        jo.put("app_id",this.appId);
//        jo.put("enc_type",this.encType);
//        jo.put("method",this.method);
//        jo.put("sign_type",this.signType);
//        jo.put("term_id",this.termId);
//        jo.put("timestamp",this.timestamp);
//        jo.put("version",this.version);
//
//        StringBuffer sb=new StringBuffer();
//        sb.append("app_id="+this.appId);
//    }
//}

+ 0 - 360
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZUser.java

@ -1,360 +0,0 @@
package com.yihu.wlyy.service.third.ylz.model;
import com.alibaba.fastjson.annotation.JSONField;
/**
 * Created by chenweida on 2018/5/16 0016.
 */
public class YLZUser {
    @JSONField(name = "empi_user_id")
    private String empiUserId;//用户主索引
    @JSONField(name = "name")
    private String name;//姓名
    @JSONField(name = "sex")
    private String sex;//性别  0未知性别 1男 2女 9未说明性别
    @JSONField(name = "birth_day")
    private String birthDay;//出生日期  yyyyMMddHH
    @JSONField(name = "birth_addr")
    private String birthAddr;//出生地
    @JSONField(name = "id_type")
    private String idType;//证件类型   01	居民身份证 02	居民户口簿 03	护照  04	军官证   05	驾驶证   06	港澳居民来往内地通行证   07	台湾居民来往内地通行证   99	其他法定有效证件
    @JSONField(name = "id_no")
    private String idNo;//证件号码
    @JSONField(name = "native")
    private String native_;//国籍
    @JSONField(name = "address")
    private String address;//所在地, 通讯地址
    @JSONField(name = "origin")
    private String origin;//籍贯
    @JSONField(name = "company")
    private String company;//作单位
    @JSONField(name = "company_phone")
    private String companyPhone;//单位电话
    @JSONField(name = "contacts_relationship")
    private String contactsRelationship;//与联系人关系 参考国家互联互通标准GB/T 4761-2008
    @JSONField(name = "contacts_phone")
    private String contactsPhone;//联系人电话
    @JSONField(name = "contacts_addr")
    private String contactsAddr;//联系人地址
    @JSONField(name = "is_certified")
    private String isCertified;//安全认证  0否,1 是
    @JSONField(name = "certificate_authority")
    private String certificateAuthority;//认证机构  1经信局 2公安 等
    @JSONField(name = "telephone")
    private String telephone;//联系方式
    @JSONField(name = "email")
    private String email;//邮箱地址
    @JSONField(name = "post")
    private String post;//邮编
    @JSONField(name = "work")
    private String work;//职业
    @JSONField(name = "home_phone")
    private String homePhone;//家庭电话
    @JSONField(name = "avatar_photo_id")
    private String avatarPhotoId;//照片
    @JSONField(name = "marital_status")
    private String maritalStatus;//婚姻状态  10未婚 20已婚  21初婚 22再婚 23复婚  30丧偶 40离婚 90未说明的婚姻状况
    @JSONField(name = "state")
    private String state;//状态  normal 正常 freeze 冻结  logout 注销   lossed 挂失
    @JSONField(name = "domain_id")
    private String domainId;//标识域编码
    @JSONField(name = "domain_name")
    private String domainName;//标识域名称
    @JSONField(name = "term_id")
    private String termId;//终端号
    @JSONField(name = "oper_id")
    private String operId;//操作员编号
    @JSONField(name = "oper_name")
    private String operName;//操作员姓名
    @JSONField(name = "crt_date")
    private String crtDate;//创建日期
    @JSONField(name = "crt_time")
    private String crtTime;//创建时间
    @JSONField(name = "nation")
    private String nation;//民族
    @JSONField(name = "contacts_name")
    private String contactsName;//联系人姓名
    private YLZUserCard ylzUserCard;
    public String getEmpiUserId() {
        return empiUserId;
    }
    public void setEmpiUserId(String empiUserId) {
        this.empiUserId = empiUserId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getBirthDay() {
        return birthDay;
    }
    public void setBirthDay(String birthDay) {
        this.birthDay = birthDay;
    }
    public String getBirthAddr() {
        return birthAddr;
    }
    public void setBirthAddr(String birthAddr) {
        this.birthAddr = birthAddr;
    }
    public String getIdType() {
        return idType;
    }
    public void setIdType(String idType) {
        this.idType = idType;
    }
    public String getIdNo() {
        return idNo;
    }
    public void setIdNo(String idNo) {
        this.idNo = idNo;
    }
    public String getNative_() {
        return native_;
    }
    public void setNative_(String native_) {
        this.native_ = native_;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getOrigin() {
        return origin;
    }
    public void setOrigin(String origin) {
        this.origin = origin;
    }
    public String getCompany() {
        return company;
    }
    public void setCompany(String company) {
        this.company = company;
    }
    public String getCompanyPhone() {
        return companyPhone;
    }
    public void setCompanyPhone(String companyPhone) {
        this.companyPhone = companyPhone;
    }
    public String getContactsRelationship() {
        return contactsRelationship;
    }
    public void setContactsRelationship(String contactsRelationship) {
        this.contactsRelationship = contactsRelationship;
    }
    public String getContactsPhone() {
        return contactsPhone;
    }
    public void setContactsPhone(String contactsPhone) {
        this.contactsPhone = contactsPhone;
    }
    public String getContactsAddr() {
        return contactsAddr;
    }
    public void setContactsAddr(String contactsAddr) {
        this.contactsAddr = contactsAddr;
    }
    public String getIsCertified() {
        return isCertified;
    }
    public void setIsCertified(String isCertified) {
        this.isCertified = isCertified;
    }
    public String getCertificateAuthority() {
        return certificateAuthority;
    }
    public void setCertificateAuthority(String certificateAuthority) {
        this.certificateAuthority = certificateAuthority;
    }
    public String getTelephone() {
        return telephone;
    }
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getPost() {
        return post;
    }
    public void setPost(String post) {
        this.post = post;
    }
    public String getWork() {
        return work;
    }
    public void setWork(String work) {
        this.work = work;
    }
    public String getHomePhone() {
        return homePhone;
    }
    public void setHomePhone(String homePhone) {
        this.homePhone = homePhone;
    }
    public String getAvatarPhotoId() {
        return avatarPhotoId;
    }
    public void setAvatarPhotoId(String avatarPhotoId) {
        this.avatarPhotoId = avatarPhotoId;
    }
    public String getMaritalStatus() {
        return maritalStatus;
    }
    public void setMaritalStatus(String maritalStatus) {
        this.maritalStatus = maritalStatus;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    public String getDomainId() {
        return domainId;
    }
    public void setDomainId(String domainId) {
        this.domainId = domainId;
    }
    public String getDomainName() {
        return domainName;
    }
    public void setDomainName(String domainName) {
        this.domainName = domainName;
    }
    public String getTermId() {
        return termId;
    }
    public void setTermId(String termId) {
        this.termId = termId;
    }
    public String getOperId() {
        return operId;
    }
    public void setOperId(String operId) {
        this.operId = operId;
    }
    public String getOperName() {
        return operName;
    }
    public void setOperName(String operName) {
        this.operName = operName;
    }
    public String getCrtDate() {
        return crtDate;
    }
    public void setCrtDate(String crtDate) {
        this.crtDate = crtDate;
    }
    public String getCrtTime() {
        return crtTime;
    }
    public void setCrtTime(String crtTime) {
        this.crtTime = crtTime;
    }
    public String getNation() {
        return nation;
    }
    public void setNation(String nation) {
        this.nation = nation;
    }
    public String getContactsName() {
        return contactsName;
    }
    public void setContactsName(String contactsName) {
        this.contactsName = contactsName;
    }
    public YLZUserCard getYlzUserCard() {
        return ylzUserCard;
    }
    public void setYlzUserCard(YLZUserCard ylzUserCard) {
        this.ylzUserCard = ylzUserCard;
    }
}

+ 0 - 137
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/model/YLZUserCard.java

@ -1,137 +0,0 @@
package com.yihu.wlyy.service.third.ylz.model;
import com.alibaba.fastjson.annotation.JSONField;
/**
 * Created by chenweida on 2018/5/16 0016.
 */
public class YLZUserCard {
    @JSONField(name = "card_no")
    private String cardNo;//卡号
    @JSONField(name = "card_type")
    private String cardType;//卡类型 01社保卡  02就诊卡
    @JSONField(name = "card_org")
    private String cardOrg;//办卡机构
    @JSONField(name = "card_zone")
    private String cardZone;//办卡地区
    @JSONField(name = "card_fn")
    private String cardFn;//卡内码
    @JSONField(name = "term_id")
    private String termId;//	终端号
    @JSONField(name = "oper_id")
    private String operId;//	操作员编号
    @JSONField(name = "oper_name")
    private String operName;//操作员姓名
    @JSONField(name = "crt_date")
    private String crtDate;//创建日期
    @JSONField(name = "crt_time")
    private String crtTime;//创建时间
    @JSONField(name = "state")
    private String state; //状态  normal 正常 freeze 冻结  logout 注销  lossed 挂失 
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
    public String getCardType() {
        return cardType;
    }
    public void setCardType(String cardType) {
        this.cardType = cardType;
    }
    public String getCardOrg() {
        return cardOrg;
    }
    public void setCardOrg(String cardOrg) {
        this.cardOrg = cardOrg;
    }
    public String getCardZone() {
        return cardZone;
    }
    public void setCardZone(String cardZone) {
        this.cardZone = cardZone;
    }
    public String getCardFn() {
        return cardFn;
    }
    public void setCardFn(String cardFn) {
        this.cardFn = cardFn;
    }
    public String getTermId() {
        return termId;
    }
    public void setTermId(String termId) {
        this.termId = termId;
    }
    public String getOperId() {
        return operId;
    }
    public void setOperId(String operId) {
        this.operId = operId;
    }
    public String getOperName() {
        return operName;
    }
    public void setOperName(String operName) {
        this.operName = operName;
    }
    public String getCrtDate() {
        return crtDate;
    }
    public void setCrtDate(String crtDate) {
        this.crtDate = crtDate;
    }
    public String getCrtTime() {
        return crtTime;
    }
    public void setCrtTime(String crtTime) {
        this.crtTime = crtTime;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    @Override
    public String toString() {
        return "YLZUserCard{" +
                "cardNo='" + cardNo + '\'' +
                ", cardType='" + cardType + '\'' +
                ", cardOrg='" + cardOrg + '\'' +
                ", cardZone='" + cardZone + '\'' +
                ", cardFn='" + cardFn + '\'' +
                ", termId='" + termId + '\'' +
                ", operId='" + operId + '\'' +
                ", operName='" + operName + '\'' +
                ", crtDate='" + crtDate + '\'' +
                ", crtTime='" + crtTime + '\'' +
                ", state='" + state + '\'' +
                '}';
    }
}

+ 24 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/IdCardUtil.java

@ -122,6 +122,30 @@ public class IdCardUtil {
        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未知

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

@ -203,9 +203,9 @@ public class LoginController extends BaseController {
                        one.put("level","4");
                        if(list.size()>0&&!org.springframework.util.StringUtils.isEmpty(list.get(0).get("code"))){
                            one.put("authOperate", "1");
                            one.put("doctorAuthOperate", "1");
                        }else{
                            one.put("authOperate", "0");
                            one.put("doctorAuthOperate", "0");
                        }
                        map.put("currentUserRole", one);
                    }
@ -313,9 +313,9 @@ public class LoginController extends BaseController {
                         one.put("areas", "");
                         one.put("level","4");
                        if(list.size()>0&&!org.springframework.util.StringUtils.isEmpty(list.get(0).get("code"))){
                            one.put("authOperate", "1");
                            one.put("doctorAuthOperate", "1");
                        }else{
                            one.put("authOperate", "0");
                            one.put("doctorAuthOperate", "0");
                        }
                        map.put("currentUserRole", one);
                    }

+ 98 - 39
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -15,14 +15,13 @@ import com.yihu.wlyy.service.common.account.AccessTokenService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.service.common.login.LoginLogService;
import com.yihu.wlyy.service.third.ylz.YLZUserService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.IdcardValidator;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import com.yihu.wlyy.wechat.util.WeiXinTagUtil;
import com.ylzinfo.ehc.empi.sdk.dto.response.UserInfoResponse;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
@ -34,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.*;
@ -73,6 +73,8 @@ public class WechatController extends WeixinBaseController {
    private WeiXinTagUtil weiXinTagUtil;
    @Autowired
    private RSAUtils rsaUtils;
    @Autowired
    private YLZUserService ylzUserService;
    /**
@ -132,7 +134,7 @@ public class WechatController extends WeixinBaseController {
            // 解密身份证号
            //idcard = RSAUtils.getInstance(patientService).decryptString(idcard);
            rsaUtils.setBaseService(patientService);
            idcard =rsaUtils.decryptString(idcard);
            idcard = rsaUtils.decryptString(idcard);
            idcard = URLDecoder.decode(idcard, "UTF-8");
            idcard = StringUtils.reverse(idcard);
@ -188,7 +190,7 @@ public class WechatController extends WeixinBaseController {
    @ResponseBody
    public String regist(@RequestParam(value = "name", required = true) String name,
                         @RequestParam(value = "idcard", required = true) String idcard,
                         @RequestParam(value = "ssc", required = false) String ssc,
                         @RequestParam(value = "ssc", required = true) String ssc,
                         @RequestParam(value = "mobile", required = true) String mobile,
                         @RequestParam(value = "captcha", required = true) String captcha,
                         @RequestParam(value = "openid", required = true) String openid,
@ -200,9 +202,9 @@ public class WechatController extends WeixinBaseController {
            if (StringUtils.isEmpty(idcard)) {
                return error(-1, "身份证号不允许为空!");
            }
//            if (StringUtils.isEmpty(ssc)) {
//                return error(-1, "社保卡号不允许为空!");
//            }
            if (StringUtils.isEmpty(ssc)) {
                return error(-1, "社保卡号不允许为空!");
            }
            if (StringUtils.isEmpty(mobile)) {
                return error(-1, "手机号不允许为空!");
            }
@ -240,24 +242,80 @@ public class WechatController extends WeixinBaseController {
            } else {
                return error(-1, "请输入正确的身份证号!");
            }
//            SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
            //==========================同步易联众的医保卡号=============================
            //判断此人有没有厦门社保卡 没有补给注册
            //判断身份证号与姓名是否一致
            //判断身份证和社保卡是否一致  统一只存英文字母开头的医保卡
//            if (!org.springframework.util.StringUtils.isEmpty(token)) {
//                UserInfoResponse userInfoResponse = ylzUserService.getUserByToken(token);
//                if (userInfoResponse.getCardInfo() != null && userInfoResponse.getCardInfo().size() > 0) {
//                    List<UserInfoResponse.CardInfo> cards = userInfoResponse.getCardInfo();
//                    Boolean hasCard = false;
//                    UserInfoResponse.CardInfo cardInfo = null;
//                    for (UserInfoResponse.CardInfo card : cards) {
//                        //如果患者有正常状态的社保卡
//                        if ("01".equals(card.getCardType()) && "normal".equals("state")) {
//                            hasCard = true;
//                            cardInfo = card;
//                            break;
//                        }
//                    }
//
//            if (socialSecurityInfo != null) {
//                if (name.compareTo(socialSecurityInfo.getXming0() == null ? "" : socialSecurityInfo.getXming0()) != 0) {
//                    return error(-1, "身份证号与姓名不一致<br/>请检查后重新输入");
//                }
//                if (ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0) {
//                    if (ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0) {
//                    if (!hasCard) {
//                        return error(-1, "医保卡不存在,必须使用正常状态的厦门医保卡");
//                    }
//                    if (name.compareTo(userInfoResponse.getName() == null ? "" : userInfoResponse.getName()) != 0) {
//                        return error(-1, "身份证号与姓名不一致<br/>请检查后重新输入");
//                    }
//                    if (ssc.compareTo(cardInfo.getCardNo() == null ? "" : cardInfo.getCardNo()) != 0) {
//                        return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
//                    } else {
//                        ssc = socialSecurityInfo.getCardno();//统一只存英文字母开头的医保卡
//                        ssc = cardInfo.getCardNo();//统一只存英文字母开头的医保卡
//                    }
//                    SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
//                    //如果我们表没有记录那就新增一条记录
//                    if(socialSecurityInfo==null){
//                        socialSecurityInfo=new SocialSecurityInfo();
//                        socialSecurityInfo.setXming0(name);
//                        socialSecurityInfo.setXbie00(IdCardUtil.getSexForIdcard(idcard));
//                        socialSecurityInfo.setCsrqi0(IdCardUtil.getBirthdayForIdcardStr(idcard));
//                        socialSecurityInfo.setSfzh18(idcard);
//                        socialSecurityInfo.setGrsfen("8");
//                        socialSecurityInfo.setId0000(idcard);
//                        socialSecurityInfo.setGzztai("01");
//                        socialSecurityInfo.setCardno(ssc);
//                        socialSecurityInfoDao.save(socialSecurityInfo);
//                    }
//                    //如果医保卡不一致更新{
//                    if(!socialSecurityInfo.getCardno().equals(ssc)){
//                        socialSecurityInfo.setCardno(ssc);
//                    }
//
//
//                }
//            } else {
//                return error(-1, "对不起,暂不支持16年6月份之后办理的医保卡注册");
//
//            }
            //==============================旧版验证=========================
            SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
            if (socialSecurityInfo != null) {
                if (name.compareTo(socialSecurityInfo.getXming0() == null ? "" : socialSecurityInfo.getXming0()) != 0) {
                    return error(-1, "身份证号与姓名不一致<br/>请检查后重新输入");
                }
                if (ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0) {
                    if (ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0) {
                        return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
                    } else {
                        ssc = socialSecurityInfo.getCardno();//统一只存英文字母开头的医保卡
                    }
                }
            } else {
                return error(-1, "对不起,暂不支持16年6月份之后办理的医保卡注册");
            }
            //==========================旧版验证=============================
            Patient patient = patientDao.findByIdcard(idcard);
            if (patient == null) {
@ -278,7 +336,7 @@ public class WechatController extends WeixinBaseController {
            password = StringUtils.reverse(password);
            patient.setPassword(MD5.GetMD5Code(password + salt));
            patient.setSsc(ssc);
            if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
            if (!"undefined".equals(openid) && StringUtils.isNotBlank(openid)) {
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            }
@ -287,7 +345,7 @@ public class WechatController extends WeixinBaseController {
//                patient.setOpenidTime(new Date());
//            }
            JSONObject json = patientService.register(idcard, ssc, name, mobile, MD5.GetMD5Code(password + salt)
                    ,salt,openid,3);
                    , salt, openid, 3);
            if (json != null) {
                try {
                    Patient p = patientDao.findByIdcard(idcard);
@ -307,6 +365,7 @@ public class WechatController extends WeixinBaseController {
        }
    }
    /**
     * 患者微信登录接口
     *
@ -384,22 +443,22 @@ public class WechatController extends WeixinBaseController {
                    if (StringUtils.isNotBlank(openid) && !"undefined".equals(openid)) {//undefined不更新数据库
                        //patient.setOpenid(openid);
                        //1.判斷居民OPenid是不是空
                        if(StringUtils.isNotBlank(p.getOpenid())){
                        if (StringUtils.isNotBlank(p.getOpenid())) {
                            //如果OPenid与原来用户不相等,则判断登录的openids是否被大于10人登录
                            if(!p.getOpenid().equals(openid)){
                            if (!p.getOpenid().equals(openid)) {
                                //判断登录的openids是否被大于10人登录
                                if(!patientService.checkOpenidCount(openid)){
                                    errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录";
                                if (!patientService.checkOpenidCount(openid)) {
                                    errorMessage = "您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录";
                                    return error(-2, errorMessage);
                                }
                            }
                            patientService.updatePatient(p, openid);
                        }else{
                        } else {
                            // 判断登录的openids是否被大于10人登录
                            if(!patientService.checkOpenidCount(openid)){
                                errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录";
                            if (!patientService.checkOpenidCount(openid)) {
                                errorMessage = "您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录";
                                return error(-2, errorMessage);
                            }else{
                            } else {
                                //未达到上限更新用户openid
                                patientService.updatePatient(p, openid);
                            }
@ -422,7 +481,7 @@ public class WechatController extends WeixinBaseController {
                    loginLog.setLoginType("1");
                    loginLogService.saveLog(loginLog);
                    //判断是否打过标签
                   //if (!(Patient.isWchatTage.yes.getValue() == p.getIsWxtag())) {
                    //if (!(Patient.isWchatTage.yes.getValue() == p.getIsWxtag())) {
                    //清空患者的微信标签
                    weiXinTagUtil.deleteTagWithOpenid(p.getOpenid());
@ -510,22 +569,22 @@ public class WechatController extends WeixinBaseController {
                    if (StringUtils.isNotBlank(openid) && !"undefined".equals(openid)) {//undefined不更新数据库
                        //patient.setOpenid(openid);
                        //1.判斷居民OPenid是不是空
                        if(StringUtils.isNotBlank(p.getOpenid())){
                        if (StringUtils.isNotBlank(p.getOpenid())) {
                            //如果OPenid与原来用户不相等,则判断登录的openids是否被大于10人登录
                            if(!p.getOpenid().equals(openid)){
                            if (!p.getOpenid().equals(openid)) {
                                //判断登录的openids是否被大于10人登录
                                if(!patientService.checkOpenidCount(openid)){
                                    errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录";
                                if (!patientService.checkOpenidCount(openid)) {
                                    errorMessage = "您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录";
                                    return error(-2, errorMessage);
                                }
                            }
                            patientService.updatePatient(p, openid);
                        }else{
                        } else {
                            // 判断登录的openids是否被大于10人登录
                            if(!patientService.checkOpenidCount(openid)){
                                errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录";
                            if (!patientService.checkOpenidCount(openid)) {
                                errorMessage = "您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录";
                                return error(-2, errorMessage);
                            }else{
                            } else {
                                //未达到上限更新用户openid
                                patientService.updatePatient(p, openid);
                            }

+ 3 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/messages/ImMessageController.java

@ -33,9 +33,10 @@ public class ImMessageController extends BaseController {
    @RequestMapping(value = "messages",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    @ApiOperation("查询医生未读消息和最后消息")
    public String messages() {
    public String messages(@ApiParam(name = "type", value = "文章审核的时候必传,消息类型,14:提交文章审核,15:审核结果")
                               @RequestParam(value = "type", required = false,defaultValue = "15") Integer type) {
        try {
            JSONObject json = messageService.findDoctorAllMessage(getUID());
            JSONObject json = messageService.findDoctorAllMessage(getUID(),type);
            return write(200, "获取消息总数成功!", "data", json);
        } catch (Exception e) {
            error(e);

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java

@ -245,7 +245,7 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @ApiOperation("文章认证")
    public  String authenticationArticle(@ApiParam(name = "articleId", value = "文章id,多个文章‘,’隔开")
                                         @RequestParam(value = "articleId", required = true) String articleId,
                                         @ApiParam(name = "isAuthentication", value = "认证,0取消认证,1认证")
                                         @ApiParam(name = "isAuthentication", value = "认证,0取消认证,1认证,2(认证但未通过)")
                                         @RequestParam(value = "isAuthentication", required = true) String isAuthentication,
                                         @ApiParam(name = "firstLevelCategoryId", value = "文章一级分类")
                                         @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
@ -259,10 +259,10 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                                         @RequestParam(value = "reasonContent", required = false) String reasonContent){
        try{
            jmJkEduArticleService.authenticationArticle(articleId,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName,reasonContent,getUID());
            return success("认证成功!");
            return success("操作成功!");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"认证失败!");
            return error(-1,"操作失败!");
        }
    }

+ 7 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java

@ -37,9 +37,10 @@ public class DoctorMessageController extends BaseController {
    @RequestMapping(value = "messages")
    @ResponseBody
    @ApiOperation("查询医生未读消息和最后消息")
    public String messages() {
    public String messages(@ApiParam(name = "type", value = "文章审核的时候必传,消息类型,14:提交文章审核,15:审核结果")
                               @RequestParam(value = "type", required = false) Integer type) {
        try {
            JSONObject json = messageService.findDoctorAllMessage(getUID());
            JSONObject json = messageService.findDoctorAllMessage(getUID(),type);
            return write(200, "获取消息总数成功!", "data", json);
        } catch (Exception e) {
            error(e);
@ -215,12 +216,14 @@ public class DoctorMessageController extends BaseController {
    @RequestMapping(value = "getEduArticleMessage", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取文章审核消息")
    public String getEduArticleMessage(@ApiParam(value = "第几页", defaultValue = "1")
    public String getEduArticleMessage(@ApiParam(name = "type", value = "文章审核的时候必传,消息类型,14:提交文章审核,15:审核结果")
                                           @RequestParam(value = "type", required = false) Integer type,
                                        @ApiParam(value = "第几页", defaultValue = "1")
                                       @RequestParam Integer page,
                                       @ApiParam(value = "每页几行", defaultValue = "10")
                                       @RequestParam Integer pagesize){
        try{
            List<Message> list = messageService.getEduArticleMessage(getUID(),page,pagesize);
            List<Message> list = messageService.getEduArticleMessage(getUID(),type,page,pagesize);
            return write(200,"获取消息成功!", "list", list);
        }catch (Exception e){
            error(e);

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

@ -530,8 +530,8 @@ public class PatientInfoController extends BaseController {
    @ApiOperation("在绑定设备的时候查找患者(带签约信息)")
    public String getPatientSignByNameOrIdCard(@ApiParam(value = "关键搜索词", name = "keyWord") @RequestParam(value = "keyWord",required = true)String keyWord,
                                               @ApiParam(value = "设备sn码", name = "deviceSn") @RequestParam(value = "deviceSn",required = true)String deviceSn,
                                                @ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
                                                @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize){
                                               @ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
                                               @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize){
        if (StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
@ -545,5 +545,4 @@ public class PatientInfoController extends BaseController {
            return error( -1, "查询失败!");
        }
    }
}

+ 7 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorGuidanceTempLabelController.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.web.doctor.template;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
import com.yihu.wlyy.repository.template.DoctorGuidanceTempLabelDao;
import com.yihu.wlyy.service.template.DoctorGuidanceTempLableService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -25,6 +26,8 @@ public class DoctorGuidanceTempLabelController extends BaseController {
    @Autowired
    private DoctorGuidanceTempLableService doctorGuidanceTempLableService;
    @Autowired
    private DoctorGuidanceTempLabelDao doctorGuidanceTempLableDao;
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加指导模板标签")
@ -34,6 +37,10 @@ public class DoctorGuidanceTempLabelController extends BaseController {
                        @ApiParam(name = "teamId", value = "医生团队id", required = true)
                        @RequestParam(value = "teamId", required = true) Integer teamId){
        try{
            DoctorGuidanceTempLabel doctorGuidanceTempLabel = doctorGuidanceTempLableDao.findByNameWithDel(teamId,name);
            if(doctorGuidanceTempLabel!=null){
                return error(-1,"标签名称已存在!");
            }
            DoctorGuidanceTempLabel doctorGuidanceTempLable = doctorGuidanceTempLableService.save(getUID(),name,teamId);
            if(doctorGuidanceTempLable!=null){
                return write(200,"保存标签成功!","data",doctorGuidanceTempLable);

+ 20 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorTeamGuidanceController.java

@ -56,6 +56,25 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
        }
    }
    /**
     * 获取医生所属的所有团队
     *
     * @return
     */
    @RequestMapping(value = "/findDoctorLeaderTeam", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取团队长所属的团队长团队")
    public String findDoctorLeaderTeam(@RequestParam(required = false, defaultValue = "") @ApiParam(value = "搜索关键字") String filter) {
        try {
            String doctorCode = getUID();
            List teamList = doctorTeamGuidanceService.findDoctorLeaderTeam(doctorCode,filter);
            return write(200, "获取医生所属团队成功!", "teamList", teamList);
        } catch (Exception e) {
            return invalidUserException(e, -1, e.getMessage());
        }
    }
    /**
     * 根据医生所属的单个团队获取团队模板列表
     *
@ -124,7 +143,7 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
            @ApiParam(value = "图片路径")
            @RequestParam(required = false) String images,
            @ApiParam(value = "指导标签")
            @RequestParam(required = false) String labelCode
            @RequestParam(required = false,defaultValue = "") String labelCode
    ) {
        try {
//            前端参数校验

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

@ -118,9 +118,9 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "getArticalById",method = RequestMethod.GET)
    @ApiOperation("获取文章详情")
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                 @RequestParam(value = "articleId", required = true) String articleId,
                                 @RequestParam(value = "articleId", required = true,defaultValue = "1") String articleId,
                                 @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                 @RequestParam(value = "userType", required = false) String userType,
                                 @RequestParam(value = "userType", required = false,defaultValue = "1") String userType,
                                 @ApiParam(name = "messageCode", value = "消息code")
                                 @RequestParam(value = "messageCode", required = false) String messageCode){
        try {

+ 33 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdCheckUserController.java

@ -3,16 +3,25 @@ package com.yihu.wlyy.web.third.ylzpay;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.third.ylz.YLZUserService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import com.ylzinfo.ehc.empi.sdk.dto.response.UserInfoResponse;
import com.ylzinfo.onepay.sdk.exception.PayException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONObject;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
 *
@ -20,9 +29,9 @@ import java.io.IOException;
@RestController
@RequestMapping(value = "/check")
@Api(description = "易联众验证相关的服务")
public class ThirdCheckUserController extends BaseController {
public class ThirdCheckUserController extends WeixinBaseController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ThirdCheckUserController.class);
    private static final Logger LOGGER = LoggerFactory.getLogger("elasticsearch_logger");
    @Autowired
    ObjectMapper objectMapper;
@ -31,21 +40,37 @@ public class ThirdCheckUserController extends BaseController {
    /**
     * 验证用户的唯一性
     * 加密URL给前端
     *
     * @throws IOException
     * @throws PayException
     */
    @RequestMapping(value = "/checkUser", method = RequestMethod.POST)
    public String checkUser(String mediaIds) {
    @RequestMapping(value = "/securityURL", method = RequestMethod.POST)
    public String securityURL(
            @ApiParam(name = "openId", value = "openId", required = true) @RequestParam(value = "openId", required = true) String openId) {
        try {
            checkService.getAccessToken();
            return write(200, "获取成功!", "data", "");
            String url = checkService.securityURL(openId);
            return write(200, "获取成功!", "data", url);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "失败!");
        }
    }
    /**
     * 根据易联众返回的tokan 同步sb_info表
     *
     * @return
     */
    @RequestMapping(value = "/synchronousBSInfo", method = RequestMethod.POST)
    public String synchronousBSInfo(
            @ApiParam(name = "params", value = "params", required = true) @RequestParam(value = "params", required = true) String params) {
        try {
            Map<String, String> userInfoResponse = checkService.synchronousBSInfo(params);
            return write(200, "获取成功!", "data", userInfoResponse);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "失败!");
        }
    }
}

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

@ -163,9 +163,9 @@ Riva:
ylz:
  appId: aaa
  appSecret:  aaa
  redirectUrl:  aaa
  termId: aaa
  appId: 1BQ08T2R60006501A8C00000BE73319D
  appSecret:  1BQ08T2QV0006501A8C0000032313A0A
  redirectUrl:  wx/html/home/html/regist-info.html
  termId: 01
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway
    url: http://www.mstpay.com:1300/huangsb

+ 8 - 5
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -141,12 +141,14 @@ es:
jkEdu:
  web:
#    articleBaseUrl: http://yihu.com:9088/
#    articleBaseUrl: http://172.19.103.78:9092/
    articleBaseUrl: http://172.19.103.87:9088/
#消息队列
activemq:
  username: admin
  password: admin
#  url: tcp://172.19.103.78:61616
  url: tcp://172.19.103.87:61616
  queue:
    healtHarticleQueue: healthArticleChannel_test  #健康文章推送
@ -165,9 +167,10 @@ Riva:
ylz:
  appId: aaa
  appSecret:  aaa
  redirectUrl:  aaa
  termId: aaa
  appId: 1BQ08T2R60006501A8C00000BE73319D
  appSecret:  1BQ08T2QV0006501A8C0000032313A0A
  redirectUrl:  wx/html/home/html/regist-info.html
  termId: 01
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway
    url: http://www.mstpay.com:1300/huangsb

+ 7 - 5
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -131,12 +131,14 @@ es:
#集美宣教居民端健康文章
jkEdu:
  web:
#    articleBaseUrl: http://172.19.103.78:9092/
    articleBaseUrl: http://172.19.103.87:9088/
#消息队列
activemq:
  username: admin
  password: admin
#  url: tcp://172.19.103.78:61616
  url: tcp://172.19.103.87:61616
  queue:
    healtHarticleQueue: healthArticleChannel_test  #健康文章推送
@ -154,9 +156,9 @@ Riva:
ylz:
  appId: aaa
  appSecret:  aaa
  redirectUrl:  aaa
  termId: aaa
  appId: 1BQ08T2R60006501A8C00000BE73319D
  appSecret:  1BQ08T2QV0006501A8C0000032313A0A
  redirectUrl:  wx/html/home/html/regist-info.html
  termId: 01
  gateway:
    url: http://120.42.37.94:1301/ehc-empi-web/gateway
    url: http://www.mstpay.com:1300/huangsb