Forráskód Böngészése

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

trick9191 8 éve
szülő
commit
68f936d67e
43 módosított fájl, 1843 hozzáadás és 467 törlés
  1. 0 1
      .gitignore
  2. 1 1
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/MessageDao.java
  3. 0 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/cache/CacheCleanJob.java
  4. 24 0
      patient-co-wlyy/readme.MD
  5. 21 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/consult/ConsultTeam.java
  6. 77 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/consult/Evaluate.java
  7. 57 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/consult/EvaluateLabel.java
  8. 10 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java
  9. 20 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/education/HealthEduArticlePatient.java
  10. 36 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/message/SMS.java
  11. 8 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  12. 1 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java
  13. 107 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/job/consult/EvaluateScoreJob.java
  14. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDoctorDao.java
  15. 36 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/EvaluateDao.java
  16. 28 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/EvaluateLabelDao.java
  17. 17 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  18. 54 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateLabelService.java
  19. 130 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateService.java
  20. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/feedback/AppealService.java
  21. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/feedback/FeedbackService.java
  22. 5 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticleDoctorService.java
  23. 88 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticlePatientService.java
  24. 10 7
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticleService.java
  25. 70 9
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  26. 43 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java
  27. 6 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  28. 78 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ClazzReflect.java
  29. 23 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java
  30. 26 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java
  31. 82 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorEvaluateController.java
  32. 6 6
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackController.java
  33. 75 30
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  34. 84 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/EvaluateController.java
  35. 7 7
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackController.java
  36. 4 11
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java
  37. 494 308
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthController.java
  38. 59 40
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java
  39. 33 33
      patient-co-wlyy/src/main/resources/application.properties
  40. 2 2
      patient-co-wlyy/src/main/resources/config/fdfs_client.conf
  41. 4 2
      patient-co-wlyy/src/main/resources/system.properties
  42. 1 1
      patient-co-wlyy/src/main/resources/weixin_menu.txt
  43. 11 0
      readme.MD

+ 0 - 1
.gitignore

@ -12,7 +12,6 @@
build/*.jar
.settings
.cache
cache
.generated-mima*
work/
out/

+ 1 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/MessageDao.java

@ -17,7 +17,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("select count(a) from Message a where a.type =1 and a.read= 1 and a.receiver=?1 ")
    int amountUnreadByReceiver(String doctor);
    @Query("select count(a) from Message a where a.read = 0 and over ='0'  and a.receiver=?1 and a.type=3 ")
    @Query("select count(a) from Message a where a.read = 1  and a.receiver=?1 and a.type=3 ")
    int amountUnreadSystemByReceiver(String doctor);

CacheCleanJob.java → patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/cache/CacheCleanJob.java


+ 24 - 0
patient-co-wlyy/readme.MD

@ -0,0 +1,24 @@
doc 项目相关文档
src 代码
    main
        java
            com.yihu.wlyy
                aop 切面相关代码
                config 配置相关代码
                entity jpa 实体类相关代码
                event 事件相关代码
                exception 异常相关代码
                health 体征设备相关代码
                interceptors 拦截器相关代码
                job 任务相关代码
                logs 日志相关代码
                repository dao相关代码
                rest 
                service 服务类相关代码
                task 线程相关代码
                util 工具类相关代码
                web controller相关代码
                wechat 微信相关代码
        resource 资源和配置文件
        webapp  web相关代码

+ 21 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/consult/ConsultTeam.java

@ -9,6 +9,7 @@ import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import io.swagger.models.auth.In;
/**
 * 三师咨询
@ -53,6 +54,26 @@ public class ConsultTeam extends IdEntity {
	private Integer endType;
	// 结束时间
	private Date endTime;
	//是否评价 1、已评价 0、未评价'
	private Integer evaluate;
	//评价时间
	private Date evaluateTime;
	public Integer getEvaluate() {
		return evaluate;
	}
	public void setEvaluate(Integer evaluate) {
		this.evaluate = evaluate;
	}
	public Date getEvaluateTime() {
		return evaluateTime;
	}
	public void setEvaluateTime(Date evaluateTime) {
		this.evaluateTime = evaluateTime;
	}
	@Column(name = "admin_team_code")
	public Long getAdminTeamId() {

+ 77 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/consult/Evaluate.java

@ -0,0 +1,77 @@
package com.yihu.wlyy.entity.consult;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by 卓 on 2017/5/10.
 */
@Entity
@Table(name = "wlyy_evaluate")
public class Evaluate extends IdEntity {
    private static final long serialVersionUID = -161924234234189L;
    private String doctor;//被评价的医生
    private String patient;//评价人
    private String consult;//咨询
    private Integer score;//分数
    private Integer type;//1、实名,2、匿名
    private Integer evaluateType;//评价种类0、实名评价, 1、专业能力,2、服务态度,3、回复速度
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getConsult() {
        return consult;
    }
    public void setConsult(String consult) {
        this.consult = consult;
    }
    public Integer getScore() {
        return score;
    }
    public void setScore(Integer score) {
        this.score = score;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public Integer getEvaluateType() {
        return evaluateType;
    }
    public void setEvaluateType(Integer evaluateType) {
        this.evaluateType = evaluateType;
    }
}

+ 57 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/consult/EvaluateLabel.java

@ -0,0 +1,57 @@
package com.yihu.wlyy.entity.consult;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by 卓 on 2017/5/10.
 */
@Entity
@Table(name = "wlyy_evaluate_label")
public class EvaluateLabel extends IdEntity {
    private static final long serialVersionUID = -161943424234234189L;
    private String doctor; //被评价的医生
    private String patient; //被评价的患者
    private String consult; //咨询code
    private String content;//标签内容
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getConsult() {
        return consult;
    }
    public void setConsult(String consult) {
        this.consult = consult;
    }
}

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java

@ -64,6 +64,16 @@ public class Doctor extends IdEntity {
    private String isPasswordPrompt;// 是否提示密码信息 1是 0或者空是否
    private String isHelp;//是否求助  1已经求助 0未求助
    private Double evaluateScore;//评分
    public Double getEvaluateScore() {
        return evaluateScore;
    }
    public void setEvaluateScore(Double evaluateScore) {
        this.evaluateScore = evaluateScore;
    }
    public Doctor() {
    }

+ 20 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/education/HealthEduArticlePatient.java

@ -48,6 +48,26 @@ public class HealthEduArticlePatient extends IdEntity {
	private Long adminTeamCode;
	// 简介
	private String summary;
	//附加内容
	private String attachedContent;
	//批次号记录发送所属批次
	private String batchNo;
	public String getBatchNo() {
		return batchNo;
	}
	public void setBatchNo(String batchNo) {
		this.batchNo = batchNo;
	}
	public String getAttachedContent() {
		return attachedContent;
	}
	public void setAttachedContent(String attachedContent) {
		this.attachedContent = attachedContent;
	}
	public String getPatient() {
		return patient;

+ 36 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/message/SMS.java

@ -24,6 +24,42 @@ public class SMS extends IdEntity {
    private Date deadline;// 过期时间
    private Integer status;// 状态,0未发送,1已发送
    private Date czrq;
    private String userCode;//用户标示
    private Integer userType;//用户类型
    private String town; //所属区
    private String hospital;//所属机构,未签约用居民地址
    public String getUserCode() {
        return userCode;
    }
    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }
    public Integer getUserType() {
        return userType;
    }
    public void setUserType(Integer userType) {
        this.userType = userType;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getMobile() {
        return mobile;

+ 8 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.event;
import com.yihu.wlyy.job.QuartzHelper;
import com.yihu.wlyy.job.SignEndJob;
import com.yihu.wlyy.job.consult.EvaluateScoreJob;
import com.yihu.wlyy.util.SystemConf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
@ -30,6 +31,13 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            } else {
                System.out.println("sign end job exist");
            }
            if (!quartzHelper.isExistJob("evaluate_score_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("evaluate_score_job");
                quartzHelper.addJob(EvaluateScoreJob.class, trigger, "evaluate_score_job", new HashMap<String, Object>());
                System.out.println("evaluate_score_job start success");
            } else {
                System.out.println("evaluate_score_job exist");
            }
        } catch (Exception e) {
            System.out.println("sign end job start failed");
        }

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java

@ -28,6 +28,7 @@ public class PatientInterceptor extends BaseInterceptor {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		boolean flag = true;
		if(flag) return flag;
		try {
			request.setCharacterEncoding("UTF-8");
			request.setAttribute("log-start", new Date().getTime());

+ 107 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/consult/EvaluateScoreJob.java

@ -0,0 +1,107 @@
package com.yihu.wlyy.job.consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeamDoctor;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.job.QuartzHelper;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.consult.ConsultTeamDoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.service.quota.JobService;
import com.yihu.wlyy.util.DateUtil;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.math.BigDecimal;
import java.util.*;
import static com.yihu.wlyy.job.consult.ConsultCleanerJob.ConsultTerminatorJobKey;
/**
 * @author Sand
 * @since 2016/9/26
 */
@Service
public class EvaluateScoreJob implements Job{
    @Autowired
    ConsultTeamDoctorDao consultTeamDoctorDao;
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    DoctorDao doctorDao;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            System.out.println("calculate evaluate job start");
            SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
            //获取有被评价过的医生列表
            String doctorsSql = "select w.doctor from wlyy_evaluate w group by w.doctor";
            String sql = "select w.evaluate_type,sum(w.score) as score from wlyy_evaluate w where w.doctor =? GROUP BY w.evaluate_type,w.doctor";
            String evaluateTimesSql = "select count(1) as count from wlyy_evaluate w where w.doctor =? GROUP BY w.consult,w.doctor";
            List<Map<String, Object>> doctorList = jdbcTemplate.queryForList(doctorsSql);
            for (Map<String, Object> doctorMap : doctorList) {
                //获取医生的所有评价信息
                String doctor =  doctorMap.get("doctor").toString();
                List<Map<String, Object>> evaluateList = jdbcTemplate.queryForList(sql, new Object[]{doctor});
                BigDecimal score = BigDecimal.ZERO;//总分
                BigDecimal anonymousScore = BigDecimal.ZERO;//匿名评价分
                BigDecimal realScore = BigDecimal.ZERO;//实名评价分
                BigDecimal jiaquan = BigDecimal.ZERO;//加权平均分
                for (Map<String, Object> evaluate : evaluateList) {
                    BigDecimal scoreTemp = new BigDecimal(evaluate.get("score").toString());
                    switch (evaluate.get("evaluate_type").toString()) {
                        case "0":
                            realScore = realScore.add(scoreTemp.multiply(new BigDecimal("0.3")));
                            break;
                        case "1":
                            anonymousScore=  anonymousScore.add(scoreTemp.multiply(new BigDecimal("0.2")));
                            break;
                        case "2":
                            anonymousScore=  anonymousScore.add(scoreTemp.multiply(new BigDecimal("0.25")));
                            break;
                        case "3":
                            anonymousScore=  anonymousScore.add(scoreTemp.multiply(new BigDecimal("0.25")));
                            break;
                    }
                }
                //获取有效评价次数
                List<Map<String, Object>> evaluateTimesList = jdbcTemplate.queryForList(evaluateTimesSql, new Object[]{doctor});
                int evaTimes = Integer.parseInt(evaluateTimesList.get(0).get("count").toString());
                if(evaTimes>0){
                    evaTimes = evaluateTimesList.size();
                }
                int consultTimes = consultTeamDoctorDao.countByDoctorAndType(2, doctor);
                jiaquan = (anonymousScore.add(realScore)).divide(BigDecimal.valueOf(evaTimes),2,BigDecimal.ROUND_HALF_UP);
                if (consultTimes <= 100) {  //咨询系数 咨询次数≤100次,对应系数为3;
                    //100次<咨询次数≤1000次,对应系数为2;
                    //咨询次数>1000次,对应系数为1。
                    jiaquan = (jiaquan.subtract(BigDecimal.valueOf(80L))).divide(BigDecimal.valueOf(3L),2,BigDecimal.ROUND_HALF_UP);
                } else if (consultTimes > 100 && consultTimes <= 1000) {
                    jiaquan = (jiaquan.subtract(BigDecimal.valueOf(80L))).divide(BigDecimal.valueOf(2L),2,BigDecimal.ROUND_HALF_UP);
                } else {
                    jiaquan = (jiaquan.subtract(BigDecimal.valueOf(80L))).divide(BigDecimal.valueOf(1L),2,BigDecimal.ROUND_HALF_UP);
                }
                score = jiaquan.add(BigDecimal.valueOf(80L)).setScale(1, BigDecimal.ROUND_HALF_UP);
                //计算完毕
                Doctor d  =  doctorDao.findByCode(doctor);
                d.setEvaluateScore(score.doubleValue());
                doctorDao.save(d);
            }
            System.out.println("calculate evaluate job end");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("calculate evaluate job failed");
        }
    }
}

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

@ -12,6 +12,9 @@ public interface ConsultTeamDoctorDao extends PagingAndSortingRepository<Consult
	@Query("select count(1) from ConsultTeamDoctor a where a.consult = ?1 and a.to = ?2")
	int isExist(String consult, String doctor);
	@Query("select count(1) from ConsultTeamDoctor a,ConsultTeam t where t.consult = a.consult and t.type = ?1 and a.to = ?2")
	int countByDoctorAndType(int type,String doctor);
	// 更新为有回复
	@Modifying
	@Query("update ConsultTeamDoctor a set a.reply = 1 where a.consult = ?1 and a.to = ?2")

+ 36 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/EvaluateDao.java

@ -0,0 +1,36 @@
package com.yihu.wlyy.repository.consult;
import com.yihu.wlyy.entity.consult.Evaluate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by 卓 on 2017/5/10.
 */
public interface EvaluateDao extends PagingAndSortingRepository<Evaluate, Long>, JpaSpecificationExecutor<Evaluate> {
    /**
     * 获取某个咨询的评分
     * @param consult
     * @return
     */
    List<Evaluate> findByConsult(String consult);
    /**
     * 根据咨询获取实名或者匿名评分
     * @param consult
     * @return
     */
    List<Evaluate> findByConsultAndType(String consult,int type);
    /**
     * 根据医生获取实名或者匿名评分
     * @param doctor
     * @return
     */
    List<Evaluate> findByDoctorAndType(String doctor,int type);
}

+ 28 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/EvaluateLabelDao.java

@ -0,0 +1,28 @@
package com.yihu.wlyy.repository.consult;
import com.yihu.wlyy.entity.consult.EvaluateLabel;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by 卓 on 2017/5/10.
 */
public interface EvaluateLabelDao extends PagingAndSortingRepository<EvaluateLabel, Long>, JpaSpecificationExecutor<EvaluateLabel> {
    /**
     * 获取某个咨询的标签
     * @param consult
     * @return
     */
    List<EvaluateLabel> findByConsult(String consult);
    /**
     * 获取某个医生的标签
     * @param doctor
     * @return
     */
    List<EvaluateLabel> findByDoctor(String doctor);
}

+ 17 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -26,6 +26,7 @@ import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
@ -46,6 +47,7 @@ import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter.Operator;
import org.springside.modules.utils.Clock;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -84,6 +86,9 @@ public class ConsultTeamService extends ConsultService {
    @Autowired
    private com.yihu.wlyy.service.common.account.DoctorService doctorService;
    @Autowired
    WeiXinAccessTokenUtils accessTokenUtils;
    /**
     * 查询患者是否还有未结束的三师咨询
     *
@ -758,6 +763,7 @@ public class ConsultTeamService extends ConsultService {
            if (patient.equals(key)) {
                continue;
            }
            //记录咨询的医生详情误删
            ConsultTeamDoctor cd = new ConsultTeamDoctor();
            cd.setConsult(consult.getCode());
            cd.setDel("1");
@ -1623,6 +1629,17 @@ public class ConsultTeamService extends ConsultService {
                endId = d.getCode();
                endName = d.getName();
            }
            if(consultTeam.getType()==2){
                Patient p = patientDao.findByCode(consultTeam.getPatient());
                String name = p.getName();
                String openId = p.getOpenid();
                JSONObject json = new JSONObject();
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                json.put("keyword1", sdf.format(new Date()));
                json.put("toUser", p.getCode());
                json.put("first", name +",您好!您有1条咨询已结束,请及时对咨询医生进行满意度评价。待办事项:满意度评价");
                PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, openId, p.getName(), json);
            }
        }
        JSONObject obj = ImUtill.endTopics(consultTeam.getPatient(), endId, endName, consultTeam.getConsult());
        if (obj == null) {

+ 54 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/EvaluateLabelService.java

@ -0,0 +1,54 @@
package com.yihu.wlyy.service.app.consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.Evaluate;
import com.yihu.wlyy.entity.consult.EvaluateLabel;
import com.yihu.wlyy.repository.consult.EvaluateLabelDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.ClazzReflect;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
@Transactional
public class EvaluateLabelService extends BaseService {
	@Autowired
	EvaluateLabelDao evaluateLabelDao;
	@Autowired
	JdbcTemplate jdbcTemplate;
	public void save(List<EvaluateLabel> evaluateLabels){
		evaluateLabelDao.save(evaluateLabels);
	}
	public List<EvaluateLabel> findByDoctor(String doctor){
		return	this.evaluateLabelDao.findByDoctor(doctor);
	}
	public List<EvaluateLabel> findByConsult(String consult){
		return this.evaluateLabelDao.findByConsult(consult);
	}
	public 	List<Map<String, Object>> findDistinctLabelByLaDoctor(String doctor){
		String sql ="select content,count(content) as amount from wlyy_evaluate_label where doctor =? group by content";
		List<Object> params = new ArrayList<Object>();
		params.add(doctor);
		List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql,params);
		return  result;
	}
}

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

@ -0,0 +1,130 @@
package com.yihu.wlyy.service.app.consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.Evaluate;
import com.yihu.wlyy.entity.consult.EvaluateLabel;
import com.yihu.wlyy.repository.consult.EvaluateDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.ClazzReflect;
import com.yihu.wlyy.util.ImUtill;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Component
@Transactional
public class EvaluateService extends BaseService {
	@Autowired
	EvaluateDao evaluateDao;
	@Autowired
	ConsultTeamService consultTeamService;
	@Autowired
	EvaluateLabelService evaluateLabelService;
	public void save(List<Evaluate> evaluates){
		evaluateDao.save(evaluates);
	}
	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 = new ArrayList<>();
		List<EvaluateLabel> evaluateLabelList = new ArrayList<>();
		for(Object evaluateObj: evaluateArray){
			Evaluate evaluate = new Evaluate();
			JSONObject obj =(JSONObject) evaluateObj;
			ClazzReflect clazzReflect = new ClazzReflect();
			evaluate = (Evaluate)clazzReflect.formatToClazz(evaluate,obj);
			evaluate.setConsult(consult);
			evaluate.setPatient(patient);
			evaluateList.add(evaluate);
		}
		for(Object labelObj: labelArray){
			EvaluateLabel evaluateLabel = new EvaluateLabel();
			JSONObject obj =(JSONObject) labelObj;
			ClazzReflect clazzReflect = new ClazzReflect();
			evaluateLabel = (EvaluateLabel)clazzReflect.formatToClazz(evaluateLabel,obj);
			evaluateLabel.setConsult(consult);
			evaluateLabel.setPatient(patient);
			evaluateLabelList.add(evaluateLabel);
		}
		this.save(evaluateList);
		evaluateLabelService.save(evaluateLabelList);
		consultTeam.setEvaluate(1);
		consultTeam.setEvaluateTime(new Date());
		JSONObject topicObject = new JSONObject();
		topicObject.put("evaluate",1);
		topicObject.put("evaluate_time",new Date());
		ImUtill.updateTopics(consult,topicObject.toString());
		this.consultTeamService.save(consultTeam);
	}
	/**
	 * 查询某个咨询某种类型的评价
	 * @param consult
	 * @param type
	 * @return
	 */
	public List<Evaluate> getEvaluateByConsultAndType(String consult,int type){
		List<Evaluate> evaluates = evaluateDao.findByConsultAndType(consult,type);
		return 	evaluates;
	}
	/**
	 * 查询某个咨询的评价
	 * @param consult
	 * @return
	 */
	public List<Evaluate> getEvaluateByConsult(String consult){
		List<Evaluate> evaluates = evaluateDao.findByConsult(consult);
		return 	evaluates;
	}
	/**
	 * 获取某个医生的某种类型的评价
	 * @param doctor
	 * @param type
	 * @return
	 */
	public List<Evaluate> getEvaluateByDoctorAndType(String doctor,int type){
		List<Evaluate> evaluates = evaluateDao.findByDoctorAndType(doctor,type);
		return 	evaluates;
	}
	//public static void main(String args[]){
	//	JSONObject object = new JSONObject();
	//	JSONArray evaluateArray = new JSONArray();
	//	JSONArray labelArray = new JSONArray();
	//	JSONObject evaluateObject = new JSONObject();
	//	evaluateObject.put("doctor","要评价的医生code");
	//	evaluateObject.put("evaluateType","评价种类0、实名评价, 1、专业能力,2、服务态度,3、回复速度");
	//	evaluateObject.put("type","1、实名,2、匿名");
	//	evaluateObject.put("score","得分多少");
	//	evaluateArray.put(evaluateObject);
	//	JSONObject labelObject = new JSONObject();
	//	labelObject.put("doctor","要贴标签的医生code");
	//	labelObject.put("content","标签内容");
	//	labelArray.put(labelObject);
	//	object.put("consult","咨询的code");
	//	object.put("evaluate",evaluateArray);
	//	object.put("label",labelArray);
	//	System.out.print(object.toString());
	//}
}

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/feedback/AppealService.java

@ -16,7 +16,7 @@ public class AppealService extends BaseService {
    @Autowired
    private AppealDao appealDao;
    public void saveAppeal(String doctor,String description,int type,String images,String phone,int identity) {
    public void saveAppeal(String doctor,String description,int type,String images,String phone,int identity) throws Exception{
        Appeal appeal = new Appeal();
        appeal.setCode(getCode());
        appeal.setPhone(phone);

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/feedback/FeedbackService.java

@ -16,7 +16,7 @@ public class FeedbackService extends BaseService {
    @Autowired
    private FeedbackDao feedbackDao;
    public void saveFeedback(String doctor,String description,int type,String images,String contact,int idetity) {
    public void saveFeedback(String doctor,String description,int type,String images,String contact,int idetity) throws Exception{
        Feedback feedback = new Feedback();
        feedback.setCode(getCode());
        feedback.setContact(contact);

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

@ -92,7 +92,7 @@ public class HealthEduArticleDoctorService extends BaseService {
	 * @param pagesize 分页大小
	 * @return
	 */
	public List<Map<String, Object>> list(int page, int pagesize,String filter,String doctor,String patient) {
	public List<Map<String, Object>> list(int page, int pagesize,String filter,String doctor,String patient,Integer wheaType) {
		if (pagesize <= 0) {
			pagesize = 10;
		}
@ -101,7 +101,7 @@ public class HealthEduArticleDoctorService extends BaseService {
		}
		List<Object> params = new ArrayList<Object>();
		StringBuffer sql = new StringBuffer();
		sql.append("select a.id,a.article,a.doctor,a.title,a.url,a.czrq,b.summary content,b.keyword");
		sql.append("select a.id,a.article,a.doctor,a.title,a.url,a.czrq,b.summary content,b.keyword,b.whea_type");
		sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.article and c.status = 1) as readAmount");
		sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.article and c.status = 2) as collectionAmount");
		sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.article and c.status = 3) as repeatAmount");
@ -112,6 +112,9 @@ public class HealthEduArticleDoctorService extends BaseService {
		}
		sql.append(" from wlyy_health_edu_article_doctor a left join wlyy_health_edu_article b on a.article = b.code ");//内联取文章内容
		String where = " where a.doctor = ?";
		if(wheaType>-1){
			where += " and  whea_type ="+wheaType;
		}
		params.add(doctor);
		if(StringUtils.isNotBlank(filter)){
			//记录搜索记录

+ 88 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticlePatientService.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.education.HealthEduArticlePatient;
import com.yihu.wlyy.repository.education.HealthEduArticleDao;
import com.yihu.wlyy.repository.education.HealthEduArticlePatientDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@ -95,7 +96,7 @@ public class HealthEduArticlePatientService extends BaseService {
     * @param pagesize 分页大小
     * @return
     */
    public List<HealthEduArticlePatient> findByPatient(String patient, long id, int pagesize) {
    public List<HealthEduArticlePatient> findByPatient(String patient,int wheaType, long id, int pagesize) {
        if (pagesize <= 0) {
            pagesize = 10;
        }
@ -110,6 +111,7 @@ public class HealthEduArticlePatientService extends BaseService {
                "    ,b.summary as content" +
                "    ,a.is_read as 'read'" +
                "    ,a.czrq" +
                "    ,a.attached_content" +
                " from" +
                "     wlyy_health_edu_article_patient a" +
                "     , wlyy_health_edu_article b" +
@ -117,12 +119,95 @@ public class HealthEduArticlePatientService extends BaseService {
                "      a.article = b.code" +
                " and a.patient = ?" +
                (id > 0 ? " and a.id < ? " : "") +
                (wheaType > 0 ? " and a.wheaType = ? " : "") +
                " order by a.id desc limit 0," + pagesize;
        List<HealthEduArticlePatient> list = jdbcTemplate.query(sql,
                id > 0 ? new Object[]{patient,id} : new Object[]{patient}, new BeanPropertyRowMapper(HealthEduArticlePatient.class));
        Object params[] = null;
        if(wheaType>-1&&id>0){
            params = new Object[]{patient,id,wheaType};
        }else if(wheaType>-1&&id<0){
            params = new Object[]{patient,wheaType};
        }
        else if(wheaType<0&&id>0){
            params = new Object[]{patient,id};
        }else{
            params = new Object[]{patient};
        }
        List<HealthEduArticlePatient> list = jdbcTemplate.query(sql,params, new BeanPropertyRowMapper(HealthEduArticlePatient.class));
        return list;
    }
    /**
     * 查询患者文章
     *
     * @param doctor  医生标识
     * @param  page 第几页
     * @param pagesize 分页大小
     * @return
     */
    public List<Map<String,Object>> findByDoctor(String doctor,int page, int pagesize) {
        if (pagesize <= 0) {
            pagesize = 10;
        }
        if(page<=0){
            page = 1 ;
        }
        int start = (page-1) * pagesize;
        String sql ="select a.article,b.title,b.summary,a.attached_content, a.czrq,count(a.patient) as amount,GROUP_CONCAT(p.name) as  patients,a.batch_no from "+
        " wlyy_health_edu_article_patient a, "+
        " wlyy_health_edu_article b,"+
        " wlyy_patient p"+
        " where"+
        " a.article = b.code"+
        " and a.patient = p.code"+
        " and a.doctor =? "+
        " group BY a.batch_no,a.article,a.attached_content,b.summary,a.doctor limit ?,?";
        Object params[] = new Object[]{doctor,start,pagesize};
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,params);
        return list;
    }
    /**
     * 查询批次号相关的文章及成员信息
     * @param doctor
     * @param article
     * @param batchNo
     * @return
     */
    public List<Map<String,Object>> findByBatchNo(String doctor,String article, String  batchNo) {
        String sql ="select a.article,b.title,b.content,a.attached_content,b.url, a.czrq as send_time,b.czrq,a.batch_no,sum(a.is_read) as no_read from "+
                " wlyy_health_edu_article_patient a, "+
                " wlyy_health_edu_article b,"+
                " wlyy_patient p"+
                " where"+
                " a.article = b.code"+
                " and a.patient = p.code"+
                " and a.doctor =? "+
                " and a.article =? "+
                (StringUtils.isNotBlank(batchNo)?" and a.batch_no =? ":"and a.batch_no is null ")+
                " group BY a.batch_no,a.article,b.content,b.summary,a.doctor,b.title";
        Object params[] =  (StringUtils.isNotBlank(batchNo)?new Object[]{doctor,article,batchNo}:new Object[]{doctor,article});
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,params);
        for(Map<String,Object> dataMap :list){
            String patientListSql ="select a.patient,p.name,a.is_read "+
            " from wlyy_health_edu_article_patient a,wlyy_health_edu_article b,wlyy_patient p"+
            " where "+
            " a.article = b.code " +
            " and a.doctor=? and  a.article =?"+
            (StringUtils.isNotBlank(batchNo)?" and a.batch_no =? ":" and a.batch_no is null ")+
            " and a.patient = p.code " +
            " group BY a.batch_no,a.article,b.content,a.attached_content,a.patient,b.title";
            List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientListSql,params);
            dataMap.put("patients",patientList);
            dataMap.put("read_amount",patientList.size()-Integer.parseInt(dataMap.get("no_read").toString()));
            dataMap.put("amount",patientList.size());
        }
        return list;
    }
    /**
     * 文章更新为已读
     *

+ 10 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticleService.java

@ -164,7 +164,7 @@ public class HealthEduArticleService extends BaseService {
     * @param pagesize 分页大小
     * @return 列表
     */
    public List<Map<String, Object>> findAll(int page, int pagesize, String filter, String doctor, String patient) {
    public List<Map<String, Object>> findAll(int page, int pagesize, String filter, String doctor, String patient,int wheaType) {
        if (pagesize <= 0) {
            pagesize = 10;
        }
@ -184,22 +184,23 @@ public class HealthEduArticleService extends BaseService {
            params.add(doctor);
            params.add(patient);
        }
        sql.append(" from wlyy_health_edu_article a ");//内联取文章内容
        String where = " ";
        sql.append(" from wlyy_health_edu_article a  ");//内联取文章内容
        String where = " where 1=1 ";
        if (StringUtils.isNotBlank(filter)) {
            //记录搜索记录
            healthEduArticleLabelService.saveOrUpdateLabel(filter, doctor);
            filter = "%" + filter + "%";
            where += " where ( a.title like ? or a.keyword like ? )";
            where += " and  ( a.title like ? or a.keyword like ? )";
            params.add(filter);
            params.add(filter);
        }
        if(wheaType>=0){
            where += " and  ( a.whea_type = ? )";
            params.add(wheaType);
        }
        int start = page * pagesize;
        String pageInfo = " limit " + start + "," + pagesize;
        String orderBy = " order by a.czrq,a.id desc";
        sql.append(where).append(orderBy).append(pageInfo);
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql.toString(), params.toArray());
        return result;
@ -226,6 +227,8 @@ public class HealthEduArticleService extends BaseService {
                "    ,d.name" +
                "    ,d.photo" +
                "    ,a.admin_team_code" +
                "    ,a.is_read" +
                "    ,a.attached_content" +
                "  from" +
                "    wlyy_health_edu_article_patient a" +
                "    ,wlyy_health_edu_article b" +

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

@ -39,6 +39,7 @@ import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter.Operator;
import org.springside.modules.utils.Clock;
import java.text.SimpleDateFormat;
import java.util.*;
@Component
@ -69,10 +70,70 @@ public class PatientHealthIndexService extends BaseService {
    @Autowired
    private DoctorWorkTimeService doctorWorkTimeService;
    /**
     * 获取居民最新各类健康记录
     */
    public Map findDataByPatient(String patient, int type) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String sql = "SELECT " +
                " a.* " +
                " FROM " +
                "  wlyy_patient_health_index a " +
                " WHERE " +
                " a. USER = ? " +
                " AND a.type = ? " +
                " AND a.del = 1 " +
                " ORDER BY " +
                " a.record_date DESC " +
                "LIMIT 0,1 ";
        List<Map<String, Object>> devicePatient = jdbcTemplate.queryForList(sql, patient, type);
        Map<String, Object> map = new HashMap<>();
        for (Map<String, Object> device : devicePatient) {
            String time = device.get("record_date") == null ? null : device.get("record_date").toString();
            String deviceSN = device.get("device_sn") == null ? "0" : "1";
            String value1 = device.get("value1") == null ? null : device.get("value1").toString();
            String value2 = device.get("value2") == null ? null : device.get("value2").toString();
            String value3 = device.get("value3") == null ? null : device.get("value3").toString();
            String value4 = device.get("value4") == null ? null : device.get("value4").toString();
            String value5 = device.get("value5") == null ? null : device.get("value5").toString();
            String value6 = device.get("value6") == null ? null : device.get("value6").toString();
            String value7 = device.get("value7") == null ? null : device.get("value7").toString();
            map.put("isDevice", deviceSN);
            if (StringUtils.isNotEmpty(time)) {
                Date date = sdf.parse(time);
                time = sdf.format(date);
                map.put("time", time);
            }
            if (StringUtils.isNotEmpty(value1)) {
                map.put("value1", value1);
            }
            if (StringUtils.isNotEmpty(value2)) {
                map.put("value2", value2);
            }
            if (StringUtils.isNotEmpty(value3)) {
                map.put("value3", value3);
            }
            if (StringUtils.isNotEmpty(value4)) {
                map.put("value4", value4);
            }
            if (StringUtils.isNotEmpty(value5)) {
                map.put("value5", value5);
            }
            if (StringUtils.isNotEmpty(value6)) {
                map.put("value6", value6);
            }
            if (StringUtils.isNotEmpty(value7)) {
                map.put("value7", value7);
            }
        }
        return map;
    }
    /**
     * 保存患者健康指标  (旧)
     */
    public DevicePatientHealthIndex save(DevicePatientHealthIndex model, int index, double value, String patientCode)throws Exception {
    public DevicePatientHealthIndex save(DevicePatientHealthIndex model, int index, double value, String patientCode) throws Exception {
        model.setCzrq(clock.getCurrentDate());
        model.setDel("1");
        PatientHealthStandard standard = null;
@ -194,7 +255,8 @@ public class PatientHealthIndexService extends BaseService {
                JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(receiver);
                if (jsonObject.getString("status").equals("1")) {
                    //如果在工作时间内就推送
                    array.put(json);  }
                    array.put(json);
                }
            }
            // 批量保存消息
            messageDao.save(messages);
@ -379,12 +441,11 @@ public class PatientHealthIndexService extends BaseService {
            // 餐后
            if (index % 2 == 0) {
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueBefore, minValueBefore)) {
                    msgContent += patient.getName() + "血糖异常("+value1+"mmol/L)";
                    msgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L)";
                }
            }
            else { //餐前
            } else { //餐前
                if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueAfter, minValueAfter)) {
                    msgContent += patient.getName() + "血糖异常("+value1+"mmol/L)";
                    msgContent += patient.getName() + "血糖异常(" + value1 + "mmol/L)";
                }
            }
        }
@ -413,8 +474,8 @@ public class PatientHealthIndexService extends BaseService {
                }
            }
            // 收缩压/舒张压校验
            if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY)||!checkHealthIndex(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY)) {
                msgContent = patient.getName() +"血压异常(舒张压 "+value2+"mmHg、收缩压 "+value1+"mmHg)";
            if (!checkHealthIndex(NumberUtils.toDouble(value1), maxValueSSY, minValueSSY) || !checkHealthIndex(NumberUtils.toDouble(value2), maxValueSZY, minValueSZY)) {
                msgContent = patient.getName() + "血压异常(舒张压 " + value2 + "mmHg、收缩压 " + value1 + "mmHg)";
            }
        }
@ -775,7 +836,7 @@ public class PatientHealthIndexService extends BaseService {
     * 获取患者健康指标历史记录
     * 1血糖,2血压,3体重,4腰围
     */
    public List<Map<String,String>> getHealthIndexHistory(String patientCode, int type,int page,int pagesize) throws Exception {
    public List<Map<String, String>> getHealthIndexHistory(String patientCode, int type, int page, int pagesize) throws Exception {
        List<Map<String, String>> re = new ArrayList<>();
        // 排序

+ 43 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java

@ -4,8 +4,12 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
@ -24,6 +28,8 @@ import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import javax.print.Doc;
@Component
@Transactional(rollbackFor = Exception.class)
public class SMSService extends BaseService {
@ -32,7 +38,10 @@ public class SMSService extends BaseService {
    public SMSDao smsDao;
    @Autowired
    PatientDao patientDao;
    @Autowired
    SignFamilyDao signFamilyDao;
    @Autowired
    DoctorDao doctorDao;
    /**
     * 发送短信验证码接口
     *
@ -81,9 +90,9 @@ public class SMSService extends BaseService {
        // 1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录
        if (type == 1) {
            // 患者注册
            sms.setContent("您的注册验证码为:" + captcha);
        } else if (type == 2 || type == 3) {
            // 找回密码
            sms.setContent("您找回密码验证码为:" + captcha);
        } else if (type == 4 || type == 5) {
            // 登录
@ -108,6 +117,38 @@ public class SMSService extends BaseService {
            // 其他验证码
            sms.setContent("验证码:" + captcha);
        }
        if(type==2||type==4||type==10) {//患者
            List<Patient> patients = patientDao.findByMobile(mobile);
            if(patients!=null&&patients.size()>0){
                SignFamily signFamily = signFamilyDao.findByMobile(mobile);
                if(signFamily!=null){
                    sms.setUserType(0);
                    sms.setUserCode(signFamily.getPatient());
                    sms.setHospital(signFamily.getHospital());
                }
            }
        }else if(type==3||type==5||type==6){//医生
            Doctor d = doctorDao.findByMobile(mobile);
            if(d!=null){
                sms.setUserType(0);
                sms.setUserCode(d.getCode());
                sms.setHospital(d.getHospital());
            }
        }else{//未知
            Doctor d = doctorDao.findByMobile(mobile);
            if(d!=null){
                sms.setUserType(0);
                sms.setUserCode(d.getCode());
                sms.setHospital(d.getHospital());
            }else{
                SignFamily signFamily = signFamilyDao.findByMobile(mobile);
                if(signFamily!=null){
                    sms.setUserType(0);
                    sms.setUserCode(signFamily.getPatient());
                    sms.setHospital(signFamily.getHospital());
                }
            }
        }
        sms.setCaptcha(captcha);
        Date date = new Date();
        // 延后5分钟

+ 6 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -518,6 +518,12 @@ public class PushMsgTask {
                keyword2.setColor("#000000");
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            }else if(type == 15){
                temp.setTemplate_id(SystemConf.getInstance().getSystemProperties().getProperty("template_doctor_survey"));
                WechatTemplateData  keyword1= new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword1"));
                m.put("keyword1", keyword1);
            }
            temp.setData(m);

+ 78 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ClazzReflect.java

@ -0,0 +1,78 @@
package com.yihu.wlyy.util;
import org.json.JSONObject;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.util.Date;
/**
 * Created by 卓 on 2017/3/14.
 */
public class ClazzReflect {
    public Object formatToClazz(Object clazz, JSONObject jsonObject){
        Field[] field = clazz.getClass().getDeclaredFields(); // 获取实体类的所有属性,返回Field数组
            try {
            for (int j = 0; j < field.length; j++) { // 遍历所有属性
                String name = field[j].getName(); // 获取属性的名字
                String key = field[j].getName();
                if(jsonObject.isNull(name))continue;
                name = name.substring(0, 1).toUpperCase() + name.substring(1); // 将属性的首字符大写,方便构造get,set方法
                String type = field[j].getGenericType().toString(); // 获取属性的类型
                Method m = null;
                if (type.equals("class java.lang.String")) { // 如果type是类类型,则前面包含"class ",后面跟类名
                    String value = jsonObject.getString(key);
                    m = clazz.getClass().getMethod("set"+name,String.class);
                    m.invoke(clazz, value);
                }
                if (type.equals("class java.lang.Integer")) {
                    Integer value =  jsonObject.getInt(key);
                    m = clazz.getClass().getMethod("set"+name,Integer.class);
                    m.invoke(clazz, value);
                }
                if (type.equals("class java.lang.Boolean")) {
                    Boolean value =  jsonObject.getBoolean(key);
                    m = clazz.getClass().getMethod("set"+name,Boolean.class);
                    m.invoke(clazz, value);
                }
                if (type.equals("class java.lang.Long")) {
                    Long value =  getJsonLong(jsonObject,key);
                    m = clazz.getClass().getMethod("set"+name,Long.class);
                    m.invoke(clazz, value);
                }
                if (type.equals("class java.util.Date")) {
                    String valueString = jsonObject.getString(key);
                    Date value =  DateUtil.strToDate(valueString);
                    m = clazz.getClass().getMethod("set"+name,Date.class);
                    m.invoke(clazz, value);
                }// 如果有需要,可以仿照上面继续进行扩充,再增加对其它类型的判断
            }
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }catch (Exception e){
              e.printStackTrace();
        }
        return clazz;
    }
    private Long getJsonLong(JSONObject jsonObject,String key){
            Object object = jsonObject.get(key);
            if(object==null||"".equals(object)){
                return null;
            }else{
                return jsonObject.getLong(key);
            }
    }
}

+ 23 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -32,6 +32,14 @@ public class ImUtill {
        return response;
    }
    public static void updateTopics(String topicId,String jsonValue){
        String imAddr = im_host + "api/v2/sessions/"+topicId+"/topics";
        JSONObject params = new JSONObject();
        params.put("topic_id",topicId);
        params.put("data",jsonValue);
        HttpClientUtil.putBody(imAddr, params);
    }
    /**
     * 列表接口
     * 获取团队内医生的健康咨询状况
@ -90,6 +98,19 @@ public class ImUtill {
        return response;
    }
    /**
     * 更新会话状态
     *
     * @param sessionId       会话ID
     * @param status 状态
     */
    public static String updateTopicEvaluate(String sessionId,String status) {
        String imAddr = im_host + "api/v2/sessions/"+sessionId+"/status?status="+status+"&sessionId="+sessionId;
        JSONObject params = new JSONObject();
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
    /**
     * 发送消息给IM
@ -328,4 +349,6 @@ public class ImUtill {
    public  static final String SESSION_TYPE_SYSTEM = "0";
    public  static final String SESSION_STATUS_PROCEEDINGS= "0";
    public  static final String SESSION_STATUS_END= "1";
    public  static final String CONTENT_TYPE_TEXT= "1";
}

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

@ -2,7 +2,9 @@ package com.yihu.wlyy.web.common.util;
import com.yihu.wlyy.job.QuartzHelper;
import com.yihu.wlyy.job.SignEndJob;
import com.yihu.wlyy.job.consult.EvaluateScoreJob;
import com.yihu.wlyy.job.consult.FamousConsultTimesJob;
import com.yihu.wlyy.repository.consult.ConsultTeamDoctorDao;
import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
@ -18,12 +20,14 @@ import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
@ -52,6 +56,8 @@ public class ManagerUtilController extends BaseController {
    ManageUtilService manageUtilService;
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    ConsultTeamDoctorDao consultTeamDoctorDao;
    /*********************************************患者疾病相关******************************************/
    /**
@ -265,4 +271,24 @@ public class ManagerUtilController extends BaseController {
            return error(-1, "启动失败");
        }
    }
    /**
     * 开始名医咨询剩余次数统计任务
     *
     * @return
     */
    @RequestMapping(value = "/start_evaluate_score_job")
    @ResponseBody
    public String startEvaluateScoreJob() {
        try {
            if (!quartzHelper.isExistJob("evaluate_score_job")) {
                quartzHelper.addJob(SignEndJob.class, "59 59 23 * * ?", "evaluate_score_job", new HashMap<String, Object>());
                return write(200, "启动成功");
            } else {
                return write(200, "任务已存在");
            }
        } catch (Exception e) {
            return error(-1, "启动失败");
        }
    }
}

+ 82 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorEvaluateController.java

@ -0,0 +1,82 @@
package com.yihu.wlyy.web.doctor.consult;
import com.yihu.wlyy.entity.consult.Evaluate;
import com.yihu.wlyy.entity.consult.EvaluateLabel;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.consult.EvaluateLabelService;
import com.yihu.wlyy.service.app.consult.EvaluateService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
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.
 */
@Controller
@RequestMapping(value = "/doctor/consult/evaluate", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生评价")
public class DoctorEvaluateController extends BaseController {
    @Autowired
    ConsultTeamService consultTeamService;
    @Autowired
    EvaluateService evaluateService;
    @Autowired
    EvaluateLabelService evaluateLabelService;
    /**
     * 获取评价
     * @param consult 咨询
     * @return
     */
    @RequestMapping(value = "list")
    @ResponseBody
    public String list(@RequestParam(required = true,value="consult") String consult,@RequestParam(required = false,value="type") Integer type){
        try{
            List<Evaluate> evaluates = null;
            List<EvaluateLabel> evaluateLabels = new ArrayList<>();
            if(type==null){
                evaluates  =  evaluateService.getEvaluateByConsult(consult);
                evaluateLabels  =  evaluateLabelService.findByConsult(consult);
                JSONArray evaluatesJson = new JSONArray(evaluates);
                JSONArray evaluateLabelsJson = new JSONArray(evaluateLabels);
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("evaluate",evaluatesJson);
                jsonObject.put("label",evaluateLabelsJson);
                return  write(200,"查询成功!","data",jsonObject);
            }else{
                evaluates = evaluateService.getEvaluateByConsultAndType(consult,type);
                return  write(200,"查询成功!","list",evaluates);
            }
        }catch (Exception e){
            error(e);
            return write(-1,e.getMessage());
        }
    }
    /**
     * 获取去重的标签
     * @return
     */
    @RequestMapping(value = "label")
    @ResponseBody
    public String label(){
        try{
            List<Map<String,Object>> result = evaluateLabelService.findDistinctLabelByLaDoctor(getUID());
            return write(200,"查询成功!","list",result);
        }catch (Exception e){
            error(e);
            return write(-1,e.getMessage());
        }
    }
}

+ 6 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackController.java

@ -37,7 +37,7 @@ public class DoctorFeedbackController extends BaseController {
     * @param contact     联系方式
     * @return
     */
    @RequestMapping(value = "/saveFeedback", method = RequestMethod.GET)
    @RequestMapping(value = "/saveFeedback", method = RequestMethod.POST)
    @ApiOperation(value = "医生端保存反馈")
    @ResponseBody
    public String saveFeedback(
@ -46,17 +46,17 @@ public class DoctorFeedbackController extends BaseController {
            @RequestParam(required = false) String images,
            @RequestParam(required = false) String contact) {
        try {
            String email = null;
            if (StringUtils.isNotEmpty(contact)) {
                //        邮箱正则|QQ号正则
                //        邮箱正则|QQ号|手机号正则
                String regexEmail = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
                String regexQQ = "^[1-9][0-9]{4,}$";
                String regexPhone = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
                Boolean emailFlag = Pattern.matches(regexEmail, contact);
                Boolean qqFlag = Pattern.matches(regexQQ, contact);
                if (emailFlag || qqFlag) {
                Boolean phoneFlag = Pattern.matches(regexPhone, contact);
                if (emailFlag || qqFlag || phoneFlag) {
                    return write(-1, "QQ/邮箱格式错误!");
                }
                email = contact;
            }
//        图片上传
            if (StringUtils.isNotEmpty(images)) {
@ -80,7 +80,7 @@ public class DoctorFeedbackController extends BaseController {
     * @param phone       手机号码
     * @return
     */
    @RequestMapping(value = "/saveAppeal", method = RequestMethod.GET)
    @RequestMapping(value = "/saveAppeal", method = RequestMethod.POST)
    @ApiOperation(value = "医生端保存申诉")
    @ResponseBody
    public String saveAppeal(

+ 75 - 30
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -11,12 +11,14 @@ import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.health.*;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.web.doctor.message.DoctorMessageController;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.htmlparser.Parser;
import org.htmlparser.beans.StringBean;
@ -84,13 +86,18 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
     * 查询
     *
     * @param pagesize 分页大小
     * @param wheaType 文章类型
     * @return 列表
     */
    @RequestMapping(value = "list")
    @ResponseBody
    public String list(@RequestParam(value = "page", required = true) int page, @RequestParam(value = "pagesize", required = true) int pagesize, @RequestParam(value = "filter", required = false) String filter, @RequestParam(value = "patient", required = false) String patient) {
    public String list(@RequestParam(value = "page", required = true) int page,
                       @RequestParam(value = "pagesize", required = true) int pagesize,
                       @RequestParam(value = "wheaType", required = true) int wheaType,
                       @RequestParam(value = "filter", required = false) String filter,
                       @RequestParam(value = "patient", required = false) String patient) {
        try {
            List<Map<String, Object>> list = healthEduArticleService.findAll(page, pagesize, filter, getUID(), patient);
            List<Map<String, Object>> list = healthEduArticleService.findAll(page, pagesize, filter, getUID(), patient,wheaType);
            JSONArray jsonArray = new JSONArray();
            if (list != null) {
                for (Map<String, Object> map : list) {
@ -170,6 +177,10 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                    // 文章简介
                    //json.put("content", parsrHtml(map.get("content").toString()));
                    json.put("content", map.get("content").toString());
                    json.put("read", map.get("is_read"));
                    json.put("attached_content", map.get("attached_content"));
                    // 发送日期
                    json.put("czrq", DateUtil.dateToStrLong((Date) map.get("czrq")));
                    // 发送团队
@ -192,9 +203,9 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
     */
    @RequestMapping(value = "listDoctor")
    @ResponseBody
    public String listDoctor(@RequestParam(value = "page", required = true) int page, @RequestParam(value = "pagesize", required = true) int pagesize, @RequestParam(value = "filter", required = false) String filter, @RequestParam(value = "patient", required = false) String patient) {
    public String listDoctor(@RequestParam(value = "page", required = true) int page, @RequestParam(value = "pagesize", required = true) int pagesize, @RequestParam(value = "filter", required = false) String filter, @RequestParam(value = "patient", required = false) String patient, @RequestParam(value = "wheaType", required = false) Integer wheaType) {
        try {
            List<Map<String, Object>> list = healthEduArticleDoctorService.list(page, pagesize, filter, getUID(), patient);
            List<Map<String, Object>> list = healthEduArticleDoctorService.list(page, pagesize, filter, getUID(), patient,wheaType);
            JSONArray jsonArray = new JSONArray();
            for (Map<String, Object> map : list) {
                JSONObject json = new JSONObject();
@ -223,6 +234,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                json.put("repeatAmount", map.get("repeatAmount"));
                //是否收藏(医生收藏的列表肯定是收藏的无需额外校验)
                json.put("collection", 1);
                jsonArray.put(json);
            }
            return write(200, "查询成功", "list", jsonArray);
@ -302,6 +314,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
     * @param code    文章标识,多个以逗号分隔
     * @param patient 患者标识,多个以逗号分隔
     * @param group   所选群组,多个用逗号分隔
     * @param  attachedContent 附加内容
     * @return
     */
    @RequestMapping(value = "send")
@ -310,7 +323,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                       @RequestParam(value = "patient", required = false) String patient,
                       @RequestParam(value = "group", required = false, defaultValue = "") String group,
                       @RequestParam(value = "labelType", required = false) String labelType,
                       @RequestParam(value = "teamCode", required = false) long teamCode) {
                       @RequestParam(value = "teamCode", required = false) long teamCode,
                       @RequestParam(value = "attachedContent", required = false) String attachedContent) {
        try {
            List<HealthEduArticlePatient> list = new ArrayList<HealthEduArticlePatient>();
            if (StringUtils.isEmpty(code)) {
@ -347,11 +361,15 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
            }
            // 查询医生信息
            Doctor doctor = doctorService.findDoctorByCode(getUID());
            //Doctor doctor = doctorService.findDoctorByCode("test00000000005");
            String msgHead = doctor.getName() + "医生给您发来了一篇患教文章";
            String endMsg = "为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。";
            String endMsg = "";//"为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。";
            if(StringUtils.isNotBlank(attachedContent)){
                endMsg = attachedContent;
            }
            JSONArray messages = new JSONArray();
            Map<String, Map<String, Object>> msgs = new HashMap<>();
            String batchNo = UUID.randomUUID().toString();
            Date createTime = new Date();
            for (String p : patientSet) {
                Patient patientTemp = patientService.findByCode(p);
                SignFamily signFamily = signFamilyDao.findByjiatingPatient(p);
@ -390,25 +408,33 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                    heap.setSignType(2);
                    // 行政团队
                    heap.setAdminTeamCode(signFamily.getAdminTeamId());
                    //附加内容
                    heap.setAttachedContent(attachedContent);
                    //批次号记录发送批次
                    heap.setBatchNo(batchNo);
                    //创建时间
                    heap.setCzrq(createTime);
                    list.add(heap);
                    consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle()+ "\",\"type\":0,\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patientTemp.getName());
                    //if (StringUtils.isNotEmpty(patientTemp.getOpenid())) {
                        // 推送消息给微信端
                        JSONObject json = new JSONObject();
                        json.put("first", patientTemp.getName() + ",您好!\n" + msgHead);
                        json.put("toUser", p);
                        json.put("article", temp.getCode() + "");
                        json.put("title", temp.getTitle());
                        json.put("doctorName", doctor.getName());
                        json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
                        json.put("remark", endMsg);
                        Map<String, Object> content = new HashMap<>();
                        content.put("openid", patientTemp.getOpenid());
                        content.put("name", patientTemp.getName());
                        content.put("json", json);
                        content.put("code",patientTemp.getCode());
                        msgs.put(patientTemp.getCode(), content);
                    //}
                    if(StringUtils.isNotBlank(attachedContent)){
                        //发送备注
                        consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, attachedContent, ImUtill.CONTENT_TYPE_TEXT, patientTemp.getName());
                    }
                    // 推送消息给微信端
                    JSONObject json = new JSONObject();
                    json.put("first", patientTemp.getName() + ",您好!\n" + msgHead);
                    json.put("toUser", p);
                    json.put("article", temp.getCode() + "");
                    json.put("title", temp.getTitle());
                    json.put("doctorName", doctor.getName());
                    json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
                    json.put("remark", endMsg);
                    Map<String, Object> content = new HashMap<>();
                    content.put("openid", patientTemp.getOpenid());
                    content.put("name", patientTemp.getName());
                    content.put("json", json);
                    content.put("code",patientTemp.getCode());
                    msgs.put(patientTemp.getCode(), content);
                }
            }
            // 保存到数据库
@ -432,20 +458,15 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                        JSONObject data = (JSONObject) map.get("json");
                        String first = (String)data.get("first");
                        data.remove("first");
                        data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),member.getName()));
                        data.put("first",weiXinOpenIdUtils.getTitleMes(p,j.isNull("relation")?1:j.getInt("relation"),member.getName()));
                        if(StringUtils.isNotBlank(member.getOpenid())){
                            PushMsgTask.getInstance().putWxMsg(getAccessToken(), 9, member.getOpenid(), member.getName(), data);
                        }
                    }
                    JSONObject json = (JSONObject) map.get("json");
                }
                for (HealthEduArticlePatient heap : list) {
                    BusinessLogs.info(BusinessLogs.BusinessType.article, getUID(), heap.getPatient(), new JSONObject(heap));
                }
                // 推送消息给患者
                PushMsgTask.getInstance().put(messages);
                return success("发送成功!");
@ -516,6 +537,30 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "/logs")
    @ResponseBody
    public String getPatientHealthLogs(@RequestParam(value = "page", required = true) int page, @RequestParam(value = "pagesize", required = true) int pagesize){
       try{
           List<Map<String,Object>> result  =  healthEduArticlePatientService.findByDoctor(getUID(),page,pagesize);
           return write(200,"查询成功!","list",result);
       }catch (Exception e){
           return write(-1,"查询失败!");
       }
    }
    @RequestMapping(value = "/log")
    @ResponseBody
    public String getPatientHealthLog(@RequestParam(value = "article", required = true) String article, @RequestParam(value = "batchNo", required = false) String batchNo){
        try{
            List<Map<String,Object>> result  =   healthEduArticlePatientService.findByBatchNo(getUID(),article,batchNo);
            return write(200,"查询成功!","list",result);
        }catch (Exception e){
            error(e);
            return write(-1,"查询失败!");
        }
    }
    private String parsrHtml(String html) {
        html = ("<span>" + html + "</span>");//拼接一个HTML标签,防止纯文字字符串转换在linux下面出现的异常。
        Parser parser = null;

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

@ -0,0 +1,84 @@
package com.yihu.wlyy.web.patient.consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.Evaluate;
import com.yihu.wlyy.entity.consult.EvaluateLabel;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.consult.EvaluateLabelService;
import com.yihu.wlyy.service.app.consult.EvaluateService;
import com.yihu.wlyy.util.ClazzReflect;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by 卓 on 2017/5/10.
 */
@Controller
@RequestMapping(value = "/patient/consult/evaluate", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生评价")
public class EvaluateController  extends BaseController {
    @Autowired
    ConsultTeamService consultTeamService;
    @Autowired
    EvaluateService evaluateService;
    @Autowired
    EvaluateLabelService evaluateLabelService;
    /**
     * 保存评价
     * @param evaluateJson 保存评价内容的JSON
     * @return
     */
    @RequestMapping(value = "save")
    @ResponseBody
    public String save(@RequestParam(required = true,value="evaluate") String evaluateJson){
        try{
            evaluateService.saveByJson(evaluateJson,"67437bd793a642a6a9655f00340bddfc");
            return  write(200,"保存成功!");
        }catch (Exception e){
            error(e);
            return write(-1,e.getMessage());
        }
    }
    /**
     * 获取评价
     * @param consult 咨询
     * @return
     */
    @RequestMapping(value = "list")
    @ResponseBody
    public String list(@RequestParam(required = true,value="consult") String consult,@RequestParam(required = false,value="type") Integer type){
        try{
            List<Evaluate> evaluates = null;
            List<EvaluateLabel> evaluateLabels = new ArrayList<>();
            if(type==null){
                evaluates  =  evaluateService.getEvaluateByConsult(consult);
                evaluateLabels  =  evaluateLabelService.findByConsult(consult);
                JSONArray evaluatesJson = new JSONArray(evaluates);
                JSONArray evaluateLabelsJson = new JSONArray(evaluateLabels);
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("evaluate",evaluatesJson);
                jsonObject.put("label",evaluateLabelsJson);
                return  write(200,"查询成功!","data",jsonObject);
            }else{
                evaluates = evaluateService.getEvaluateByConsultAndType(consult,type);
                return  write(200,"查询成功!","list",evaluates);
            }
        }catch (Exception e){
            error(e);
            return write(-1,e.getMessage());
        }
    }
}

+ 7 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackController.java

@ -37,7 +37,7 @@ public class PatientFeedbackController extends BaseController {
     * @param contact     联系方式
     * @return
     */
    @RequestMapping(value = "/saveFeedback", method = RequestMethod.GET)
    @RequestMapping(value = "/saveFeedback", method = RequestMethod.POST)
    @ApiOperation(value = "居民端保存反馈")
    @ResponseBody
    public String saveFeedback(
@ -46,17 +46,17 @@ public class PatientFeedbackController extends BaseController {
            @RequestParam(required = false) String images,
            @RequestParam(required = false) String contact) {
        try {
            String email = null;
            if (StringUtils.isNotEmpty(contact)) {
                //        邮箱正则|QQ号正则
                //        邮箱正则|QQ号正则|手机号正则
                String regexEmail = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
                String regexQQ = "^[1-9][0-9]{4,}$";
                String regexPhone = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
                Boolean emailFlag = Pattern.matches(regexEmail, contact);
                Boolean qqFlag = Pattern.matches(regexQQ, contact);
                if (emailFlag || qqFlag) {
                    return write(-1, "QQ/邮箱格式错误!");
                Boolean phoneFlag = Pattern.matches(regexPhone, contact);
                if (emailFlag || qqFlag || phoneFlag) {
                    return write(-1, "QQ/邮箱/手机号格式错误!");
                }
                email = contact;
            }
//        图片上传
            if (StringUtils.isNotEmpty(images)) {
@ -81,7 +81,7 @@ public class PatientFeedbackController extends BaseController {
     * @param phone       手机号码
     * @return
     */
    @RequestMapping(value = "/saveAppeal", method = RequestMethod.GET)
    @RequestMapping(value = "/saveAppeal", method = RequestMethod.POST)
    @ApiOperation(value = "居民端保存申诉")
    @ResponseBody
    public String saveAppeal(

+ 4 - 11
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java

@ -59,9 +59,9 @@ public class HealthEduArticleController extends BaseController {
	 */
	@RequestMapping(value = "list")
	@ResponseBody
	public String list(@RequestParam("id")long id, @RequestParam("pagesize") int pagesize) {
	public String list(@RequestParam("id")long id, @RequestParam("pagesize") int pagesize,@RequestParam(required = true,value="wheaType")int wheaType) {
		try {
			List<HealthEduArticlePatient> list = healthEduArticlePatientService.findByPatient(getUID(), id, pagesize);
			List<HealthEduArticlePatient> list = healthEduArticlePatientService.findByPatient(getUID(),wheaType, id, pagesize);
			JSONArray jsonArray = new JSONArray();
			Map<String,Doctor> docMap = new HashMap<>();
			if (list != null) {
@ -83,6 +83,8 @@ public class HealthEduArticleController extends BaseController {
					json.put("read", article.getRead());
					// 添加日期
					json.put("czrq", DateUtil.dateToStrLong(article.getCzrq()));
					//附加内容
					json.put("attached_content", article.getAttachedContent());
					if(docMap.get(article.getDoctor())==null){
						Doctor doctor = doctorService.findDoctorByCode(article.getDoctor());
@ -91,15 +93,6 @@ public class HealthEduArticleController extends BaseController {
					}else{
						json.put("photo",docMap.get(article.getDoctor()).getPhoto());
					}
					//int collectionAmount =  healthEduArticleOpHistoryService.countCollectionAmount(article.getArticle());
					//int readAmount = healthEduArticleOpHistoryService.countReadAmount(article.getArticle());
					//int repeatAmount = healthEduArticleOpHistoryService.countRepeatAmount(article.getArticle());
					////阅读量
					//json.put("readAmount", readAmount);
					////收藏量
					//json.put("collectionAmount", collectionAmount);
					////转发量
					//json.put("repeatAmount", repeatAmount);
					jsonArray.put(json);
				}
			}

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

@ -1,7 +1,6 @@
package com.yihu.wlyy.web.patient.health;
import java.util.Iterator;
import java.util.List;
import java.util.*;
import com.yihu.wlyy.health.entity.DevicePatientHealthIndex;
import io.swagger.annotations.Api;
@ -29,325 +28,512 @@ import com.yihu.wlyy.web.BaseController;
@Api(description = "患者指标")
public class PatientHealthController extends BaseController {
	@Autowired
	private PatientHealthIndexService healthIndexService;
    @Autowired
    private PatientHealthIndexService healthIndexService;
	/**
	 * 患者最近填写的健康指标
	 * @return
	 */
	@RequestMapping(value = "recent")
	@ResponseBody
	public String recent() {
		try {
			JSONArray array = healthIndexService.findRecentByPatient(getUID());
			if (array != null) {
				return write(200, "查询成功", "list", array);
			} else {
				return error(-1, "查询失败");
			}
		} catch (Exception e) {
			error(e);
			return error(-1, "查询失败");
		}
	}
    /**
     * 患者最近的各项健康信息
     *
     * @return
     */
    @RequestMapping(value = "/getRecentData")
    @ResponseBody
    public String getRecentData() {
        try {
            List list = new ArrayList();
            String patient = getUID();
//            String patient = "test_4429a0a4138a281e7c6316eb9bd";
//            健康指标类型(1血糖,2血压,3体重,4腰围)
            Map map = healthIndexService.findDataByPatient(patient, 1);
            Map map1 = healthIndexService.findDataByPatient(patient, 2);
            Map map2 = healthIndexService.findDataByPatient(patient, 3);
            Map map3 = healthIndexService.findDataByPatient(patient, 4);
//            血糖各个时间段取值
            if (map.size()!=0) {
                Map sugar = new HashMap();
                Object time = map.get("time");
                String isDevice = map.get("isDevice").toString();
                Object value1 = map.get("value1");
                Object value2 = map.get("value2");
                Object value3 = map.get("value3");
                Object value4 = map.get("value4");
                Object value5 = map.get("value5");
                Object value6 = map.get("value6");
                Object value7 = map.get("value7");
                sugar.put("type", 1);
                sugar.put("isDevice", isDevice);
                if (time!=null){
                    sugar.put("time", time);
                }
                if (value1 != null) {
                    sugar.put("value1", value1);
                }
                if (value2!=null) {
                    sugar.remove("value1");
                    sugar.put("value2", value2);
                }
                if (value3!=null) {
                    sugar.remove("value2");
                    sugar.put("value3", value3);
                }
                if (value4!=null) {
                    sugar.remove("value3");
                    sugar.put("value4", value4);
                }
                if (value5!=null) {
                    sugar.remove("value4");
                    sugar.put("value5", value5);
                }
                if (value6!=null) {
                    sugar.remove("value5");
                    sugar.put("value6", value6);
                }
                if (value7!=null) {
                    sugar.remove("value6");
                    sugar.put("value7", value7);
                }
                list.add(sugar);
            }
//            血压  value1高压 value2低压 value3脉搏 value4心率不齐
            if (map1.size()!=0) {
                Map pa = new HashMap();
                Object time = map1.get("time");
                String isDevice = map1.get("isDevice").toString();
                Object value1 = map1.get("value1");
                Object value2 = map1.get("value2");
                Object value3 = map1.get("value3");
                Object value4 = map1.get("value4");
                Object value5 = map1.get("value5");
                Object value6 = map1.get("value6");
                Object value7 = map1.get("value7");
                pa.put("type", 2);
                pa.put("isDevice", isDevice);
                if (time!=null){
                    pa.put("time", time);
                }
                if (value1 != null) {
                    pa.put("value1", value1);
                }
                if (value2!=null) {
                    pa.put("value2", value2);
                }
                if (value3!=null) {
                    pa.put("value3", value3);
                }
                if (value4!=null) {
                    pa.put("value4", value4);
                }
                if (value5!=null) {
                    pa.put("value5", value5);
                }
                if (value6!=null) {
                    pa.put("value6", value6);
                }
                if (value7!=null) {
                    pa.put("value7", value7);
                }
                list.add(pa);
            }
//            体重 value1 体重
            if (map2.size()!=0) {
                Map weight = new HashMap();
                Object time = map2.get("time");
                String isDevice = map2.get("isDevice").toString();
                Object value1 = map2.get("value1");
                Object value2 = map2.get("value2");
                Object value3 = map2.get("value3");
                Object value4 = map2.get("value4");
                Object value5 = map2.get("value5");
                Object value6 = map2.get("value6");
                Object value7 = map2.get("value7");
                weight.put("type", 3);
                weight.put("isDevice", isDevice);
                if (time!=null){
                    weight.put("time", time);
                }
                if (value1 != null) {
                    weight.put("value1", value1);
                }
                if (value2!=null) {
                    weight.put("value2", value2);
                }
                if (value3!=null) {
                    weight.put("value3", value3);
                }
                if (value4!=null) {
                    weight.put("value4", value4);
                }
                if (value5!=null) {
                    weight.put("value5", value5);
                }
                if (value6!=null) {
                    weight.put("value6", value6);
                }
                if (value7!=null) {
                    weight.put("value7", value7);
                }
                list.add(weight);
            }
//            腰围 value1腰围
            if (map3.size()!=0) {
                Map waist = new HashMap();
                Object time = map3.get("time");
                String isDevice = map3.get("isDevice").toString();
                Object value1 = map3.get("value1");
                Object value2 = map3.get("value2");
                Object value3 = map3.get("value3");
                Object value4 = map3.get("value4");
                Object value5 = map3.get("value5");
                Object value6 = map3.get("value6");
                Object value7 = map3.get("value7");
                waist.put("type", 4);
                waist.put("isDevice", isDevice);
                if (time!=null){
                    waist.put("time", time);
                }
                if (value1 != null) {
                    waist.put("value1", value1);
                }
                if (value2!=null) {
                    waist.put("value2", value2);
                }
                if (value3!=null) {
                    waist.put("value3", value3);
                }
                if (value4!=null) {
                    waist.put("value4", value4);
                }
                if (value5!=null) {
                    waist.put("value5", value5);
                }
                if (value6!=null) {
                    waist.put("value6", value6);
                }
                if (value7!=null) {
                    waist.put("value7", value7);
                }
                list.add(waist);
            }
            return write(200, "查询成功", "data", list);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
	/**
	 * 保存患者健康指标 (旧)
	 * @param intervene 干预标志
	 * @param time 记录时间
	 * @param value1 血糖/收缩压/体重/腰围/早餐前空腹
	 * @param value2 舒张压/早餐后空腹
	 * @param value3 午餐空腹
	 * @param value4 午餐后
	 * @param value5 晚餐空腹
	 * @param value6 晚餐后
	 * @param value7 睡前
	 * @param type 健康指标类型(1血糖,2血压,3体重,4腰围)
	 * @return 操作结果
	 */
	@RequestMapping(value = "add")
	@ResponseBody
	public String add(@RequestParam(required = false) String intervene, String time, String value1, String value2, String value3, String value4, String value5, String value6, String value7, int type) {
		try {
    /**
     * 患者最近填写的健康指标
     *
     * @return
     */
    @RequestMapping(value = "recent")
    @ResponseBody
    public String recent() {
        try {
            JSONArray array = healthIndexService.findRecentByPatient(getUID());
            if (array != null) {
                return write(200, "查询成功", "list", array);
            } else {
                return error(-1, "查询失败");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
			DevicePatientHealthIndex healthIndex = null;
			if (type == 1) {
				// 血糖等一天只能存在一条数据
				Iterable<DevicePatientHealthIndex> list = healthIndexService.findByPatienDate(getUID(), type, DateUtil.strToDate(time, DateUtil.YYYY_MM_DD));
				if (list != null) {
					for (DevicePatientHealthIndex model : list) {
						healthIndex = model;
					}
				}
			}
			if (healthIndex == null) {
				healthIndex = new DevicePatientHealthIndex();
			}
			// 设置患者标识
			healthIndex.setUser(getUID());
			// 设置干预标识,默认为NULL
			healthIndex.setIntervene(intervene);
    /**
     * 保存患者健康指标 (旧)
     *
     * @param intervene 干预标志
     * @param time      记录时间
     * @param value1    血糖/收缩压/体重/腰围/早餐前空腹
     * @param value2    舒张压/早餐后空腹
     * @param value3    午餐空腹
     * @param value4    午餐后
     * @param value5    晚餐空腹
     * @param value6    晚餐后
     * @param value7    睡前
     * @param type      健康指标类型(1血糖,2血压,3体重,4腰围)
     * @return 操作结果
     */
    @RequestMapping(value = "add")
    @ResponseBody
    public String add(@RequestParam(required = false) String intervene, String time, String value1, String value2, String value3, String value4, String value5, String value6, String value7, int type) {
        try {
			int index = 0;
			double value = 0;
            DevicePatientHealthIndex healthIndex = null;
            if (type == 1) {
                // 血糖等一天只能存在一条数据
                Iterable<DevicePatientHealthIndex> list = healthIndexService.findByPatienDate(getUID(), type, DateUtil.strToDate(time, DateUtil.YYYY_MM_DD));
                if (list != null) {
                    for (DevicePatientHealthIndex model : list) {
                        healthIndex = model;
                    }
                }
            }
            if (healthIndex == null) {
                healthIndex = new DevicePatientHealthIndex();
            }
            // 设置患者标识
            healthIndex.setUser(getUID());
            // 设置干预标识,默认为NULL
            healthIndex.setIntervene(intervene);
			// 设置血糖/收缩压/体重/腰围/早餐前空腹
			if (NumberUtils.toDouble(value1, 0) > 0) {
				healthIndex.setValue1(value1);
				index = 1;
				value = NumberUtils.toDouble(value1, 0);
			}
			// 设置 舒张压/早餐后血糖
			if (NumberUtils.toDouble(value2, 0) > 0) {
				healthIndex.setValue2(value2);
				index = 2;
				value = NumberUtils.toDouble(value2, 0);
			}
			// 设置午餐前血糖
			if (NumberUtils.toDouble(value3, 0) > 0) {
				healthIndex.setValue3(value3);
				index = 3;
				value = NumberUtils.toDouble(value3, 0);
			}
			// 设置午餐后血糖
			if (NumberUtils.toDouble(value4, 0) > 0) {
				healthIndex.setValue4(value4);
				index = 4;
				value = NumberUtils.toDouble(value4, 0);
			}
			// 设置晚餐前血糖
			if (NumberUtils.toDouble(value5, 0) > 0) {
				healthIndex.setValue5(value5);
				index = 5;
				value = NumberUtils.toDouble(value5, 0);
			}
			// 设置晚餐后血糖
			if (NumberUtils.toDouble(value6, 0) > 0) {
				healthIndex.setValue6(value6);
				index = 6;
				value = NumberUtils.toDouble(value6, 0);
			}
			// 设置睡前血糖
			if (NumberUtils.toDouble(value7, 0) > 0) {
				healthIndex.setValue7(value7);
				index = 7;
				value = NumberUtils.toDouble(value7, 0);
			}
			// 设置健康指标类型(1血糖,2血压,3体重,4腰围)
			healthIndex.setType(type);
			// 设置记录时间
			if(type == 2){
				healthIndex.setRecordDate(DateUtil.strToDate(time, DateUtil.YYYY_MM_DD_HH_MM_SS));
			}else {
				healthIndex.setRecordDate(DateUtil.strToDate(time, DateUtil.YYYY_MM_DD));
			}
			healthIndex.setSortDate(DateUtil.strToDateAppendNowTime(time, DateUtil.YYYY_MM_DD_HH_MM_SS));
			// 保存到数据库
			healthIndex = healthIndexService.save(healthIndex, index, value,getUID());
			if (healthIndex == null) {
				return error(-1, "保存失败!");
			}
			return success("保存成功!");
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, "保存失败!");
		}
	}
            int index = 0;
            double value = 0;
	@RequestMapping(value = "addPatientHealthIndex",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("新增患者指标")
	public String addPatientHealthIndex(@ApiParam(name="data",value="指标数据",defaultValue = "{\"gi\":\"5.5\",\"gi_type\":\"1\"}")
										@RequestParam(value="data",required = true) String data,
										@ApiParam(name="type",value="指标类型",defaultValue = "1")
										@RequestParam(value="type",required = true) String type)
	{
		try {
			DevicePatientHealthIndex obj = healthIndexService.addPatientHealthIndex(data, type, getUID(), null);
			//血糖和血压需要校验
			if(type.equals("1")||type.equals("2"))
			{
				healthIndexService.verifyHealthIndex(obj.getId());
			}
            // 设置血糖/收缩压/体重/腰围/早餐前空腹
            if (NumberUtils.toDouble(value1, 0) > 0) {
                healthIndex.setValue1(value1);
                index = 1;
                value = NumberUtils.toDouble(value1, 0);
            }
            // 设置 舒张压/早餐后血糖
            if (NumberUtils.toDouble(value2, 0) > 0) {
                healthIndex.setValue2(value2);
                index = 2;
                value = NumberUtils.toDouble(value2, 0);
            }
            // 设置午餐前血糖
            if (NumberUtils.toDouble(value3, 0) > 0) {
                healthIndex.setValue3(value3);
                index = 3;
                value = NumberUtils.toDouble(value3, 0);
            }
            // 设置午餐后血糖
            if (NumberUtils.toDouble(value4, 0) > 0) {
                healthIndex.setValue4(value4);
                index = 4;
                value = NumberUtils.toDouble(value4, 0);
            }
            // 设置晚餐前血糖
            if (NumberUtils.toDouble(value5, 0) > 0) {
                healthIndex.setValue5(value5);
                index = 5;
                value = NumberUtils.toDouble(value5, 0);
            }
            // 设置晚餐后血糖
            if (NumberUtils.toDouble(value6, 0) > 0) {
                healthIndex.setValue6(value6);
                index = 6;
                value = NumberUtils.toDouble(value6, 0);
            }
            // 设置睡前血糖
            if (NumberUtils.toDouble(value7, 0) > 0) {
                healthIndex.setValue7(value7);
                index = 7;
                value = NumberUtils.toDouble(value7, 0);
            }
            // 设置健康指标类型(1血糖,2血压,3体重,4腰围)
            healthIndex.setType(type);
            // 设置记录时间
            if (type == 2) {
                healthIndex.setRecordDate(DateUtil.strToDate(time, DateUtil.YYYY_MM_DD_HH_MM_SS));
            } else {
                healthIndex.setRecordDate(DateUtil.strToDate(time, DateUtil.YYYY_MM_DD));
            }
            healthIndex.setSortDate(DateUtil.strToDateAppendNowTime(time, DateUtil.YYYY_MM_DD_HH_MM_SS));
            // 保存到数据库
            healthIndex = healthIndexService.save(healthIndex, index, value, getUID());
            if (healthIndex == null) {
                return error(-1, "保存失败!");
            }
            return success("保存成功!");
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, "保存失败!");
        }
    }
			return success("新增患者指标成功!");
		}
		catch (Exception ex)
		{
			return invalidUserException(ex, -1, ex.getMessage());
		}
	}
    @RequestMapping(value = "addPatientHealthIndex", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("新增患者指标")
    public String addPatientHealthIndex(@ApiParam(name = "data", value = "指标数据", defaultValue = "{\"gi\":\"5.5\",\"gi_type\":\"1\"}")
                                        @RequestParam(value = "data", required = true) String data,
                                        @ApiParam(name = "type", value = "指标类型", defaultValue = "1")
                                        @RequestParam(value = "type", required = true) String type) {
        try {
            DevicePatientHealthIndex obj = healthIndexService.addPatientHealthIndex(data, type, getUID(), null);
            //血糖和血压需要校验
            if (type.equals("1") || type.equals("2")) {
                healthIndexService.verifyHealthIndex(obj.getId());
            }
            return success("新增患者指标成功!");
        } catch (Exception ex) {
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
	@RequestMapping(value = "verifyPatientHealthIndex",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("校验患者指标")
	public String verifyPatientHealthIndex(@ApiParam(name="id",value="指标id",defaultValue = "")
										@RequestParam(value="id",required = true) Long id)
	{
		try {
			healthIndexService.verifyHealthIndex(id);
			return success("校验患者指标成功!");
		}
		catch (Exception ex)
		{
			return invalidUserException(ex, -1, ex.getMessage());
		}
	}
    @RequestMapping(value = "verifyPatientHealthIndex", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("校验患者指标")
    public String verifyPatientHealthIndex(@ApiParam(name = "id", value = "指标id", defaultValue = "")
                                           @RequestParam(value = "id", required = true) Long id) {
        try {
            healthIndexService.verifyHealthIndex(id);
	/**
	 * 根据患者标志获取健康指标
	 * @param type 健康指标类型(1血糖,2血压,3体重,4腰围)
	 * @return 操作结果
	 */
	@RequestMapping(value = "chart",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("根据患者标志获取健康指标(图表)")
	public String getHealthIndexChartByPatient(@ApiParam(name="type",value="指标类型",defaultValue = "1")
												   @RequestParam(value="type",required = true) int type,
											   @ApiParam(name="begin",value="开始时间",defaultValue = "2016-08-23 00:00:00")
											   @RequestParam(value="begin",required = true) String begin,
											   @ApiParam(name="end",value="结束时间",defaultValue = "2016-09-23 00:00:00")
												   @RequestParam(value="end",required = true) String end) {
		try {
			List<DevicePatientHealthIndex> list = healthIndexService.findChartByPatien(getUID(), type, begin, end);
			if (list == null) {
				return success("查询成功!");
			}
			JSONArray jsonArray = new JSONArray();
			for (DevicePatientHealthIndex model : list) {
				JSONObject modelJson = new JSONObject();
				modelJson.put("patient", model.getUser());
				modelJson.put("value1", model.getValue1());
				modelJson.put("value2", model.getValue2());
				modelJson.put("value3", model.getValue3());
				modelJson.put("value4", model.getValue4());
				modelJson.put("value5", model.getValue5());
				modelJson.put("value6", model.getValue6());
				modelJson.put("value7", model.getValue7());
				modelJson.put("type", model.getType());
				if(type == 2){
					modelJson.put("date", DateUtil.dateToStr(model.getRecordDate(), DateUtil.YYYY_MM_DD_HH_MM_SS));
				}else{
					modelJson.put("date", DateUtil.dateToStr(model.getRecordDate(), DateUtil.YYYY_MM_DD));
				}
				modelJson.put("czrq", DateUtil.dateToStr(model.getCzrq(), DateUtil.YYYY_MM_DD_HH_MM_SS));
				jsonArray.put(modelJson);
			}
			return write(200, "查询成功", "list", jsonArray);
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, "查询失败!");
		}
	}
            return success("校验患者指标成功!");
        } catch (Exception ex) {
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
	/**
	 * 根据患者标志获取健康指标
	 * @param type 健康指标类型(1血糖,2血压,3体重,4腰围)
	 * @param pagesize 页数
	 * @return 操作结果
	 */
	@RequestMapping(value = "list",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("患者获取健康指标")
	public String getHealthIndexByPatient(@ApiParam(name="type",value="指标类型",defaultValue = "1")
										   @RequestParam(value="type",required = true) int type,
										  @ApiParam(name="start",value="开始时间",defaultValue = "2016-07-23 00:00:00")
										  @RequestParam(value="start",required = true) String start,
										  @ApiParam(name="end",value="结束时间",defaultValue = "2016-08-23 00:00:00")
										  @RequestParam(value="end",required = true) String end,
										  @ApiParam(name="page",value="第几页",defaultValue = "1")
										  @RequestParam(value="page",required = true) int page,
										  @ApiParam(name="pagesize",value="每页几行",defaultValue = "10")
										  @RequestParam(value="pagesize",required = true) int pagesize) {
		try {
			List<DevicePatientHealthIndex> list = healthIndexService.findIndexByPatient(getUID(), type, start,end,page, pagesize);
    /**
     * 根据患者标志获取健康指标
     *
     * @param type 健康指标类型(1血糖,2血压,3体重,4腰围)
     * @return 操作结果
     */
    @RequestMapping(value = "chart", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("根据患者标志获取健康指标(图表)")
    public String getHealthIndexChartByPatient(@ApiParam(name = "type", value = "指标类型", defaultValue = "1")
                                               @RequestParam(value = "type", required = true) int type,
                                               @ApiParam(name = "begin", value = "开始时间", defaultValue = "2016-08-23 00:00:00")
                                               @RequestParam(value = "begin", required = true) String begin,
                                               @ApiParam(name = "end", value = "结束时间", defaultValue = "2016-09-23 00:00:00")
                                               @RequestParam(value = "end", required = true) String end) {
        try {
            List<DevicePatientHealthIndex> list = healthIndexService.findChartByPatien(getUID(), type, begin, end);
            if (list == null) {
                return success("查询成功!");
            }
            JSONArray jsonArray = new JSONArray();
            for (DevicePatientHealthIndex model : list) {
                JSONObject modelJson = new JSONObject();
                modelJson.put("patient", model.getUser());
                modelJson.put("value1", model.getValue1());
                modelJson.put("value2", model.getValue2());
                modelJson.put("value3", model.getValue3());
                modelJson.put("value4", model.getValue4());
                modelJson.put("value5", model.getValue5());
                modelJson.put("value6", model.getValue6());
                modelJson.put("value7", model.getValue7());
                modelJson.put("type", model.getType());
                if (type == 2) {
                    modelJson.put("date", DateUtil.dateToStr(model.getRecordDate(), DateUtil.YYYY_MM_DD_HH_MM_SS));
                } else {
                    modelJson.put("date", DateUtil.dateToStr(model.getRecordDate(), DateUtil.YYYY_MM_DD));
                }
                modelJson.put("czrq", DateUtil.dateToStr(model.getCzrq(), DateUtil.YYYY_MM_DD_HH_MM_SS));
                jsonArray.put(modelJson);
            }
            return write(200, "查询成功", "list", jsonArray);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, "查询失败!");
        }
    }
			JSONArray jsonArray = new JSONArray();
			if (list != null) {
				for (DevicePatientHealthIndex model : list) {
					JSONObject modelJson = new JSONObject();
					modelJson.put("id", model.getId());
					modelJson.put("patient", model.getUser());
					modelJson.put("value1", model.getValue1());
					modelJson.put("value2", model.getValue2());
					modelJson.put("value3", model.getValue3());
					modelJson.put("value4", model.getValue4());
					modelJson.put("value5", model.getValue5());
					modelJson.put("value6", model.getValue6());
					modelJson.put("value7", model.getValue7());
					modelJson.put("type", model.getType());
					if(type == 2) {
						modelJson.put("date", DateUtil.dateToStr(model.getRecordDate(), DateUtil.YYYY_MM_DD_HH_MM_SS));
					}else{
						modelJson.put("date", DateUtil.dateToStr(model.getRecordDate(), DateUtil.YYYY_MM_DD));
					}
					modelJson.put("sortDate", DateUtil.dateToStrLong(model.getSortDate()));
					modelJson.put("czrq", DateUtil.dateToStr(model.getCzrq(), DateUtil.YYYY_MM_DD_HH_MM_SS));
					jsonArray.put(modelJson);
				}
			}
    /**
     * 根据患者标志获取健康指标
     *
     * @param type     健康指标类型(1血糖,2血压,3体重,4腰围)
     * @param pagesize 页数
     * @return 操作结果
     */
    @RequestMapping(value = "list", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("患者获取健康指标")
    public String getHealthIndexByPatient(@ApiParam(name = "type", value = "指标类型", defaultValue = "1")
                                          @RequestParam(value = "type", required = true) int type,
                                          @ApiParam(name = "start", value = "开始时间", defaultValue = "2016-07-23 00:00:00")
                                          @RequestParam(value = "start", required = true) String start,
                                          @ApiParam(name = "end", value = "结束时间", defaultValue = "2016-08-23 00:00:00")
                                          @RequestParam(value = "end", required = true) String end,
                                          @ApiParam(name = "page", value = "第几页", defaultValue = "1")
                                          @RequestParam(value = "page", required = true) int page,
                                          @ApiParam(name = "pagesize", value = "每页几行", defaultValue = "10")
                                          @RequestParam(value = "pagesize", required = true) int pagesize) {
        try {
            List<DevicePatientHealthIndex> list = healthIndexService.findIndexByPatient(getUID(), type, start, end, page, pagesize);
            JSONArray jsonArray = new JSONArray();
            if (list != null) {
                for (DevicePatientHealthIndex model : list) {
                    JSONObject modelJson = new JSONObject();
                    modelJson.put("id", model.getId());
                    modelJson.put("patient", model.getUser());
                    modelJson.put("value1", model.getValue1());
                    modelJson.put("value2", model.getValue2());
                    modelJson.put("value3", model.getValue3());
                    modelJson.put("value4", model.getValue4());
                    modelJson.put("value5", model.getValue5());
                    modelJson.put("value6", model.getValue6());
                    modelJson.put("value7", model.getValue7());
                    modelJson.put("type", model.getType());
                    if (type == 2) {
                        modelJson.put("date", DateUtil.dateToStr(model.getRecordDate(), DateUtil.YYYY_MM_DD_HH_MM_SS));
                    } else {
                        modelJson.put("date", DateUtil.dateToStr(model.getRecordDate(), DateUtil.YYYY_MM_DD));
                    }
                    modelJson.put("sortDate", DateUtil.dateToStrLong(model.getSortDate()));
                    modelJson.put("czrq", DateUtil.dateToStr(model.getCzrq(), DateUtil.YYYY_MM_DD_HH_MM_SS));
                    jsonArray.put(modelJson);
                }
            }
			return write(200, "查询成功", "list", jsonArray);
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, "查询失败!");
		}
	}
            return write(200, "查询成功", "list", jsonArray);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, "查询失败!");
        }
    }
	/**
	 * 患者健康指标预警值查询
	 * @return
	 */
	@RequestMapping(value = "standard")
	@ResponseBody
	public String standard() {
		try {
			JSONArray standardArray = new JSONArray();
			JSONArray userArray = new JSONArray();
			Iterable<PatientHealthStandard> iterable = healthIndexService.findStandardByPatient(getUID());
			Iterator<PatientHealthStandard> iterator = null;
			if (iterable != null) {
				iterator = iterable.iterator();
			}
			// 预警值未设置,返回默认值
			StringBuffer sb = new StringBuffer();
			sb.append("[");
			// 默认血糖(餐前,餐后二小时)
			sb.append("{min_value_1:3.9, max_value_1:6.1, min_value_2:4.4, max_value_2:7.8, type:1},");
			// 默认血压(收缩压,舒张压)
			sb.append("{min_value_1:90, max_value_1:139, min_value_2:60, max_value_2:89, type:2}");
			sb.append("]");
			standardArray = new JSONArray(sb.toString());
			if (iterator != null) {
				while (iterator.hasNext()) {
					PatientHealthStandard phs = iterator.next();
					if (phs == null) {
						continue;
					}
					JSONObject json = new JSONObject();
					// 最低安全值(血糖餐前\收缩压\体重\腰围)
					json.put("min_value_1", phs.getMinValue1());
					// 最高安全值(血糖餐前\收缩压\体重\腰围)
					json.put("max_value_1", phs.getMaxValue1());
					// 最低安全值(血糖餐后\舒张压)
					json.put("min_value_2", phs.getMinValue2());
					// 最高安全值(血糖餐后\舒张压)
					json.put("max_value_2", phs.getMaxValue2());
					// 健康指标类型:1血糖,2血压,3体重,4腰围
					json.put("type", phs.getType());
					userArray.put(json);
				}
			}
			JSONObject json = new JSONObject();
			json.put("standard", standardArray);
			json.put("custom", userArray);
			return write(200, "查询成功", "data", json);
		} catch (Exception e) {
			error(e);
			return invalidUserException(e, -1, "查询失败!");
		}
	}
    /**
     * 患者健康指标预警值查询
     *
     * @return
     */
    @RequestMapping(value = "standard")
    @ResponseBody
    public String standard() {
        try {
            JSONArray standardArray = new JSONArray();
            JSONArray userArray = new JSONArray();
            Iterable<PatientHealthStandard> iterable = healthIndexService.findStandardByPatient(getUID());
            Iterator<PatientHealthStandard> iterator = null;
            if (iterable != null) {
                iterator = iterable.iterator();
            }
            // 预警值未设置,返回默认值
            StringBuffer sb = new StringBuffer();
            sb.append("[");
            // 默认血糖(餐前,餐后二小时)
            sb.append("{min_value_1:3.9, max_value_1:6.1, min_value_2:4.4, max_value_2:7.8, type:1},");
            // 默认血压(收缩压,舒张压)
            sb.append("{min_value_1:90, max_value_1:139, min_value_2:60, max_value_2:89, type:2}");
            sb.append("]");
            standardArray = new JSONArray(sb.toString());
            if (iterator != null) {
                while (iterator.hasNext()) {
                    PatientHealthStandard phs = iterator.next();
                    if (phs == null) {
                        continue;
                    }
                    JSONObject json = new JSONObject();
                    // 最低安全值(血糖餐前\收缩压\体重\腰围)
                    json.put("min_value_1", phs.getMinValue1());
                    // 最高安全值(血糖餐前\收缩压\体重\腰围)
                    json.put("max_value_1", phs.getMaxValue1());
                    // 最低安全值(血糖餐后\舒张压)
                    json.put("min_value_2", phs.getMinValue2());
                    // 最高安全值(血糖餐后\舒张压)
                    json.put("max_value_2", phs.getMaxValue2());
                    // 健康指标类型:1血糖,2血压,3体重,4腰围
                    json.put("type", phs.getType());
                    userArray.put(json);
                }
            }
            JSONObject json = new JSONObject();
            json.put("standard", standardArray);
            json.put("custom", userArray);
            return write(200, "查询成功", "data", json);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "查询失败!");
        }
    }
}

+ 59 - 40
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -74,7 +74,7 @@ public class StatisticsController extends BaseController {
            if (index != null) {
                for (String idx : indexes) {
                    result.put("index_" + idx, statisticsService.getDateIncrementDetail(startDate, endDate, interval, area, level,idx,level2_type));
                    result.put("index_" + idx, statisticsService.getDateIncrementDetail(startDate, endDate, interval, area, level, idx, level2_type));
                }
            }
@ -119,11 +119,11 @@ public class StatisticsController extends BaseController {
    /**
     * 指标截止日期累积量
     *
     * @param endDate 结束时间
     * @param area 父code
     * @param level 等级  1 团队,2 机构,3 区,4 市
     * @param index 指标代码
     * @param level2_type  指标代码 例如性别 1 男 2 女  不传就返回男和女的总和
     * @param endDate     结束时间
     * @param area        父code
     * @param level       等级  1 团队,2 机构,3 区,4 市
     * @param index       指标代码
     * @param level2_type 指标代码 例如性别 1 男 2 女  不传就返回男和女的总和
     * @return
     */
        @RequestMapping("/total")
@ -138,7 +138,7 @@ public class StatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsService.getTotalAmount(endDate, area, level, idx,level2_type));
                result.put("index_" + idx, statisticsService.getTotalAmount(endDate, area, level, idx, level2_type));
            }
            return write(200, "查询成功", "data", result);
@ -184,13 +184,13 @@ public class StatisticsController extends BaseController {
    /**
     * 指标截止日期增量
     *
     * @param endDate 结束时间
     * @param area 父code
     * @param level 等级  1 团队,2 机构,3 区,4 市
     * @param index 指标代码
     * @param sort 排序 1倒叙 2是 正序
     * @param endDate     结束时间
     * @param area        父code
     * @param level       等级  1 团队,2 机构,3 区,4 市
     * @param index       指标代码
     * @param sort        排序 1倒叙 2是 正序
     * @param lowLevel
     * @param level2_type  指标代码 例如性别 1 男 2 女  不传就返回男和女的总和
     * @param level2_type 指标代码 例如性别 1 男 2 女  不传就返回男和女的总和
     * @return
     */
    @RequestMapping("/lowlevel_total")
@ -207,7 +207,7 @@ public class StatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsService.getLowLevelTotalDetail(endDate, area, level, idx, sort, lowLevel,level2_type));
                result.put("index_" + idx, statisticsService.getLowLevelTotalDetail(endDate, area, level, idx, sort, lowLevel, level2_type));
            }
            return write(200, "查询成功", "data", result);
@ -240,39 +240,56 @@ public class StatisticsController extends BaseController {
            JSONArray returnJa = new JSONArray();
            List<JSONArray> jsonArrays = new ArrayList<>();
            JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel,null);
            JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null);
            jsonArrays.add(jsonArray1);
            JSONArray jsonArray2 = statisticsService.getLowLevelIncrementDetail(endDate, endDate, area, level, indexes[1], sort, lowLevel);
            jsonArrays.add(jsonArray2);
            //遍历合并2个指标中key值一样的
            for (int i = 0; i < jsonArrays.get(0).length(); i++) {
                if (jsonArrays.get(1).length() == 0) {
            if (jsonArrays.get(1).length() == 0) {
                //如果只有一个指标的时候 另外一个指标默认是0
                for (int i = 0; i < jsonArrays.get(0).length(); i++) {
                    //未回复咨询不存在的时候默认是0
                    JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
                    String amount = map1.get("amount").toString() + ",0";
                    map1.put("amount", amount);
                    returnJa.put(map1);
                } else {
                    for (int j = 0; j < jsonArrays.get(1).length(); j++) {
                        JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
                        JSONObject map2 = jsonArrays.get(1).getJSONObject(j);
                        String amount = "";
                        if (map1.get("code").equals(map2.get("code"))) {
                            amount = map1.get("amount").toString() + "," + map2.get("amount").toString();
                            map1.put("amount", amount);
                            returnJa.put(map1);
                        }
                    }
                }
            } else {
                //如果是2个指标的时候,分别放入map中,以减少查询次数
                Map<String,JSONObject> index1=new HashMap<>();
                Map<String,JSONObject> index2=new HashMap<>();
                for (int i = 0; i < jsonArrays.get(0).length(); i++) {
                    JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
                    index1.put(map1.get("code").toString(),map1);
                }
                for (int i = 0; i < jsonArrays.get(1).length(); i++) {
                    JSONObject map1 = jsonArrays.get(1).getJSONObject(i);
                    index2.put(map1.get("code").toString(),map1);
                }
                for(Map.Entry<String , JSONObject> one:index1.entrySet()){
                    JSONObject map1 = one.getValue();
                    JSONObject map2 = index2.get(one.getKey());
                    String amount = map1.get("amount").toString() + "," + map2.get("amount").toString();
                    map1.put("amount", amount);
                    returnJa.put(map1);
                }
            }
            result.put("index_" + indexes[0], returnJa);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
        } catch (
                Exception e
                )
        {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
@ -450,6 +467,7 @@ public class StatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取三师转签或高危人群
     *
@ -572,13 +590,13 @@ public class StatisticsController extends BaseController {
    @RequestMapping("/Consulting_StatList")
    @ResponseBody
    public String getConsultingStatisticsList(@RequestParam(required = true) Integer level,
                                               @RequestParam(required = true) String area ,
                                               @RequestParam(required = false) String lowlevel) {
                                              @RequestParam(required = true) String area,
                                              @RequestParam(required = false) String lowlevel) {
        try {
            JSONObject data = statisticsService.getConsultingStatisticsList(level,area,lowlevel);
            if(data!=null){
            JSONObject data = statisticsService.getConsultingStatisticsList(level, area, lowlevel);
            if (data != null) {
                return write(200, "查询成功", "data", data);
            }else{
            } else {
                return error(-1, "查询失败");
            }
        } catch (Exception e) {
@ -599,12 +617,12 @@ public class StatisticsController extends BaseController {
    @RequestMapping("/Consulting_Title")
    @ResponseBody
    public String getConsultingTitle(@RequestParam(required = true) Integer level,
                                      @RequestParam(required = true) String area) {
                                     @RequestParam(required = true) String area) {
        try {
            JSONObject data = statisticsService.getConsultingTitle(level,area);
            if(data!=null){
            JSONObject data = statisticsService.getConsultingTitle(level, area);
            if (data != null) {
                return write(200, "查询成功", "data", data);
            }else{
            } else {
                return error(-1, "查询失败");
            }
        } catch (Exception e) {
@ -614,15 +632,16 @@ public class StatisticsController extends BaseController {
    /**
     * 获取回复数时间分布数
     *
     * @param level
     * @param area
     * @return
     */
    @RequestMapping("/getCoutListByTime")
    @ResponseBody
    public String getCoutListByTime(@RequestParam(required = true)String level,@RequestParam(required = true) String area){
    public String getCoutListByTime(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
        try {
            return write(200, "查询成功", "data", statisticsService.getCoutListByTime(level,area));
            return write(200, "查询成功", "data", statisticsService.getCoutListByTime(level, area));
        } catch (Exception e) {
            return error(-1, "查询失败");
        }

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

@ -53,45 +53,45 @@
##------------------------------------�����������ݿ�����------------------------------------#
#### 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
#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
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=luofaqiang
#jdbc.password=luofaqiang
#
###### 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=luofaqiang
#health.jdbc.password=luofaqiang
#
###### 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=luofaqiang
#fv.jdbc.password=luofaqiang
##### 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
#
###### redis
#redis.host=172.19.103.88

+ 2 - 2
patient-co-wlyy/src/main/resources/config/fdfs_client.conf

@ -6,10 +6,10 @@ http.anti_steal_token = no
http.secret_key = FastDFS1234567890
#-------------开发环境---------------#
tracker_server = 172.19.103.54:22122
#tracker_server = 172.19.103.54:22122
#-------------测试环境---------------#
#tracker_server = 172.19.103.54:22122
#-------------正式环境---------------#
#tracker_server = 192.168.0.239:22122
tracker_server = 192.168.0.239:22122

+ 4 - 2
patient-co-wlyy/src/main/resources/system.properties

@ -64,6 +64,8 @@ admin_token=0a5c5258-8863-4b07-a3f9-88c768528ab4
# 签约到期JOB触发时间
sign_end_job_trigger=0 0 0 * * ?
evaluate_score_job = 59 59 23 * * ?
#-------------------------开发环境配置-------------------------#
 服务器基本配置
server_ip=weixin.xmtyw.cn
@ -80,8 +82,8 @@ chat_server=http://weixin.xmtyw.cn/res/chat/
sign_check_upload=http://172.19.103.87:8011/wlyy_service
# IM配置
im_list_get=http://172.19.103.29:3008/
#im_list_get=http://192.168.131.102:3008/
#im_list_get=http://172.19.103.88:3000/
im_list_get=http://192.168.131.107:3000/
im_group_server=http://172.19.103.29:3000/api/v1/chats/gm
msg_push_server=http://172.19.103.29:3000/api/v1/chats/sm

+ 1 - 1
patient-co-wlyy/src/main/resources/weixin_menu.txt

@ -82,7 +82,7 @@
        {
        	 "type":"view",
        	 "name":"意见反馈",
        	 "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdyy%2fhtml%2fmy-appointment.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        	 "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyjfk%2fhtml%2ffeedback.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        }
	 ]
  }

+ 11 - 0
readme.MD

@ -0,0 +1,11 @@
patient-co-analysis  数据采集分析项目
    主要功能是监听kafka解析日志并且入库到mongodb
    
patient-co-figure 居民画像项目
    
patient-co-statistics 统计项目
    生成各种类统计指标
    
patient-co-wlyy
    i健康后台项目 包括医生端与患者端