소스 검색

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

humingfen 7 년 전
부모
커밋
03aacfb9dd
33개의 변경된 파일1371개의 추가작업 그리고 896개의 파일을 삭제
  1. 51 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyAdvice.java
  2. 11 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyOptionAnswers.java
  3. 66 5
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyScreenResult.java
  4. 42 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyTemplateAdvice.java
  5. 10 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyTemplateOptions.java
  6. 143 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyTemplateResult.java
  7. 19 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyTemplates.java
  8. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  9. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/specialist/TeamDiseaseRelation.java
  10. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyAdviceDao.java
  11. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyOptionAnswersDao.java
  12. 13 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyScreenResultDao.java
  13. 18 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyTemplateAdviceDao.java
  14. 18 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyTemplateResultDao.java
  15. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyServerDao.java
  16. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/PatientDiseaseServerDao.java
  17. 6 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/SpecialDiseaseDao.java
  18. 21 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  19. 11 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  20. 297 179
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java
  21. 130 21
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java
  22. 74 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  23. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/DoctorPatientGroupController.java
  24. 21 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java
  25. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java
  26. 71 36
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java
  27. 0 84
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorQuestionnaireController.java
  28. 173 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java
  29. 40 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java
  30. 0 563
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/SurveyScreenResultController.java
  31. 12 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/PatientSpecialistController.java
  32. 86 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/survey/PatientQuestionnaireController.java
  33. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

+ 51 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyAdvice.java

@ -0,0 +1,51 @@
package com.yihu.wlyy.entity.doctor.survey;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by hmf on 2018/7/4.
 */
@Entity
@Table(name = "wlyy_survey_advice")
public class SurveyAdvice extends IdEntity {
    private String code;
    private String advice;//建议内容
    private Date czrq;//创建时间
    private Integer diseaseType;//疾病类型
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getAdvice() {
        return advice;
    }
    public void setAdvice(String advice) {
        this.advice = advice;
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    public Integer getDiseaseType() {
        return diseaseType;
    }
    public void setDiseaseType(Integer diseaseType) {
        this.diseaseType = diseaseType;
    }
}

+ 11 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyOptionAnswers.java

@ -33,6 +33,9 @@ public class SurveyOptionAnswers extends IdEntity implements Serializable {
//    用户openId
    private String openId;
    //筛查结果code
    private String screenResultCode;
    public SurveyOptionAnswers() {
    }
@ -131,4 +134,12 @@ public class SurveyOptionAnswers extends IdEntity implements Serializable {
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    public String getScreenResultCode() {
        return screenResultCode;
    }
    public void setScreenResultCode(String screenResultCode) {
        this.screenResultCode = screenResultCode;
    }
}

+ 66 - 5
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyScreenResult.java

@ -32,16 +32,22 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
    private String openId;
    //居民名字
    private String patientName;
    //筛查结果设置中相关code
    private String screenResultCode;
    //筛查结果分值
    private int screenResultScore;
    private Integer screenResultScore;
    //筛查结果
    private String screenResult;
    //是否高危预警(0不是  1是)
    private Integer isDanger;
    //是否预约(0未预约 1已预约)
    private int order;
    private Integer order;
    //是否跟踪(0未跟踪 1已跟踪)
    private int following;
    private Integer following;
    //是否进行健康教育(0没有  1有)
    private Integer isEducate;
    //是否完成(0未完成 1已完成)
    private int over;
    private Integer over;
    //预约记录code
    private String reservationCode;
    //创建时间
@ -56,11 +62,15 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
    private String adviceCode;
    //其他建议
    private String otherAdvice;
    //来源(1医生发放  2居民自我评估)
    private int source;
    //更新时间
    private Date updateTime;
    public SurveyScreenResult() {
    }
    public SurveyScreenResult(String code, String templateCode, String templateTitle, int disease, String doctor, String patientCode, String openId, String patientName, int screenResultScore, String screenResult, int order, int following, int over, String reservationCode, Date czrq, int isAgain, String parentCode, String originCode, String adviceCode, String otherAdvice) {
    public SurveyScreenResult(String code, String templateCode, String templateTitle, int disease, String doctor, String patientCode, String openId, String patientName, String screenResultCode, Integer screenResultScore, String screenResult, Integer isDanger, Integer order, Integer following, Integer isEducate, Integer over, String reservationCode, Date czrq, int isAgain, String parentCode, String originCode, String adviceCode, String otherAdvice, int source, Date updateTime) {
        this.code = code;
        this.templateCode = templateCode;
        this.templateTitle = templateTitle;
@ -69,10 +79,13 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.patientCode = patientCode;
        this.openId = openId;
        this.patientName = patientName;
        this.screenResultCode = screenResultCode;
        this.screenResultScore = screenResultScore;
        this.screenResult = screenResult;
        this.isDanger = isDanger;
        this.order = order;
        this.following = following;
        this.isEducate = isEducate;
        this.over = over;
        this.reservationCode = reservationCode;
        this.czrq = czrq;
@ -81,6 +94,8 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.originCode = originCode;
        this.adviceCode = adviceCode;
        this.otherAdvice = otherAdvice;
        this.source = source;
        this.updateTime = updateTime;
    }
    @Column(name = "code")
@ -155,6 +170,15 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.patientName = patientName;
    }
    @Column(name = "screen_result_code")
    public String getScreenResultCode() {
        return screenResultCode;
    }
    public void setScreenResultCode(String screenResultCode) {
        this.screenResultCode = screenResultCode;
    }
    @Column(name = "screen_result_score")
    public int getScreenResultScore() {
        return screenResultScore;
@ -173,6 +197,15 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.screenResult = screenResult;
    }
    @Column(name = "is_danger")
    public int getIsDanger() {
        return isDanger;
    }
    public void setIsDanger(int isDanger) {
        this.isDanger = isDanger;
    }
    @Column(name = "order")
    public int getOrder() {
        return order;
@ -191,6 +224,15 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.following = following;
    }
    @Column(name = "is_educate")
    public int getIsEducate() {
        return isEducate;
    }
    public void setIsEducate(int isEducate) {
        this.isEducate = isEducate;
    }
    @Column(name = "over")
    public int getOver() {
        return over;
@ -263,4 +305,23 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
    public void setOtherAdvice(String otherAdvice) {
        this.otherAdvice = otherAdvice;
    }
    @Column(name = "source")
    public int getSource() {
        return source;
    }
    public void setSource(int source) {
        this.source = source;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "update_time")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 42 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyTemplateAdvice.java

@ -0,0 +1,42 @@
package com.yihu.wlyy.entity.doctor.survey;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by hmf on 2018/7/4.
 */
@Entity
@Table(name = "wlyy_survey_template_advice")
public class SurveyTemplateAdvice extends IdEntity {
    private String templateCode;//关联的筛查模板code
    private String adviceCode;//建议code
    private Date czrq;//创建时间
    public String getTemplateCode() {
        return templateCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }
    public String getAdviceCode() {
        return adviceCode;
    }
    public void setAdviceCode(String adviceCode) {
        this.adviceCode = adviceCode;
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyTemplateOptions.java

@ -33,6 +33,8 @@ public class SurveyTemplateOptions extends IdEntity implements Serializable {
    private Integer sort;
    //    删除标志(1正常,0删除)
    private Integer del;
    //评分
    private Integer score;
    public SurveyTemplateOptions() {
    }
@ -129,4 +131,12 @@ public class SurveyTemplateOptions extends IdEntity implements Serializable {
    public void setDel(Integer del) {
        this.del = del;
    }
    public Integer getScore() {
        return score;
    }
    public void setScore(Integer score) {
        this.score = score;
    }
}

+ 143 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyTemplateResult.java

@ -0,0 +1,143 @@
package com.yihu.wlyy.entity.doctor.survey;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 问卷调查模板评分筛查表
 * Created by hmf on 2018/7/3.
 */
@Entity
@Table(name = "wlyy_survey_template_result")
public class SurveyTemplateResult extends IdEntity {
    private static final long serialVersionUID = 1L;
    private String code;//筛选结果编码
    private String templateCode;//模板编码
    private Integer lowScore;//分值范围低分
    private Integer highScore;//分值范围高分
    private String result;//分析结果
    private String advice;//筛查建议
    private Integer warning;//是否高危预警(1是,0否)
    private Integer del;//删除标志(1正常,0删除)
    private Date createTime;             //创建时间
    private String createUser;
    private String createUserName;
    private String updateUser;
    private String updateUserName;
    private Date updateTime;//修改时间
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getTemplateCode() {
        return templateCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }
    public Integer getLowScore() {
        return lowScore;
    }
    public void setLowScore(Integer lowScore) {
        this.lowScore = lowScore;
    }
    public Integer getHighScore() {
        return highScore;
    }
    public void setHighScore(Integer highScore) {
        this.highScore = highScore;
    }
    public String getResult() {
        return result;
    }
    public void setResult(String result) {
        this.result = result;
    }
    public String getAdvice() {
        return advice;
    }
    public void setAdvice(String advice) {
        this.advice = advice;
    }
    public Integer getWarning() {
        return warning;
    }
    public void setWarning(Integer warning) {
        this.warning = warning;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 19 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyTemplates.java

@ -20,6 +20,8 @@ public class SurveyTemplates extends IdEntity implements Serializable{
    private  String title;
//    模板说明
    private String templateComment;
    private Integer diseaseType;//疾病类型,对应专病code
    private String organization;//发布机构
//    创建人(医生编码)
    private String creater;
//    删除标志(1正常,0删除)
@ -29,6 +31,7 @@ public class SurveyTemplates extends IdEntity implements Serializable{
//修改时间
    private  Date updateTime;
    public SurveyTemplates() {
    }
@ -97,4 +100,20 @@ public class SurveyTemplates extends IdEntity implements Serializable{
    public void setDel(int del) {
        this.del = del;
    }
    public Integer getDiseaseType() {
        return diseaseType;
    }
    public void setDiseaseType(Integer diseaseType) {
        this.diseaseType = diseaseType;
    }
    public String getOrganization() {
        return organization;
    }
    public void setOrganization(String organization) {
        this.organization = organization;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java

@ -30,7 +30,7 @@ public class Message extends IdEntity {
	/** type
	 *  消息类型(1.是家庭签约信息  2.体征消息  3分配健管师 4.随访提醒 5.咨询回复提醒,6.续方咨询待审核提醒,7.续方消息待取药
	 *  8.续方支付成功后团队长分配健管师,9线下调整完成,10意见反馈 11账号申诉,12.协同服务 13.孕检提醒 14.文章提交审核消息  15、健康文章审核结果
	 *  16.专科医生申请签约消息
	 *  16.专科医生申请签约消息 18.专科医生同意签约发送给全科医生消息
	 *  101患者申请取消签约、102患者同意取消签约、103患者拒绝取消签约、104患者填写了血糖记录、105患者填写了血压记录、106患者填写了体重记录、
	 *  107患者填写了腰围记录、108患者填写了运动记录、109患者填写了用药记录、110患者填写了饮食记录、111患者提交了问卷随访、112请求添加好友消息、
	 *  113入群消息、114群解散消息、115踢出群消息、116新的网络咨询、117网络咨询追问、

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/specialist/TeamDiseaseRelation.java

@ -11,7 +11,7 @@ import java.util.Date;
 * Created by Trick on 2018/7/4.
 */
@Entity
@Table(name = "wlyy_special_disease")
@Table(name = "wlyy_team_disease_relation")
public class TeamDiseaseRelation extends IdEntity {
    private Long teamCode;//团队id',

+ 17 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyAdviceDao.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.survey.SurveyAdvice;
import com.yihu.wlyy.entity.doctor.survey.SurveyTemplateAdvice;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by zhangdan on 2018/7/4.
 */
public interface SurveyAdviceDao extends PagingAndSortingRepository<SurveyAdvice, Long> {
    @Query("select a from SurveyAdvice a where a.code=?1")
    SurveyAdvice getByCode(String code);
}

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

@ -20,4 +20,7 @@ public interface SurveyOptionAnswersDao extends PagingAndSortingRepository<Surve
    @Query("select  count(distinct  t.patient) from SurveyOptionAnswers t where t.surveyCode =?1 and t.questionCode=?2 ")
    int countByRelationCode(String id, String questionId);
    @Query("select a from  SurveyOptionAnswers a where a.patient=?1 and a.surveyCode=?2")
    List<SurveyOptionAnswers> getBySurveyCodeAndPatient(String patient,String surveyCode);
}

+ 13 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyScreenResultDao.java

@ -1,6 +1,8 @@
package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -9,5 +11,16 @@ import java.util.List;
 * Created by zhangdan on 2018/7/2.
 */
public interface SurveyScreenResultDao extends PagingAndSortingRepository<SurveyScreenResult, Long> {
    @Query("select surveyScreenResult from SurveyScreenResult surveyScreenResult where surveyScreenResult.code=?1")
    SurveyScreenResult getSurveyScreenResultByCode(String code);
    @Query(nativeQuery = true, value = "SELECT * FROM `wlyy_survey_screen_result` WHERE template_code=?1 ORDER BY czrq DESC LIMIT 1")
    List<SurveyScreenResult> findNewOneByTemplateCode(String templateCode);
    @Query("select a from  SurveyScreenResult a where a.parentCode=?1 and a.templateCode=?2")
    List<SurveyScreenResult> getByPatientCodeAndTemplateCode(String patientCode,String templateCode);
    @Modifying
    @Query("update SurveyScreenResult s set s.isAgain=0 where s.code=?1")
    void updateNoAgain(String code);
}

+ 18 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyTemplateAdviceDao.java

@ -0,0 +1,18 @@
package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
import com.yihu.wlyy.entity.doctor.survey.SurveyTemplateAdvice;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by zhangdan on 2018/7/4.
 */
public interface SurveyTemplateAdviceDao extends PagingAndSortingRepository<SurveyTemplateAdvice, Long> {
    @Query("select a from SurveyTemplateAdvice a where a.templateCode=?1")
    List<SurveyTemplateAdvice> getByTemplateCode(String code);
}

+ 18 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyTemplateResultDao.java

@ -0,0 +1,18 @@
package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
import com.yihu.wlyy.entity.doctor.survey.SurveyTemplateResult;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by zhangdan on 2018/7/4.
 */
public interface SurveyTemplateResultDao extends PagingAndSortingRepository<SurveyTemplateResult, Long> {
    @Query("select a from SurveyTemplateResult a where a.templateCode=?1 and a.lowScore<=?2 and a.highScore>=?2")
    SurveyTemplateResult getByTemplateCodeAndLowScoreAndHighScore (String template,int score);
}

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyServerDao.java

@ -16,4 +16,5 @@ public interface SignFamilyServerDao extends PagingAndSortingRepository<SignFami
    @Query("select f from SignFamilyServer f where f.signCode = ?1 and f.serverType in (4,5)")
    List<SignFamilyServer> findBySignCodeAndType(String signCode);
    List<SignFamilyServer> findBySignCode(String signCode);
}

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/PatientDiseaseServerDao.java

@ -13,4 +13,5 @@ public interface PatientDiseaseServerDao extends
        PagingAndSortingRepository<PatientDiseaseServer, Long>,
        JpaSpecificationExecutor<PatientDiseaseServer> {
    List<PatientDiseaseServer> findByPatientAndDel(String patient,String del);
    List<PatientDiseaseServer> findBySpecialistRelationCodeAndDel(String code,String del);
}

+ 6 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/SpecialDiseaseDao.java

@ -2,14 +2,17 @@ package com.yihu.wlyy.repository.specialist;
import com.yihu.wlyy.entity.specialist.SpecialDisease;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/7/4.
 */
public interface SpecialDiseaseDao extends
        PagingAndSortingRepository<SpecialDisease, Long>,
        JpaSpecificationExecutor<SpecialDisease> {
public interface SpecialDiseaseDao extends PagingAndSortingRepository<SpecialDisease, Long>, JpaSpecificationExecutor<SpecialDisease> {
    SpecialDisease findByCode(String code);
    List<SpecialDisease> findByDel(String del);
}

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

@ -1811,4 +1811,25 @@ public class PatientInfoService extends BaseService {
        }
        return patientList;
    }
    public List<Map<String,Object>> getPatientSignByDoctor(int pageNo,int pageSize,String keyWord,String doctor)throws Exception{
        int start = (pageNo-1)*pageSize;
        String sql = "SELECT `name`,patient,mobile,idcard,openid FROM wlyy_sign_family WHERE `status`>0 AND (doctor='"+doctor+"' OR doctor_health='"+doctor+"')";
        if (StringUtils.isNotEmpty(keyWord)){
            sql += " and name LIKE '%"+keyWord+"%'";
        }
        sql += " limit ?,?";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        for (Map<String,Object> map : list){
            String idcard = String.valueOf(map.get("idcard"));
            map.put("sex",IdCardUtil.getSexForIdcard(idcard));
            map.put("age",IdCardUtil.getAgeForIdcard(idcard));
            /*String healthSql ="SELECT value1,value2 FROM device.wlyy_patient_health_index WHERE user='"+String.valueOf(map.get("patient"))+"' AND type=3 ORDER BY record_date DESC LIMIT 1";
            List<Map<String,Object>> healthMapList = jdbcTemplate.queryForList(healthSql);
            if (healthMapList!=null && healthMapList.size()>0){
                map.putAll(healthMapList.get(0));
            }*/
        }
        return list;
    }
}

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

@ -20,6 +20,7 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.specialist.SpecialistService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
@ -81,6 +82,8 @@ public class SignPatientLabelInfoService extends BaseService {
    TrackPatientDao trackPatientDao;
    @Autowired
    PatientHealthIndexService patientHealthIndexService;
    @Autowired
    SpecialistService specialistService;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -263,6 +266,14 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("isTrack","0");
            }
        }
        //1.4.9  是否专科医生服务
        JSONArray jsonArray =specialistService.findPatientSignSpecialist(patient);
        if(jsonArray!=null&&jsonArray.length()>0){
            json.put("isSpecialist",1);
        }else{
            json.put("isSpecialist",0);
        }
        return json;
    }

+ 297 - 179
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java

@ -1,8 +1,16 @@
package com.yihu.wlyy.service.app.survey;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.survey.*;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -23,32 +31,48 @@ import java.util.*;
@Transactional
public class SurveyScreenResultService extends BaseService {
    @Autowired
    private SurveyQuestionnaireDao surveyQuestionnaireDao;
    SurveyStatisticsDao surveyStatisticsDao;
    @Autowired
    private SurveyQuestionnaireOptionsDao surveyQuestionnaireOptionsDao;
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private SurveyDao surveyDao;
    private SurveyTemplatesDao surveyTemplatesDao;
    @Autowired
    private SurveyUserDao surveyUserDao;
    private PatientDao patientDao;
    @Autowired
    private SurveyOptionAnswersDao surveyOptionAnswersDao;
    private SurveyScreenResultDao surveyScreenResultDao;
    @Autowired
    private SurveyAnswersDao surveyAnswersDao;
    private SurveyTemplateResultDao surveyTemplateResultDao;
    @Autowired
    SurveyStatisticsDao surveyStatisticsDao;
    private SurveyTemplateAdviceDao surveyTemplateAdviceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private SurveyTemplateQuestionsDao surveyTemplateQuestionsDao;
    @Autowired
    private SurveyTemplatesDao surveyTemplatesDao;
    private DoctorDao doctorDao;
    @Autowired
    private SurveyAdviceDao surveyAdviceDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
    /**
     * 筛查记录结果列表
     * @param pageNo
     * @param pageSize
     * @param doctor
     * @param diseaseType
     * @param dealType
     * @param isDanger
     * @param patientName
     * @return
     * @throws Exception
     */
    public Map<String,Object> getResultList(int pageNo, int pageSize,String doctor,String diseaseType,String dealType,String isDanger,String patientName) throws Exception {
        int start = (pageNo-1)*pageSize;
        String sql = "SELECT ssr.* FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1  and ssr.doctor='"+doctor+"'";
        String countSql = "SELECT count(*) num FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.doctor='"+doctor+"'";
        String sql = "SELECT ssr.* FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.source=1 and ssr.doctor='"+doctor+"'";
        //String countSql = "SELECT count(*) num FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.doctor='"+doctor+"'";
        if (StringUtils.isNotEmpty(isDanger)){
            sql += " AND ssr.is_danger= "+isDanger;
        }
@ -60,7 +84,7 @@ public class SurveyScreenResultService extends BaseService {
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("1",dealType)){
            //已预约
            sql += " AND ssr.`order` = 1";
            sql += " AND ssr.order = 1";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("2",dealType)){
            //已跟踪
@ -68,16 +92,29 @@ public class SurveyScreenResultService extends BaseService {
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("3",dealType)){
            //已接诊
            sql += " AND ssr.reservtion_code is not null";
            sql += " AND ssr.order = 2";
        }
        Map<String,Object> map = jdbcTemplate.queryForMap(countSql);
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("4",dealType)){
            //待处理
            sql +=" AND ssr.`order` = 0 AND ssr.following= 0";
        }
        List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
        sql += " limit "+start+","+pageSize;
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        Map<String,Object> map = new HashedMap();
        map.put("num",maps.size());
        map.put("data",surveyScreenResultList);
        return map;
    }
    /**
     * 筛查模板列表
     * @param pageNo
     * @param pageSize
     * @param labelType
     * @return
     */
    public List<SurveyTemplates> getScreenList(int pageNo,int pageSize,int labelType){
        int start = (pageNo-1)*pageSize;
        String sql = "SELECT st.* FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_label_info sli ON st.`code`= sli.relation_code WHERE st.del = 1 and sli.label="+labelType+" limit "+start+","+pageSize;
@ -85,189 +122,270 @@ public class SurveyScreenResultService extends BaseService {
        return surveyTemplatesList;
    }
    public JSONObject getSurveySummary(String patient, String id) throws Exception {
        JSONObject jsonObject = new JSONObject();
        Survey survey = surveyDao.findById(id);
        int complete = surveyUserDao.findByPatient(patient, id);
        String title = survey.getTitle();
        String comment = survey.getSurveyComment();
        int status = survey.getStatus();
        jsonObject.put("title", title);
        jsonObject.put("comment", comment);
        jsonObject.put("status", status);
        jsonObject.put("complete", complete == 0 ? 0 : 1);
        return jsonObject;
    }
    /**
     * @param id   问卷id
     * @param sort 当前问题的sort(初始为1)
     * 保存筛查结果
     * @param patientCode
     * @param doctor
     * @param source
     * @param jsonData
     */
    public JSONObject getQuestions(String id, Integer sort) throws Exception {
        JSONObject jsonObject = new JSONObject();
        SurveyQuestionnaire question = null;
        //      该套问卷总题目数
        int total = surveyQuestionnaireDao.findTotalById(id);
        question = surveyQuestionnaireDao.findTotalByIdAndSort(id, sort);
        int sorts = question.getSort();
        String qstCode = question.getCode();
        String qstTitle = question.getTitle();
        int isRequired = question.getIsRequired();
        if (question.getQuestionCodeNext() != null) {
            String next = question.getQuestionCodeNext();
            SurveyQuestionnaire sq = surveyQuestionnaireDao.findByIdAndQstId(id, next);
            System.out.println("");
            jsonObject.put("nextQuestion", sq == null ? 0 : sq.getSort());
        }
        if (!StringUtils.isEmpty(question.getQuestionComment())) {
            jsonObject.put("comment", question.getQuestionComment());
        }
        int type = question.getQuestionType();
        switch (type) {
            case 0:
                List<SurveyQuestionnaireOptions> options = surveyQuestionnaireOptionsDao.findByIdAndQstCode(id, qstCode);
                List list = new ArrayList();
                for (SurveyQuestionnaireOptions option : options) {
//                        可构造集合,返回选项特定值
                    Map<String, Object> map = new HashMap<>();
                    String content = option.getContent();
                    int optSort = option.getSort();
                    int required = option.getIsRequired();
                    String surCod = option.getSurveyCode();
                    int del = option.getDel();
                    int havaComment = option.getHaveComment();
                    String code = option.getCode();
                    String questionCode = option.getQuestionnaireCode();
                    long optid = option.getId();
                    map.put("content", content);
                    map.put("isRequired", required);
                    map.put("code", code);
                    map.put("del", del);
                    map.put("sort", optSort);
                    map.put("surveyCode", surCod);
                    map.put("havaComment", havaComment);
                    map.put("questionnaireCode", questionCode);
                    map.put("id", optid);
                    if (option.getQuestionCodeNext() != null) {
                        String next = option.getQuestionCodeNext();
                        SurveyQuestionnaire sq = surveyQuestionnaireDao.findByIdAndQstId(id, next);
                        map.put("nextQuestion", sq == null ? 0 : sq.getSort());
                    }
                    list.add(map);
                }
                jsonObject.put("options", list);
                break;
            case 1:
                List<SurveyQuestionnaireOptions> optionss = surveyQuestionnaireOptionsDao.findByIdAndQstCode(id, qstCode);
                List lis = new ArrayList();
                for (SurveyQuestionnaireOptions option : optionss) {
//                        可构造集合,返回选项特定值
                    Map<String, Object> map = new HashMap<>();
                    String content = option.getContent();
                    int optSort = option.getSort();
                    int required = option.getIsRequired();
                    String surCod = option.getSurveyCode();
                    int del = option.getDel();
                    int havaComment = option.getHaveComment();
                    String code = option.getCode();
                    String questionCode = option.getQuestionnaireCode();
                    long optid = option.getId();
                    map.put("content", content);
                    map.put("isRequired", required);
                    map.put("code", code);
                    map.put("del", del);
                    map.put("sort", optSort);
                    map.put("surveyCode", surCod);
                    map.put("havaComment", havaComment);
                    map.put("questionnaireCode", questionCode);
                    map.put("id", optid);
                    if (option.getQuestionCodeNext() != null) {
                        String next = option.getQuestionCodeNext();
                        SurveyQuestionnaire sq = surveyQuestionnaireDao.findByIdAndQstId(id, next);
                        map.put("nextQuestion", sq == null ? 0 : sq.getSort());
                    }
                    lis.add(map);
                }
                jsonObject.put("options", lis);
                Integer maxNum = question.getMaxNum();
                Integer minNum = question.getMinNum();
                jsonObject.put("maxNum", maxNum);
                jsonObject.put("minNum", minNum);
//                jsonObject.put("options", optionss);
                break;
           /* case 2:
                if (question.getQuestionCodeNext() != null) {
                    String next = question.getQuestionCodeNext();
                    SurveyQuestionnaire sq = surveyQuestionnaireDao.findByIdAndQstId(id, next);
                    jsonObject.put("nextQuestion", sq.getSort());
                }
                break;*/
        }
        jsonObject.put("qstCode", qstCode);
        jsonObject.put("qstTitle", qstTitle);
        jsonObject.put("isRequired", isRequired);
        jsonObject.put("type", type);
        jsonObject.put("sort", sorts);
//        题目数量是变量
        jsonObject.put("totalNum", total);
        logger.error("居民获取题目信息==》" + jsonObject);
        return jsonObject;
    }
    public void saveAnswer(String patient, JSONObject jsonData) throws Exception {
        System.out.println("********jsonData********* " + jsonData);
        //解析json保存各种答案
    public String saveScreenResult(String patientCode,String doctor,int isAgain,int source, JSONObject jsonData){
        System.out.println("********保存筛查结果--jsonData********* " + jsonData);
        String surveyCode = jsonData.get("surveyCode").toString();
        Date createTime = new Date();
//        获取一维数组
        SurveyTemplates surveyTemplates = surveyTemplatesDao.findById(surveyCode);
        Patient patient = patientDao.findByCode(patientCode);
        SurveyScreenResult surveyScreenResult =  new SurveyScreenResult();
        //解析json保存各种答案--获取一维数组
        JSONArray questions = jsonData.getJSONArray("questions");
        int totalScore = 0;
        for (int i = 0; i < questions.length(); i++) {
//            获取每一道题的信息
            //获取每一道题的信息
            JSONObject question = new JSONObject(questions.get(i).toString());
            String qstCode = question.get("qstCode").toString();
            int qstsort = Integer.parseInt(question.get("sort").toString());
            int type = Integer.parseInt(question.get("type").toString());
            if (type != 2) {
                if (question.has("options")) {
//               获取每道题的所有选项
                    //获取每道题的所有选项
                    JSONArray options = question.getJSONArray("options");
                    for (int j = 0; j < options.length(); j++) {
                        JSONObject option = new JSONObject(options.get(j).toString());
                        String code = getCode();
                        String optionCode = option.get("optionCode").toString();
                        int optsort = Integer.parseInt(option.get("sort").toString());
                        String comment = null;
                        int haveComment = 0;
                        if (option.has("comment")) {
                            comment = option.get("comment").toString();
                            haveComment = 1;
                        }
//                 保存到选择题答案表
                        SurveyOptionAnswers optionAnswer = new SurveyOptionAnswers(code, patient, surveyCode, qstCode, optionCode, comment, type, createTime);
                        surveyOptionAnswersDao.save(optionAnswer);
//                选择题修改统计表数量
                        surveyStatisticsDao.modifyAmount(surveyCode, qstCode, optionCode);
                        int score = Integer.parseInt(option.getString("score"));
                        totalScore += score;
                    }
                }
            }
        }
        //查询该筛查的结果设置
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode,totalScore);
        //更新上一条数据为不可再次评估
        List<SurveyScreenResult> surveyScreenResultList = surveyScreenResultDao.findNewOneByTemplateCode(surveyCode);
        String lastCode = "";
        String originCode = "";
        if (surveyScreenResultList!=null && surveyScreenResultList.size()>0){
            lastCode = surveyScreenResultList.get(0).getCode();
            originCode = surveyScreenResultList.get(0).getOriginCode();
            surveyScreenResultDao.updateNoAgain(lastCode);
        }
        String code = getCode();
        surveyScreenResult.setCode(code);
        surveyScreenResult.setSource(source);
        //是来自再次评估
        if (isAgain==1){
            surveyScreenResult.setParentCode(lastCode);
            surveyScreenResult.setOriginCode(originCode);
        }else {
            //来自第一次筛查评分
            surveyScreenResult.setOriginCode(code);
        }
        if (surveyTemplates!=null){
            surveyScreenResult.setTemplateCode(surveyTemplates.getCode());
            surveyScreenResult.setTemplateTitle(surveyTemplates.getTitle());
            surveyScreenResult.setDisease(surveyTemplates.getDiseaseType());
        }
        //来自医生发放和自我评估不一样来源
        if (source==1){
            surveyScreenResult.setDoctor(doctor);
        }else {
            SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
            if (signFamily!=null && StringUtils.isNotEmpty(signFamily.getDoctor())){
                surveyScreenResult.setDoctor(signFamily.getDoctor());
            }
            if (signFamily!=null && StringUtils.isNotEmpty(signFamily.getDoctorHealth())){
                surveyScreenResult.setDoctor(signFamily.getDoctorHealth());
            }
        }
        surveyScreenResult.setPatientCode(patientCode);
        if (patient!=null){
            surveyScreenResult.setPatientName(patient.getName());
            surveyScreenResult.setOpenId(patient.getOpenid());
        }
        surveyScreenResult.setOrder(0);
        surveyScreenResult.setFollowing(0);
        surveyScreenResult.setOver(1);
        surveyScreenResult.setCzrq(new Date());
        surveyScreenResult.setIsAgain(1);
        surveyScreenResult.setScreenResultScore(totalScore);
        if (surveyTemplateResult!=null){
            surveyScreenResult.setScreenResultCode(surveyTemplateResult.getCode());
            surveyScreenResult.setIsDanger(surveyTemplateResult.getWarning());
            surveyScreenResult.setScreenResult(surveyTemplateResult.getResult());
        }
        surveyScreenResultDao.save(surveyScreenResult);
        return code;
            } else {
                String content = question.get("content").toString();
                if (!StringUtils.isEmpty(content)) {
//                    保存到问答题答案表
                    String code = getCode();
                    SurveyAnswers surveyAnswer = new SurveyAnswers(code, surveyCode, patient, qstCode, content, createTime);
                    surveyAnswersDao.save(surveyAnswer);
//                问答题保存到统计表(只负责更改数量不负责创建)
                    surveyStatisticsDao.modifyAmount(surveyCode, qstCode);
    }
    public JSONObject getScreenResultDetail(String code)throws Exception{
        JSONObject json = new JSONObject();
        //登记信息
        String infoSql = "SELECT ssr.*,p.idcard FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient p ON ssr.patient_code=p.code where ssr.code ='"+code+"'";
        Map<String,Object> infoMap = jdbcTemplate.queryForMap(infoSql);
        if (infoMap==null || infoMap.size()==0){
            json.put(code,-1);
            json.put("message","没有改筛查结果!");
            return json;
        }
        /*String idcard = String.valueOf(infoMap.get("idcard"));
        infoMap.put("sex",IdCardUtil.getSexForIdcard(idcard));
        infoMap.put("age",IdCardUtil.getAgeForIdcard(idcard));*/
        String templateCode = String.valueOf(infoMap.get("template_code"));
        //String doctorCode = String.valueOf(infoMap.get("doctor"));
        String patientCode = String.valueOf(infoMap.get("patient_code"));
       /* Doctor doctor = doctorDao.findByCode(doctorCode);
        if (doctor!=null){
            infoMap.put("doctorName",doctor.getName());
        }*/
        json.put("info",infoMap);
        /*String healthSql ="SELECT value1,value2 FROM device.wlyy_patient_health_index WHERE user='"+patientCode+"' AND type=3 ORDER BY record_date DESC LIMIT 1";
        List<Map<String,Object>> healthMapList = jdbcTemplate.queryForList(healthSql);
        if (healthMapList!=null && healthMapList.size()>0){
            json.put("health",healthMapList.get(0));
        }*/
        //题目和答案
        List<SurveyTemplateQuestions> questionList = surveyTemplateQuestionsDao.findById(templateCode);
        String sql = "SELECT soa.*,sto.score FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code=? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String,Object>> optionAnswersList = jdbcTemplate.queryForList(sql,new Object[]{code,patientCode,templateCode});
        for (SurveyTemplateQuestions surveyTemplateQuestions : questionList){
            Map<String,Object> map = new HashMap<>();
            map.put("question",surveyTemplateQuestions);
            String qusCode = surveyTemplateQuestions.getCode();
            for (Map<String,Object> option : optionAnswersList){
                if (option.get("question_code").equals(qusCode)){
                    map.put("option",option);
                }
            }
            json.put(surveyTemplateQuestions.getSort()+"",map);
        }
        //结果
        String reultSql ="SELECT ssr.screen_result_score,ssr.screen_result,str.advice FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='"+code+"'";
        Map<String,Object> resultMap = jdbcTemplate.queryForMap(reultSql);
        int following = Integer.parseInt(String.valueOf(infoMap.get("following")));
        int order = Integer.parseInt(String.valueOf(infoMap.get("order")));
        if (order>0){
            //已转诊
            String doctorSql ="SELECT pr.doctor_name FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient_reservation pr ON ssr.reservation_code= pr.`code` where ssr.`code`='"+code+"'";
            List<String> list= jdbcTemplate.queryForList(doctorSql,String.class);
            if (list!=null && list.size()>0){
                json.put("specialDoctorName",list.get(0));
            }
        }else if (following==1){
            String adviceCodes = String.valueOf(infoMap.get("advice_code"));
            List<SurveyAdvice> surveyAdviceList = new ArrayList<>();
            if (StringUtils.isNotEmpty(adviceCodes)){
                String[] advicesStr = adviceCodes.split(",");
                for (String adviceCode : advicesStr){
                    surveyAdviceList.add(surveyAdviceDao.getByCode(adviceCode));
                }
            }
            resultMap.put("advice",surveyAdviceList);
        }
        json.put("result",resultMap);
        return json;
    }
    public List<Map<String,Object>> getTemplateAdviceList(String templateCode){
        String sql ="SELECT st.template_code,sa.code adviceCode,sa.advice FROM wlyy_survey_template_advice st LEFT JOIN wlyy_survey_advice sa ON st.advice_code=sa.`code` WHERE st.template_code='"+templateCode+"'";
        return jdbcTemplate.queryForList(sql);
    }
    public void updateAfterFollowing(String code,String adviceCodes,String otherAdvice)throws Exception{
        String sql ="UPDATE wlyy_survey_screen_result SET following=1,advice_code=?";
        if (StringUtils.isNotEmpty(otherAdvice)){
            sql += " ,other_advice=?";
        }
//        更改调查对象表答题状态为已答
        surveyUserDao.modifyStatus(surveyCode, patient);
        sql +=" where code=?";
        if (StringUtils.isNotEmpty(otherAdvice)){
            jdbcTemplate.update(sql,new Object[]{adviceCodes,otherAdvice,code});
        }else {
            jdbcTemplate.update(sql,new Object[]{adviceCodes,code});
        }
    }
    public void updateColume(String colume,Object value,String code){
        String sql ="UPDATE wlyy_survey_screen_result SET "+colume+"=? where code=?";
        jdbcTemplate.update(sql,new Object[]{value,code});
    }
    public Map<String,Object> patientGetList(int pageNo,int pageSize,int labelType,String patientCode){
        Map<String,Object> map = new HashedMap();
        List<SurveyTemplates> templates = getScreenList(pageNo,pageSize,labelType);
        List<Map<String,Object>> mapList = new ArrayList<>();
        for (SurveyTemplates surveyTemplates : templates){
            Map<String,Object> sMap = new HashedMap();
            sMap.put("surveyTemplate",surveyTemplates);
            int count =  surveyScreenResultDao.getByPatientCodeAndTemplateCode(patientCode,surveyTemplates.getCode()).size();
            sMap.put("myRecordCount",count);
            mapList.add(sMap);
        }
        map.put("screenList",mapList);
        String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result WHERE patient_code='"+patientCode+"' ORDER BY czrq DESC) a  GROUP BY a.template_code";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        map.put("result",surveyScreenResultList);
        return map;
    }
    public List<Map<String,Object>> getResultByTemplateCode(int pageNo,int pageSize,String templateCode,String patientCode){
        int start = (pageNo-1)*pageSize;
        String sql ="SELECT st.*,ssr.code screenCode,ssr.screen_result,ssr.screen_result_score,ssr.czrq as screenCzrq,ssr.is_again FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_screen_result ssr ON st.code = ssr.template_code WHERE st.`code`='"+templateCode+"' AND ssr.patient_code='"+patientCode+"' limit ?,?";
        return jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
    }
    public Map<String,Object> screenStatics(String doctor){
        Map<String,Object> resultMap = new HashedMap();
        String userSql = "SELECT DISTINCT(template_code) FROM wlyy_survey_screen_result WHERE doctor = '"+doctor+"'";
        List<String> userList = jdbcTemplate.queryForList(userSql,String.class);
        //使用筛查表数量
        resultMap.put("useTemplateCount",userList.size());
        String sql = "SELECT * FROM wlyy_survey_screen_result WHERE doctor='"+doctor+"'";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        //下发问卷数量
        resultMap.put("grantCount",surveyScreenResultList.size());
        int overCount = 0;
        int warnCount = 0;
        int followCount = 0;
        int orderCount = 0 ;
        int againCount = 0;
        int eduCount = 0;
        for (SurveyScreenResult surveyScreenResult : surveyScreenResultList){
            if (surveyScreenResult.getOver()==1){
                overCount++;
            }
            if (surveyScreenResult.getIsDanger()==1){
                warnCount++;
            }
            if (surveyScreenResult.getFollowing()==1){
                followCount++;
            }
            if (surveyScreenResult.getOrder()==1){
                orderCount++;
            }
            if (StringUtils.isNotEmpty(surveyScreenResult.getParentCode())){
                againCount++;
            }
            if (surveyScreenResult.getIsEducate()==1){
                eduCount++;
            }
        }
        //筛查记录
        resultMap.put("overCount",overCount);
        //疑似高危
        resultMap.put("dangetCount",warnCount);
        //健康跟踪
        resultMap.put("followCount",followCount);
        //已跟踪
        resultMap.put("orderCount",orderCount);
        //再次评估
        resultMap.put("againCount",againCount);
        //健康教育
        resultMap.put("eduCount",eduCount);
        return  resultMap;
    }
    public void getSpecialDoctorScreenList(String doctor,int type,int pageNo,int pageSize){
    }
}

+ 130 - 21
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.specialist.PatientDiseaseServer;
import com.yihu.wlyy.entity.specialist.SpecialDisease;
import com.yihu.wlyy.entity.specialist.TeamDiseaseRelation;
@ -73,6 +74,8 @@ public class SpecialistService extends BaseService {
    private SpecialDiseaseDao specialDiseaseDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    public String setPatientLabelInfo(List<SignPatientLabelInfo> list) {
        if (list != null && list.size() > 0) {
@ -387,7 +390,13 @@ public class SpecialistService extends BaseService {
    public Map<String, Object> findSpecialistTeamInfo(String doctor, Long teamCode) {
        String sql = "SELECT t.id, " +
                " t. NAME, " +
                " d.photo " +
                " d.photo," +
                " d.hospital," +
                " d.hospital_name AS hospitalName," +
                " d.code AS doctor," +
                " d.name AS doctorName ," +
                " d.dept," +
                " d.dept_name AS deptName" +
                " FROM " +
                " wlyy_admin_team t " +
                " JOIN wlyy_admin_team_member m ON t.id = m.team_id " +
@ -430,8 +439,7 @@ public class SpecialistService extends BaseService {
        Patient p = patientDao.findByCode(patient);
        Doctor d = doctorDao.findByCode(doctor);
        SpecialDisease dis = specialDiseaseDao.findByCode(disease);
        if (p != null && d != null && dis != null) {
        if (p != null && d != null) {
            Map<String, Object> param = new HashedMap();
            param.put("doctor", doctor);
            param.put("doctorName", d.getName());
@ -441,18 +449,22 @@ public class SpecialistService extends BaseService {
            HttpResponse response = HttpUtils.doPost(specialistUrl + "svr-specialist/signSpecialistTeam", param);
            JSONObject rs = new JSONObject(response.getContent());
            if ("succes".equals(rs.getString("message"))) {
                // 保存居民病种
                PatientDiseaseServer server = new PatientDiseaseServer();
                server.setCode(getCode());
                server.setDel("1");
                server.setSpecialistRelationCode(rs.getString("obj"));
                server.setPatient(patient);
                server.setPatientName(p.getName());
                server.setDisease(dis.getCode());
                server.setDiseaseName(dis.getName());
                server.setCreateTime(new Date());
                patientDiseaseServerDao.save(server);
                String[] str = disease.split(",");
                for (String ds : str) {
                    SpecialDisease dis = specialDiseaseDao.findByCode(ds);
                    // 保存居民病种
                    PatientDiseaseServer server = new PatientDiseaseServer();
                    server.setCode(getCode());
                    server.setDel("1");
                    server.setSpecialistRelationCode(rs.getString("obj"));
                    server.setPatient(patient);
                    server.setPatientName(p.getName());
                    server.setDisease(dis.getCode());
                    server.setDiseaseName(dis.getName());
                    server.setCreateTime(new Date());
                    patientDiseaseServerDao.save(server);
                }
                // 添加签约申请消息
                Message message = new Message();
                message.setCzrq(new Date());
@ -471,6 +483,17 @@ public class SpecialistService extends BaseService {
                message.setOver("1");//未处理
                message.setRelationCode(rs.getString("obj"));
                message.setDel("1");
                JSONObject dataJson = new JSONObject();
                dataJson.put("doctor",d.getCode());
                dataJson.put("doctorName",d.getName());
                dataJson.put("hospital",d.getHospital());
                dataJson.put("hospitalName",d.getHospitalName());
                dataJson.put("dept",d.getDept());
                dataJson.put("deptName",d.getDeptName());
                message.setReason(dataJson.toString());
                message.setState(1);
                messageDao.save(message);
@ -480,24 +503,32 @@ public class SpecialistService extends BaseService {
                mes.put("data", "");
                return mes;
            } else if ("doctor_exist".equals(rs.getString("message"))) {
                JSONObject obj = rs.getJSONObject("obj");
                mes.put("code", -1);
                mes.put("mes", "医生与患者已经签约");
                mes.put("data", rs.getJSONObject("obj"));
            } else if ("team_exist".equals(rs.getString("message"))){
                String relationCode =  obj.getString("relationCode");
                obj.put("server",patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(relationCode,"1"));
                mes.put("data", obj.toString());
                return mes;
            } else if ("team_exist".equals(rs.getString("message"))) {
                JSONObject obj = rs.getJSONObject("obj");
                mes.put("code", -2);
                mes.put("mes", "团队与患者已经签约");
                mes.put("data", rs.getJSONObject("obj"));
                String relationCode =  obj.getString("relationCode");
                obj.put("server",patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(relationCode,"1"));
                mes.put("data", obj.toString());
                return mes;
            } else {
                logger.info(response.getContent());
            }
        }
        mes.put("code",-3);
        mes.put("mes","获取居民信息失败");
        mes.put("code", -3);
        mes.put("mes", "获取居民信息失败");
        mes.put("data", "");
        return mes;
    }
    public String agreeSpecialistTeam(String state,String relationCode,String remark,Long mesId)throws Exception{
    public String agreeSpecialistTeam(String state, String relationCode, String remark, Long mesId) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("state", state);
        param.put("relationCode", relationCode);
@ -506,16 +537,94 @@ public class SpecialistService extends BaseService {
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            if(mesId!=null){
            if (mesId != null) {
                Message m = messageDao.findOne(mesId);
                m.setOver("0");
                m.setRead(0);
                messageDao.save(m);
            }
            JSONObject josn =  rs.getJSONObject("obj");
            SignFamily sign =  signFamilyDao.findByPatient(josn.getString("patient"));
            //判断是否有家庭医生,有家庭医生则通知家庭医生
            if(sign!=null){
                Patient p = patientDao.findByCode(josn.getString("patient"));
                Doctor d = doctorDao.findByCode(josn.getString("doctor"));
                // 添加签约申请消息
                Message message = new Message();
                message.setCzrq(new Date());
                message.setCreateTime(new Date());
                message.setContent("您有一个居民开通共管服务!");
                message.setRead(1);//设置未读
                message.setReceiver(sign.getDoctor());//设置接受医生的code
                message.setSender(p.getCode());//设置发送的用户
                message.setSenderName(p.getName());
                message.setCode(getCode());
                message.setTitle("专科医生共管通知");
                message.setType(18);//家庭签约取消信息
                message.setReadonly(0);//是否只读消息
                message.setSex(p.getSex());
                message.setOver("1");//未处理
                message.setRelationCode(relationCode);
                message.setDel("1");
                message.setState(1);
                JSONObject dataJson = new JSONObject();
                dataJson.put("doctor",d.getCode());
                dataJson.put("doctorName",d.getName());
                dataJson.put("hospital",d.getHospital());
                dataJson.put("hospitalName",d.getHospitalName());
                dataJson.put("dept",d.getDept());
                dataJson.put("deptName",d.getDeptName());
                message.setReason(dataJson.toString());
                messageDao.save(message);
            }
            return "1";
        }
        return "0";
    }
    public JSONObject findPatientSigninfo(String code) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("code", code);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findPatientSigninfo", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            JSONObject json = rs.getJSONObject("obj");
            List<PatientDiseaseServer> patientDiseaseServers =  patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(code,"1");
            json.put("diseaseServer",patientDiseaseServers);
            return json;
        }
        return null;
    }
    public JSONArray findPatientTeamList(String patient) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("patient", patient);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findPatientTeamList", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            JSONArray jr = rs.getJSONArray("obj");
            for(int i=0;i<rs.getJSONArray("obj").length();i++){
                JSONObject j = jr.getJSONObject(i);
                String relationCode =  j.getString("relationCode");
                j.put("server",patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(relationCode,"1"));
            }
            return jr;
        }
        return null;
    }
    public JSONArray findPatientSignSpecialist(String patient) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("patient", patient);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findPatientSignSpecialist", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            return rs.getJSONArray("obj");
        }
        return null;
    }
}

+ 74 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -786,7 +786,7 @@ public class ManagerQuestionnaireService extends BaseService {
    public JSONObject getAnswers(String id) throws Exception {
        JSONObject jsonObject = new JSONObject();
//一个问卷内的所有问题
        //一个问卷内的所有问题
        List<SurveyQuestionnaire> questions = surveyQuestionnaireDao.findById(id);
        if (questions.size() == 0) {
            return jsonObject;
@ -1727,4 +1727,77 @@ public class ManagerQuestionnaireService extends BaseService {
        return patients;
    }
    public JSONObject getAllQuestions(String surveyTemplateCode)throws Exception{
        JSONObject json = new JSONObject();
        List<SurveyTemplateQuestions> questionList = surveyTemplateQuestionsDao.findById(surveyTemplateCode);
        List<SurveyTemplateOptions> optionsList = surveyTemplateOptionsDao.findByQuestionCode(surveyTemplateCode);
        for (SurveyTemplateQuestions surveyTemplateQuestions : questionList){
            Map<String,Object> map = new HashMap<>();
            String qusCode = surveyTemplateQuestions.getCode();
            List<SurveyTemplateOptions>  resultOptionList = new ArrayList<>();
            for (SurveyTemplateOptions option : optionsList){
                if (option.getTemplateQuestionCode().equals(qusCode)){
                    resultOptionList.add(option);
                }
            }
            map.put("question",surveyTemplateQuestions);
            map.put("option",resultOptionList);
            json.put(surveyTemplateQuestions.getSort()+"",map);
        }
        return  json;
    }
    public void saveAnswer(String patient,String screenResultCode, JSONObject jsonData) throws Exception {
        System.out.println("********jsonData********* " + jsonData);
        //解析json保存各种答案
        String surveyCode = jsonData.get("surveyCode").toString();
        Date createTime = new Date();
//        获取一维数组
        JSONArray questions = jsonData.getJSONArray("questions");
        for (int i = 0; i < questions.length(); i++) {
//            获取每一道题的信息
            JSONObject question = new JSONObject(questions.get(i).toString());
            String qstCode = question.get("qstCode").toString();
            int qstsort = Integer.parseInt(question.get("sort").toString());
            int type = Integer.parseInt(question.get("type").toString());
            if (type != 2) {
                if (question.has("options")) {
//               获取每道题的所有选项
                    JSONArray options = question.getJSONArray("options");
                    for (int j = 0; j < options.length(); j++) {
                        JSONObject option = new JSONObject(options.get(j).toString());
                        String code = getCode();
                        String optionCode = option.get("optionCode").toString();
                        int optsort = Integer.parseInt(option.get("sort").toString());
                        String comment = null;
                        int haveComment = 0;
                        if (option.has("comment")) {
                            comment = option.get("comment").toString();
                            haveComment = 1;
                        }
//                 保存到选择题答案表
                        SurveyOptionAnswers optionAnswer = new SurveyOptionAnswers(code, patient, surveyCode, qstCode, optionCode, comment, type, createTime);
                        optionAnswer.setScreenResultCode(screenResultCode);
                        surveyOptionAnswersDao.save(optionAnswer);
//                选择题修改统计表数量
                        surveyStatisticsDao.modifyAmount(surveyCode, qstCode, optionCode);
                    }
                }
            } else {
                String content = question.get("content").toString();
                if (!StringUtils.isEmpty(content)) {
//                    保存到问答题答案表
                    String code = getCode();
                    SurveyAnswers surveyAnswer = new SurveyAnswers(code, surveyCode, patient, qstCode, content, createTime);
                    surveyAnswersDao.save(surveyAnswer);
//                问答题保存到统计表(只负责更改数量不负责创建)
                    surveyStatisticsDao.modifyAmount(surveyCode, qstCode);
                }
            }
        }
        //更改调查对象表答题状态为已答
        //surveyUserDao.modifyStatus(surveyCode, patient);
    }
}

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

@ -684,6 +684,13 @@ public class DoctorPatientGroupController extends BaseController {
                    jtJson.put("jyDate", DateUtil.dateToStr(jtSign.getApplyUnsignDate(), DateUtil.YYYY_MM_DD));
                    jtJson.put("status", jtSign.getStatus());
                    Doctor d =  doctorInfoService.findDoctorByCode(jtSign.getDoctor());
                    jtJson.put("doctor",jtSign.getDoctor());
                    jtJson.put("doctorName",jtSign.getDoctorName());
                    jtJson.put("hospital",d.getHospital());
                    jtJson.put("hospitalName",d.getHospitalName());
                    jtJson.put("mobile",d.getMobile());
                    json.put("jtSign", jtJson);
                } else {
                    json.put("jtSign", "");

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -569,4 +569,25 @@ public class PatientInfoController extends BaseController {
            return error( -1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPatientSignByDoctor",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("查询医生的签约居民")
    public String getPatientSignByDoctor(@ApiParam(value = "关键搜索词", name = "keyWord") @RequestParam(value = "keyWord",required = false,defaultValue = "")String keyWord,
                                         @ApiParam(name="pageNo",value="第几页",defaultValue = "1") @RequestParam(value="pageNo",required = true) String pageNo,
                                         @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize){
        if (StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (pageNo.equals("0")){
            pageNo = "1";
        }
        try {
            return  write(200,"查找成功!","data",patientInfoService.getPatientSignByDoctor(Integer.parseInt(pageNo),Integer.parseInt(pageSize),keyWord,getUID()));
        } catch (Exception e) {
            error(e);
            return error( -1, "查询失败!");
        }
    }
}

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -9,8 +9,10 @@ import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.SignFamilyServer;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.repository.patient.SignFamilyServerDao;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.family.FamilyMemberService;
import com.yihu.wlyy.service.app.message.MessageService;
@ -74,6 +76,8 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    FamilyMemberService familyMemberService;
    @Autowired
    SignPatientLabelDao labelDao;
    @Autowired
    SignFamilyServerDao signFamilyServerDao;
    @Autowired
    private CommonUtil CommonUtil;
@ -1098,9 +1102,11 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                }
                // 家庭签约
                if (jtSign != null) {
                    List<SignFamilyServer> servers = signFamilyServerDao.findBySignCode(jtSign.getCode());
                    json.put("applySurrDate", jtSign.getPatientApplyUnsignDate());
                    json.put("applyDate", jtSign.getPatientApplyDate());
                    json.put("jtSign",jtjson);
                    json.put("signFamilyServer",servers);
                }
                json.put("countryCode", temp.getSickVillage() == null ? "" : temp.getSickVillage());

+ 71 - 36
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java

@ -40,7 +40,7 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findHealthAssistant", method = RequestMethod.GET)
    @ApiOperation("获取所有计管师")
    public String findHealthAssistant(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor) {
    public String findHealthAssistant(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200, "获取成功", "data", specialistService.findHealthAssistant(doctor));
        } catch (Exception e) {
@ -51,7 +51,7 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findHealthAssistantPatientCount", method = RequestMethod.GET)
    @ApiOperation("获取所有计管师下居民数目")
    public String findHealthAssistantPatientCount(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor){
    public String findHealthAssistantPatientCount(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200, "获取成功", "data", specialistService.findHealthAssistantPatientCount(doctor));
        } catch (Exception e) {
@ -75,11 +75,11 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findLabelAndPatientCount", method = RequestMethod.GET)
    @ApiOperation("获取标签与居民数量")
    public String findLabelAndPatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
                                           @ApiParam(name = "type", value = "标签类型") @RequestParam(required = true)String type,
                                           @ApiParam(name = "teamCode", value = "团队id") @RequestParam(required = false)Long teamCode) {
    public String findLabelAndPatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true) String doctor,
                                           @ApiParam(name = "type", value = "标签类型") @RequestParam(required = true) String type,
                                           @ApiParam(name = "teamCode", value = "团队id") @RequestParam(required = false) Long teamCode) {
        try {
            return write(200, "获取成功", "data", specialistService.findLabelAndPatientCount(doctor,type,teamCode));
            return write(200, "获取成功", "data", specialistService.findLabelAndPatientCount(doctor, type, teamCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -111,12 +111,12 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findPatientRelatioByAssistant", method = RequestMethod.GET)
    @ApiOperation("获取计管师下未分配标签居民")
    public String findPatientRelatioByAssistant(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
    public String findPatientRelatioByAssistant(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true) String doctor,
                                                @ApiParam(name = "assistant", value = "计管师") @RequestParam(required = true) String assistant,
                                                @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                                @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) throws Exception {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientRelatioByAssistant(doctor,assistant, page, size));
            return write(200, "获取成功", "data", specialistService.findPatientRelatioByAssistant(doctor, assistant, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -137,13 +137,13 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "getPatientByLabel", method = RequestMethod.POST)
    @ApiOperation("获取标签下居民")
    public String getPatientByLabel(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                    @ApiParam(name = "labelType", value = "标签类型")@RequestParam(required = true) String labelType,
                                    @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true)String labelCode,
                                    @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                    @ApiParam(name = "size", value = "每页大小")@RequestParam(required = true) Integer size) {
    public String getPatientByLabel(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor,
                                    @ApiParam(name = "labelType", value = "标签类型") @RequestParam(required = true) String labelType,
                                    @ApiParam(name = "labelCode", value = "标签code") @RequestParam(required = true) String labelCode,
                                    @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                    @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.getPatientByLabel(doctor,labelType, labelCode, page, size));
            return write(200, "获取成功", "data", specialistService.getPatientByLabel(doctor, labelType, labelCode, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -152,7 +152,7 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findDoctorTeamMenmber", method = RequestMethod.GET)
    @ApiOperation("获取团队及团队成员")
    public String findDoctorTeamMenmber(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor) {
    public String findDoctorTeamMenmber(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200, "获取成功", "data", specialistService.findDoctorTeamMenmber(doctor));
        } catch (Exception e) {
@ -163,12 +163,12 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "getDoctorInHospital", method = RequestMethod.GET)
    @ApiOperation("获取院内工作人员")
    public String getDoctorInHospital(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                      @ApiParam(name = "name", value = "医生姓名模糊") @RequestParam(required = false)String name,
                                      @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                      @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size){
    public String getDoctorInHospital(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor,
                                      @ApiParam(name = "name", value = "医生姓名模糊") @RequestParam(required = false) String name,
                                      @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                      @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.getDoctorInHospital(doctor,name,page,size));
            return write(200, "获取成功", "data", specialistService.getDoctorInHospital(doctor, name, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -177,12 +177,12 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "getDoctorPatientByName", method = RequestMethod.GET)
    @ApiOperation("搜索专科医生下的居民")
    public String getDoctorPatientByName(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                         @ApiParam(name = "nameKey", value = "居民姓名模糊") @RequestParam(required = false)String nameKey,
                                         @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size) {
    public String getDoctorPatientByName(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor,
                                         @ApiParam(name = "nameKey", value = "居民姓名模糊") @RequestParam(required = false) String nameKey,
                                         @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                         @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.getDoctorPatientByName(doctor,nameKey,page,size));
            return write(200, "获取成功", "data", specialistService.getDoctorPatientByName(doctor, nameKey, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -191,11 +191,11 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findPatientNoAssistant", method = RequestMethod.GET)
    @ApiOperation(value = "获取未分配计管师居民列表")
    public String findPatientNoAssistant(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                       @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                       @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size) {
    public String findPatientNoAssistant(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor,
                                         @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                         @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true) Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientNoAssistant(doctor,page,size));
            return write(200, "获取成功", "data", specialistService.findPatientNoAssistant(doctor, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -204,7 +204,7 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "getSpecialistTeamList", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科医生所在团队信息列表")
    public String getSpecialistTeamList(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor) {
    public String getSpecialistTeamList(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
            return write(200, "获取成功", "data", specialistService.getSpecialistTeamList(doctor));
        } catch (Exception e) {
@ -216,15 +216,50 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "/agreeSpecialistTeam", method = RequestMethod.GET)
    @ApiOperation(value = "医生审核")
    @ObserverRequired
    public String agreeSpecialistTeam(@ApiParam(name = "state", value = "状态0为拒绝,1为同意") @RequestParam(required = true)String state,
                                      @ApiParam(name = "relationCode", value = "关联code") @RequestParam(required = true)String relationCode,
                                      @ApiParam(name = "remark", value = "审核失败原因") @RequestParam(required = false)String remark,
                                      @ApiParam(name = "mesId", value = "消息Id") @RequestParam(required = false)Long mesId)throws Exception {
    public String agreeSpecialistTeam(@ApiParam(name = "state", value = "状态0为拒绝,1为同意") @RequestParam(required = true) String state,
                                      @ApiParam(name = "relationCode", value = "关联code") @RequestParam(required = true) String relationCode,
                                      @ApiParam(name = "remark", value = "审核失败原因") @RequestParam(required = false) String remark,
                                      @ApiParam(name = "mesId", value = "消息Id") @RequestParam(required = false) Long mesId) throws Exception {
        try {
            return write(200, "获取成功", "data", specialistService.agreeSpecialistTeam( state, relationCode, remark, mesId));
            return write(200, "获取成功", "data", specialistService.agreeSpecialistTeam(state, relationCode, remark, mesId));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}
    @RequestMapping(value = "/findPatientSigninfo", method = RequestMethod.GET)
    @ApiOperation(value = "医生审核")
    @ObserverRequired
    public String findPatientSigninfo(@ApiParam(name = "code", value = "专科医生签约code") @RequestParam(required = true) String code) {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientSigninfo(code));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/findPatientTeamList", method = RequestMethod.GET)
    @ApiOperation(value = "获取居民所有专科医生团队签约信息")
    public String findPatientTeamList(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true) String patient) {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientTeamList(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/findPatientSignSpecialist", method = RequestMethod.GET)
    @ApiOperation(value = "获取居民所有专科医生签约信息")
    public String findPatientSignSpecialist(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true)String patient) throws Exception {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientSignSpecialist(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    }

+ 0 - 84
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorQuestionnaireController.java

@ -1,84 +0,0 @@
package com.yihu.wlyy.web.doctor.survey;
import com.yihu.wlyy.repository.questionnaire.QuestionnaireUsersDao;
import com.yihu.wlyy.service.questionnaire.QuestionnaireService;
import com.yihu.wlyy.service.survey.PatientQuestionnaireService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by zhangdan on 2018/7/3.
 */
@Controller
@RequestMapping(value = "/doctor/questionnaire")
@Api(description = "医生端端问卷调查")
public class DoctorQuestionnaireController extends BaseController {
    @Autowired
    private PatientQuestionnaireService patientQuestionnaireService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private QuestionnaireService questionnaireService;
    @Autowired
    private QuestionnaireUsersDao questionnaireUsersDao;
    @RequestMapping(value = "getSurveySummary", method = RequestMethod.GET)
    @ApiOperation(value = "居民端获取问卷概述")
    @ResponseBody
    public String getSurveySummary(
            @ApiParam(value = "问卷编码")
            @RequestParam String id) {
        try {
            String patient = getRepUID();
//            String patient = getUID();
            JSONObject jsonObject = patientQuestionnaireService.getSurveySummary(patient, id);
            return write(200, "查询成功!", "data", jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "getQuestions", method = RequestMethod.GET)
    @ApiOperation(value = "按升序获取问卷的问题")
    @ResponseBody
    public String getQuestions(@ApiParam(value = "问卷编码")@RequestParam String templateCode,
            @ApiParam(value = "当前问题的sort(初始为1)")@RequestParam Integer sort) {
        try {
            JSONObject jsonObject = patientQuestionnaireService.getQuestions(templateCode, sort);
            return write(200, "查询成功!", "data", jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "saveAnswer", method = RequestMethod.POST)
    @ApiOperation(value = "保存用户答案")
    @ResponseBody
    public String saveAnswer( @RequestParam String jsonData,
                              @ApiParam(value = "居民code")@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")int labelType) {
        try {
            JSONObject json = new JSONObject(jsonData);
            patientQuestionnaireService.saveAnswer(patientCode, json);
            //@TODO 如果是筛查还要保存结果
            return write(200, "保存成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "保存失败!");
        }
    }
}

+ 173 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java

@ -0,0 +1,173 @@
package com.yihu.wlyy.web.doctor.survey;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.specialist.SpecialDiseaseDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * 医生端-疾病筛查
 * Created by zhangdan on 2018/7/2.
 */
@Controller
@RequestMapping(value = "/doctor/screen")
@Api(description = "医生端-疾病筛查")
public class DoctorSurveyScreenResultController extends BaseController {
    @Autowired
    private PatientDao patientDao;
    @Autowired
    WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    @Autowired
    private SpecialDiseaseDao specialDiseaseDao;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
    /**
     * 获取筛查结果列表
     * @param pageNo
     * @param pageSize
     * @param diseaseType
     * @param dealType
     * @param patientName
     * @param isDanger
     * @return
     */
    @RequestMapping(value = "getResultList", method = RequestMethod.GET)
    @ApiOperation(value = "获取筛查记录列表")
    @ResponseBody
    public String getResultList(@ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                @ApiParam(value = "疾病类型")@RequestParam(value = "diseaseType",required = false) String diseaseType,
                                @ApiParam(value = "处理方式(1已预约 2已跟踪 3已接诊 4待处理)")@RequestParam(value = "dealType",required = false) String dealType,
                                @ApiParam(value = "搜索居民的姓名")@RequestParam(value = "patientName",required = false) String patientName,
                                @ApiParam(value = "是否高危预警(0否 1是)")@RequestParam(value = "isDanger",required = false) String isDanger){
        try {
            return write(200, "查询成功!", "data", surveyScreenResultService.getResultList(pageNo,pageSize,getUID(),diseaseType,dealType,isDanger,patientName));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "getSpecialDisease", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科疾病类型")
    @ResponseBody
    public String getSpecialDisease(){
        try {
            return write(200, "查询成功!", "data", specialDiseaseDao.findByDel("1"));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    /**
     * 获取筛查问卷列表
     * @param pageNo
     * @param pageSize
     * @param labelType
     * @return
     */
    @RequestMapping(value = "getScreenList", method = RequestMethod.GET)
    @ApiOperation(value = "根据问卷标签类型获取筛查问卷列表")
    @ResponseBody
    public String getScreenList(@ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                @ApiParam(value = "问卷类型标签")@RequestParam(value = "labelType") int labelType) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getScreenList(pageNo,pageSize,labelType));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "getScreenResultDetail", method = RequestMethod.GET)
    @ApiOperation(value = "查看筛查结果记录详情")
    @ResponseBody
    public String getScreenResultDetail(@ApiParam(value = "筛查结果唯一code")@RequestParam(value = "code") String code) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getScreenResultDetail(code));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "getTemplateAdvice", method = RequestMethod.GET)
    @ApiOperation(value = "获取健康建议列表")
    @ResponseBody
    public String getTemplateAdvice(@ApiParam(value = "筛查模板code")@RequestParam(value = "templateCode") String templateCode) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getTemplateAdviceList(templateCode));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "updateAfterFollwoing", method = RequestMethod.POST)
    @ApiOperation(value = "医生跟踪")
    @ResponseBody
    public String updateAfterFollwoing(@ApiParam(value = "筛查记录code")@RequestParam(value = "code") String code,
                                    @ApiParam(value = "建议code,多个逗号隔开")@RequestParam(value = "advicCcodes") String advicCcodes,
                                    @ApiParam(value = "其他建议")@RequestParam(value = "otherAdvice",required = false) String otherAdvice) {
        try {
            surveyScreenResultService.updateAfterFollowing(code,advicCcodes,otherAdvice);
            return write(200, "跟踪成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "跟踪失败!");
        }
    }
    @RequestMapping(value = "updateAfterEducate", method = RequestMethod.POST)
    @ApiOperation(value = "医生筛查后进行健康教育")
    @ResponseBody
    public String updateAfterEducate(@ApiParam(value = "筛查记录code")@RequestParam(value = "code") String code) {
        try {
            surveyScreenResultService.updateColume("is_educate",1,code);
            return write(200, "更新健康教育成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "更新健康教育失败!");
        }
    }
    @RequestMapping(value = "screenStatics", method = RequestMethod.POST)
    @ApiOperation(value = "PCIM筛查统计模型")
    @ResponseBody
    public String screenStatics() {
        try {
            return write(200, "获取数据成功!","data",surveyScreenResultService.screenStatics(getUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取数据失败!");
        }
    }
}

+ 40 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.repository.doctor.SurveyUserDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.WeixinBaseController;
@ -57,6 +58,8 @@ public class ManagerQuestionnaireController extends WeixinBaseController {
    private PushMsgTask pushMsgTask;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    /**
     * 获取问卷列表
     *
@ -547,5 +550,42 @@ public class ManagerQuestionnaireController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "/getAllQuestions",method = RequestMethod.GET)
    @ApiOperation(value = "获取所有问卷题目")
    @ResponseBody
    public String getAllQuestions(@ApiParam(name = "surveyTemplateCode",value = "问卷模板code")@RequestParam(value = "surveyTemplateCode",required = true)String surveyTemplateCode){
        try {
            JSONObject jsonObject = managerQuestionnaireService.getAllQuestions(surveyTemplateCode);
            return write(200, "查询成功!", "data", jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "saveAnswer", method = RequestMethod.POST)
    @ApiOperation(value = "保存用户答案")
    @ResponseBody
    public String saveAnswer( @RequestParam String jsonData,
                              @ApiParam(value = "居民code")@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")int labelType,
                              @ApiParam(value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估")@RequestParam(value = "isAgain")int isAgain,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source")int source) {
        try {
            JSONObject json = new JSONObject(jsonData);
            //如果是评分筛查还要保存最后记录
            String screenResultcode = "";
            if (labelType==5){
                screenResultcode = surveyScreenResultService.saveScreenResult(patientCode,getUID(),isAgain,source,json);
            }
            managerQuestionnaireService.saveAnswer(patientCode, screenResultcode,json);
            return write(200, "保存成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "保存失败!");
        }
    }
}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 563
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/SurveyScreenResultController.java


+ 12 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/PatientSpecialistController.java

@ -63,7 +63,7 @@ public class PatientSpecialistController extends BaseController{
        }
    }
    @RequestMapping(value = "/signSpecialist", method = RequestMethod.GET)
    @RequestMapping(value = "/signSpecialist", method = RequestMethod.POST)
    @ApiOperation(value = "居民提交专科医生团队签约申请")
    public String signSpecialist(@ApiParam(name = "patient", value = "患者code") @RequestParam(required = true)String patient,
                                 @ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
@ -87,5 +87,16 @@ public class PatientSpecialistController extends BaseController{
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/findPatientTeamList", method = RequestMethod.GET)
    @ApiOperation(value = "获取居民所有专科医生签约信息")
    public String findPatientTeamList(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true) String patient) {
        try {
            return write(200, "获取成功", "data", specialistService.findPatientTeamList(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
//----
}

+ 86 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/survey/PatientQuestionnaireController.java

@ -5,8 +5,10 @@ import com.yihu.es.entity.QuestionnaireWinningESDO;
import com.yihu.wlyy.entity.questionnaire.QuestionnaireUsers;
import com.yihu.wlyy.repository.questionnaire.QuestionnaireUsersDao;
import com.yihu.wlyy.rest.model.common.SimpleResult;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.service.questionnaire.QuestionnaireService;
import com.yihu.wlyy.service.questionnaire.QuestionnaireUsersService;
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
import com.yihu.wlyy.service.survey.PatientQuestionnaireService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -41,6 +43,10 @@ public class    PatientQuestionnaireController extends BaseController {
    private QuestionnaireService questionnaireService;
    @Autowired
    private QuestionnaireUsersDao questionnaireUsersDao;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    @Autowired
    private ManagerQuestionnaireService managerQuestionnaireService;
    @RequestMapping(value = "getSurveySummary", method = RequestMethod.GET)
    @ApiOperation(value = "居民端获取问卷概述")
@ -93,4 +99,84 @@ public class    PatientQuestionnaireController extends BaseController {
        }
    }
    //----------------------------------疾病筛查-----------------------------------------//
    @RequestMapping(value = "getResultAndScreenList", method = RequestMethod.GET)
    @ApiOperation(value = "根据问卷标签类型获取筛查问卷列表和自己的筛查结果")
    @ResponseBody
    public String getResultAndScreenList(@ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                @ApiParam(value = "问卷类型标签")@RequestParam(value = "labelType") int labelType) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.patientGetList(pageNo,pageSize,labelType,getRepUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "getResultByTemplateCode", method = RequestMethod.GET)
    @ApiOperation(value = "居民查看具体一个筛查模板自己的结果")
    @ResponseBody
    public String getResultByTemplateCode(@ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                         @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                         @ApiParam(value = "问卷code")@RequestParam(value = "templateCode") String templateCode) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getResultByTemplateCode(pageNo,pageSize,templateCode,getRepUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "getScreenResultDetail", method = RequestMethod.GET)
    @ApiOperation(value = "查看筛查结果记录详情")
    @ResponseBody
    public String getScreenResultDetail(@ApiParam(value = "筛查结果唯一code")@RequestParam(value = "code") String code) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getScreenResultDetail(code));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/getAllQuestions",method = RequestMethod.GET)
    @ApiOperation(value = "获取所有问卷题目")
    @ResponseBody
    public String getAllQuestions(@ApiParam(name = "surveyTemplateCode",value = "问卷模板code")@RequestParam(value = "surveyTemplateCode",required = true)String surveyTemplateCode){
        try {
            JSONObject jsonObject = managerQuestionnaireService.getAllQuestions(surveyTemplateCode);
            return write(200, "查询成功!", "data", jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "saveScreenAnswer", method = RequestMethod.POST)
    @ApiOperation(value = "保存用户答案")
    @ResponseBody
    public String saveAnswer( @RequestParam String jsonData,
                              @ApiParam(value = "居民code")@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")int labelType,
                              @ApiParam(value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估")@RequestParam(value = "isAgain")int isAgain,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source")int source) {
        try {
            JSONObject json = new JSONObject(jsonData);
            //如果是评分筛查还要保存最后记录
            String screenResultcode = "";
            if (labelType==5){
                screenResultcode = surveyScreenResultService.saveScreenResult(patientCode,getUID(),isAgain,source,json);
            }
            managerQuestionnaireService.saveAnswer(patientCode, screenResultcode,json);
            return write(200, "保存成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "保存失败!");
        }
    }
}

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

@ -809,7 +809,7 @@ public class WeiXinEventProcess {
            List<Map<String, String>> articles = new ArrayList<>();
            // 二维码参数
            String[] keys = eventKey.replace("sp_disease_", "").split("_");
            //设置抽奖
            //设置图文消息
            setSpDisease(articles,keys[0],keys[1],systemConf);
            // 构建回复消息XMLs
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);