Explorar o código

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

chenweida %!s(int64=8) %!d(string=hai) anos
pai
achega
95f14e8011
Modificáronse 52 ficheiros con 1827 adicións e 433 borrados
  1. 28 27
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java
  2. 4 4
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/model/FilterModel.java
  3. 116 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  4. 25 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/config/quartz/JobFactory.java
  5. 52 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/config/quartz/SchedulerConfig.java
  6. 9 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/PatientHealthRecordDiet.java
  7. 9 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/PatientHealthRecordMedication.java
  8. 9 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/PatientHealthRecordSports.java
  9. 10 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  10. 19 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java
  11. 65 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/job/RenewToSignJob.java
  12. 49 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/job/SignAgainJob.java
  13. 1 4
      patient-co-wlyy/src/main/java/com/yihu/wlyy/job/SignEndJob.java
  14. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  15. 35 31
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java
  16. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  17. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyRenewDao.java
  18. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  19. 7 11
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateService.java
  20. 17 13
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  21. 27 5
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthRecordService.java
  22. 18 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  23. 1 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  24. 97 17
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  25. 194 20
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  26. 1 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsAllService.java
  27. 109 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  28. 132 25
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  29. 26 9
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/WeiXinCoreService.java
  30. 4 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  31. 20 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java
  32. 139 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendNews.java
  33. 33 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ValueComparator.java
  34. 99 37
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  35. 31 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java
  36. 1 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  37. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthController.java
  38. 21 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  39. 72 30
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java
  40. 20 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/EvaluateController.java
  41. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthController.java
  42. 1 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/hosptail/HospitalController.java
  43. 1 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/hosptail/HospitalWithoutFilterController.java
  44. 5 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java
  45. 48 5
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java
  46. 27 26
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatCoreController.java
  47. 173 110
      patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  48. 17 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinMessageReplyUtils.java
  49. 33 33
      patient-co-wlyy/src/main/resources/application.properties
  50. 5 5
      patient-co-wlyy/src/main/resources/applicationContext.xml
  51. 4 4
      patient-co-wlyy/src/main/webapp/WEB-INF/spring-mvc.xml
  52. BIN=BIN
      patient-co-wlyy/src/main/webapp/images/renew.png

+ 28 - 27
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java

@ -81,7 +81,7 @@ public class SignDataFilter {
     *
     * @param signFamilies 签约列表
     * @param level2Key    二级维度的key
     *                       1:性别 2:年龄 3:分组 4:费用 5:健康服务分布 6:年龄 7:年龄疾病
     *                     1:性别 2:年龄 3:分组 4:费用 5:健康服务分布 6:年龄 7:年龄疾病
     * @param filterDate   过滤的是哪天的数据 yyyy-MM-dd
     * @return
     */
@ -94,9 +94,9 @@ public class SignDataFilter {
     *
     * @param signFamilies 签约列表
     * @param level2Key    二级维度的key
     *                       1:性别 2:年龄 3:分组 4:费用 5:健康服务分布 6:年龄 7:年龄疾病
     *                     1:性别 2:年龄 3:分组 4:费用 5:健康服务分布 6:年龄 7:年龄疾病
     * @param level3Key    三级维度的key
     *                      1.疾病
     *                     1.疾病
     * @param filterDate   过滤的是哪天的数据 yyyy-MM-dd
     * @return
     */
@ -109,9 +109,9 @@ public class SignDataFilter {
     *
     * @param signFamilies 签约列表
     * @param level2Key    二级维度的key
     *                       1:性别 2:年龄 3:分组 4:费用 5:健康服务分布 6:年龄 7:年龄疾病
     *                     1:性别 2:年龄 3:分组 4:费用 5:健康服务分布 6:年龄 7:年龄疾病
     * @param level3Key    三级维度的key
     *                      1.疾病
     *                     1.疾病
     * @param filterDate   过滤的是哪天的数据 yyyy-MM-dd
     * @return
     */
@ -300,7 +300,8 @@ public class SignDataFilter {
    /**
     * 得到二级维度的key
     *1:性别 2:年龄 3:分组 4:费用 5:健康服务分布 6:年龄 7:年龄疾病
     * 1:性别 2:年龄 3:分组 4:费用 5:健康服务分布 6:年龄 7:年龄疾病
     *
     * @param level2Key
     * @return
     */
@ -588,34 +589,34 @@ public class SignDataFilter {
                errorCount++;
                continue;
            }
            Long adminId=signFamily.getAdminTeamCode();
            Long adminId = signFamily.getAdminTeamCode();
            //医生团队列表
            List<Long> adminTeamList=new ArrayList<>();
            if(adminId == null||adminId<=0) {
            List<Long> adminTeamList = new ArrayList<>();
            if (adminId == null || adminId <= 0) {
                //如果团队是空 把数目给待签约的医生 可能是健康管理师也可以能是全科
                if(!StringUtils.isEmpty(signFamily.getDoctor())) {
                if (!StringUtils.isEmpty(signFamily.getDoctor())) {
                    //找出全科医生所在的团队
                    String sqlD="select DISTINCT team_id from wlyy_admin_team_member w where w.doctor_code='"+signFamily.getDoctor()+"'";
                    adminTeamList= jdbcTemplate.queryForList(sqlD,Long.class);
                    if(adminTeamList==null&&adminTeamList.size()==0){
                        errorModels.add(ErrorModel.newEM(signFamily.getCode(),ErrorModel.sign_adminTeam_null));
                        isAll=false;
                    String sqlD = "select DISTINCT team_id from wlyy_admin_team_member w where w.doctor_code='" + signFamily.getDoctor() + "'";
                    adminTeamList = jdbcTemplate.queryForList(sqlD, Long.class);
                    if (adminTeamList == null && adminTeamList.size() == 0) {
                        errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_adminTeam_null));
                        isAll = false;
                        errorCount++;
                        continue;
                    }
                }else if(!StringUtils.isEmpty(signFamily.getDoctorHealth())){
                } else if (!StringUtils.isEmpty(signFamily.getDoctorHealth())) {
                    //找出健康管理师所在的团队
                    String sqlD="select DISTINCT team_id from wlyy_admin_team_member w where w.doctor_code='"+signFamily.getDoctorHealth()+"'  ";
                    adminTeamList= jdbcTemplate.queryForList(sqlD,Long.class);
                    if(adminTeamList==null&&adminTeamList.size()==0){
                        errorModels.add(ErrorModel.newEM(signFamily.getCode(),ErrorModel.sign_adminTeam_null));
                        isAll=false;
                    String sqlD = "select DISTINCT team_id from wlyy_admin_team_member w where w.doctor_code='" + signFamily.getDoctorHealth() + "'  ";
                    adminTeamList = jdbcTemplate.queryForList(sqlD, Long.class);
                    if (adminTeamList == null && adminTeamList.size() == 0) {
                        errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_adminTeam_null));
                        isAll = false;
                        errorCount++;
                        continue;
                    }
                }else{
                    errorModels.add(ErrorModel.newEM(signFamily.getCode(),ErrorModel.sign_adminTeam_null));
                    isAll=false;
                } else {
                    errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_adminTeam_null));
                    isAll = false;
                    errorCount++;
                    continue;
                }
@ -625,18 +626,18 @@ public class SignDataFilter {
            String returnLevel3Key = getLevel3Key(level3Key, signFamily);
            if (StringUtils.isEmpty(returnLevel2Key)) {
                //没有二级维度
                for(int teamNum=0;teamNum<adminTeamList.size();teamNum++){
                for (int teamNum = 0; teamNum < adminTeamList.size(); teamNum++) {
                    ETLModel etlModel = new ETLModel();
                    etlModel.setHospital(orgCodeTemp);
                    etlModel.setTown(hospital.getTown());
                    etlModel.setCity(Constant.city);
                    etlModel.setAdminTeam(adminTeamList.get(teamNum)+"");
                    etlModel.setAdminTeam(adminTeamList.get(teamNum) + "");
                    etlModelList.add(etlModel);
                }
            } else {
                String[] level2Keys = returnLevel2Key.split(",");
                for (int j = 0; j < level2Keys.length; j++) {
                    for(int teamNum=0;teamNum<adminTeamList.size();teamNum++) {
                    for (int teamNum = 0; teamNum < adminTeamList.size(); teamNum++) {
                        ETLModel etlModel = new ETLModel();
                        etlModel.setLevel2Key(level2Keys[j]);
                        etlModel.setLevel3Key(returnLevel3Key);

+ 4 - 4
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/model/FilterModel.java

@ -21,14 +21,14 @@ public class FilterModel {
        this.etlModelList = etlModelList;
    }
    public static FilterModel getFiltrerMode(LogModel logModel, List<ETLModel> etlModelList,Boolean isError){
        return new FilterModel(logModel,etlModelList,isError);
    }
    public LogModel getLogModel() {
        return logModel;
    }
    public static FilterModel getFiltrerMode(LogModel logModel, List<ETLModel> etlModelList,Boolean isError){
        return new FilterModel(logModel,etlModelList,isError);
    }
    public void setLogModel(LogModel logModel) {
        this.logModel = logModel;
    }

+ 116 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -37,6 +37,7 @@ import org.springframework.context.annotation.Scope;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.nativejdbc.OracleJdbc4NativeJdbcExtractor;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
@ -182,6 +183,7 @@ public class CurrentDayAllQuotaJob implements Job {
        computequota_25();//统计质询量总数
        computequota_26();//统计未缴费签约总数
        computequota_27();//统计代预约量
        computequota_28();//统计平均值
        quartzJobLog.setJobContent(allContent.toString());
        quartzJobLog.setJobName("实时统计");
@ -965,6 +967,120 @@ public class CurrentDayAllQuotaJob implements Job {
        allContent.append("-----------27----------");
    }
    /**
     * SQL统计平均值存储redis
     * 统计市,区,机构,团队医生满意度
     */
    private void  computequota_28(){
        //获取市,区统计结果
        List<Map<String,Object>> m1 = getCityTowms();
        JSONObject json1 = new JSONObject();
        json1.put("data",m1);
        redisTemplate.opsForValue().set("quota:28:4:"+Constant.city+":3:"+RedisStorage.timeKey,json1.toString());
        //获取市,机构统计结果
        List<Map<String,Object>> m2 = getCityHoss();
        JSONObject json2 = new JSONObject();
        json2.put("data",m2);
        redisTemplate.opsForValue().set("quota:28:4:"+Constant.city+":2:"+RedisStorage.timeKey,json2.toString());
        //统计区级低下所有机构
        if(m1!=null&&m1.size()>0){
            for(Map<String,Object> m:m1){
                String town =(String)m.get("code");
                List<Map<String,Object>> m3 = getTownHoss(town);
                JSONObject json3 = new JSONObject();
                json3.put("data",m3);
                redisTemplate.opsForValue().set("quota:28:3:"+town+":2:"+RedisStorage.timeKey,json3.toString());
            }
        }
        //得到所有机构
        List<Map<String,Object>> allHs = getAllHoss();
        //得到所有团队统计结果
        List<Map<String,Object>> allTs =getAllHosTeams();
        //将团队按机构分组,分别存储
        if(allHs!=null&&allHs.size()>0){
            for(Map<String,Object> h : allHs){
                String code = (String)h.get("code");
                List<Map<String,Object>> hosTeams = new ArrayList<>();
                Iterator<Map<String,Object>> it = allTs.iterator();
                while(it.hasNext()){
                    Map<String,Object> x = it.next();
                    String hospital = (String)x.get("hospital");
                    if(code.equals(hospital)){
                        hosTeams.add(x);
                        it.remove();
                    }
                }
                JSONObject json = new JSONObject();
                json.put("data",hosTeams);
                redisTemplate.opsForValue().set("quota:28:2:"+code+":1:"+RedisStorage.timeKey,json.toString());
            }
        }
    }
    public List<Map<String,Object>> getCityTowms(){
        List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("city_town_SQL"));
        return map;
    }
    public List<Map<String,Object>> getCityHoss(){
        List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("city_hos_SQL"));
        return map;
    }
    public List<Map<String,Object>> getTownHoss(String townCode){
        List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("town_hos_SQL"),new Object[]{townCode});
        return map;
    }
    public List<Map<String,Object>> getAllHosTeams(){
        List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("team_SQL"));
        return map;
    }
    public List<Map<String,Object>> getAllHoss(){
        List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("All_hos_SQL"));
        return map;
    }
    public String getAvgSqlByCode(String code){
        if("city_town_SQL".equals(code)){
            //统计市级各区
            String city_town_SQL ="SELECT t.code,t.`name` ,ifnull(ROUND(AVG(s.score),1),0) as avgCount " +
                    " FROM wlyy_doctor d " +
                    " RIGHT JOIN dm_town t on t.code=d.town " +
                    " LEFT JOIN wlyy_evaluate_score s ON d.code = s.doctor " +
                    " WHERE t.city='"+Constant.city+"' GROUP BY d.town order by avgCount DESC ";
            return city_town_SQL;
        }else if("city_hos_SQL".equals(code)){
            //统计市级各社区
            String city_hos_SQL ="SELECT  t.code,t.`name`,ifnull(ROUND(AVG(s.score),1),0) as avgCount " +
                    " FROM wlyy_doctor d " +
                    " RIGHT JOIN dm_hospital t on t.code = d.hospital " +
                    " LEFT JOIN wlyy_evaluate_score s ON d.code = s.doctor " +
                    " WHERE t.city='"+Constant.city+"' GROUP BY d.hospital order by avgCount DESC ";
            return city_hos_SQL;
        }else if("town_hos_SQL".equals(code)){
            //统计区级各社区
            String town_hos_SQL ="SELECT  t.code,t.`name`,ifnull(ROUND(AVG(s.score),1),0) as avgCount " +
                    " FROM wlyy_doctor d " +
                    " RIGHT JOIN dm_hospital t on t.code = d.hospital " +
                    " LEFT JOIN wlyy_evaluate_score s ON d.code = s.doctor " +
                    " WHERE t.town= ? GROUP BY d.hospital order by avgCount DESC ";
            return town_hos_SQL;
        }else if("team_SQL".equals(code)){
            //查找所有团队
            String team_SQL ="SELECT  t.id,t.`name` ,d.hospital,ifnull(ROUND(AVG(s.score),1),0) as avgCount " +
                    " FROM wlyy_doctor d " +
                    " RIGHT JOIN wlyy_admin_team t on t.leader_code = d.code " +
                    " LEFT JOIN wlyy_evaluate_score s ON d.code = s.doctor " +
                    " GROUP BY t.id order by avgCount DESC ";
            return team_SQL;
        }else if("All_hos_SQL".equals(code)){
            //查找所有机构
            String All_hos_SQL = "SELECT t.code FROM dm_hospital t where t.city ='"+Constant.city+"'";
            return All_hos_SQL;
        }
    return "";
    }
    public static String getDayString(Integer size) {
        Date date = new Date();//取时间

+ 25 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/config/quartz/JobFactory.java

@ -0,0 +1,25 @@
package com.yihu.wlyy.config.quartz;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.scheduling.quartz.AdaptableJobFactory;
import org.springframework.stereotype.Component;
/**
 * Created by Administrator on 2016.10.12.
 * 為了讓quartz種可以使用Spring的注入
 */
@Component("jobFactory")
public class JobFactory extends AdaptableJobFactory {
    @Autowired
    private AutowireCapableBeanFactory capableBeanFactory;
    @Override
    protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
        // 调用父类的方法
        Object jobInstance = super.createJobInstance(bundle);
       // 进行注入
        capableBeanFactory.autowireBean(jobInstance);
        return jobInstance;
    }
}

+ 52 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/config/quartz/SchedulerConfig.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.config.quartz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import javax.sql.DataSource;
import java.io.IOException;
import java.util.Properties;
/**
 * Created by chenweida on 2016/2/3.
 */
@Configuration
public class SchedulerConfig {
    @Autowired
    private ApplicationContext applicationContext;
    @Autowired
    private JobFactory jobFactory;
    @Autowired
    private DataSource dataSource;
    @Bean
    SchedulerFactoryBean schedulerFactoryBeanWlyy() throws IOException {
        SchedulerFactoryBean bean = new SchedulerFactoryBean();
        bean.setJobFactory(jobFactory);
        bean.setApplicationContext(this.applicationContext);
        bean.setOverwriteExistingJobs(true);
        bean.setStartupDelay(20);// 延时启动
        bean.setAutoStartup(true);
        bean.setDataSource(dataSource);
        bean.setQuartzProperties(quartzProperties());
        return bean;
    }
    /**
     * quartz配置文件
     * @return
     * @throws IOException
     */
    @Bean
    public Properties quartzProperties() throws IOException {
        PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
        propertiesFactoryBean.setLocation(new ClassPathResource("/quartz.properties"));
        propertiesFactoryBean.afterPropertiesSet();
        return propertiesFactoryBean.getObject();
    }
}

+ 9 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/PatientHealthRecordDiet.java

@ -39,6 +39,8 @@ public class PatientHealthRecordDiet extends IdEntity {
	private Date czrq;
	// 是否作废,1正常,0作废
	private String del;
	//记录来源 0手动 1设备同步
	private String source;
	public String getCode() {
		return code;
@ -109,4 +111,11 @@ public class PatientHealthRecordDiet extends IdEntity {
		this.del = del;
	}
	public String getSource() {
		return source;
	}
	public void setSource(String source) {
		this.source = source;
	}
}

+ 9 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/PatientHealthRecordMedication.java

@ -39,6 +39,8 @@ public class PatientHealthRecordMedication extends IdEntity {
	private Date czrq;
	// 是否作废,1正常,0作废
	private String del;
	//记录来源 0 手动 1记录同步
	private String source;
	public String getCode() {
		return code;
@ -110,4 +112,11 @@ public class PatientHealthRecordMedication extends IdEntity {
		this.del = del;
	}
	public String getSource() {
		return source;
	}
	public void setSource(String source) {
		this.source = source;
	}
}

+ 9 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/PatientHealthRecordSports.java

@ -45,6 +45,8 @@ public class PatientHealthRecordSports extends IdEntity {
	private Date czrq;
	// 是否作废,1正常,0作废
	private String del;
	//记录来源 0 手动  1 设备同步
	private String source;
	public String getCode() {
		return code;
@ -143,4 +145,11 @@ public class PatientHealthRecordSports extends IdEntity {
		this.del = del;
	}
	public String getSource() {
		return source;
	}
	public void setSource(String source) {
		this.source = source;
	}
}

+ 10 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.event;
import com.yihu.wlyy.job.QuartzHelper;
import com.yihu.wlyy.job.SignAgainJob;
import com.yihu.wlyy.job.SignEndJob;
import com.yihu.wlyy.job.consult.EvaluateScoreJob;
import com.yihu.wlyy.util.SystemConf;
@ -15,7 +16,7 @@ import java.util.HashMap;
 * Created by lyr-pc on 2017/3/10.
 */
@Service
public class ApplicationEvent implements ApplicationListener<ContextRefreshedEvent>{
public class ApplicationEvent implements ApplicationListener<ContextRefreshedEvent> {
    @Autowired
    QuartzHelper quartzHelper;
@ -38,6 +39,14 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            } else {
                System.out.println("evaluate_score_job exist");
            }
             //启动群发续签图文消息
            if (!quartzHelper.isExistJob("sign_again_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("sign_again_job_trigger");
                quartzHelper.addJob(SignAgainJob.class, trigger, "sign_again_job", new HashMap<String, Object>());
                System.out.println("sign_again_job start success");
            } else {
                System.out.println("sign_again_job exist");
            }
        } catch (Exception e) {
            System.out.println("sign end job start failed");
        }

+ 19 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -80,7 +80,25 @@ public interface DevicePatientHealthIndexDao
	/**
	 * 上次血糖值
     */
	@Query(value = "select a.value1 from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and a.id<?2 and a.value2 = ?3 order by a.record_date desc limit 0,1",nativeQuery = true)
	@Query(value = "select a.value1 from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and a.id<?2 and a.value2 = ?3 order by a.sort_date desc ,record_date desc limit 0,1",nativeQuery = true)
	String getPreValue(String user,Long id,String value2);
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user = ?1 and a.type = ?2 and a.value2 =?3 and a.record_date >= ?4 and a.record_date <= ?5 and a.del = '1' order by a.sort_date desc ,record_date desc limit ?6 ,?7",nativeQuery = true)
	List<DevicePatientHealthIndex> findIndexByPatientNative(String patient, int type,String gi_type, Date start, Date end,int currentSize,int pageSize);
	/**
	 * 获取患者某一天的血糖  普通sql写法
	 * @param patient
	 * @param date
	 * @return
	 */
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and DATE_FORMAT(a.record_date,'%Y-%m-%d') = ?2 order by a.record_date,a.id",nativeQuery = true)
	List<DevicePatientHealthIndex> findByDateNative(String patient, String date );
	@Query(value = "select a.* from device.wlyy_patient_health_index a where a.user = ?1 and a.type = ?2 and a.record_date >= ?3 and a.record_date <= ?4 and a.del = '1' order by a.sort_date desc ,record_date desc limit ?5 ,?6",nativeQuery = true)
	List<DevicePatientHealthIndex> findIndexByPatientNative(String patient, int type, Date start, Date end,int currentSize,int pageSize);
	@Query(value = "select DATE_FORMAT(a.record_date,'%Y-%m-%d') from device.wlyy_patient_health_index a where a.user = ?1 and a.record_date >= ?2 and a.record_date <= ?3 and a.del = '1' group by DATE_FORMAT(a.record_date,'%Y-%m-%d') order by DATE_FORMAT(a.record_date,'%Y-%m-%d') desc limit ?4,5?",nativeQuery = true)
	List<String> findDateList(String patient,Date start ,Date end,int currentSize,int pageSize);
}

+ 65 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/RenewToSignJob.java

@ -0,0 +1,65 @@
package com.yihu.wlyy.job;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.util.Calendar;
/**
 * Created by lyr-pc on 2017/3/9.
 */
@Component
public class RenewToSignJob implements Job {
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            System.out.println("RenewToSign start");
            Calendar cal = Calendar.getInstance();
            int year = cal.get(Calendar.YEAR)-1;
            int month = cal.get(Calendar.MONTH)+1;
            if(month >=7){
                //设置已过期
                String sql = "UPDATE wlyy_sign_family t SET t.status = -4 WHERE t.status>=0 AND t.sign_year='"+year+"' AND t.expenses_status='1'";
                //数据迁移
                String sql2 ="INSERT INTO wlyy_sign_family(" +
                        "code,lw_code,type,patient,openid,name,idcard,ssc," +
                        "mobile,emer_mobile,hospital,hospital_name,doctor," +
                        "doctor_name,begin,end,images,group_code,status,reason," +
                        "czrq,team_code,sign_type,apply_date,release_speak," +
                        "doctor_health_name,doctor_health,family_code,patient_apply_date," +
                        "expenses,expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
                        "sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date,expenses_type," +
                        "sign_year,medical_insurance_num,agent_doctor_code,agent_doctor_name," +
                        "agent_doctor_level,admin_team_code,expenses_time) " +
                        "SELECT code,lw_code,type,patient,openid,name,idcard,ssc," +
                        "mobile,emer_mobile,hospital,hospital_name,doctor,doctor_name," +
                        "begin,end,images,group_code,status,reason,czrq,team_code," +
                        "sign_type,apply_date,release_speak,doctor_health_name," +
                        "doctor_health,family_code,patient_apply_date,expenses," +
                        "expenses_status,sign_source,sign_doctor_code,sign_doctor_name," +
                        "sign_doctor_level,patient_apply_unsgin_date,apply_unsign_date," +
                        "expenses_type,sign_year,medical_insurance_num,agent_doctor_code," +
                        "agent_doctor_name,agent_doctor_level,admin_team_code,expenses_time " +
                        "FROM wlyy_sign_family_renew t WHERE t.is_valid =0 AND t.status =1 AND t.sign_year='"+(year+1)+"' AND t.expenses_status='1'";
                //更改迁移状态
                String sql3 = "UPDATE wlyy_sign_family_renew t SET t.is_valid =1 WHERE t.is_valid =0 AND t.status =1 AND t.sign_year='"+(year+1)+"' AND t.expenses_status='1'";
                jdbcTemplate.execute(sql);
                jdbcTemplate.execute(sql2);
                jdbcTemplate.execute(sql3);
            }
            System.out.println("RenewToSign end");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("RenewToSign failed");
        }
    }
}

+ 49 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/SignAgainJob.java

@ -0,0 +1,49 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.common.account.WechatController;
import com.yihu.wlyy.wechat.process.WeiXinEventProcess;
import com.yihu.wlyy.wechat.util.WeiXinMessageReplyUtils;
import org.json.JSONObject;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
/**
 * Created by Reece on 2017/5/18.
 */
public class SignAgainJob implements Job {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private PatientService patientService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        try {
            System.out.println("sign again job start1 SignAgainJob");
            SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
//            Calendar today = Calendar.getInstance();
            WechatController wechatController = new WechatController();
            wechatController.sendNews();
            System.out.println("sign again job end1 SignAgainJob");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("sign end job failed1 SignAgainJob");
        }
    }
}

+ 1 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/SignEndJob.java

@ -35,7 +35,7 @@ public class SignEndJob implements Job {
            int sucessT = jdbcTemplate.update(sqlT, start, end);
            int sucessTm = jdbcTemplate.update(sqlTm, start, end);
            int sucess = jdbcTemplate.update(sql, start, end);
            renewToSign();
            System.out.println("sign end job end");
        } catch (Exception e) {
            e.printStackTrace();
@ -43,7 +43,4 @@ public class SignEndJob implements Job {
        }
    }
    public void renewToSign(){
    }
}

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

@ -43,6 +43,9 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("select a from Message a where a.receiver = ?1 and a.sender=?2 and a.tzType=?3 order by a.czrq desc")
    List<Message> getHealthIndexMessageByPatient(String doctor,String patient,String type,Pageable pageRequest);
    @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) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);

+ 35 - 31
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java

@ -18,46 +18,50 @@ import java.util.List;
public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
	// 查询患者姓名
	@Query("select p.name from Patient p where p.code=?1 and p.status=1")
	String findNameByCode(String code);
    // 查询患者姓名
    @Query("select p.name from Patient p where p.code=?1 and p.status=1")
    String findNameByCode(String code);
	// 根據患者標識查詢患者信息
	@Query("select p from Patient p where p.code=?1 and p.status=1")
	Patient findByCode(String code);
    // 根據患者標識查詢患者信息
    @Query("select p from Patient p where p.code=?1 and p.status=1")
    Patient findByCode(String code);
	// 根據身份證號查詢患者信息
	@Query("select p from Patient p where p.idcard=?1 and p.status=1")
	Patient findByIdcard(String idcard);
    // 根據身份證號查詢患者信息
    @Query("select p from Patient p where p.idcard=?1 and p.status=1")
    Patient findByIdcard(String idcard);
	@Query("select p from Patient p where p.ssc=?1 and p.status=1")
	Patient findBySsc(String ssc);
    @Query("select p from Patient p where p.ssc=?1 and p.status=1")
    Patient findBySsc(String ssc);
	// 根據手机号查詢患者信息
	@Query("select p from Patient p where p.mobile=?1 and p.status=1")
	List<Patient> findByMobile(String mobile);
    // 根據手机号查詢患者信息
    @Query("select p from Patient p where p.mobile=?1 and p.status=1")
    List<Patient> findByMobile(String mobile);
	// 根據病情等级获取患者信息
	@Query("select p from Patient p where p.diseaseCondition=?1 and p.status=1")
	Iterable<Patient> findInfoByLevel(int level);
    // 根據病情等级获取患者信息
    @Query("select p from Patient p where p.diseaseCondition=?1 and p.status=1")
    Iterable<Patient> findInfoByLevel(int level);
	@Query("select p from Patient p where p.openid=?1 and p.status=1")
	Patient findByOpenid(String openid);
    @Query("select p from Patient p where p.openid=?1 and p.status=1")
    Patient findByOpenid(String openid);
	@Query("select count(1) from Patient p where p.openid=?1 and p.status=1")
	int countByOpenid(String openid);
    @Query("select count(1) from Patient p where p.openid=?1 and p.status=1")
    int countByOpenid(String openid);
	//清空openid
	@Modifying
	@Query("update Patient p set p.openid = null where p.code <> ?1 and p.openid = ?2 and p.status=1")
	int clearOpenid(String patient, String openid);
    //清空openid
    @Modifying
    @Query("update Patient p set p.openid = null where p.code <> ?1 and p.openid = ?2 and p.status=1")
    int clearOpenid(String patient, String openid);
	@Query(" select p from Patient p,SignFamily s where p.code=s.patient and s.status > 0 ")
	List<Patient> findAllSignPatient();
    @Query(" select p from Patient p,SignFamily s where p.code=s.patient and s.status > 0 ")
    List<Patient> findAllSignPatient();
	@Query(" select p from Patient p where password is null ")
	List<Patient> findAllIdCardPatientAndNoPassword();
    @Query(" select p from Patient p where password is null ")
    List<Patient> findAllIdCardPatientAndNoPassword();
	@Query("select p from Patient p where p.status = 1 and p.openid = ?1 order by p.czrq desc")
	Page<Patient> findPatientByOpenid(String openid, Pageable pageable);
    @Query("select p from Patient p where p.status = 1 and p.openid = ?1 order by p.czrq desc")
    Page<Patient> findPatientByOpenid(String openid, Pageable pageable);
    //获取所有的openid并排重
    @Query("select distinct p.openid from Patient p where p.openid is not null and p.openid <> '' ")
    List<String> findOpenids();
}

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -286,6 +286,9 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status >= 0")
    SignFamily findByPatient(String patient);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status >= 0")
    List<SignFamily> findByPatients(String patient);
    @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 1 and a.status >= 0")
    SignFamily findBySanshiIdcard(String idcard);

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

@ -5,7 +5,6 @@
 *******************************************************************************/
package com.yihu.wlyy.repository.patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
@ -16,7 +15,7 @@ import java.util.List;
public interface SignFamilyRenewDao extends PagingAndSortingRepository<SignFamilyRenew, Long>, JpaSpecificationExecutor<SignFamilyRenew> {
    @Query("select a from SignFamilyRenew a where a.idcard = ?1 and a.type = 2 and a.status >= 0")
    SignFamilyRenew findByIdcard(String idcard);
    List<SignFamilyRenew> findByIdcard(String idcard);
    /**
     * 获取所有有效的签约信息(不包含-1 -2)
@ -27,6 +26,7 @@ public interface SignFamilyRenewDao extends PagingAndSortingRepository<SignFamil
    @Query(value = "select a from SignFamilyRenew a where a.patient = ?1 and a.status <> -1 and a.status <> -2")
    List<SignFamilyRenew> findAllActiveSignByPatient(String patient);
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 ")
    List<SignFamilyRenew> findByDoctorAndPatient(String doctor,String patient);
    List<SignFamilyRenew> findByDoctorHealthAndPatient(String doctorHealth,String patient);

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

@ -316,7 +316,7 @@ public class DoctorInfoService extends BaseService {
    public Page<Doctor> getDoctorListByHospital(String query, String hospital,
                                                long id, int pageSize) {
        // 排序
        Sort sort = new Sort(Direction.DESC, "id");
        Sort sort = new Sort(Direction.DESC, "evaluateScore","id");
        // 分页信息
        PageRequest pageRequest = new PageRequest(0, pageSize, sort);
        // 查询全部

+ 7 - 11
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateService.java

@ -39,24 +39,21 @@ public class EvaluateService extends BaseService {
	@Autowired
	EvaluateScoreDao evaluateScoreDao;
	public void save(List<Evaluate> evaluates){
		evaluateDao.save(evaluates);
	private  void save(Map<String,List<Evaluate>> docEvaMap){
		for(String key :docEvaMap.keySet())
			evaluateDao.save(docEvaMap.get(key));
	}
	public void saveByJson(String jsonData,String patient){
		JSONObject jsonObject = new JSONObject(jsonData);
		String consult = jsonObject.getString("consult");
		ConsultTeam consultTeam  = consultTeamService.findByCode(consult);
		if(consultTeam.getEvaluate()==1){
			throw new RuntimeException("已经评价不允许重复评价!");
		}
		JSONArray evaluateArray = jsonObject.getJSONArray("evaluate");
		JSONArray labelArray = jsonObject.getJSONArray("label");
		List<Evaluate> evaluateList =null;
		List<EvaluateLabel> evaluateLabelList = new ArrayList<>();
		Map<String,List<Evaluate>> docEvaMap = new HashMap<>();
		for(Object evaluateObj: evaluateArray){
			Evaluate evaluate = new Evaluate();
			JSONObject obj =(JSONObject) evaluateObj;
			ClazzReflect clazzReflect = new ClazzReflect();
@ -70,7 +67,6 @@ public class EvaluateService extends BaseService {
			}else{
				docEvaMap.get(evaluate.getDoctor()).add(evaluate);
			}
		}
		for(Object labelObj: labelArray){
			EvaluateLabel evaluateLabel = new EvaluateLabel();
@ -83,7 +79,7 @@ public class EvaluateService extends BaseService {
		}
		//计算单条得分
		evaluateScoreCal(docEvaMap,consult);
		this.save(evaluateList);
		this.save(docEvaMap);
		evaluateLabelService.save(evaluateLabelList);
		consultTeam.setEvaluate(1);
		consultTeam.setEvaluateTime(new Date());
@ -156,9 +152,9 @@ public class EvaluateService extends BaseService {
			anonymousScore = anonymousScore.add(realScore.multiply(new BigDecimal("0.3")));
			anonymousScore =anonymousScore.add(anonymousScore1.multiply(new BigDecimal("0.2")));
			anonymousScore =anonymousScore.add(anonymousScore2.multiply(new BigDecimal("0.25")));
			anonymousScore =anonymousScore.add(anonymousScore2.multiply(new BigDecimal("0.25")));
			int evaTimes = Integer.parseInt(evaluateTimesList.get(0).get("count").toString());
			if(evaTimes>0){
			anonymousScore =anonymousScore.add(anonymousScore3.multiply(new BigDecimal("0.25")));
			int evaTimes = 0;
			if(evaluateTimesList.size()>0){
				evaTimes = evaluateTimesList.size();
			}else{
				evaTimes = 1;

+ 17 - 13
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -441,7 +441,8 @@ public class PatientHealthIndexService extends BaseService {
        boolean hadData = false;
        Date date = DateUtil.strToDateShort(dateString);
        /***************** 按时间排序 ***************************/
        List<DevicePatientHealthIndex> list = patientHealthIndexDao.findByDate(patient, dateString);
        List<DevicePatientHealthIndex> list = patientHealthIndexDao.findByDateNative(patient, dateString);
        if (list != null && list.size() > 0) {
            obj.put("type",1);
            obj.put("czrq",date);
@ -637,7 +638,9 @@ public class PatientHealthIndexService extends BaseService {
                    String recordDate = map.get("recordDate");
                    obj.setValue1(value1);
                    obj.setValue2(gi_type);
                    obj.setRecordDate(DateUtil.strToDateAppendNowTime(recordDate, DateUtil.YYYY_MM_DD_HH_MM_SS));
                    if (StringUtils.isNotBlank(recordDate)) {
                        obj.setRecordDate(DateUtil.strToDateAppendNowTime(recordDate, DateUtil.YYYY_MM_DD_HH_MM_SS));
                    }
                    break;
                }
                case "2": {
@ -740,13 +743,13 @@ public class PatientHealthIndexService extends BaseService {
        if(gi_type != 0){
            Sort sort = new Sort(Direction.ASC, "recordDate");
            PageRequest pageRequest = new PageRequest(0, 1000, sort);
            re = patientHealthIndexDao.findIndexByPatient(patient, type,gi_type+"", startDate, endDate, pageRequest).getContent();
            re = patientHealthIndexDao.findIndexByPatientNative(patient, type,gi_type+"", startDate, endDate, pageRequest.getOffset(),pageRequest.getPageSize());
        }else{
            // 排序
            Sort sort = new Sort(Direction.ASC, "recordDate");
            PageRequest pageRequest = new PageRequest(0, 1000, sort);
            re = patientHealthIndexDao.findIndexByPatient(patient, type, startDate, endDate, pageRequest).getContent();
            re = patientHealthIndexDao.findIndexByPatientNative(patient, type, startDate, endDate, pageRequest.getOffset(),pageRequest.getPageSize());
        }
        return re;
@ -775,7 +778,7 @@ public class PatientHealthIndexService extends BaseService {
        {
            PageRequest pageRequest = new PageRequest(page, pageSize);
            //根据时间过滤排序
            List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, pageRequest);
            List<String> dateList = patientHealthIndexDao.findDateList(patient, startDate, endDate, pageRequest.getOffset(),pageRequest.getPageSize());
            if (dateList != null && dateList.size() > 0) {
                for (String dateString : dateList) {
                    DevicePatientHealthIndex obj = getPatientXT(patient, dateString);
@ -788,8 +791,8 @@ public class PatientHealthIndexService extends BaseService {
            // 排序
            Sort sort = new Sort(Direction.DESC, "recordDate");
            PageRequest pageRequest = new PageRequest(page, pageSize, sort);
            Page<DevicePatientHealthIndex> list = patientHealthIndexDao.findIndexByPatient(patient, type, startDate, endDate, pageRequest);
            re = list.getContent();
            List<DevicePatientHealthIndex> list = patientHealthIndexDao.findIndexByPatientNative(patient, type, startDate, endDate, pageRequest.getOffset(),pageRequest.getPageSize());
            re = list;
        }
        return re;
    }
@ -986,12 +989,13 @@ public class PatientHealthIndexService extends BaseService {
        //最新血糖指标
        if (type == 1) {
            DevicePatientHealthIndex obj = patientHealthIndexDao.findLastData(patientCode, 1);
            if (obj != null) {
                String dateString = DateUtil.dateToStrShort(obj.getRecordDate());
                return getPatientXT(patientCode, dateString);
            } else {
                return null;
            }
//            if (obj != null) {
//                String dateString = DateUtil.dateToStrShort(obj.getRecordDate());
//                return getPatientXT(patientCode, dateString);
//            } else {
//                return null;
//            }
            return obj;
        } else if(type ==2) {  //其他指标
            return patientHealthIndexDao.findLastData(patientCode, 2);
        }else{

+ 27 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthRecordService.java

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.yihu.wlyy.util.DateUtil;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -84,7 +85,7 @@ public class PatientHealthRecordService extends BaseService {
	/**
	 * 按分类查询患者运动记录
	 * @param patient 患者标识
	 * @param page 页码
	 * @param
	 * @param pageSize 分页大小
	 * @return
	 */
@ -209,7 +210,7 @@ public class PatientHealthRecordService extends BaseService {
	/**
	 * 按分类查询患者饮食记录
	 * @param patient 患者标识
	 * @param page 页码
	 * @param
	 * @param pageSize 分页大小
	 * @return
	 */
@ -248,19 +249,40 @@ public class PatientHealthRecordService extends BaseService {
		// 查询最近的饮食
		Page<PatientHealthRecordDiet> diet = patientHealthRecordDietDao.findRecentByPatient(patient, new PageRequest(0, 1));
		if (sports != null && sports.getSize() > 0) {
			JSONObject sportObject = new JSONObject();
			for (PatientHealthRecordSports temp : sports) {
				jsonObject.put("sports", temp.getSportsName());
				sportObject.put("sports", temp.getSportsName());
				sportObject.put("sports_time", temp.getSportsTime());
				sportObject.put("sports_type", temp.getSportsType());
				sportObject.put("sports_typeName", temp.getSportsTypeName());
				sportObject.put("czrq", DateUtil.dateToStr(temp.getCzrq(), DateUtil.YYYY_MM_DD));
				sportObject.put("sortDate", DateUtil.dateToStr(temp.getSortDate(), DateUtil.YYYY_MM_DD));
				sportObject.put("source","1".equals(temp.getSource())?1:0);
			}
			jsonObject.put("sprot",sportObject);
		}
		if (medication != null) {
			JSONObject medicationObject = new JSONObject();
			for (PatientHealthRecordMedication temp : medication) {
				jsonObject.put("medication", temp.getMedicinesName());
				medicationObject.put("medication", temp.getMedicinesName());
				medicationObject.put("recordDate",DateUtil.dateToStr(temp.getRecordDate(), DateUtil.YYYY_MM_DD));
				medicationObject.put("source","1".equals(temp.getSource())?1:0);
			}
			jsonObject.put("medication",medicationObject);
		}
		if (diet != null) {
			JSONObject dietObject = new JSONObject();
			for (PatientHealthRecordDiet temp : diet) {
				jsonObject.put("diet", temp.getContent());
				dietObject.put("diet", temp.getContent());
				dietObject.put("recordDate",DateUtil.dateToStr(temp.getRecordDate(), DateUtil.YYYY_MM_DD));
				dietObject.put("images",temp.getImages());
				dietObject.put("source","1".equals(temp.getSource())?1:0);
			}
			jsonObject.put("diet",dietObject);
		}
		return jsonObject;
	}

+ 18 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -9,6 +9,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientDisease;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
@ -17,6 +18,7 @@ import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDiseaseDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyRenewDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.DateUtil;
@ -74,6 +76,8 @@ public class SignPatientLabelInfoService extends BaseService {
    AdminTeamService adminTeamService;
    @Autowired
    SignPatientLabelDao labelDao;
    @Autowired
    SignFamilyRenewDao signFamilyRenewDao;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -202,6 +206,20 @@ public class SignPatientLabelInfoService extends BaseService {
            json.put("wechatFocusRemind", 1);
        }
        String timeKey = DateUtil.dateToStr(new Date(),"yyyyMMdd");
        String flag = redisTemplate.opsForValue().get("renew:"+timeKey+":"+patient);
        if(StringUtils.isNotBlank(flag)){
            json.put("isRemindRenew","1");
        }else{
            json.put("isRemindRenew","0");
        }
        String sql = "SELECT t.czrq FROM wlyy_sign_family_renew t WHERE t.status>=0 AND t.is_valid =0";
        List<Map<String,Object>> renews =  jdbcTemplate.queryForList(sql);
        if(renews!=null&&renews.size()>0){
            Map<String,Object> renew = renews.get(0);
            json.put("renewTime",renew.get("czrq"));
        }
        return json;
    }

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

@ -403,10 +403,8 @@ public class MessageService extends BaseService {
                }
                re.add(map);
                item.setRead(0);//把消息设置为已读
            }
            messageDao.save(list);
            messageDao.updateHealthIndexMessageByPatient(doctor,patient,type);
        }
        return re;
    }

+ 97 - 17
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -99,6 +99,9 @@ public class FamilyContractService extends BaseService {
    MessageService messageService;
    @Autowired
    AdminTeamService adminTeamService;
    @Autowired
    SignPatientLabelDao labelDao;
    @Autowired
@ -260,6 +263,7 @@ public class FamilyContractService extends BaseService {
        // 查询医生基本信息
        Doctor d = doctorDao.findByCode(doctor);
        json.put("doctor", d.getCode());
        json.put("evaluateScore", d.getEvaluateScore());
        json.put("name", d.getName());
        json.put("photo", d.getPhoto());
        json.put("sex", d.getSex());
@ -2882,15 +2886,16 @@ public class FamilyContractService extends BaseService {
     * @param patient 居民code
     * @return
     */
    @Transactional
    public int signRenew(String doctor,String healthDoctor, String patient) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {
            return -1;
        }
        SignFamilyRenew sc = signFamilyRenewDao.findByIdcard(p.getIdcard());
        List<SignFamilyRenew> sc = signFamilyRenewDao.findByIdcard(p.getIdcard());
        //判断身份证号是否已签约
        if (sc != null) {
        if (sc != null&&sc.size()>0) {
            return -2;
        }
@ -2900,25 +2905,96 @@ public class FamilyContractService extends BaseService {
        if (d == null) {
            return -3;
        }
        if (hd == null) {
            return -3;
        }
        SignFamilyRenew sf = new SignFamilyRenew();
        //判断是否有生效记录SQL
        String sql = "SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1'";
        List<Map<String,Object>> signs = jdbcTemplate.queryForList(sql);
        if(signs==null||signs.size()==0){
            return -4;
        }
        Map<String,Object> sign = signs.get(0);
        //判断续签医生是否一致
        if(doctor.equals((String)sign.get("doctor"))){
            //如果一致保存团队信息
            sf.setTeamCode((String)sign.get("teamCode"));
            sf.setAdminTeamId((Long)sign.get("adminTeamId"));
        }else {
            //如果不一致 查看医生团队
            String tcSql = "SELECT t.id FROM wlyy_admin_team t WHERE t.leader_code ='"+doctor+"'";
            List<Map<String ,Object>> ids = jdbcTemplate.queryForList(tcSql);
            if(ids!=null&&ids.size()>0){
                Integer id =  (Integer)ids.get(0).get("id");
                Long lid = id.longValue();
                sf.setAdminTeamId(lid);
            }else{
                //未找到团队信息
                return -5;
            }
            //新建咨询团队组
            DoctorTeam team = new DoctorTeam();
            String code = getCode();
            team.setCode(code);
            team.setCzrq(new Date());
            team.setDel("1");
            team.setSignType("2");
            //判断是否有健康管理师
            if(hd!=null&&StringUtils.isNotBlank(hd.getName())){
                team.setName(d.getName()+","+hd.getName()+","+p.getName());
                //新建健康管理师
                DoctorTeamMember hdmb = new DoctorTeamMember();
                hdmb.setName(hd.getName());
                hdmb.setMemberCode(healthDoctor);
                hdmb.setCode(getCode());
                hdmb.setDel("1");
                hdmb.setCzrq(new Date());
                hdmb.setTeam(code);
                hdmb.setType(hd.getLevel());
                hdmb.setSignType("2");
                doctorTeamDoctor.save(hdmb);
            }else{
                team.setName(d.getName()+","+p.getName());
            }
            //新建医生成员
            DoctorTeamMember dmb = new DoctorTeamMember();
            dmb.setName(d.getName());
            dmb.setMemberCode(doctor);
            dmb.setCode(getCode());
            dmb.setDel("1");
            dmb.setCzrq(new Date());
            dmb.setTeam(code);
            dmb.setType(d.getLevel());
            dmb.setSignType("2");
            //新建病人
            DoctorTeamMember pmb = new DoctorTeamMember();
            pmb.setName(p.getName());
            pmb.setMemberCode(patient);
            pmb.setCode(getCode());
            pmb.setDel("1");
            pmb.setCzrq(new Date());
            pmb.setTeam(code);
            pmb.setType(5);
            pmb.setSignType("2");
            doctorTeamDoctor.save(dmb);
            doctorTeamDoctor.save(pmb);
            doctorTeamDao.save(team);
            //关联新团队
            sf.setTeamCode(code);
        }
        sf.setCode(getCode());
        sf.setCzrq(new Date());
        sf.setPatientApplyDate(new Date());
        if(d!=null){
            sf.setDoctor(doctor);
            sf.setDoctorName(d.getName());
        }
        sf.setDoctor(doctor);
        sf.setDoctorName(d.getName());
        sf.setDoctorHealth(healthDoctor);
        sf.setDoctorHealthName(hd.getName());
        if(hd!=null){
            sf.setDoctorHealth(healthDoctor);
            sf.setDoctorHealthName(hd.getName());
        }
        sf.setMobile(p.getMobile());
        sf.setName(p.getName());
        sf.setIdcard(p.getIdcard());
@ -2933,8 +3009,12 @@ public class FamilyContractService extends BaseService {
        sf.setSignSource("2");//签约来源【1 社区签约 2 移动签约】
        //******************扣费接口**********************/
        sf.setExpensesStatus("0");   //扣费状态 【0未扣费 1已扣费 2已退费】
        Calendar cal = Calendar.getInstance();
        int year =cal.get(Calendar.YEAR);
        sf.setSignYear(year+"");
        sf.setIsValid(0);
        sf.setBegin(new Date());
        sf.setEnd(DateUtil.stringToDate(year+1+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
        SignFamilyRenew temp = signFamilyRenewDao.save(sf);
        if (temp != null) {
@ -2961,7 +3041,7 @@ public class FamilyContractService extends BaseService {
            JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
            if (jsonObject.getString("status").equals("1")) {
                //如果在工作时间内就推送
                PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), "您有一条新的家庭签约申请!", patient);
                PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName()+"申请与您续签家庭医生", patient);
            }
        }

+ 194 - 20
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -4,9 +4,12 @@ import java.util.*;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyRenewDao;
import com.yihu.wlyy.service.app.team.AdminTeamService;
@ -62,7 +65,8 @@ public class SignWebService extends BaseService {
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    private SignFamilyRenewDao signFamilyRenewDao;
    @Autowired
    private DoctorDao doctorDao;
    /**
     * 根据医生代码及签约状态编码 获取该医生签约患者的信息列表
     *
@ -400,7 +404,7 @@ public class SignWebService extends BaseService {
            jsonObject.put("applyDate",renew.getApplyDate());
            jsonObject.put("createTime",renew.getCzrq());
            jsonObject.put("type",renew.getType());
            jsonObject.put("typeName",renew.getType()==1?"三师签约":"家庭签约");
            jsonObject.put("typeName",renew.getType()==1?"三师签约":"家庭签约续签");
            String statusName = "";
            switch (jsonObject.getInt("status")){
                case -4 : statusName = "已到期";break;
@ -517,6 +521,7 @@ public class SignWebService extends BaseService {
        object.put("code",doctor.getCode());
        object.put("jobName",doctor.getJobName());
        object.put("name",doctor.getName());
        object.put("evaluateScore",doctor.getEvaluateScore());
        object.put("photo",doctor.getPhoto());
        object.put("sex",doctor.getSex());
        object.put("hospitalName",doctor.getHospitalName());
@ -689,9 +694,9 @@ public class SignWebService extends BaseService {
            String value = map.get(key)+"";
            if("is_read".equals(key)){
                if("1".equals(value)){
                    resultObject.put("status_name","已完成");
                    resultObject.put("status_name","未读");
                }else{
                    resultObject.put("status_name","进行中");
                    resultObject.put("status_name","已读");
                }
            }
            resultObject.put(key,value);
@ -705,9 +710,9 @@ public class SignWebService extends BaseService {
            String value = map.get(key)+"";
            if("read_status".equals(key)){
                if("1".equals(value)){
                    resultObject.put("status_name","已完成");
                    resultObject.put("status_name","已读");
                }else{
                    resultObject.put("status_name","进行中");
                    resultObject.put("status_name","未读");
                }
            }
            resultObject.put(key,value);
@ -744,8 +749,9 @@ public class SignWebService extends BaseService {
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                "    ,b.openid" +
                "    ,a.czrq" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family_renew where (doctor = ? or doctor_health = ?) and status = ? and type = 2" +
                " ( select czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family_renew where (doctor = ? or doctor_health = ?) and status = ? and type = 2" +
                " order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by a.begin desc limit " + page * pageSize + "," + pageSize;
@ -769,10 +775,37 @@ public class SignWebService extends BaseService {
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                "    ,b.openid" +
                "    ,a.czrq" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family_renew where (doctor = ? or doctor_health = ?) and status > ? and type = 2 order by begin desc ) a " +
                " ( select czrq,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family_renew where (doctor = ? or doctor_health = ?) and status > ? and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code and (a.expenses_status = '0' or a.len < 1) order by a.begin desc limit " + page * pageSize + "," + pageSize;
                " where a.patient = b.code and a.expenses_status = '0' order by a.begin desc limit " + page * pageSize + "," + pageSize;
        // 已签约
        String signedSql = "select " +
                "    a.code " +
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.idcard " +
                "    ,b.name " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
                "    ,b.town_name  as townName" +
                "    ,b.address " +
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                (status == 1 ? "    ,a.patient_apply_date as applyDate " : "    ,a.expenses_time as applyDate ") +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                "    ,b.openid" +
                "    ,a.czrq" +
                " from " +
                " ( select expenses_status,czrq,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family_renew where (doctor = ? or doctor_health = ?) and status = ? and type = 2" +
                " order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code and a.expenses_status = '1' order by a.begin desc limit " + page * pageSize + "," + pageSize;
        //1:待签约 2, 待缴费 3 已签约
@ -783,10 +816,10 @@ public class SignWebService extends BaseService {
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, 0});
                break;
            case 2:// 待缴费
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 1});
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0});
                break;
            case 3:// 已签约
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, 1});
                patients = jdbcTemplate.queryForList(signedSql, new Object[]{doctor, doctor, 1});
                break;
        }
@ -877,7 +910,7 @@ public class SignWebService extends BaseService {
                        renew.setStatus(1);
                    }
                }
                renew.setStatus(1);
                renew.setApplyDate(new Date());
                signFamilyRenewDao.save(renew);
                //发送微信模板消息
@ -885,6 +918,9 @@ public class SignWebService extends BaseService {
                data.put("doctorName",renew.getDoctorName());
                data.put("date",DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
                data.put("content","家庭医生续签");
                data.put("doctor",dotorCode);
                data.put("toUser",patientCode);
                data.put("toName",renew.getName());
                Patient patient = patientService.findByCode(renew.getPatient());
                if(patient!=null && StringUtils.isNotBlank(patient.getOpenid())){
@ -922,6 +958,8 @@ public class SignWebService extends BaseService {
                    }
                }
            }
        }else{
            return 0;
        }
        return 1;
    }
@ -930,9 +968,9 @@ public class SignWebService extends BaseService {
     * 获取年度列表
     * @return
     */
    public JSONObject getRenewYearCount(String doctorCode){
        StringBuffer sql = new StringBuffer("SELECT t.sign_year,COUNT(1) count " +
                "FROM  wlyy_sign_family t WHERE t.doctor ='"+doctorCode+"' AND t.end <=NOW() AND t.status=-4 AND sign_year IS NOT NULL GROUP BY t.sign_year DESC");
    public JSONObject getRenewYearCount(Long teamCode){
        StringBuffer sql = new StringBuffer("SELECT t.sign_year labelCode,t.sign_year labelName,COUNT(1) amount " +
                "FROM  wlyy_sign_family t WHERE t.admin_team_code ="+teamCode+"  AND t.status=-4 AND sign_year IS NOT NULL GROUP BY t.sign_year DESC");
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql.toString());
        JSONObject json = new JSONObject();
        json.put("result",rs);
@ -943,15 +981,151 @@ public class SignWebService extends BaseService {
     * 获取用户信息
     * @return
     */
    public JSONObject getOverDuePatients(String year,String doctorCode,Integer page,Integer pageSize){
    public JSONObject getOverDuePatients(String year,Long teamCode,Integer page,Integer pageSize){
        StringBuffer sql = new StringBuffer("SELECT IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                "p.code,p.idcard,p.name,p.mobile,p.openid,p.phone,p.photo," +
                "p.ssc,t.sign_type,p.sex,t.emer_mobile,t.expenses_time,t.expenses_status " +
                "FROM wlyy_sign_family t ,wlyy_patient p " +
                "WHERE t.patient = p.code AND t.doctor ='"+doctorCode+"' AND t.sign_year ='"+year+"' LIMIT "+page*pageSize+","+pageSize+";");
                "t.patient code,t.idcard,t.name,t.mobile,t.openid," +
                "t.ssc,t.sign_type signType,p.sex ,t.expenses_status expensesStatus " +
                " FROM wlyy_sign_family t " +
                " LEFT JOIN wlyy_patient p ON t.patient = p.code " +
                " WHERE t.admin_team_code ="+teamCode+" AND t.sign_year ='"+year+"' AND t.status =-4 LIMIT "+page*pageSize+","+pageSize);
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql.toString());
        JSONObject json = new JSONObject();
        json.put("result",rs);
        return json;
    }
    /**
     * 统计
     * 咨询量、获取待预约、获取健康教育、获取健康指导
     * @param patient
     * @return
     */
    public JSONObject getSignCountInfoInYear(String patient){
        JSONObject rs = new JSONObject();
        List<SignFamily> signFamilys = signFamilyDao.findByPatients(patient);
        if(signFamilys==null||signFamilys.size()==0){
            throw new RuntimeException("找不到签约关系!");
        }
        SignFamily signFamily = signFamilys.get(0);
        String doctors_sql = "";
        if(StringUtils.isNotBlank(signFamily.getTeamCode())){
          doctors_sql = "SELECT t.member_code member,t.name FROM wlyy_doctor_team_member t WHERE t.team ='"+signFamily.getTeamCode()+"' AND t.type <>5";
        }else{
            throw new RuntimeException("找不到团队关系!");
        }
        List<Map<String,Object>> doctors = jdbcTemplate.queryForList(doctors_sql);
        String doctorCodeSql = "";
        if (doctors!=null&&doctors.size()>0){
            for(int i=0;i<doctors.size();i++){
                Map<String,Object> doctor = doctors.get(i);
                if(i==0){
                    doctorCodeSql = "'"+(String)doctor.get("member")+"'";
                }else{
                    doctorCodeSql +=",'"+(String)doctor.get("member")+"'";
                }
            }
        }
        Calendar cal = Calendar.getInstance();
        int year = cal.get(Calendar.YEAR);
        //咨询量
        String consult_sql = "SELECT COUNT(1) AS consultCount,d.name doctorName FROM wlyy_consult_team t,wlyy_doctor d WHERE t.doctor = d.code AND t.patient ='"+patient+"' " +
                "AND t.czrq <='"+year+"-07-01' AND t.czrq >='"+(year-1)+"-07-01' GROUP BY t.doctor DESC ";
        //获取待预约
        String reservation_sql = "SELECT COUNT(1) AS reservationCount FROM wlyy_patient_reservation  w " +
                " WHERE w.doctor in("+doctorCodeSql+") AND w.patient ='"+patient+"'" +
                " AND w.czrq <='"+year+"-07-01' AND w.czrq >='"+(year-1)+"-07-01'  ";
        //获取健康教育
        String article_sql = "SELECT COUNT(1) AS articleCount FROM wlyy_health_edu_article_patient  w,wlyy_health_edu_article w2 WHERE w.article = w2.code " +
                "AND  w.doctor IN("+doctorCodeSql+") AND w.patient ='"+patient+"' " +
                "AND w.czrq <='"+year+"-07-01' AND w.czrq >='"+(year-1)+"-07-01'  ";
        //获取健康指导
        String guidance_sql = "SELECT COUNT(1) AS guidanceCount  FROM wlyy_patient_health_guidance  w " +
                "WHERE w.doctor IN("+doctorCodeSql+") and w.patient ='"+patient+"' AND w.czrq <='"+year+"-07-01' AND w.czrq >='"+(year-1)+"-07-01'  ";
        //咨询量
        List<Map<String, Object>> consultResult = jdbcTemplate.queryForList(consult_sql);
        //待预约量
        List<Map<String, Object>> reservationResult = jdbcTemplate.queryForList(reservation_sql);
        //健康教育量
        List<Map<String, Object>> articleResult = jdbcTemplate.queryForList(article_sql);
        //健康指导量
        List<Map<String, Object>> guidanceResult = jdbcTemplate.queryForList(guidance_sql);
        Long consultTotal = 0L;
        if(consultResult!=null&&consultResult.size()>0){
            for(Map<String,Object> map :consultResult){
                Long c = (Long)map.get("consultCount");
                consultTotal+=c;
            }
        }
        rs.put("consultTotal",consultTotal);
        rs.put("consultResult",consultResult);
        rs.put("doctors",doctors);
        rs.put("reservationResult",reservationResult);
        rs.put("articleResult",articleResult);
        rs.put("guidanceResult",guidanceResult);
        return rs;
    }
    /**
     * 提醒用户续签约
     * @param access_token
     * @param patientCode
     * @param doctor
     * @return
     * @throws Exception
     */
    public int remainPatientRenew(String access_token,String patientCode,String doctor)throws Exception{
        Doctor d = doctorDao.findByCode(doctor);
        if(doctor==null){
            return -1;
        }
        //发送微信模板消息
        Patient p = patientService.findByCode(patientCode);
        JSONObject json = new JSONObject();
        json.put("keyword1", "续签家庭医生");
        json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
        json.put("remark","提醒医生 :"+d.getName()+"\n"
                +"我们将继续为您提供优质的健康服务。");
        String openid = p.getOpenid();
        String name = p.getName();
        if(StringUtils.isNotBlank(openid)){
            json.put("first",name+",您好!\n" +
                    "您的家庭医生签约将于7月31日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
            PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
            patientSetReminFlag(patientCode);
            return 1;
        }else{
            //如果自己没有绑定,则发给家人
            JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(patientCode);
            Patient member = (Patient)j.get("member");
            if(StringUtils.isNotBlank(member.getOpenid())){
                json.put("first",weiXinOpenIdUtils.getTitleMes(p,(int)j.get("relation"),member.getName())+"\n"+
                        name+",您好!\n" +
                        "您的家庭医生签约将于7月31日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
                PushMsgTask.getInstance().putWxMsg(access_token, 16, member.getOpenid(), member.getName(), json);
                patientSetReminFlag(patientCode);
                return 1;
            }else{
                //发送短信
                String mobile = p.getMobile();
                if(StringUtils.isNotBlank(mobile)){
                    SMSService.sendMsg(mobile,name+"您好!您的家庭医生将于7月31日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
                    patientSetReminFlag(patientCode);
                    return 2;
                }
            }
        }
        return -1;
    }
    public void patientSetReminFlag(String patient){
        String dateKey = DateUtil.dateToStr(new Date(),"yyyyMMdd");
        redisTemplate.opsForValue().set("renew:"+dateKey+":"+patient,"1");
    }
}

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsAllService.java

@ -2518,4 +2518,5 @@ public class StatisticsAllService extends BaseService {
        return 0L;
    }
}

+ 109 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -17,6 +17,7 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.nativejdbc.OracleJdbc4NativeJdbcExtractor;
import org.springframework.stereotype.Service;
import org.apache.commons.lang3.StringUtils;
@ -1597,4 +1598,112 @@ public class StatisticsService extends BaseService {
        }
        return result;
    }
    public JSONObject getAVGSocre(String level,String area){
        String sql = "SELECT ROUND(AVG(s.score),1) avgCount FROM wlyy_evaluate_score s ,wlyy_doctor d WHERE s.doctor = d.code ";
        //市级
        if("4".equals(level)){
            sql +=" AND d.city = ? ";
        //区级
        }else if("3".equals(level)){
            sql +=" AND d.town = ? ";
        //机构
        }else if("2".equals(level)){
            sql +=" AND d.hospital = ? ";
        }
        Map<String,Object> rs = jdbcTemplate.queryForMap(sql,new Object[]{area});
        JSONObject json = new JSONObject();
        json.put("rs",rs);
        return json;
    }
    public JSONArray getAVGSocreByMonth(String level ,String area,String statDate,String endDate)throws  Exception{
        List<String> times =  getMonthBetween(statDate,endDate);
        if(times==null||times.size()==0){
            throw new Exception("时间区间错误");
        }
        String sql = "SELECT DATE_FORMAT(t.czrq,'%Y-%m') mt,ifnull(ROUND(AVG(s.score),1),0)  as avgCount " +
                " FROM  wlyy_consult_team t " +
                "  LEFT JOIN wlyy_doctor d ON d.code = t.doctor" +
                "  LEFT JOIN wlyy_evaluate_score s ON s.doctor = t.doctor" +
                " WHERE t.czrq >=? AND t.czrq <=?";
        //市级
        if("4".equals(level)){
            sql +=" AND d.city = ? ";
            //区级
        }else if("3".equals(level)){
            sql +=" AND d.town = ? ";
            //机构
        }else if("2".equals(level)){
            sql +=" AND d.hospital = ? ";
        }
        sql +=" GROUP BY mt order by mt DESC ";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql,new Object[]{statDate,endDate,area});
        Map<String,Object> map = new HashMap<>();
        if(rs!=null&&rs.size()>0){
            //降低循环层级
            for(Map<String,Object> m : rs){
                map.put((String)m.get("mt"),m);
            }
        }
        JSONArray jsRs = new JSONArray();
        for(String time : times){
            JSONObject json   = new JSONObject();
            json.put("month",time);
            json.put("socre",map.get(time)==null?0:((Map<String,Object>)map.get(time)).get("avgCount"));
            jsRs.put(json);
        }
        return jsRs;
    }
    private  List<String> getMonthBetween(String minDate, String maxDate) throws Exception {
        ArrayList<String> result = new ArrayList<String>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");//格式化为年月
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");//格式化为年月
        Calendar min = Calendar.getInstance();
        Calendar max = Calendar.getInstance();
        min.setTime(sdf2.parse(minDate));
        min.set(min.get(Calendar.YEAR), min.get(Calendar.MONTH), 1);
        max.setTime(sdf2.parse(maxDate));
        max.set(max.get(Calendar.YEAR), max.get(Calendar.MONTH), 2);
        Calendar curr = min;
        while (curr.before(max)) {
            result.add(sdf.format(curr.getTime()));
            curr.add(Calendar.MONTH, 1);
        }
        return result;
    }
    public String getAvgAllInfo(int level ,String area,String lowLevel){
        String timeKey = redisTemplate.opsForValue().get("quota:timeKey");
        String rs = "";
        //市级
        if(level==4){
            if(StringUtils.isBlank(lowLevel)){
                rs = redisTemplate.opsForValue().get("quota:28:"+level+":"+area+":3:"+timeKey);
            }else{
                rs = redisTemplate.opsForValue().get("quota:28:"+level+":"+area+":2:"+timeKey);
            }
        } else if(level ==3){
            rs = redisTemplate.opsForValue().get("quota:28:"+level+":"+area+":2:"+timeKey);
        }else if(level ==2){
            rs = redisTemplate.opsForValue().get("quota:28:"+level+":"+area+":1:"+timeKey);
        }
        return rs;
    }
}

+ 132 - 25
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -17,10 +17,12 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.security.TokenDao;
import com.yihu.wlyy.task.SignSsGetTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.EncodesUtil;
import com.yihu.wlyy.util.IdcardInfoExtractor;
import com.yihu.wlyy.util.SystemData;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -31,9 +33,12 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.utils.Clock;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 患者基本信息类.
@ -58,6 +63,8 @@ public class PatientService extends TokenService {
    JdbcTemplate jdbcTemplate;
    private Clock clock = Clock.DEFAULT;
    //可续签月份
    private int[] canRenewMonth = {4, 5, 6, 7};
    public void setClock(Clock clock) {
        this.clock = clock;
@ -214,7 +221,7 @@ public class PatientService extends TokenService {
                " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE idcard = ?";
        jdbcTemplate.update(sql, new Object[]{code, idcard, name, ssc, mobile, password, salt, imei, 1, ie.getBirthday()
                , ie.getGender(), clock.getCurrentDate(),clock.getCurrentDate(), 0, 0, 0, 0,idcard});
                , ie.getGender(), clock.getCurrentDate(), clock.getCurrentDate(), 0, 0, 0, 0, idcard});
        Patient temp = patientDao.findByIdcard(idcard);
        if (temp != null) {
@ -299,10 +306,11 @@ public class PatientService extends TokenService {
    /**
     * 判断是否续签
     *
     * @param patient
     * @return
     */
    public JSONObject checkCanRenew(String patient){
    public JSONObject checkCanRenew(String patient) {
        // 是否可以续签逻辑
        //A:wlyy_sign_family
        //B: wlyy_sign_family_renew
@ -311,60 +319,159 @@ public class PatientService extends TokenService {
        JSONObject rs = new JSONObject();
        //判断是否签约
        List<SignFamily> signs =  jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family t WHERE t.status >=0 AND t.expenses_status ='1' AND  t.patient ='"+patient+"'  AND NOW() >= t.begin AND NOW() <= t.end",SignFamily.class);
        if(signs!=null){
        List<SignFamily> signs = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family t WHERE t.status >=0 AND t.expenses_status ='1' AND  t.patient ='" + patient + "'  AND NOW() >= t.begin AND NOW() <= t.end", SignFamily.class);
        if (signs != null) {
            //当前年度已经签约
            rs.put("issign","1");
        }else{
            rs.put("issign", "1");
        } else {
            //当前年度未签约
            rs.put("issign","0");
            rs.put("issign", "0");
        }
        //A表有已签约,但还没有扣费的记录的,不允许续签
        List<SignFamily>  signFamilys1 = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family t WHERE t.status >=0 AND t.expenses_status <>'1' AND t.patient ='"+patient+"'",SignFamily.class);
        if(signFamilys1!=null){
            rs.put("isrenew","0");
        List<SignFamily> signFamilys1 = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family t WHERE t.status >=0 AND t.expenses_status <>'1' AND t.patient ='" + patient + "'", SignFamily.class);
        if (signFamilys1 != null) {
            rs.put("isrenew", "0");
            return rs;
        }
        //A表有已签约,且已扣费,当前日期超过了7月1日,且当前日期在合约的有效期范围内,不允许续签
        Calendar calendar =Calendar.getInstance();
        String year = calendar.get(Calendar.YEAR)+"";
        List<SignFamily>  signFamilys2 = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family t WHERE t.status >=0 AND t.expenses_status ='1' AND  t.patient ='"+patient+"' AND CURDATE()>'"+year+"-07-01' NOW() >= t.begin and NOW() <= t.end",SignFamily.class);
        if(signFamilys2!=null){
            rs.put("isrenew","0");
        Calendar calendar = Calendar.getInstance();
        String year = calendar.get(Calendar.YEAR) + "";
        List<SignFamily> signFamilys2 = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family t WHERE t.status >=0 AND t.expenses_status ='1' AND  t.patient ='" + patient + "' AND CURDATE()>'" + year + "-07-01' NOW() >= t.begin and NOW() <= t.end", SignFamily.class);
        if (signFamilys2 != null) {
            rs.put("isrenew", "0");
            return rs;
        }
        //B表:已签约且未生效,不允许续签
        List<SignFamilyRenew> signFamilyRenews = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family_renew t WHERE t.status>=0 AND  t.is_valid = 0 AND t.patient ='"+patient+"'",SignFamilyRenew.class);
        if(signFamilyRenews!=null){
            rs.put("isrenew","0");
        List<SignFamilyRenew> signFamilyRenews = jdbcTemplate.queryForList("SELECT t.id FROM wlyy_sign_family_renew t WHERE t.status>=0 AND  t.is_valid = 0 AND t.patient ='" + patient + "'", SignFamilyRenew.class);
        if (signFamilyRenews != null) {
            rs.put("isrenew", "0");
            return rs;
        }
        //都未有记录则允许续签
        rs.put("isrenew","1");
        rs.put("isrenew", "1");
        return rs;
    }
    /**
     * 判断是否可以续签
     * @param patient
     * @return
     */
    public JSONObject checkCanSignRenew(String patient) {
        JSONObject rs = new JSONObject();
        //得到当前年度,和当前月份,年度
        Calendar cal = Calendar.getInstance();
        int month = cal.get(Calendar.MONTH) + 1;
        int year = cal.get(Calendar.YEAR);
        //判断是否在续签允许的范围内
        boolean flag = false;
        for (int i = 0; i < canRenewMonth.length; i++) {
            if (month == canRenewMonth[i]) {
                flag = true;
                break;
            }
        }
        if (!flag) {
            rs.put("mes", "当前时间段不允许续签");
            rs.put("code", "-1");
            return rs;
        }
        //判断是否有生效记录SQL
        String sql = "SELECT t.id,t.sign_year signYear FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1'";
        //用于判断续签表是否有记录QL,有记录则不允许续签
        String sqlRenew = "SELECT t.id,t.sign_year signYear FROM wlyy_sign_family_renew t WHERE t.patient ='" + patient + "' AND t.status>=0 ";
        //判读是否有当前年度的记录SQL
        String signSql = "SELECT t.id,t.sign_year signYear FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1' AND t.sign_year ='" + year + "'";
        //判读是否有旧的已到期记录SQL
        String oldSignSql = "SELECT t.id,t.sign_year signYear FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status=-4 AND  t.expenses_status='1' AND t.sign_year ='" + (year - 1) + "'";
        //判断时间是否在6月30之前
        if (month < 7) {
            //判断是否有签约记录
            List<Map<String,Object>> signFamilys1 = jdbcTemplate.queryForList(sql);
            if (signFamilys1 != null && signFamilys1.size() > 0) {
                //如果有记录则判断其年份是否为当前年份,如果为当前年份,不允许续签
                Map<String,Object> sign = signFamilys1.get(0);
                if (StringUtils.isNotBlank((String)sign.get("signYear"))){
                    int y = Integer.parseInt((String)sign.get("signYear"));
                    if (y == year) {
                        rs.put("mes", "当前年度已经签约");
                        rs.put("code", "-2");
                        return rs;
                        //如果不等于当前年份,则判断续签表是否有数据
                    } else {
                        return checkRenewData(sqlRenew,rs);
                    }
                } else {
                    rs.put("mes", "签约记录为脏数据");
                    rs.put("code", "0");
                    return rs;
                }
            } else {
                //没有签约记录,不允许续签,提示前往签约
                rs.put("mes", "没有签约记录,请前往签约");
                rs.put("code", "-4");
                return rs;
            }
        } else {
            //如果在签约七月份之后判断是否已经生效,判断是否有旧数据
            List<SignFamily> signFamilys1 = jdbcTemplate.queryForList(signSql, SignFamily.class);
            if (signFamilys1 != null && signFamilys1.size() > 0) {
                rs.put("mes", "当前年度已经签约");
                rs.put("code", "-2");
                return rs;
            }
            List<SignFamily> signFamilys2 = jdbcTemplate.queryForList(oldSignSql, SignFamily.class);
            if (signFamilys1 != null && signFamilys1.size() > 0) {
                rs.put("mes", "可以续签(已到期)");
                rs.put("code", "2");
                return rs;
            } else {
                rs.put("mes", "没有签约记录,请前往签约");
                rs.put("code", "-4");
                return rs;
            }
        }
    }
    public JSONObject checkRenewData(String sqlRenew,JSONObject rs){
        List<Map<String,Object>> renews = jdbcTemplate.queryForList(sqlRenew);
        //如果续签表没有数据,则可以续签,有数据提示已经续签
        if (renews != null && renews.size() > 0) {
            rs.put("mes", "已经提交续签");
            rs.put("code", "-3");
            return rs;
        } else {
            rs.put("mes", "可以续签(未到期)");
            rs.put("code", "1");
            return rs;
        }
    }
    /**
     * 根据居民ID查询签约CODE
     *
     * @param patient
     * @return
     */
    public String getSignCodeByPatient(String patient){
    public String getSignCodeByPatient(String patient) {
        if(StringUtils.isBlank(patient)){
        if (StringUtils.isBlank(patient)) {
            return "";
        }
        try{
            List<SignFamily> signFamilies = jdbcTemplate.queryForList("SELECT * FROM wlyy_sign_family WHERE t.patient = '"+patient+"' AND t.status >=0 AND t.expenses_status ='1' ",SignFamily.class);
            if(signFamilies!=null && signFamilies.size()>0){
        try {
            List<SignFamily> signFamilies = jdbcTemplate.queryForList("SELECT * FROM wlyy_sign_family WHERE t.patient = '" + patient + "' AND t.status >=0 AND t.expenses_status ='1' ", SignFamily.class);
            if (signFamilies != null && signFamilies.size() > 0) {
                return signFamilies.get(0).getCode();
            }
        }catch (Exception e){
        } catch (Exception e) {
            return "";
        }
        return "";
    }
}

+ 26 - 9
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/WeiXinCoreService.java

@ -1,15 +1,20 @@
package com.yihu.wlyy.service.weixin;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.wechat.process.WeiXinEventProcess;
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -18,7 +23,9 @@ import java.util.Map;
 * Created by lyr on 2016/08/11.
 */
@Service
public class WeiXinCoreService extends BaseService{
public class WeiXinCoreService extends BaseService {
    @Autowired
    private SignFamilyDao signFamilyDao;
    /**
     * 微信推送消息处理
@ -26,11 +33,11 @@ public class WeiXinCoreService extends BaseService{
     * @param request
     * @param accessToken
     */
    public String messageProcess(HttpServletRequest request,String accessToken){
        try{
    public String messageProcess(HttpServletRequest request, String accessToken) {
        try {
            String returnStr = "";
            // 将解析结果存储在HashMap中
            Map<String,String> message = new HashMap();
            Map<String, String> message = new HashMap();
            // 从request中取得输入流
            InputStream inputStream = request.getInputStream();
@ -44,19 +51,19 @@ public class WeiXinCoreService extends BaseService{
            // 遍历所有子节点
            for (Object e : elementList) {
                Element ele = (Element)e;
                Element ele = (Element) e;
                message.put(ele.getName(), ele.getText());
            }
            System.out.println("weixin  event:" + message.toString());
            // 释放资源
            inputStream.close();
            // 添加access_token参数
            message.put("token",accessToken);
            message.put("token", accessToken);
            // 消息处理
            returnStr = messageProcess(message);
            return returnStr;
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
@ -68,18 +75,28 @@ public class WeiXinCoreService extends BaseService{
     * @param message
     * @return
     */
    private String messageProcess(Map<String,String> message) throws Exception {
    private String messageProcess(Map<String, String> message) throws Exception {
        String msgType = message.get("MsgType");
        String result = "";
        switch (msgType){
        switch (msgType) {
            case WeiXinMessageUtils.REQ_MESSAGE_TYPE_EVENT:  // 事件消息
                result = WeiXinEventProcess.eventProcess(message);
                break;
            case WeiXinMessageUtils.RESP_MESSAGE_TYPE_TEXT:  // 回复文本消息
                String content = message.get("Content");
                if ("续签".equals(content)){
//                      发送续签和签约图文消息
                    System.out.print("content======? "+content);
                    result = WeiXinEventProcess.replyKeyword(message);
                    System.out.print("图文结束======? ");
                }
                break;
            default:
                break;
        }
        return result;
    }
}

+ 4 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -529,16 +529,17 @@ public class PushMsgTask {
                WechatTemplateData  keyword1= new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword1"));
                m.put("keyword1", keyword1);
                WechatTemplateData  keyword2= new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword2"));
                keyword2.setColor("#000000");
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            }
            temp.setData(m);
            ObjectMapper mapper = new ObjectMapper();
            String strJson = mapper.writeValueAsString(temp);
            System.out.println("send message================>" + strJson);
            //System.out.println("send message================>" + strJson);
            logger.error("send message================>" + strJson);
            return strJson;
        } catch (Exception e) {

+ 20 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.util;
import java.sql.Time;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@ -735,4 +736,23 @@ public class DateUtil {
//
		System.out.println(getNextYear(new Date(), -65));
	}
	/**
	 *  字符串转时间
	 * @param str 时间字符串
	 * @param eg 格式
	 * @return
	 */
	public static Date stringToDate(String str, String eg) {
		DateFormat format = new SimpleDateFormat(eg);
		Date date = null;
		if (str != null && !"".equals(str)) {
			try {
				date = format.parse(str);
			} catch (Exception e) {
				return null;
			}
		}
		return date;
	}
}

+ 139 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendNews.java

@ -0,0 +1,139 @@
package com.yihu.wlyy.util;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
/**
 * Created by Reece on 2017/5/20.
 */
public class SendNews {
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
    /**
     * 模拟form表单的形式 ,上传文件 以输出流的形式把文件写入到url中,然后用输入流来获取url的响应
     *
     * @param url      请求地址 form表单url地址
     * @param filePath 文件在服务器保存路径
     * @return String url的响应信息返回值
     * @throws IOException
     */
    public static String uploadImage(String url, String filePath) throws IOException {
        String result = null;
        File file = new File(filePath);
        if (!file.exists() || !file.isFile()) {
            throw new IOException("文件不存在");
        }
        /**
         * 第一部分
         */
        URL urlObj = new URL(url);
        // 连接
        HttpURLConnection con = (HttpURLConnection) urlObj.openConnection();
        /**
         * 设置关键值
         */
        con.setRequestMethod("POST"); // 以Post方式提交表单,默认get方式
        con.setDoInput(true);
        con.setDoOutput(true);
        con.setUseCaches(false); // post方式不能使用缓存
        // 设置请求头信息
        con.setRequestProperty("Connection", "Keep-Alive");
        con.setRequestProperty("Charset", "UTF-8");
        // 设置边界
        String BOUNDARY = "---------------------------" + System.currentTimeMillis();
        con.setRequestProperty("Content-Type", "multipart/form-data; boundary="
                + BOUNDARY);
        // 请求正文信息
        // 第一部分:
        StringBuilder sb = new StringBuilder();
        sb.append("--"); // 必须多两道线
        sb.append(BOUNDARY);
        sb.append("\r\n");
        sb.append("Content-Disposition: form-data;name=\"media\";filename=\""
                + file.getName() + "\"\r\n");
        sb.append("Content-Type:application/octet-stream\r\n\r\n");
        byte[] head = sb.toString().getBytes("utf-8");
        // 获得输出流
        OutputStream out = new DataOutputStream(con.getOutputStream());
        // 输出表头
        out.write(head);
        // 文件正文部分
        // 把文件已流文件的方式 推入到url中
        DataInputStream in = new DataInputStream(new FileInputStream(file));
        int bytes = 0;
        byte[] bufferOut = new byte[1024];
        while ((bytes = in.read(bufferOut)) != -1) {
            out.write(bufferOut, 0, bytes);
        }
        in.close();
        // 结尾部分
        byte[] foot = ("\r\n--" + BOUNDARY + "--\r\n").getBytes("utf-8");// 定义最后数据分隔线
        out.write(foot);
        out.flush();
        out.close();
        StringBuffer buffer = new StringBuffer();
        BufferedReader reader = null;
        try {
            // 定义BufferedReader输入流来读取URL的响应
            reader = new BufferedReader(new InputStreamReader(
                    con.getInputStream()));
            String line = null;
            while ((line = reader.readLine()) != null) {
                buffer.append(line);
            }
            if (result == null) {
                result = buffer.toString();
            }
        } catch (IOException e) {
            System.out.println("发送POST请求出现异常!" + e);
            e.printStackTrace();
            throw new IOException("数据读取异常");
        } finally {
            if (reader != null) {
                reader.close();
            }
        }
        return result;
    }
    /**
     * 上传图文消息文字素材
     * @param accessToken
     * @param data 图文消息文字素材内容
     * @return
     */
    public static String uploadNesText(String accessToken,String url,JSONObject data){
        url = url.replaceFirst("ACCESS_TOKEN",accessToken);
        //上传的图文消息数据,其中thumb_media_id是文件上传图片上传的id
//        data = "{\"articles\": [{\"thumb_media_id\":\"BW4eDIdYSvO7AFjfsZKsQ9ujNma_TkCj3VSo3JNTQkYmk_iPuhpUKm48oZ4umHED\",\"author\":\"xxx\",\"title\":\"Happy Day\",\"content_source_url\":\"www.qq.com\",\"content\":\"content\",\"digest\":\"digest\",\"show_cover_pic\":\"0\"}]}";
        String result = HttpClientUtil.postBody(url,data);
        return result;
    }
    /**
     * 发送图文消息
     * @param accessToken
     * @param openidData  群发图文消息内容
     * @return
     */
    public static String sendNewspMessage(String accessToken,String url, JSONObject openidData){
        url = url.replace("ACCESS_TOKEN",accessToken);
        String group1data = "{\"filter\":{\"is_to_all\":false,\"group_id\":\"2\"},\"text\":{\"content\":\"群发消息测试\"},\"msgtype\":\"text\"}\";";
        String openid1data = "{\"touser\":[\"obGXiwHTGN_4HkR2WToFj_3uaEKY\",\"obGXiwNu0z2o_RRWaODvaZctdWEM\"],\"msgtype\": \"text\",\"text\": {\"content\": \"测试文本消息\"}}";
        String openid2data = "{\"touser\":[\"obGXiwHTGN_4HkR2WToFj_3uaEKY\",\"obGXiwNu0z2o_RRWaODvaZctdWEM\"], \"voice\": {\"media_id\":\"UfMRvSiXAD5_iUS8u0Gc3JrKGWOABE9ivQbgrX6i-mVrKGBRL9KnKlioK1BxTPc3\"},\"msgtype\":\"voice\"}";
        String openid3data = "{\"touser\":[\"obGXiwHTGN_4HkR2WToFj_3uaEKY\",\"obGXiwNu0z2o_RRWaODvaZctdWEM\"], \"image\": {\"media_id\":\"fNUzGbYzTRui4N7-eyx9e3viP8uJuzztAvA32lIdjX4Cucj7mGN_1jpWjn7O80c8\"},\"msgtype\":\"image\"}";
        String json = HttpClientUtil.postBody(url,openidData);
        return json;
    }
}

+ 33 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ValueComparator.java

@ -0,0 +1,33 @@
package com.yihu.wlyy.util;
import org.json.JSONObject;
import java.util.Comparator;
import java.util.Map;
import java.util.jar.JarEntry;
/**
 * Created by Trick on 2017/5/24.
 */
public class ValueComparator implements Comparator<String> {
    Map<String, JSONObject> base;
    //这里需要将要比较的map集合传进来
    public ValueComparator(Map<String, JSONObject> base) {
        this.base = base;
    }
    // Note: this comparator imposes orderings that are inconsistent with equals.
    //比较的时候,传入的两个参数应该是map的两个key,根据上面传入的要比较的集合base,可以获取到key对应的value,然后按照value进行比较
    public int compare(String a, String b) {
        JSONObject j1 =  base.get(a);
        JSONObject j2 =  base.get(b);
        j1.get("amount");
        j2.get("amount");
        if((Long)j1.get("amount")>=(Long)j2.get("amount")){
            return -1;
        }
        return 1;
    }
}

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

@ -13,11 +13,11 @@ import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
import com.yihu.wlyy.service.app.family.FamilyMemberService;
import com.yihu.wlyy.service.app.family.FamilyService;
import com.yihu.wlyy.service.common.login.LoginLogService;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@ -33,8 +33,6 @@ import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.IdcardValidator;
import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.web.WeixinBaseController;
/**
@ -64,6 +62,7 @@ public class WechatController extends WeixinBaseController {
    @Autowired
    WeiXinOpenIdUtils weiXinOpenIdUtils;
    /**
     * 患者注册-验证手机号
     *
@ -76,7 +75,7 @@ public class WechatController extends WeixinBaseController {
        try {
            /**modify by linz 2017年2月28日10:11:49 校验手机号码的时候返回使用此号码的所有人员**/
            List<Patient> temp = patientService.findByMobile(phone);
            if (temp != null&&temp.size()>0) {
            if (temp != null && temp.size() > 0) {
                // 设置身份证号
                return write(200, "患者信息查询成功!", "data", temp);
            }
@ -89,22 +88,24 @@ public class WechatController extends WeixinBaseController {
    /**
     * 获取验证码发送的手机号码
     *
     * @param idCard
     * @return
     */
    @RequestMapping(value = "getMobile")
    @ResponseBody
    public String getPatientInfoByIdCard(@RequestParam(value = "idCard",required = true) String idCard){
    public String getPatientInfoByIdCard(@RequestParam(value = "idCard", required = true) String idCard) {
        Patient temp = patientService.findByIdcard(idCard);
        if(temp==null){
        getAccessToken();
        if (temp == null) {
            return error(-1, "用户未注册");
        }else{
            if(StringUtils.isBlank(temp.getMobile())){
        } else {
            if (StringUtils.isBlank(temp.getMobile())) {
                return error(-2, "用户未绑定手机号");
            }else{
            } else {
                JSONObject object = new JSONObject();
                object.put("mobile",temp.getMobile());
                return write(200,"获取成功","data",object);
                object.put("mobile", temp.getMobile());
                return write(200, "获取成功", "data", object);
            }
        }
@ -138,7 +139,7 @@ public class WechatController extends WeixinBaseController {
                return write(1, "患者信息查询成功!", "data", json);
            } else {
                List<Patient> temp1 = patientService.findByMobile(mobile);
                if (temp1 != null&&temp1.size()>0) {
                if (temp1 != null && temp1.size() > 0) {
                    //JSONObject json = new JSONObject();
                    // 设置患者标识
                    //json.put("code", temp1.getCode());
@ -237,13 +238,13 @@ public class WechatController extends WeixinBaseController {
     */
    @RequestMapping(value = "regist")
    @ResponseBody
    public String regist(@RequestParam(value="name",required = true) String name,
                         @RequestParam(value="idcard",required = true) String idcard,
                         @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,
                         @RequestParam(value="password",required = true) String password) {
    public String regist(@RequestParam(value = "name", required = true) String name,
                         @RequestParam(value = "idcard", required = true) String idcard,
                         @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,
                         @RequestParam(value = "password", required = true) String password) {
        try {
            if (StringUtils.isEmpty(name)) {
                return error(-1, "姓名不允许为空!");
@ -378,11 +379,11 @@ public class WechatController extends WeixinBaseController {
            //账号登录 mobile可能是电话号也可能是身份证
            if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(password)) {
                Patient p = patientService.findByIdcard(mobile);
                if(p==null){
                if (p == null) {
                    List<Patient> patients = patientService.findByMobile(mobile);
                    if(patients.size()>1){
                        return error(-1,"此手机号码存在多个用户,请用身份证进行登录!");
                    }else if(patients.size()==1){
                    if (patients.size() > 1) {
                        return error(-1, "此手机号码存在多个用户,请用身份证进行登录!");
                    } else if (patients.size() == 1) {
                        p = patients.get(0);
                    }
                }
@ -456,8 +457,8 @@ public class WechatController extends WeixinBaseController {
            //短信登录
            if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(captcha)) {
                List<Patient> patients = patientService.findByMobile(mobile);
                if(patients.size()>1){
                    return error(-1,"此手机存在多个用户,请用身份证和密码登录!");
                if (patients.size() > 1) {
                    return error(-1, "此手机存在多个用户,请用身份证和密码登录!");
                }
                // 对验证码进行校验
                int res = smsService.check(mobile, 4, captcha);
@ -483,7 +484,7 @@ public class WechatController extends WeixinBaseController {
                }
                loginLog.setLoginType("1");
                if (patients == null||patients.size()==0) {
                if (patients == null || patients.size() == 0) {
                    if (mobile.length() == 11) {
                        errorMessage = "该手机号暂未注册账号,请确认后重新输入!";
                    } else {
@ -492,11 +493,12 @@ public class WechatController extends WeixinBaseController {
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                }else{
                } else {
                    Patient p = null;
                    if(patients.size()==1){
                        p  = patients.get(0);
                    }if (p.getStatus() == 0) {
                    if (patients.size() == 1) {
                        p = patients.get(0);
                    }
                    if (p.getStatus() == 0) {
                        if (mobile.length() == 11) {
                            errorMessage = "该手机号已被禁止使用!";
                        } else {
@ -602,17 +604,17 @@ public class WechatController extends WeixinBaseController {
            json.put("orgName", "厦门第一医院");
            //判断是否判定openId,有没有发则查找家人发送
            if(StringUtils.isNotBlank(patient.getOpenid())){
            if (StringUtils.isNotBlank(patient.getOpenid())) {
                // 添加到发送队列
                PushMsgTask.getInstance().putWxMsg(getAccessToken(), 5, patient.getOpenid(), patient.getName(), json);
            }else{
                JSONObject j  = weiXinOpenIdUtils.getFamilyOpenId(patient.getCode());
            } else {
                JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(patient.getCode());
                Patient member = (Patient) j.get("member");
                if(StringUtils.isNotBlank(member.getOpenid())){
                if (StringUtils.isNotBlank(member.getOpenid())) {
                    String first = (String) json.get("first");
                    json.remove("first");
                    json.put("first",weiXinOpenIdUtils.getTitleMes(patient,j.getInt("relation"),member.getName())+first);
                    PushMsgTask.getInstance().putWxMsg(getAccessToken(),5, member.getOpenid(), member.getName(), json);
                    json.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.getInt("relation"), member.getName()) + first);
                    PushMsgTask.getInstance().putWxMsg(getAccessToken(), 5, member.getOpenid(), member.getName(), json);
                }
            }
@ -722,4 +724,64 @@ public class WechatController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 根据openID群发图文消息
     *
     * @return
     */
    @RequestMapping(value = "/sendNews")
    @ResponseBody
    public String sendNews() {
        try {
            String accessToken = getAccessToken();
//            本地上传图片的路径
            String filePath = SystemConf.getInstance().getChatPath();
            String sendUrl = "http://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=ACCESS_TOKEN&type=image";
            String mediaurl = "https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=ACCESS_TOKEN";//ACCESS_TOKEN是获取到的access_token
            String groupUrl = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=ACCESS_TOKEN";//根据openid发群发消息地址
            sendUrl = sendUrl.replace("ACCESS_TOKEN", accessToken);
            String image = SendNews.uploadImage(sendUrl, filePath);
            JSONObject newsTextData = new JSONObject();
            JSONArray newsText = new JSONArray();
//            续签图文
            JSONObject data = new JSONObject();
            data.put("thumb_media_id", new JSONObject(image).get("url"));
            data.put("author", "作者");
            data.put("content_source_url", "图文跳转链接");
            data.put("content", "图文消息内容");
            data.put("digest", "图文消息描述");
            data.put("show_cover_pic", 1);
//            签约图文
//            JSONObject data1 = new JSONObject();
//            data1.put("thumb_media_id",new JSONObject(image).get("url"));
//            data1.put("author","作者");
//            data1.put("content_source_url","图文跳转链接");
//            data1.put("content","图文消息内容");
//            data1.put("digest","图文消息描述");
//            data1.put("show_cover_pic",1);
            newsText.put(data);
//            newsText.put(data1);
            newsTextData.put("articles", newsText);
            String media = SendNews.uploadNesText(accessToken, mediaurl, newsTextData);
            JSONObject news = new JSONObject();
            JSONObject mapnews = new JSONObject();
            mapnews.put("media_id", new JSONObject(media).get("media_id"));
            List<String> openIds = patientDao.findOpenids();
            news.put("touser", openIds);
            news.put("mpnews", mapnews);
            news.put("msgtype", "mpnews");
            news.put("send_ignore_reprint", 1);
            SendNews.sendNewspMessage(accessToken, groupUrl, news);
            return write(200, "群发图文成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "群发图文失败!");
        }
    }
}

+ 31 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java

@ -1,6 +1,8 @@
package com.yihu.wlyy.web.common.util;
import com.yihu.wlyy.job.QuartzHelper;
import com.yihu.wlyy.job.RenewToSignJob;
import com.yihu.wlyy.job.SignAgainJob;
import com.yihu.wlyy.job.SignEndJob;
import com.yihu.wlyy.job.consult.EvaluateScoreJob;
import com.yihu.wlyy.job.consult.FamousConsultTimesJob;
@ -28,6 +30,7 @@ import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.security.Signature;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
@ -291,4 +294,32 @@ public class ManagerUtilController extends BaseController {
            return error(-1, "启动失败");
        }
    }
    @RequestMapping(value = "/start_renew_to_sign_job")
    @ResponseBody
    public String startRenewToSignJob() {
        try {
            if (!quartzHelper.isExistJob("renew_to_sign_job")) {
                quartzHelper.startNow(RenewToSignJob.class, "renew_to_sign_job", new HashMap<String, Object>());
                return write(200, "启动成功");
            } else {
                return write(200, "任务已存在");
            }
        } catch (Exception e) {
            return error(-1, "启动失败");
        }
    }
    @RequestMapping(value = "/start_sign_again_job")
    @ResponseBody
    public String startSignAgainJob() {
        try {
            if (!quartzHelper.isExistJob("start_sign_again_job")) {
                quartzHelper.startNow(SignAgainJob.class, "start_sign_again_job", new HashMap<String, Object>());
                return write(200, "启动成功");
            } else {
                return write(200, "任务已存在");
            }
        } catch (Exception e) {
            return error(-1, "启动失败");
        }
    }
}

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -1033,6 +1033,7 @@ public class DoctorController extends BaseController {
                    json.put("hospital", doctor.getHospital());
                    json.put("hospitalName", doctor.getHospitalName());
                    json.put("dept", doctor.getDept());
                    json.put("evaluateScore", doctor.getEvaluateScore());
                    json.put("deptName", doctor.getDeptName());
                    array.put(json);
                }

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthController.java

@ -265,10 +265,10 @@ public class DoctorHealthController extends BaseController {
										   @RequestParam(value="patient",required = true) String patient) {
		try {
			Map<String,Object> map = new HashMap<>();
			com.alibaba.fastjson.JSONObject xt = healthIndexService.findLastBypatient(patient,1);
			DevicePatientHealthIndex xt = healthIndexService.findLastByPatien(patient,1);
			if(xt!=null)
			{
				map.put("xt",xt.toJSONString());
				map.put("xt",xt);
			}
			DevicePatientHealthIndex xy = healthIndexService.findLastByPatien(patient,2);
			if(xy!=null)

+ 21 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.web.doctor.patient;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.sign.SignWebService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -25,6 +26,8 @@ public class SignPatientLabelInfoController extends BaseController {
    @Autowired
    SignPatientLabelInfoService labelInfoService;
    @Autowired
    SignWebService signWebService;
    /**
     * 根据姓名,地址,身份证号搜索团队内居民
@ -134,7 +137,11 @@ public class SignPatientLabelInfoController extends BaseController {
     * @return
     */
    @RequestMapping(value = "/patients_by_label")
    public String getPatientInfoByLabel(String labelCode, String labelType, Long teamCode, int page, int pagesize) {
    public String getPatientInfoByLabel(@RequestParam(required = false) String labelCode,
                                        @RequestParam(required = false) String labelType,
                                        @RequestParam(required = false)Long teamCode,
                                        @RequestParam(required = false)int page,
                                        @RequestParam(required = false)int pagesize) {
        try {
            if (StringUtils.isEmpty(labelCode)) {
                return error(-1, "标签cdoe不能为空");
@ -147,6 +154,12 @@ public class SignPatientLabelInfoController extends BaseController {
            }
            page = page - 1;
            if(labelType.equals("9")){
                JSONObject jsonObject = signWebService.getOverDuePatients(labelCode,teamCode,page,pagesize);
                return write(200, "查询成功", "data", jsonObject);
            }
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize);
            return write(200, "查询成功", "data", result);
@ -235,6 +248,13 @@ public class SignPatientLabelInfoController extends BaseController {
                teamCode = 0L;
            }
            //计算年度数目
            if(labelType.equals("9")){
                JSONObject r= signWebService.getRenewYearCount(teamCode);
                return write(200, "查询成功", "data", r);
            }
            JSONArray result = labelInfoService.getPatientAmountByLabelType(getUID(), labelType, teamCode);
            return write(200, "查询成功", "data", result);

+ 72 - 30
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -308,8 +308,8 @@ public class DoctorSignController extends WeixinBaseController {
//            data.put("totalPage", totalPage);
//            data.put("page", page);
            return write(200, "查询成功!", "data", data);
        } catch (Exception ex) {
            ex.printStackTrace();
        } catch (Exception e) {
            error(e);
            return error(-1, "系统错误,请联系管理员!");
        }
    }
@ -340,7 +340,7 @@ public class DoctorSignController extends WeixinBaseController {
        try{
            return write(200,"查询成功","data",signWebService.isRemindExpensesAll(getUID()));
        }catch (Exception e){
            e.printStackTrace();
            error(e);
            return error(-1,"查询失败");
        }
    }
@ -382,6 +382,7 @@ public class DoctorSignController extends WeixinBaseController {
                    json.put("photo", temp.get("photo"));
                    json.put("status", temp.get("status"));
                    json.put("openid", temp.get("openid"));
                    json.put("renewTime", temp.get("czrq"));
                    String statusName = "";
                    switch (Integer.parseInt(temp.get("status").toString())) {
                        case 0:
@ -410,7 +411,7 @@ public class DoctorSignController extends WeixinBaseController {
            data.put("list", jsonArray);
            return write(200, "查询成功!", "data", data);
        } catch (Exception ex) {
            ex.printStackTrace();
            error(ex);
            return error(-1, "系统错误,请联系管理员!");
        }
    }
@ -423,14 +424,15 @@ public class DoctorSignController extends WeixinBaseController {
    @ApiOperation(value = "提醒用户签约")
    public String sendRenewToPatients(){
        try{
            int rs = signWebService.sendRenewToPatients(getAccessToken(),getUID());
            //int rs = signWebService.sendRenewToPatients(getAccessToken(),"64de930c-5b15-11e6-8344-fa163e8aee56");
            //int rs = signWebService.sendRenewToPatients(getAccessToken(),getUID());
            int rs = signWebService.sendRenewToPatients(getAccessToken(),"64de930c-5b15-11e6-8344-fa163e8aee56");
            if(rs == 0){
                return error(-1, "微信和短信,提醒失败");
            }else{
                return write(200, "提醒成功!", "data", rs);
            }
        }catch (Exception e){
            error(e);
            return error(-1, "提醒失败");
        }
    }
@ -446,52 +448,92 @@ public class DoctorSignController extends WeixinBaseController {
                             @RequestParam(required = true)String patient){
        try{
            int rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state);
            //int rs =signWebService.agreeRenew(getAccessToken(),"64de930c-5b15-11e6-8344-fa163e8aee56",patient,state);
//            int rs =signWebService.agreeRenew(getAccessToken(),"test00000000005",patient,state);
            if(rs == 0){
                return error(-1, "操作失败");
            }else{
                return write(200, "操作成功!", "data", rs);
            }
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
        }
    }
//    /**
//     * 获取用户详情列表
//     * @param year
//     * @param page
//     * @param pageSize
//     * @return
//     */
//    @RequestMapping("/getOverDuePatients")
//    @ApiOperation(value = "获取用户详情列表")
//    public String getOverDuePatients(@RequestParam(required = true)String year,
//                                     @RequestParam(required = true)Integer page,
//                                     @RequestParam(required = true)Integer pageSize){
//        try{
//            JSONObject rs =signWebService.getOverDuePatients(year,getUID(),page,pageSize);
//            //JSONObject rs =signWebService.getOverDuePatients(year,"64de930c-5b15-11e6-8344-fa163e8aee56",page,pageSize);
//
//            return write(200, "操作成功!", "data", rs);
//        }catch (Exception e){
//            return error(-1, "请求失败");
//        }
//    }
    /**
     * 获取用户详情列表
     * @param year
     * @param page
     * @param pageSize
     *
     * 获取去医生下年度分组列表
     * @return
     */
    @RequestMapping("/getOverDuePatients")
    @ApiOperation(value = "获取用户详情列表")
    public String getOverDuePatients(@RequestParam(required = true)String year,
                                     @RequestParam(required = true)Integer page,
                                     @RequestParam(required = true)Integer pageSize){
        try{
            JSONObject rs =signWebService.getOverDuePatients(year,getUID(),page,pageSize);
            //JSONObject rs =signWebService.getOverDuePatients(year,"64de930c-5b15-11e6-8344-fa163e8aee56",page,pageSize);
//    @RequestMapping("/getRenewYearCount")
//    @ApiOperation(value = "获取年度分组")
//    public String getRenewYearCount(){
//        try{
//            JSONObject rs =signWebService.getRenewYearCount(getUID());
//            //JSONObject rs =signWebService.getRenewYearCount("64de930c-5b15-11e6-8344-fa163e8aee56");
//            return write(200, "操作成功!", "data", rs);
//        }catch (Exception e){
//            return error(-1, "请求失败");
//        }
//    }
    /**
     *
     *统计
     * 咨询量、获取待预约、获取健康教育、获取健康指导
     * @return
     */
    @RequestMapping("/getSignCountInfoInYear")
    @ApiOperation(value = "统计咨询量、获取待预约、获取健康教育、获取健康指导")
    public String getSignCountInfoInYear(@RequestParam(required = true)String patient){
        try{
            JSONObject rs =signWebService.getSignCountInfoInYear(patient);
            //JSONObject rs =signWebService.getRenewYearCount("64de930c-5b15-11e6-8344-fa163e8aee56");
            return write(200, "操作成功!", "data", rs);
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
        }
    }
    /**
     *
     * 获取去医生下年度分组列表
     * @return
     */
    @RequestMapping("/getRenewYearCount")
    @ApiOperation(value = "获取年度分组")
    public String getRenewYearCount(){
    @RequestMapping("/remindPatientRenew")
    @ApiOperation(value = "提醒居民续签")
    public String remindPatientRenew(@RequestParam(required = true)String patient){
        try{
            //JSONObject rs =signWebService.getRenewYearCount(getUID());
            JSONObject rs =signWebService.getRenewYearCount("64de930c-5b15-11e6-8344-fa163e8aee56");
            return write(200, "操作成功!", "data", rs);
            //int rs =signWebService.remainPatientRenew(getAccessToken(),patient,getUID());
            int rs =signWebService.remainPatientRenew(getAccessToken(),patient,"test00000000006");
            if(rs==-1){
                return error(-1, "提醒失败");
            }else if(rs ==1){
                return write(200, "微信提醒成功!", "data", rs);
            }else if(rs ==2){
                return write(200, "短信提醒成功!", "data", rs);
            }
            return error(-1, "提醒失败");
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
        }
    }

+ 20 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/EvaluateController.java

@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by 卓 on 2017/5/10.
@ -81,4 +82,23 @@ public class EvaluateController  extends BaseController {
        }
    }
    /**
     * 保存评价
     * @param doctor 保存评价内容的JSON
     * @return
     */
    @RequestMapping(value = "doctor/label")
    @ResponseBody
    public String doctorLabel(@RequestParam(required = true,value="doctor") String doctor){
        try{
            List<Map<String,Object>> result = evaluateLabelService.findDistinctLabelByLaDoctor(doctor);
            return  write(200,"查询成功!","list",result);
        }catch (Exception e){
            error(e);
            return write(-1,e.getMessage());
        }
    }
}

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthController.java

@ -273,10 +273,10 @@ public class PatientHealthController extends BaseController {
		try {
			Map<String,Object> map = new HashMap<>();
			String patient = getUID();
			com.alibaba.fastjson.JSONObject xt = healthIndexService.findLastBypatient(patient,1);
			DevicePatientHealthIndex xt = healthIndexService.findLastByPatien(patient,1);
			if(xt!=null)
			{
				map.put("xt",xt.toString());
				map.put("xt",xt);
			}
			DevicePatientHealthIndex xy = healthIndexService.findLastByPatien(patient,2);
			if(xy!=null)

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/hosptail/HospitalController.java

@ -180,6 +180,7 @@ public class HospitalController extends BaseController {
                    json.put("name", doctor.getName());
                    json.put("photo", doctor.getPhoto());
                    json.put("sex", doctor.getSex());
                    json.put("evaluateScore", doctor.getEvaluateScore());
                    String sexName = "";
                    switch (doctor.getSex()) {
                        case 1:

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/hosptail/HospitalWithoutFilterController.java

@ -65,6 +65,7 @@ public class HospitalWithoutFilterController extends BaseController {
                    json.put("jobName", doctor.getJobName());
                    json.put("hospital", doctor.getHospital());
                    json.put("hospitalName", doctor.getHospitalName());
                    json.put("evaluateScore", doctor.getEvaluateScore());
                    json.put("dept", doctor.getDept());
                    json.put("deptName", doctor.getDeptName());
                    array.put(json);

+ 5 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -487,6 +487,10 @@ public class FamilyContractController extends BaseController {
                return error(-1, "用户已存在签约");
            } else if (result == -3) {
                return error(-1, "医生信息查询失败");
            } else if (result == -4) {
                return error(-1, "未找到有效签约记录");
            } else if (result == -5) {
                return error(-1, "未找到有效团队记录");
            } else {
                return write(200, "签约申请成功");
            }
@ -654,7 +658,7 @@ public class FamilyContractController extends BaseController {
    @ResponseBody
    public String checkCanRenew(@RequestParam(required = true) String patient){
        try {
            JSONObject result = patientService.checkCanRenew(patient);
            JSONObject result = patientService.checkCanSignRenew(patient);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            return error(-1, "查询失败");

+ 48 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.statistic;
import com.yihu.wlyy.entity.statistics.PopulationBase;
import com.yihu.wlyy.service.app.statistics.StatisticsAllService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.util.ValueComparator;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
@ -258,12 +259,15 @@ public class StatisticsController extends BaseController {
                }
            } else {
                //如果是2个指标的时候,分别放入map中,以减少查询次数
                Map<String,JSONObject> index1=new HashMap<>();
                Map<String,JSONObject> index2=new HashMap<>();
                Map<String,JSONObject> in =new TreeMap<>();
                ValueComparator vc = new ValueComparator(in);
                Map<String,JSONObject> index2=new TreeMap<>();
                for (int i = 0; i < jsonArrays.get(0).length(); i++) {
                    JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
                    index1.put(map1.get("code").toString(),map1);
                    in.put(map1.get("code").toString(),map1);
                }
                Map<String,JSONObject> index1 =new TreeMap<>(vc);
                index1.putAll(in);
                for (int i = 0; i < jsonArrays.get(1).length(); i++) {
                    JSONObject map1 = jsonArrays.get(1).getJSONObject(i);
@ -440,7 +444,8 @@ public class StatisticsController extends BaseController {
                                            @RequestParam(required = true) String index,
                                            @RequestParam(required = true) int sort,
                                            @RequestParam(required = false) String lowLevel,
                                            @RequestParam(required = false) String lowCode) {
                                            @RequestParam(required = false) String lowCode,
                                            @RequestParam(required = false) String startDate) {
        try {
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
@ -455,7 +460,9 @@ public class StatisticsController extends BaseController {
                        result.put("index_" + idx, statisticsAllService.getLowLevelTotalSpecial(date, area, level, idx, sort, lowLevel));
                    } else if (idx.equals("1") || index.equals("21")) {
                        result.put("index_" + idx, statisticsAllService.getLowLevelTotal2(date, area, level, idx, sort, lowLevel));
                    } else {
                    } else if (idx.equals("28")){
                        result.put("index_" + idx, statisticsService.getAvgAllInfo(level,area,lowLevel));
                    } else{
                        result.put("index_" + idx, statisticsAllService.getLowLevelTotal(date, area, level, idx, sort, lowLevel));
                    }
                }
@ -663,4 +670,40 @@ public class StatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取得分平均数
     * @param level
     * @param area
     * @return
     */
    @RequestMapping("/getAVGSocre")
    @ResponseBody
    public String getAVGSocre(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
        try {
            return write(200, "查询成功", "data", statisticsService.getAVGSocre(level,area));
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取得分平均数按月份
     * @return
     */
    @RequestMapping("/getAVGSocreByMonth")
    @ResponseBody
    public String getAVGSocreByMonth(@RequestParam(required = true)String level ,
                                     @RequestParam(required = true)String area,
                                     @RequestParam(required = true)String statDate,
                                     @RequestParam(required = true)String endDate){
        try {
            return write(200, "查询成功", "data", statisticsService.getAVGSocreByMonth(level,area,statDate,endDate));
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
}

+ 27 - 26
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatCoreController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.wx;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.weixin.WeiXinCoreService;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.SystemConf;
@ -47,10 +48,10 @@ public class WechatCoreController extends WeixinBaseController {
            String nonce = request.getParameter("nonce").toString();
            String echostr = request.getParameter("echostr").toString();
            if(validate(signature,timestamp,nonce)){
            if (validate(signature, timestamp, nonce)) {
                // 验证成功,返回验证码
                response.getWriter().print(echostr);
            }else{
            } else {
                // 验证失败
                response.setStatus(401);
            }
@ -61,33 +62,33 @@ public class WechatCoreController extends WeixinBaseController {
    }
    /**
     * 接收微信推送消息
     * 接收居民微信回复的消息
     *
     * @return
     */
    @RequestMapping(method = RequestMethod.POST)
    @ResponseBody
    public void receiveMessages(HttpServletRequest request, HttpServletResponse response){
        try{
    public void receiveMessages(HttpServletRequest request, HttpServletResponse response) {
        try {
            String signature = request.getParameter("signature").toString();
            String timestamp = request.getParameter("timestamp").toString();
            String nonce = request.getParameter("nonce").toString();
            if(validate(signature,timestamp,nonce)){
                String xmlStr =  weiXinCoreService.messageProcess(request,getAccessToken());
            if (validate(signature, timestamp, nonce)) {
                String xmlStr = weiXinCoreService.messageProcess(request, getAccessToken());
                if(xmlStr == "error"){
                if (xmlStr == "error") {
                    // 服务器错误
                    response.setStatus(500);
                }else{
                } else {
                    // 返回消息
                    response.getWriter().print(xmlStr);
                }
            }else{
            } else {
                // 验证失败
                response.setStatus(401);
            }
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
            // 服务器错误
            response.setStatus(500);
@ -103,7 +104,7 @@ public class WechatCoreController extends WeixinBaseController {
     * @return
     * @throws NoSuchAlgorithmException
     */
    private static boolean validate(String signature,String timestamp,String nonce) throws NoSuchAlgorithmException {
    private static boolean validate(String signature, String timestamp, String nonce) throws NoSuchAlgorithmException {
        String token = SystemConf.getInstance().getSystemProperties().getProperty("wechat_token");
        // 字典序排序
        String[] array = new String[]{token, timestamp, nonce};
@ -121,9 +122,9 @@ public class WechatCoreController extends WeixinBaseController {
        byte[] bytes = md.digest(content.getBytes());
        decodeStr = byteToStr(bytes);
        if(StringUtils.isNotEmpty(decodeStr) && decodeStr.equals(signature.toUpperCase())){
        if (StringUtils.isNotEmpty(decodeStr) && decodeStr.equals(signature.toUpperCase())) {
            return true;
        }else{
        } else {
            return false;
        }
    }
@ -149,18 +150,18 @@ public class WechatCoreController extends WeixinBaseController {
     */
    @RequestMapping(value = "/menu/create")
    @ResponseBody
    public String createMenuTest(){
        try{
    public String createMenuTest() {
        try {
            String filePath = WechatCoreController.class.getResource("/").getPath() +
                    File.separator + "weixin_menu.txt";
            String url = " https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + getAccessToken();
            // 读取微信菜单配置文件
            InputStreamReader reader = new InputStreamReader(new FileInputStream(filePath),"utf-8");
            InputStreamReader reader = new InputStreamReader(new FileInputStream(filePath), "utf-8");
            BufferedReader bufferedReader = new BufferedReader(reader);
            String params = "";
            String readTxt = "";
            // 读取微信菜单
            while((readTxt = bufferedReader.readLine()) != null){
            while ((readTxt = bufferedReader.readLine()) != null) {
                System.out.println(readTxt);
                params += readTxt;
            }
@ -168,18 +169,18 @@ public class WechatCoreController extends WeixinBaseController {
            bufferedReader.close();
            reader.close();
            // 替换服务器地址、APPID
            params = params.replaceAll("server_url",SystemConf.getInstance().getSystemProperties().getProperty("wechat_base_url"));
            params = params.replaceAll("appId",SystemConf.getInstance().getSystemProperties().getProperty("appId"));
            params = params.replaceAll("server_url", SystemConf.getInstance().getSystemProperties().getProperty("wechat_base_url"));
            params = params.replaceAll("appId", SystemConf.getInstance().getSystemProperties().getProperty("appId"));
            // 请求微信接口创建菜单
            String jsonStr = HttpUtil.sendPost(url, params);
            JSONObject result = new JSONObject(jsonStr);
            if(result != null && result.get("errcode").toString().equals("0") && result.getString("errmsg").equals("ok")){
                return write(200,"创建成功!","data",jsonStr);
            }else{
                return write(-1,"创建失败!","data",jsonStr);
            if (result != null && result.get("errcode").toString().equals("0") && result.getString("errmsg").equals("ok")) {
                return write(200, "创建成功!", "data", jsonStr);
            } else {
                return write(-1, "创建失败!", "data", jsonStr);
            }
        }catch (Exception e){
            return error(-1,"创建失败");
        } catch (Exception e) {
            return error(-1, "创建失败");
        }
    }

+ 173 - 110
patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -10,7 +10,7 @@ import java.util.*;
/**
 * 微信事件处理
 *
 * <p>
 * Created by lyr on 2016/08/11.
 */
@Component
@ -34,7 +34,7 @@ public class WeiXinEventProcess {
                if (message.containsKey("EventKey") && StringUtils.isNotEmpty(message.get("EventKey")) && message.containsKey("Ticket")
                        && StringUtils.isNotEmpty(message.get("Ticket"))) {
                    result = scanEventProcess(message);
                }else{
                } else {
                    result = subscribeEventProcess(message);
                }
                break;
@ -55,17 +55,17 @@ public class WeiXinEventProcess {
     */
    public static String clickProcess(Map<String, String> message) throws Exception {
        String result = "";
        if(message.get("EventKey").equals("caozuoshuoming")){
        if (message.get("EventKey").equals("caozuoshuoming")) {
            String tempStr = clickEventProcess(message);
            /*int firsIndex = tempStr.indexOf("<item>");
            String result1 = tempStr.substring(0,firsIndex-1);
            int secondIndex = tempStr.indexOf("<item>",firsIndex+10);
            String result2 = tempStr.substring(secondIndex-1);*/
            result=tempStr.replace("<ArticleCount>5</ArticleCount>","<ArticleCount>4</ArticleCount>");
            result = tempStr.replace("<ArticleCount>5</ArticleCount>", "<ArticleCount>4</ArticleCount>");
        }
        if(message.get("EventKey").equals("jiankangdangan")){
            result  = clickEventProcessMenu(message);
        if (message.get("EventKey").equals("jiankangdangan")) {
            result = clickEventProcessMenu(message);
        }
        return result;
    }
@ -77,15 +77,15 @@ public class WeiXinEventProcess {
     * @return
     * @throws Exception
     */
    private static String clickEventProcess(Map<String,String> message) throws Exception{
    private static String clickEventProcess(Map<String, String> message) throws Exception {
        String result = "";
        // 配置信息
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
        // 图文信息
        List<Map<String,String>> articles =  new ArrayList<>();
        List<Map<String, String>> articles = new ArrayList<>();
        Map<String,String> articleConsult = new HashMap<>();
        Map<String, String> articleConsult = new HashMap<>();
        // 图文URL
        String urlConsult = systemConf.getProperty("patient_consult_url");
        // 图文消息图片URL
@ -96,14 +96,14 @@ public class WeiXinEventProcess {
        //图片地址
        picUrlConsult = picUrlConsult.replace("{server}", systemConf.getProperty("server_url"));
        articleConsult.put("Url",urlConsult);
        articleConsult.put("Url", urlConsult);
        articleConsult.put("Title", "医生咨询功能使用说明");
        articleConsult.put("Description","功能使用说明");
        articleConsult.put("PicUrl",picUrlConsult);
        articleConsult.put("Description", "功能使用说明");
        articleConsult.put("PicUrl", picUrlConsult);
        articles.add(articleConsult);
        Map<String,String> articleBooking = new HashMap<>();
        Map<String, String> articleBooking = new HashMap<>();
        // 图文URL
        String urlBooking = systemConf.getProperty("patient_booking_url");
        // 图文消息图片URL
@ -111,21 +111,17 @@ public class WeiXinEventProcess {
        // URL设置服务器URL、AppId
        urlBooking = urlBooking.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        System.out.println("picUrlBooking ===>"+picUrlBooking);
        System.out.println("server_url ===>"+systemConf.getProperty("server_url"));
        //图片地址
        picUrlBooking = picUrlBooking.replace("{server}", systemConf.getProperty("server_url"));
        articleBooking.put("Url",urlBooking);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Title", "预约挂号功能使用说明");
        articleBooking.put("Description","功能使用说明");
        articleBooking.put("PicUrl",picUrlBooking);
        articleBooking.put("Description", "功能使用说明");
        articleBooking.put("PicUrl", picUrlBooking);
        articles.add(articleBooking);
        Map<String,String> articleDevice = new HashMap<>();
        Map<String, String> articleDevice = new HashMap<>();
        // 图文URL
        String urlDevice = systemConf.getProperty("patient_device_url");
        // 图文消息图片URL
@ -136,14 +132,14 @@ public class WeiXinEventProcess {
        //图片地址
        picUrlDevice = picUrlDevice.replace("{server}", systemConf.getProperty("server_url"));
        articleDevice.put("Url",urlDevice);
        articleDevice.put("Url", urlDevice);
        articleDevice.put("Title", "体征设备管理功能使用说明");
        articleDevice.put("Description","功能使用说明");
        articleDevice.put("PicUrl",picUrlDevice);
        articleDevice.put("Description", "功能使用说明");
        articleDevice.put("PicUrl", picUrlDevice);
        articles.add(articleDevice);
        Map<String,String> articleFamily = new HashMap<>();
        Map<String, String> articleFamily = new HashMap<>();
        // 图文URL
        String urlFamily = systemConf.getProperty("patient_family_url");
        // 图文消息图片URL
@ -154,15 +150,15 @@ public class WeiXinEventProcess {
        //图片地址
        picUrlFamily = picUrlFamily.replace("{server}", systemConf.getProperty("server_url"));
        articleFamily.put("Url",urlFamily);
        articleFamily.put("Url", urlFamily);
        articleFamily.put("Title", "我的家庭功能使用说明");
        articleFamily.put("Description","功能使用说明");
        articleFamily.put("PicUrl",picUrlFamily);
        articleFamily.put("Description", "功能使用说明");
        articleFamily.put("PicUrl", picUrlFamily);
        articles.add(articleFamily);
        // 构建回复消息XML
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        return result;
    }
@ -175,14 +171,14 @@ public class WeiXinEventProcess {
     * @return
     * @throws Exception
     */
    private static String clickEventProcessMenu(Map<String,String> message) throws Exception{
    private static String clickEventProcessMenu(Map<String, String> message) throws Exception {
        String result = "";
        // 配置信息
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
        // 图文信息
        List<Map<String,String>> articles =  new ArrayList<>();
        List<Map<String, String>> articles = new ArrayList<>();
        //就诊记录
        Map<String,String> articleVisit = new HashMap<>();
        Map<String, String> articleVisit = new HashMap<>();
        String visit = systemConf.getProperty("patient_visit_url");
        // 图文消息图片URL
        String visit_pic = systemConf.getProperty("patient_visit_pic");
@ -192,14 +188,14 @@ public class WeiXinEventProcess {
        //图片地址
        visit_pic = visit_pic.replace("{server}", systemConf.getProperty("server_url"));
        articleVisit.put("Url",visit);
        articleVisit.put("Url", visit);
        articleVisit.put("Title", "就诊记录");
        articleVisit.put("Description","就诊记录");
        articleVisit.put("PicUrl",visit_pic);
        articleVisit.put("Description", "就诊记录");
        articleVisit.put("PicUrl", visit_pic);
        articles.add(articleVisit);
        //#检查检验
        Map<String,String> articleInspect = new HashMap<>();
        Map<String, String> articleInspect = new HashMap<>();
        // 图文URL
        String inspect = systemConf.getProperty("patient_inspect_url");
        // 图文消息图片URL
@ -210,13 +206,13 @@ public class WeiXinEventProcess {
        //图片地址
        inspect_pic = inspect_pic.replace("{server}", systemConf.getProperty("server_url"));
        articleInspect.put("Url",inspect);
        articleInspect.put("Url", inspect);
        articleInspect.put("Title", "检查检验");
        articleInspect.put("Description","检查检验");
        articleInspect.put("PicUrl",inspect_pic);
        articleInspect.put("Description", "检查检验");
        articleInspect.put("PicUrl", inspect_pic);
        articles.add(articleInspect);
        Map<String,String> articleExamination = new HashMap<>();
        Map<String, String> articleExamination = new HashMap<>();
        // 图文URL
        String examination = systemConf.getProperty("patient_examination_url");
        // 图文消息图片URL
@ -227,34 +223,33 @@ public class WeiXinEventProcess {
        //图片地址
        examination_pic = examination_pic.replace("{server}", systemConf.getProperty("server_url"));
        articleExamination.put("Url",examination);
        articleExamination.put("Url", examination);
        articleExamination.put("Title", "社区体检");
        articleExamination.put("Description","社区体检");
        articleExamination.put("PicUrl",examination_pic);
        articleExamination.put("Description", "社区体检");
        articleExamination.put("PicUrl", examination_pic);
        articles.add(articleExamination);
        // 构建回复消息XML
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        return result;
    }
    /**
     * 关注事件消息发送
     *
     * @param message
     * @return
     * @throws Exception
     */
    private static String subscribeEventProcess(Map<String,String> message) throws Exception{
    private static String subscribeEventProcess(Map<String, String> message) throws Exception {
        String result = "";
        // 配置信息
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
        // 图文信息
        List<Map<String,String>> articles =  new ArrayList<>();
        List<Map<String, String>> articles = new ArrayList<>();
        Map<String,String> article = new HashMap<>();
        Map<String, String> article = new HashMap<>();
        // 图文URL
        String url = systemConf.getProperty("doctor_subscribe_url");
        // 图文消息图片URL
@ -265,28 +260,29 @@ public class WeiXinEventProcess {
        //图片地址
        picUrl = picUrl.replace("{server}", systemConf.getProperty("server_url"));
        article.put("Url",url);
        article.put("Url", url);
        article.put("Title", "欢迎关注厦门i健康,快来签约家庭医生吧~");
        article.put("Description","请点击查看家庭签约");
        article.put("PicUrl",picUrl);
        article.put("Description", "请点击查看家庭签约");
        article.put("PicUrl", picUrl);
        articles.add(article);
        //设置URL
        setUrlItems(articles,systemConf);
        //设置共有的图文消息
        setUrlItems(articles, systemConf);
        // 构建回复消息XML
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        return result;
    }
    /**
     * 设置微信公共链接
     * 设置微信公共的图文消息
     *
     * @param articles
     */
    public static void setUrlItems(List<Map<String,String>> articles,Properties systemConf){
        Map<String,String> articleConsult = new HashMap<>();
    public static void setUrlItems(List<Map<String, String>> articles, Properties systemConf) {
        Map<String, String> articleConsult = new HashMap<>();
        // 图文URL
        String urlConsult = systemConf.getProperty("patient_consult_url");
        // 图文消息图片URL
@ -297,14 +293,14 @@ public class WeiXinEventProcess {
        //图片地址
        picUrlConsult = picUrlConsult.replace("{server}", systemConf.getProperty("server_url"));
        articleConsult.put("Url",urlConsult);
        articleConsult.put("Url", urlConsult);
        articleConsult.put("Title", "医生咨询功能使用说明");
        articleConsult.put("Description","功能使用说明");
        articleConsult.put("PicUrl",picUrlConsult);
        articleConsult.put("Description", "功能使用说明");
        articleConsult.put("PicUrl", picUrlConsult);
        articles.add(articleConsult);
        Map<String,String> articleBooking = new HashMap<>();
        Map<String, String> articleBooking = new HashMap<>();
        // 图文URL
        String urlBooking = systemConf.getProperty("patient_booking_url");
        // 图文消息图片URL
@ -315,14 +311,14 @@ public class WeiXinEventProcess {
        //图片地址
        picUrlBooking = picUrlBooking.replace("{server}", systemConf.getProperty("server_url"));
        articleBooking.put("Url",urlBooking);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Title", "预约挂号功能使用说明");
        articleBooking.put("Description","功能使用说明");
        articleBooking.put("PicUrl",picUrlBooking);
        articleBooking.put("Description", "功能使用说明");
        articleBooking.put("PicUrl", picUrlBooking);
        articles.add(articleBooking);
        Map<String,String> articleDevice = new HashMap<>();
        Map<String, String> articleDevice = new HashMap<>();
        // 图文URL
        String urlDevice = systemConf.getProperty("patient_device_url");
        // 图文消息图片URL
@ -333,14 +329,14 @@ public class WeiXinEventProcess {
        //图片地址
        picUrlDevice = picUrlDevice.replace("{server}", systemConf.getProperty("server_url"));
        articleDevice.put("Url",urlDevice);
        articleDevice.put("Url", urlDevice);
        articleDevice.put("Title", "体征设备管理功能使用说明");
        articleDevice.put("Description","功能使用说明");
        articleDevice.put("PicUrl",picUrlDevice);
        articleDevice.put("Description", "功能使用说明");
        articleDevice.put("PicUrl", picUrlDevice);
        articles.add(articleDevice);
        Map<String,String> articleFamily = new HashMap<>();
        Map<String, String> articleFamily = new HashMap<>();
        // 图文URL
        String urlFamily = systemConf.getProperty("patient_family_url");
        // 图文消息图片URL
@ -351,10 +347,10 @@ public class WeiXinEventProcess {
        //图片地址
        picUrlFamily = picUrlFamily.replace("{server}", systemConf.getProperty("server_url"));
        articleFamily.put("Url",urlFamily);
        articleFamily.put("Url", urlFamily);
        articleFamily.put("Title", "我的家庭功能使用说明");
        articleFamily.put("Description","功能使用说明");
        articleFamily.put("PicUrl",picUrlFamily);
        articleFamily.put("Description", "功能使用说明");
        articleFamily.put("PicUrl", picUrlFamily);
        articles.add(articleFamily);
    }
@ -371,102 +367,169 @@ public class WeiXinEventProcess {
        // 场景值
        String eventKey = message.get("EventKey");
        if(StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("qr_") ||
        if (StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("qr_") ||
                eventKey.startsWith("qrscene_qr_"))) {
            // 配置
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String,String>> articles =  new ArrayList<>();
            Map<String,String> article = new HashMap<>();
            // 二维码跳转URL
            List<Map<String, String>> articles = new ArrayList<>();
            Map<String, String> article = new HashMap<>();
            // 医生二维码跳转URL
            String url = systemConf.getProperty("doctor_qrcode_url");
            // 图片URL
            String picUrl = systemConf.getProperty("doctor_qrcode_pic_url");
            // 二维码参数
            String[] keys = eventKey.replace("qrscene_qr_","").replace("qr_","").split("_");
            String[] keys = eventKey.replace("qrscene_qr_", "").replace("qr_", "").split("_");
            // 图文消息URL
            url = url.replace("{server}", systemConf.getProperty("wechat_base_url"))
                    .replace("{appId}", systemConf.getProperty("appId"))
                    .replace("{doctorCode}",keys[0]);
                    .replace("{doctorCode}", keys[0]);
            //图片地址
            picUrl = picUrl.replace("{server}", systemConf.getProperty("server_url"));
            article.put("Url",url);
            article.put("Title",keys[1] + "医生签约");
            article.put("Description","请点击查看医生详情并申请签约");
            article.put("PicUrl",picUrl);
            article.put("Url", url);
            article.put("Title", keys[1] + "医生签约");
            article.put("Description", "请点击查看医生详情并申请签约");
            article.put("PicUrl", picUrl);
            articles.add(article);
            //设置通用链接
            setUrlItems(articles,systemConf);
            setUrlItems(articles, systemConf);
            //加入续签图文
            Map videoText = getNews("patient_sign_again_url", "patient_sign_again_pic_url", "家庭医生续签提醒", null);
            articles.add(videoText);
            // 消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
        }else if(StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("hs_") ||
                eventKey.startsWith("qrscene_hs_"))){
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        } else if (StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("hs_") ||
                eventKey.startsWith("qrscene_hs_"))) {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String,String>> articles =  new ArrayList<>();
            Map<String,String> article = new HashMap<>();
            List<Map<String, String>> articles = new ArrayList<>();
            Map<String, String> article = new HashMap<>();
            // 社区二维码跳转URL
            String url = systemConf.getProperty("doctor_hos_qrcode_url");
            // 图片URL
            String picUrl = systemConf.getProperty("doctor_qrcode_pic_url");
            // 二维码参数
            String[] keys = eventKey.replace("qrscene_hs_","").replace("hs_","").split("_");
            String[] keys = eventKey.replace("qrscene_hs_", "").replace("hs_", "").split("_");
            // 图文消息URL
            url = url.replace("{server}", systemConf.getProperty("wechat_base_url"))
                    .replace("{appId}", systemConf.getProperty("appId"))
                    .replace("{hospital}",keys[0] + ":" + keys[1]);
                    .replace("{hospital}", keys[0] + ":" + keys[1]);
            //图片地址
            picUrl = picUrl.replace("{server}", systemConf.getProperty("server_url"));
            article.put("Url",url);
            article.put("Title",keys[1]);
            article.put("Description","请点击查看社区详情");
            article.put("PicUrl",picUrl);
            article.put("Url", url);
            article.put("Title", keys[1]);
            article.put("Description", "请点击查看社区详情");
            article.put("PicUrl", picUrl);
            articles.add(article);
            //设置通用链接
            setUrlItems(articles,systemConf);
            setUrlItems(articles, systemConf);
            //加入续签图文
            Map videoText = getNews("patient_sign_again_url", "patient_sign_again_pic_url", "家庭医生续签提醒", null);
            articles.add(videoText);
            // 消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
        } else if(StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("tw_") ||
                eventKey.startsWith("qrscene_tw_"))){
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        } else if (StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("tw_") ||
                eventKey.startsWith("qrscene_tw_"))) {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String,String>> articles =  new ArrayList<>();
            Map<String,String> article = new HashMap<>();
            // 社区二维码跳转URL
            List<Map<String, String>> articles = new ArrayList<>();
            Map<String, String> article = new HashMap<>();
            // 区二维码跳转URL
            String url = systemConf.getProperty("doctor_town_qrcode_url");
            // 图片URL
            String picUrl = systemConf.getProperty("doctor_qrcode_pic_url");
            // 二维码参数
            String[] keys = eventKey.replace("qrscene_tw_","").replace("tw_","").split("_");
            String[] keys = eventKey.replace("qrscene_tw_", "").replace("tw_", "").split("_");
            // 图文消息URL
            url = url.replace("{server}", systemConf.getProperty("wechat_base_url"))
                    .replace("{appId}", systemConf.getProperty("appId"))
                    .replace("{town}",keys[0]);
                    .replace("{town}", keys[0]);
            //图片地址
            picUrl = picUrl.replace("{server}", systemConf.getProperty("server_url"));
            article.put("Url",url);
            article.put("Title",keys[1]);
            article.put("Description","请点击查看区详情");
            article.put("PicUrl",picUrl);
            article.put("Url", url);
            article.put("Title", keys[1]);
            article.put("Description", "请点击查看区详情");
            article.put("PicUrl", picUrl);
            articles.add(article);
            //设置通用链接
            setUrlItems(articles,systemConf);
            setUrlItems(articles, systemConf);
            //加入续签图文
            Map videoText = getNews("patient_sign_again_url", "patient_sign_again_pic_url", "家庭医生续签提醒", null);
            articles.add(videoText);
            // 消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }
        return result;
    }
    /**
     * 构建单个图文消息工具类
     *
     * @param url         跳转URL
     * @param picUrl      图片地址
     * @param title       图文标题
     * @param description 图文描述
     * @return
     */
    public static Map getNews(String url, String picUrl, String title, String description) {
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
        Map<String, String> news = new HashMap<>();
        // 图文URL
        String targetUrl = systemConf.getProperty(url);
        // 图文消息图片URL
        String pictureUrl = systemConf.getProperty(picUrl);
        // URL设置服务器URL、AppId
        targetUrl = targetUrl.replace("{server}", systemConf.getProperty("wechat_base_url"))
                .replace("{appId}", systemConf.getProperty("appId"));
        //图片地址
        pictureUrl = pictureUrl.replace("{server}", systemConf.getProperty("server_url"));
        System.out.println("url ====> " + targetUrl);
        System.out.println("picurl ======> " + pictureUrl);
        news.put("Url", targetUrl);
        if (StringUtils.isNotEmpty(title)) {
            news.put("Title", title);
        }
        if (StringUtils.isNotEmpty(description)) {
            news.put("Description", description);
        }
        news.put("PicUrl", pictureUrl);
        return news;
    }
    /**
     * 居民微信回复关键字处理
     *
     * @param message
     * @return
     */
    public static String replyKeyword(Map<String, String> message) throws Exception {
        String result = "";
        String description = "您的家庭医生签约将于7月31日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。";
        String description1 = "为了能给您提供健康服务,诚邀您签签约家庭医生。";
        // 图文信息
        List<Map<String, String>> articles = new ArrayList<>();
        Map videoText = getNews("doctor_subscribe_url", "doctor_qrcode_pic_url", "欢迎关注厦门i健康,快来签约家庭医生吧~", null);
        Map videoText1 = getNews("patient_sign_again_url", "patient_sign_again_pic_url", "家庭医生续签提醒", null);
        System.out.println("255");
        articles.add(videoText);
        articles.add(videoText1);
        // 构建回复消息XML
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        System.out.println("256");
        return result;
    }
}

+ 17 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinMessageReplyUtils.java

@ -48,4 +48,21 @@ public class WeiXinMessageReplyUtils {
        return result.toString();
    }
    /**
     * 公众号群发图文消息
     *
     * @param toUser
     * @param fromUser
     * @param articles
     * @return
     * @throws Exception
     */
    public static String mapNewsMessage(String toUser,String fromUser,List<Map<String,String>> articles) throws Exception {
//1.上传图片到微信服务器
//2.上传图文消息素材到微信服务器
// 3.根据openID列表群发
        return null;
    }
}

+ 33 - 33
patient-co-wlyy/src/main/resources/application.properties

@ -52,23 +52,23 @@
#redis.testOnBorrow=true
##------------------------------------�����������ݿ�����------------------------------------#
#### mysql database setting
#jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#jdbc.username=root
#jdbc.password=123456
#
##### health index
#health.jdbc.driver=com.mysql.jdbc.Driver
#health.jdbc.url=jdbc:mysql://172.19.103.77/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#health.jdbc.username=root
#health.jdbc.password=123456
#
##### suifang
#fv.jdbc.driver=com.mysql.jdbc.Driver
#fv.jdbc.url=jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#fv.jdbc.username=root
#fv.jdbc.password=123456
### mysql database setting
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
jdbc.username=root
jdbc.password=123456
#### health index
health.jdbc.driver=com.mysql.jdbc.Driver
health.jdbc.url=jdbc:mysql://172.19.103.77/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
health.jdbc.username=root
health.jdbc.password=123456
#### suifang
fv.jdbc.driver=com.mysql.jdbc.Driver
fv.jdbc.url=jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
fv.jdbc.username=root
fv.jdbc.password=123456
#### redis
redis.host=172.19.103.47
@ -76,23 +76,23 @@ redis.port=6379
redis.password=
#---------------------------------���Ի������ݿ�����---------------------------------------#
##### mysql database setting
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
jdbc.username=linzhou
jdbc.password=linzhou
##### health index
health.jdbc.driver=com.mysql.jdbc.Driver
health.jdbc.url=jdbc:mysql://172.19.103.85/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
health.jdbc.username=linzhou
health.jdbc.password=linzhou
##### suifang
fv.jdbc.driver=com.mysql.jdbc.Driver
fv.jdbc.url=jdbc:mysql://172.19.103.85/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
fv.jdbc.username=linzhou
fv.jdbc.password=linzhou
#jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#jdbc.username=linzhou
#jdbc.password=linzhou
#
###### health index
#health.jdbc.driver=com.mysql.jdbc.Driver
#health.jdbc.url=jdbc:mysql://172.19.103.85/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#health.jdbc.username=linzhou
#health.jdbc.password=linzhou
#
###### suifang
#fv.jdbc.driver=com.mysql.jdbc.Driver
#fv.jdbc.url=jdbc:mysql://172.19.103.85/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#fv.jdbc.username=linzhou
#fv.jdbc.password=linzhou
##
###### redis
#redis.host=172.19.103.88
#redis.port=6379

+ 5 - 5
patient-co-wlyy/src/main/resources/applicationContext.xml

@ -106,11 +106,11 @@
	<bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper" />
    <!--quartz任务调度器名称,调度器只能加载与名称相同的任务-->
	<bean id="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton">
		<property name="dataSource" ref="dataSource"/>
		<property name="configLocation" value="classpath:/quartz.properties" />
		<property name="autoStartup" value="true"/>
	</bean>
	<!--<bean id="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton">-->
		<!--<property name="dataSource" ref="dataSource"/>-->
		<!--<property name="configLocation" value="classpath:/quartz.properties" />-->
		<!--<property name="autoStartup" value="true"/>-->
	<!--</bean>-->
	<bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
		<property name="maxIdle" value="${redis.maxIdle}"/>

+ 4 - 4
patient-co-wlyy/src/main/webapp/WEB-INF/spring-mvc.xml

@ -77,14 +77,14 @@
	</bean>
	
	<mvc:interceptors>
		<mvc:interceptor>
<!--		<mvc:interceptor>
	        <mvc:mapping path="/patient/**"/>
	        <bean class="com.yihu.wlyy.interceptors.PatientInterceptor"/>
	    </mvc:interceptor>
	    <mvc:interceptor>
	    </mvc:interceptor>-->
	    <!--<mvc:interceptor>
	        <mvc:mapping path="/doctor/**"/>
	        <bean class="com.yihu.wlyy.interceptors.DoctorInterceptor"/>
	    </mvc:interceptor>
	    </mvc:interceptor>-->
	    <mvc:interceptor>
	        <mvc:mapping path="/user/**"/>
	        <bean class="com.yihu.wlyy.interceptors.UserInterceptor"/>

BIN=BIN
patient-co-wlyy/src/main/webapp/images/renew.png