Browse Source

Merge branch 'dev' of huangwenjie/patient-co-management into dev

chenweida 7 năm trước cách đây
mục cha
commit
cdc106aa01
25 tập tin đã thay đổi với 2075 bổ sung285 xóa
  1. 4 0
      common/common-entity/pom.xml
  2. 938 0
      common/common-entity/src/main/java/com/yihu/es/entity/FollowupContentESDO.java
  3. 10 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/followup/Followup.java
  4. 94 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionFollowupContent.java
  5. 1 1
      patient-co-service/wlyy_service/src/main/resources/application.yml
  6. 1 1
      patient-co-service/wlyy_sign/src/main/resources/application.yml
  7. 93 93
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/es/ElasticFactory.java
  8. 51 49
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/es/ElastricSearchSave.java
  9. 295 110
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java
  10. 4 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml
  11. 6 3
      patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml
  12. 9 5
      patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml
  13. 6 2
      patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml
  14. 342 4
      patient-co/patient-co-wlyy/doc/技术文档/es/随访记录详情新增索引.txt
  15. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/es/ElastricSearchSave.java
  16. 0 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/BusinessLogs.java
  17. 0 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/archives/PatientEventService.java
  18. 188 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java
  19. 12 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java
  20. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  21. 4 3
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  22. 4 2
      patient-co/patient-co-wlyy/src/main/resources/application-local.yml
  23. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml
  24. 5 3
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  25. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

+ 4 - 0
common/common-entity/pom.xml

@ -59,5 +59,9 @@
            <artifactId>spring-data-commons</artifactId>
            <version>1.11.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
    </dependencies>
</project>

+ 938 - 0
common/common-entity/src/main/java/com/yihu/es/entity/FollowupContentESDO.java

@ -0,0 +1,938 @@
package com.yihu.es.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.searchbox.annotations.JestId;
import org.springframework.data.annotation.CreatedDate;
import java.util.Date;
/**
 * 随访详情ES实体类
 * @author huangwenjie
 * @date 2017/11/1 13:41
 */
public class FollowupContentESDO {
	
	@JestId
	private String id;
	private String followup_id;             //随访记录ID
	private String followup_project;        //随访详情分类ID
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd'T'HHmmss.SSS'Z'")
	@CreatedDate
	private Date create_time;
	
    private String NO_SYMPTOM;//无症状【0.无 1.有】
    private String HEADACHE;//头痛头晕【0.无 1.有】
    private String NAUSEA;//恶心呕吐【0.无 1.有】
    private String VERTIGO_TINNITUS;//眼花耳鸣【0.无 1.有】
    private String DIFFICULTY_BREATHING;//呼吸困难【0.无 1.有】
    private String PALPITATIONS;//心悸胸闷【0.无 1.有】
    private String EPISTAXIS_BLEEDING;//鼻衄出血不止【0.无 1.有】
    private String LIMBS_NUMB;//四肢发麻【0.无 1.有】
    private String EXTREMITY_EDEMA;//下肢水肿【0.无 1.有】
    private String SYMPTOM_OTHER;//"其他症状"
    private String POLYDIPSIA;//多饮【0.无 1.有】
    private String MORE_FOOD;//多食【0.无 1.有】
    private String MORE_URINE;//多尿【0.无 1.有】
    private String BLURRED_VISION;//视力模糊【0.无 1.有】
    private String INFECTION;//感染【0.无 1.有】
    private String NUMB_HANDS;//手脚麻木【0.无 1.有】
    private String WEIGHT_LOSS;//体重明显下降【0.无 1.有】
    private String HYPOG_REACT_CODE;//低血糖反应【0.无;1.偶尔;2.频繁;】
	
	//体征信息
    private String HEIGHT;//身高
    private String HEIGHT_EXP;//期望身高
    private String WEIGHT;//体重
    private String WEIGHT_EXP;//期望体重
    private String BP_D;//舒张压
    private String BP_U;//收缩压
    private String BS_FPG;//空腹血糖
    private String NO_BS_FPG;//餐后血糖
    private String RANDOM_BLOOD_SUGAR;//随机血糖
    private String BMI;//体质指数
    private String BMI_EXP;//期望体质
    private String OTHER_POSITIVE_SIGNS;//体征其他
    private String POFDA_MARK;//足背动脉搏动【TOUCH_DICT】
    private String HEART_RATE;//心率
	
	//检查室检查
    private String GHB;//糖化血红蛋白
    private String RENAL_FUNCTION_CREATININE;//血清肌酐
    private String RENAL_FUNCTION_BUN;//血尿素氮
    private String MICROALBUMINURIA;//尿微量白蛋白
    private String EXAM_DATE;//检查日期
    private String BLOOD_FAT_TRIGLYCERIDE;//甘油三酯 V01
    private String BLOOD_FAT_TC;//总胆固醇 V02
    private String BLOOD_FAT_LDLC;//血清低密度脂蛋白胆固醇 V03
	
	//生活方式
    private String DAILY_SMOKING;//日吸烟量
    private String SOMKING_EXP;//日吸烟期望
    private String DAILY_DRINKING;//日饮酒量
    private String DRINK_EXP;//日饮酒期望
    private String EXERCISE_FREQ_CODE;//运动频率【HYGIENE_SPORT_FREQ_DICT】
    private String EXERCISE_FREQ_CODE_EXP;//运动频率期望【HYGIENE_SPORT_FREQ_DICT】
    private String EXERCISE_DURATION_MINS;//运动时长(min) 分钟/次
    private String EXERCISE_DURATION_MINS_EXP;//运动时长期望(min) 分钟/次期望
    private String SALT_TAKEN_LEVEL_CODE;//摄盐情况【LIGHT_WEIGHT_DICT】
    private String SALT_TAKEN_LEVEL_EXP;//摄盐情况期望【LIGHT_WEIGHT_DICT】
    private String PSY_ADJUST_RESULT_CODE;//心里调整【GOOD_FAIR_POOR_DICT】
    private String COMPLIANCE_RESULT_CODE;//遵医行为【GOOD_FAIR_POOR_DICT】
    private String DAILY_STAPLE;//主食(克/天)
	
	//随访评价
    private String HYP_FOLLOWUP_TYPE_CODE;//高血压随访分类【FOLLOW_TYPE_DICT】
    private String HYP_COMPLICATION_DETAIL;//高血压随访分类--详情
    private String DIA_FOLLOWUP_TYPE_CODE;//糖尿病随访分类【FOLLOW_TYPE_DICT】
    private String DIA_COMPLICATION_DETAIL;//糖尿病随访分类--详情
	
	//用药情况
	private String DRUG_COMPLIANCE_CODE;//服药依从性【DRUG_STATE_DICT】
	
	//控制目标
    private String CONTROL_DATE;//控制日期 V04
	private String CONTROL_CONSTITUTOR;//制定者姓名
	private String CONTROL_CONSTITUTOR_DOCTORCODE;//制定者本地CODE
	private String CONTROL_CONSTITUTOR_JWDOCTORCODE;//制定者本地CODE
                            
    private String CONTROL_BP_U;//血压收缩压 V06
    private String CONTROL_BP_D;//血压舒张压 V07
    private String CONTROL_BS_FPG;//空腹血糖 V08
    private String CONTROL_NO_BS_FPG;//餐后血糖 V09
    private String CONTROL_GHB;//糖化血红蛋白 V10
    private String CONTROL_TRIGLYCERIDE;//甘油三酯 V11
    private String CONTROL_TOTAL_CHOLESTEROL;//总胆固醇 V12
    private String CONTROL_LDL;//低密度脂蛋白 V13
    private String CONTROL_WEIGHT;//体重 V14
    private String CONTROL_EXERCISE_FREQ_CODE;//运动频率 V15
    private String CONTROL_EXERCISE_DURATION_MINS;//运动时长 V16
	
	//健康教育
    private String ARCHIVE_TIME;//健康教育日期 V17
    private String ARCHIVE_OPERATOR_NAME;//健康教育记录者 基卫系统医生【传中文名称】 V18
    private String HEALTH_EDUCATE;//健康教育【CHRO_HEALTH_EDUCATE_DICT】 V19
    private String EDUCATE_CONTENT;//健康教育内容 V20
	
	//转诊
    private String DRUG_ADVERSE_MARK;//药物不良反应【0.无;1.有;】
    private String ADR_REMARK;//药物不良反应【内容】
    private String TRANSFER_RESON;//转诊原因
    private String TRANSFER_ORG_DEPT;//转诊机构科室
    private String REFUSE_REFERRAL;//患者拒绝转诊【0 否 1 是】
    private String REFUSE_REFERRAL_WHY;//患者拒绝转诊内容
	
	//多余字段
    private String ARCHIVE_ID;//档案ID
    private String CHECK_FEE_TYPE;//检测费用类型
    private String FAMILY_FOLLOWUP_ID;//随访细表外键随访ID
	
	
	
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getFollowup_id() {
		return followup_id;
	}
	
	public void setFollowup_id(String followup_id) {
		this.followup_id = followup_id;
	}
	
	public String getFollowup_project() {
		return followup_project;
	}
	
	public void setFollowup_project(String followup_project) {
		this.followup_project = followup_project;
	}
	
	public Date getCreate_time() {
		return create_time;
	}
	
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	
	@JSONField(name = "NO_SYMPTOM")
	public String getNO_SYMPTOM() {
		return NO_SYMPTOM;
	}
	
	public void setNO_SYMPTOM(String NO_SYMPTOM) {
		this.NO_SYMPTOM = NO_SYMPTOM;
	}
	
	@JSONField(name = "HEADACHE")
	public String getHEADACHE() {
		return HEADACHE;
	}
	
	public void setHEADACHE(String HEADACHE) {
		this.HEADACHE = HEADACHE;
	}
	
	@JSONField(name = "NAUSEA")
	public String getNAUSEA() {
		return NAUSEA;
	}
	
	public void setNAUSEA(String NAUSEA) {
		this.NAUSEA = NAUSEA;
	}
	
	@JSONField(name = "VERTIGO_TINNITUS")
	public String getVERTIGO_TINNITUS() {
		return VERTIGO_TINNITUS;
	}
	
	public void setVERTIGO_TINNITUS(String VERTIGO_TINNITUS) {
		this.VERTIGO_TINNITUS = VERTIGO_TINNITUS;
	}
	
	@JSONField(name = "DIFFICULTY_BREATHING")
	public String getDIFFICULTY_BREATHING() {
		return DIFFICULTY_BREATHING;
	}
	
	public void setDIFFICULTY_BREATHING(String DIFFICULTY_BREATHING) {
		this.DIFFICULTY_BREATHING = DIFFICULTY_BREATHING;
	}
	
	@JSONField(name = "PALPITATIONS")
	public String getPALPITATIONS() {
		return PALPITATIONS;
	}
	
	public void setPALPITATIONS(String PALPITATIONS) {
		this.PALPITATIONS = PALPITATIONS;
	}
	
	@JSONField(name = "EPISTAXIS_BLEEDING")
	public String getEPISTAXIS_BLEEDING() {
		return EPISTAXIS_BLEEDING;
	}
	
	public void setEPISTAXIS_BLEEDING(String EPISTAXIS_BLEEDING) {
		this.EPISTAXIS_BLEEDING = EPISTAXIS_BLEEDING;
	}
	
	@JSONField(name = "LIMBS_NUMB")
	public String getLIMBS_NUMB() {
		return LIMBS_NUMB;
	}
	
	public void setLIMBS_NUMB(String LIMBS_NUMB) {
		this.LIMBS_NUMB = LIMBS_NUMB;
	}
	
	@JSONField(name = "EXTREMITY_EDEMA")
	public String getEXTREMITY_EDEMA() {
		return EXTREMITY_EDEMA;
	}
	
	public void setEXTREMITY_EDEMA(String EXTREMITY_EDEMA) {
		this.EXTREMITY_EDEMA = EXTREMITY_EDEMA;
	}
	
	@JSONField(name = "SYMPTOM_OTHER")
	public String getSYMPTOM_OTHER() {
		return SYMPTOM_OTHER;
	}
	
	public void setSYMPTOM_OTHER(String SYMPTOM_OTHER) {
		this.SYMPTOM_OTHER = SYMPTOM_OTHER;
	}
	
	@JSONField(name = "POLYDIPSIA")
	public String getPOLYDIPSIA() {
		return POLYDIPSIA;
	}
	
	public void setPOLYDIPSIA(String POLYDIPSIA) {
		this.POLYDIPSIA = POLYDIPSIA;
	}
	
	@JSONField(name = "MORE_FOOD")
	public String getMORE_FOOD() {
		return MORE_FOOD;
	}
	
	public void setMORE_FOOD(String MORE_FOOD) {
		this.MORE_FOOD = MORE_FOOD;
	}
	
	@JSONField(name = "MORE_URINE")
	public String getMORE_URINE() {
		return MORE_URINE;
	}
	
	public void setMORE_URINE(String MORE_URINE) {
		this.MORE_URINE = MORE_URINE;
	}
	
	@JSONField(name = "BLURRED_VISION")
	public String getBLURRED_VISION() {
		return BLURRED_VISION;
	}
	
	public void setBLURRED_VISION(String BLURRED_VISION) {
		this.BLURRED_VISION = BLURRED_VISION;
	}
	
	@JSONField(name = "INFECTION")
	public String getINFECTION() {
		return INFECTION;
	}
	
	public void setINFECTION(String INFECTION) {
		this.INFECTION = INFECTION;
	}
	
	@JSONField(name = "NUMB_HANDS")
	public String getNUMB_HANDS() {
		return NUMB_HANDS;
	}
	
	public void setNUMB_HANDS(String NUMB_HANDS) {
		this.NUMB_HANDS = NUMB_HANDS;
	}
	
	@JSONField(name = "WEIGHT_LOSS")
	public String getWEIGHT_LOSS() {
		return WEIGHT_LOSS;
	}
	
	public void setWEIGHT_LOSS(String WEIGHT_LOSS) {
		this.WEIGHT_LOSS = WEIGHT_LOSS;
	}
	
	@JSONField(name = "HYPOG_REACT_CODE")
	public String getHYPOG_REACT_CODE() {
		return HYPOG_REACT_CODE;
	}
	
	public void setHYPOG_REACT_CODE(String HYPOG_REACT_CODE) {
		this.HYPOG_REACT_CODE = HYPOG_REACT_CODE;
	}
	
	@JSONField(name = "HEIGHT")
	public String getHEIGHT() {
		return HEIGHT;
	}
	
	public void setHEIGHT(String HEIGHT) {
		this.HEIGHT = HEIGHT;
	}
	
	@JSONField(name = "HEIGHT_EXP")
	public String getHEIGHT_EXP() {
		return HEIGHT_EXP;
	}
	
	public void setHEIGHT_EXP(String HEIGHT_EXP) {
		this.HEIGHT_EXP = HEIGHT_EXP;
	}
	
	@JSONField(name = "WEIGHT")
	public String getWEIGHT() {
		return WEIGHT;
	}
	
	public void setWEIGHT(String WEIGHT) {
		this.WEIGHT = WEIGHT;
	}
	
	@JSONField(name = "WEIGHT_EXP")
	public String getWEIGHT_EXP() {
		return WEIGHT_EXP;
	}
	
	public void setWEIGHT_EXP(String WEIGHT_EXP) {
		this.WEIGHT_EXP = WEIGHT_EXP;
	}
	
	@JSONField(name = "BP_D")
	public String getBP_D() {
		return BP_D;
	}
	
	public void setBP_D(String BP_D) {
		this.BP_D = BP_D;
	}
	
	@JSONField(name = "BP_U")
	public String getBP_U() {
		return BP_U;
	}
	
	public void setBP_U(String BP_U) {
		this.BP_U = BP_U;
	}
	
	@JSONField(name = "BS_FPG")
	public String getBS_FPG() {
		return BS_FPG;
	}
	
	public void setBS_FPG(String BS_FPG) {
		this.BS_FPG = BS_FPG;
	}
	
	@JSONField(name = "NO_BS_FPG")
	public String getNO_BS_FPG() {
		return NO_BS_FPG;
	}
	
	public void setNO_BS_FPG(String NO_BS_FPG) {
		this.NO_BS_FPG = NO_BS_FPG;
	}
	
	@JSONField(name = "RANDOM_BLOOD_SUGAR")
	public String getRANDOM_BLOOD_SUGAR() {
		return RANDOM_BLOOD_SUGAR;
	}
	
	public void setRANDOM_BLOOD_SUGAR(String RANDOM_BLOOD_SUGAR) {
		this.RANDOM_BLOOD_SUGAR = RANDOM_BLOOD_SUGAR;
	}
	
	@JSONField(name = "BMI")
	public String getBMI() {
		return BMI;
	}
	
	public void setBMI(String BMI) {
		this.BMI = BMI;
	}
	
	@JSONField(name = "BMI_EXP")
	public String getBMI_EXP() {
		return BMI_EXP;
	}
	
	public void setBMI_EXP(String BMI_EXP) {
		this.BMI_EXP = BMI_EXP;
	}
	
	@JSONField(name = "OTHER_POSITIVE_SIGNS")
	public String getOTHER_POSITIVE_SIGNS() {
		return OTHER_POSITIVE_SIGNS;
	}
	
	public void setOTHER_POSITIVE_SIGNS(String OTHER_POSITIVE_SIGNS) {
		this.OTHER_POSITIVE_SIGNS = OTHER_POSITIVE_SIGNS;
	}
	
	@JSONField(name = "POFDA_MARK")
	public String getPOFDA_MARK() {
		return POFDA_MARK;
	}
	
	public void setPOFDA_MARK(String POFDA_MARK) {
		this.POFDA_MARK = POFDA_MARK;
	}
	
	@JSONField(name = "HEART_RATE")
	public String getHEART_RATE() {
		return HEART_RATE;
	}
	
	public void setHEART_RATE(String HEART_RATE) {
		this.HEART_RATE = HEART_RATE;
	}
	
	@JSONField(name = "GHB")
	public String getGHB() {
		return GHB;
	}
	
	public void setGHB(String GHB) {
		this.GHB = GHB;
	}
	
	@JSONField(name = "RENAL_FUNCTION_CREATININE")
	public String getRENAL_FUNCTION_CREATININE() {
		return RENAL_FUNCTION_CREATININE;
	}
	
	public void setRENAL_FUNCTION_CREATININE(String RENAL_FUNCTION_CREATININE) {
		this.RENAL_FUNCTION_CREATININE = RENAL_FUNCTION_CREATININE;
	}
	
	@JSONField(name = "RENAL_FUNCTION_BUN")
	public String getRENAL_FUNCTION_BUN() {
		return RENAL_FUNCTION_BUN;
	}
	
	public void setRENAL_FUNCTION_BUN(String RENAL_FUNCTION_BUN) {
		this.RENAL_FUNCTION_BUN = RENAL_FUNCTION_BUN;
	}
	
	@JSONField(name = "MICROALBUMINURIA")
	public String getMICROALBUMINURIA() {
		return MICROALBUMINURIA;
	}
	
	public void setMICROALBUMINURIA(String MICROALBUMINURIA) {
		this.MICROALBUMINURIA = MICROALBUMINURIA;
	}
	
	@JSONField(name = "EXAM_DATE")
	public String getEXAM_DATE() {
		return EXAM_DATE;
	}
	
	public void setEXAM_DATE(String EXAM_DATE) {
		this.EXAM_DATE = EXAM_DATE;
	}
	
	@JSONField(name = "BLOOD_FAT_TRIGLYCERIDE")
	public String getBLOOD_FAT_TRIGLYCERIDE() {
		return BLOOD_FAT_TRIGLYCERIDE;
	}
	
	public void setBLOOD_FAT_TRIGLYCERIDE(String BLOOD_FAT_TRIGLYCERIDE) {
		this.BLOOD_FAT_TRIGLYCERIDE = BLOOD_FAT_TRIGLYCERIDE;
	}
	
	@JSONField(name = "BLOOD_FAT_TC")
	public String getBLOOD_FAT_TC() {
		return BLOOD_FAT_TC;
	}
	
	public void setBLOOD_FAT_TC(String BLOOD_FAT_TC) {
		this.BLOOD_FAT_TC = BLOOD_FAT_TC;
	}
	
	@JSONField(name = "BLOOD_FAT_LDLC")
	public String getBLOOD_FAT_LDLC() {
		return BLOOD_FAT_LDLC;
	}
	
	public void setBLOOD_FAT_LDLC(String BLOOD_FAT_LDLC) {
		this.BLOOD_FAT_LDLC = BLOOD_FAT_LDLC;
	}
	
	@JSONField(name = "DAILY_SMOKING")
	public String getDAILY_SMOKING() {
		return DAILY_SMOKING;
	}
	
	public void setDAILY_SMOKING(String DAILY_SMOKING) {
		this.DAILY_SMOKING = DAILY_SMOKING;
	}
	
	@JSONField(name = "SOMKING_EXP")
	public String getSOMKING_EXP() {
		return SOMKING_EXP;
	}
	
	public void setSOMKING_EXP(String SOMKING_EXP) {
		this.SOMKING_EXP = SOMKING_EXP;
	}
	
	@JSONField(name = "DAILY_DRINKING")
	public String getDAILY_DRINKING() {
		return DAILY_DRINKING;
	}
	
	public void setDAILY_DRINKING(String DAILY_DRINKING) {
		this.DAILY_DRINKING = DAILY_DRINKING;
	}
	
	@JSONField(name = "DRINK_EXP")
	public String getDRINK_EXP() {
		return DRINK_EXP;
	}
	
	public void setDRINK_EXP(String DRINK_EXP) {
		this.DRINK_EXP = DRINK_EXP;
	}
	
	@JSONField(name = "EXERCISE_FREQ_CODE")
	public String getEXERCISE_FREQ_CODE() {
		return EXERCISE_FREQ_CODE;
	}
	
	public void setEXERCISE_FREQ_CODE(String EXERCISE_FREQ_CODE) {
		this.EXERCISE_FREQ_CODE = EXERCISE_FREQ_CODE;
	}
	
	@JSONField(name = "EXERCISE_FREQ_CODE_EXP")
	public String getEXERCISE_FREQ_CODE_EXP() {
		return EXERCISE_FREQ_CODE_EXP;
	}
	
	public void setEXERCISE_FREQ_CODE_EXP(String EXERCISE_FREQ_CODE_EXP) {
		this.EXERCISE_FREQ_CODE_EXP = EXERCISE_FREQ_CODE_EXP;
	}
	
	@JSONField(name = "EXERCISE_DURATION_MINS")
	public String getEXERCISE_DURATION_MINS() {
		return EXERCISE_DURATION_MINS;
	}
	
	public void setEXERCISE_DURATION_MINS(String EXERCISE_DURATION_MINS) {
		this.EXERCISE_DURATION_MINS = EXERCISE_DURATION_MINS;
	}
	
	@JSONField(name = "EXERCISE_DURATION_MINS_EXP")
	public String getEXERCISE_DURATION_MINS_EXP() {
		return EXERCISE_DURATION_MINS_EXP;
	}
	
	public void setEXERCISE_DURATION_MINS_EXP(String EXERCISE_DURATION_MINS_EXP) {
		this.EXERCISE_DURATION_MINS_EXP = EXERCISE_DURATION_MINS_EXP;
	}
	
	@JSONField(name = "SALT_TAKEN_LEVEL_CODE")
	public String getSALT_TAKEN_LEVEL_CODE() {
		return SALT_TAKEN_LEVEL_CODE;
	}
	
	public void setSALT_TAKEN_LEVEL_CODE(String SALT_TAKEN_LEVEL_CODE) {
		this.SALT_TAKEN_LEVEL_CODE = SALT_TAKEN_LEVEL_CODE;
	}
	
	@JSONField(name = "SALT_TAKEN_LEVEL_EXP")
	public String getSALT_TAKEN_LEVEL_EXP() {
		return SALT_TAKEN_LEVEL_EXP;
	}
	
	public void setSALT_TAKEN_LEVEL_EXP(String SALT_TAKEN_LEVEL_EXP) {
		this.SALT_TAKEN_LEVEL_EXP = SALT_TAKEN_LEVEL_EXP;
	}
	
	@JSONField(name = "PSY_ADJUST_RESULT_CODE")
	public String getPSY_ADJUST_RESULT_CODE() {
		return PSY_ADJUST_RESULT_CODE;
	}
	
	public void setPSY_ADJUST_RESULT_CODE(String PSY_ADJUST_RESULT_CODE) {
		this.PSY_ADJUST_RESULT_CODE = PSY_ADJUST_RESULT_CODE;
	}
	
	@JSONField(name = "COMPLIANCE_RESULT_CODE")
	public String getCOMPLIANCE_RESULT_CODE() {
		return COMPLIANCE_RESULT_CODE;
	}
	
	public void setCOMPLIANCE_RESULT_CODE(String COMPLIANCE_RESULT_CODE) {
		this.COMPLIANCE_RESULT_CODE = COMPLIANCE_RESULT_CODE;
	}
	
	@JSONField(name = "DAILY_STAPLE")
	public String getDAILY_STAPLE() {
		return DAILY_STAPLE;
	}
	
	public void setDAILY_STAPLE(String DAILY_STAPLE) {
		this.DAILY_STAPLE = DAILY_STAPLE;
	}
	
	@JSONField(name = "HYP_FOLLOWUP_TYPE_CODE")
	public String getHYP_FOLLOWUP_TYPE_CODE() {
		return HYP_FOLLOWUP_TYPE_CODE;
	}
	
	public void setHYP_FOLLOWUP_TYPE_CODE(String HYP_FOLLOWUP_TYPE_CODE) {
		this.HYP_FOLLOWUP_TYPE_CODE = HYP_FOLLOWUP_TYPE_CODE;
	}
	
	@JSONField(name = "HYP_COMPLICATION_DETAIL")
	public String getHYP_COMPLICATION_DETAIL() {
		return HYP_COMPLICATION_DETAIL;
	}
	
	public void setHYP_COMPLICATION_DETAIL(String HYP_COMPLICATION_DETAIL) {
		this.HYP_COMPLICATION_DETAIL = HYP_COMPLICATION_DETAIL;
	}
	
	@JSONField(name = "DIA_FOLLOWUP_TYPE_CODE")
	public String getDIA_FOLLOWUP_TYPE_CODE() {
		return DIA_FOLLOWUP_TYPE_CODE;
	}
	
	public void setDIA_FOLLOWUP_TYPE_CODE(String DIA_FOLLOWUP_TYPE_CODE) {
		this.DIA_FOLLOWUP_TYPE_CODE = DIA_FOLLOWUP_TYPE_CODE;
	}
	
	@JSONField(name = "DIA_COMPLICATION_DETAIL")
	public String getDIA_COMPLICATION_DETAIL() {
		return DIA_COMPLICATION_DETAIL;
	}
	
	public void setDIA_COMPLICATION_DETAIL(String DIA_COMPLICATION_DETAIL) {
		this.DIA_COMPLICATION_DETAIL = DIA_COMPLICATION_DETAIL;
	}
	
	@JSONField(name = "DRUG_COMPLIANCE_CODE")
	public String getDRUG_COMPLIANCE_CODE() {
		return DRUG_COMPLIANCE_CODE;
	}
	
	public void setDRUG_COMPLIANCE_CODE(String DRUG_COMPLIANCE_CODE) {
		this.DRUG_COMPLIANCE_CODE = DRUG_COMPLIANCE_CODE;
	}
	
	@JSONField(name = "CONTROL_DATE")
	public String getCONTROL_DATE() {
		return CONTROL_DATE;
	}
	
	public void setCONTROL_DATE(String CONTROL_DATE) {
		this.CONTROL_DATE = CONTROL_DATE;
	}
	
	@JSONField(name = "CONTROL_CONSTITUTOR")
	public String getCONTROL_CONSTITUTOR() {
		return CONTROL_CONSTITUTOR;
	}
	
	public void setCONTROL_CONSTITUTOR(String CONTROL_CONSTITUTOR) {
		this.CONTROL_CONSTITUTOR = CONTROL_CONSTITUTOR;
	}
	
	@JSONField(name = "CONTROL_CONSTITUTOR_DOCTORCODE")
	public String getCONTROL_CONSTITUTOR_DOCTORCODE() {
		return CONTROL_CONSTITUTOR_DOCTORCODE;
	}
	
	public void setCONTROL_CONSTITUTOR_DOCTORCODE(String CONTROL_CONSTITUTOR_DOCTORCODE) {
		this.CONTROL_CONSTITUTOR_DOCTORCODE = CONTROL_CONSTITUTOR_DOCTORCODE;
	}
	
	@JSONField(name = "CONTROL_CONSTITUTOR_JWDOCTORCODE")
	public String getCONTROL_CONSTITUTOR_JWDOCTORCODE() {
		return CONTROL_CONSTITUTOR_JWDOCTORCODE;
	}
	
	public void setCONTROL_CONSTITUTOR_JWDOCTORCODE(String CONTROL_CONSTITUTOR_JWDOCTORCODE) {
		this.CONTROL_CONSTITUTOR_JWDOCTORCODE = CONTROL_CONSTITUTOR_JWDOCTORCODE;
	}
	
	@JSONField(name = "CONTROL_BP_U")
	public String getCONTROL_BP_U() {
		return CONTROL_BP_U;
	}
	
	public void setCONTROL_BP_U(String CONTROL_BP_U) {
		this.CONTROL_BP_U = CONTROL_BP_U;
	}
	
	@JSONField(name = "CONTROL_BP_D")
	public String getCONTROL_BP_D() {
		return CONTROL_BP_D;
	}
	
	public void setCONTROL_BP_D(String CONTROL_BP_D) {
		this.CONTROL_BP_D = CONTROL_BP_D;
	}
	
	@JSONField(name = "CONTROL_BS_FPG")
	public String getCONTROL_BS_FPG() {
		return CONTROL_BS_FPG;
	}
	
	public void setCONTROL_BS_FPG(String CONTROL_BS_FPG) {
		this.CONTROL_BS_FPG = CONTROL_BS_FPG;
	}
	
	@JSONField(name = "CONTROL_NO_BS_FPG")
	public String getCONTROL_NO_BS_FPG() {
		return CONTROL_NO_BS_FPG;
	}
	
	public void setCONTROL_NO_BS_FPG(String CONTROL_NO_BS_FPG) {
		this.CONTROL_NO_BS_FPG = CONTROL_NO_BS_FPG;
	}
	
	@JSONField(name = "CONTROL_GHB")
	public String getCONTROL_GHB() {
		return CONTROL_GHB;
	}
	
	public void setCONTROL_GHB(String CONTROL_GHB) {
		this.CONTROL_GHB = CONTROL_GHB;
	}
	
	@JSONField(name = "CONTROL_TRIGLYCERIDE")
	public String getCONTROL_TRIGLYCERIDE() {
		return CONTROL_TRIGLYCERIDE;
	}
	
	public void setCONTROL_TRIGLYCERIDE(String CONTROL_TRIGLYCERIDE) {
		this.CONTROL_TRIGLYCERIDE = CONTROL_TRIGLYCERIDE;
	}
	
	@JSONField(name = "CONTROL_TOTAL_CHOLESTEROL")
	public String getCONTROL_TOTAL_CHOLESTEROL() {
		return CONTROL_TOTAL_CHOLESTEROL;
	}
	
	public void setCONTROL_TOTAL_CHOLESTEROL(String CONTROL_TOTAL_CHOLESTEROL) {
		this.CONTROL_TOTAL_CHOLESTEROL = CONTROL_TOTAL_CHOLESTEROL;
	}
	
	@JSONField(name = "CONTROL_LDL")
	public String getCONTROL_LDL() {
		return CONTROL_LDL;
	}
	
	public void setCONTROL_LDL(String CONTROL_LDL) {
		this.CONTROL_LDL = CONTROL_LDL;
	}
	
	@JSONField(name = "CONTROL_WEIGHT")
	public String getCONTROL_WEIGHT() {
		return CONTROL_WEIGHT;
	}
	
	public void setCONTROL_WEIGHT(String CONTROL_WEIGHT) {
		this.CONTROL_WEIGHT = CONTROL_WEIGHT;
	}
	
	@JSONField(name = "CONTROL_EXERCISE_FREQ_CODE")
	public String getCONTROL_EXERCISE_FREQ_CODE() {
		return CONTROL_EXERCISE_FREQ_CODE;
	}
	
	public void setCONTROL_EXERCISE_FREQ_CODE(String CONTROL_EXERCISE_FREQ_CODE) {
		this.CONTROL_EXERCISE_FREQ_CODE = CONTROL_EXERCISE_FREQ_CODE;
	}
	
	@JSONField(name = "CONTROL_EXERCISE_DURATION_MINS")
	public String getCONTROL_EXERCISE_DURATION_MINS() {
		return CONTROL_EXERCISE_DURATION_MINS;
	}
	
	public void setCONTROL_EXERCISE_DURATION_MINS(String CONTROL_EXERCISE_DURATION_MINS) {
		this.CONTROL_EXERCISE_DURATION_MINS = CONTROL_EXERCISE_DURATION_MINS;
	}
	
	@JSONField(name = "ARCHIVE_TIME")
	public String getARCHIVE_TIME() {
		return ARCHIVE_TIME;
	}
	
	public void setARCHIVE_TIME(String ARCHIVE_TIME) {
		this.ARCHIVE_TIME = ARCHIVE_TIME;
	}
	
	@JSONField(name = "ARCHIVE_OPERATOR_NAME")
	public String getARCHIVE_OPERATOR_NAME() {
		return ARCHIVE_OPERATOR_NAME;
	}
	
	public void setARCHIVE_OPERATOR_NAME(String ARCHIVE_OPERATOR_NAME) {
		this.ARCHIVE_OPERATOR_NAME = ARCHIVE_OPERATOR_NAME;
	}
	
	@JSONField(name = "HEALTH_EDUCATE")
	public String getHEALTH_EDUCATE() {
		return HEALTH_EDUCATE;
	}
	
	public void setHEALTH_EDUCATE(String HEALTH_EDUCATE) {
		this.HEALTH_EDUCATE = HEALTH_EDUCATE;
	}
	
	@JSONField(name = "EDUCATE_CONTENT")
	public String getEDUCATE_CONTENT() {
		return EDUCATE_CONTENT;
	}
	
	public void setEDUCATE_CONTENT(String EDUCATE_CONTENT) {
		this.EDUCATE_CONTENT = EDUCATE_CONTENT;
	}
	
	@JSONField(name = "DRUG_ADVERSE_MARK")
	public String getDRUG_ADVERSE_MARK() {
		return DRUG_ADVERSE_MARK;
	}
	
	public void setDRUG_ADVERSE_MARK(String DRUG_ADVERSE_MARK) {
		this.DRUG_ADVERSE_MARK = DRUG_ADVERSE_MARK;
	}
	
	@JSONField(name = "ADR_REMARK")
	public String getADR_REMARK() {
		return ADR_REMARK;
	}
	
	public void setADR_REMARK(String ADR_REMARK) {
		this.ADR_REMARK = ADR_REMARK;
	}
	
	@JSONField(name = "TRANSFER_RESON")
	public String getTRANSFER_RESON() {
		return TRANSFER_RESON;
	}
	
	public void setTRANSFER_RESON(String TRANSFER_RESON) {
		this.TRANSFER_RESON = TRANSFER_RESON;
	}
	
	@JSONField(name = "TRANSFER_ORG_DEPT")
	public String getTRANSFER_ORG_DEPT() {
		return TRANSFER_ORG_DEPT;
	}
	
	public void setTRANSFER_ORG_DEPT(String TRANSFER_ORG_DEPT) {
		this.TRANSFER_ORG_DEPT = TRANSFER_ORG_DEPT;
	}
	
	@JSONField(name = "REFUSE_REFERRAL")
	public String getREFUSE_REFERRAL() {
		return REFUSE_REFERRAL;
	}
	
	public void setREFUSE_REFERRAL(String REFUSE_REFERRAL) {
		this.REFUSE_REFERRAL = REFUSE_REFERRAL;
	}
	
	@JSONField(name = "REFUSE_REFERRAL_WHY")
	public String getREFUSE_REFERRAL_WHY() {
		return REFUSE_REFERRAL_WHY;
	}
	
	public void setREFUSE_REFERRAL_WHY(String REFUSE_REFERRAL_WHY) {
		this.REFUSE_REFERRAL_WHY = REFUSE_REFERRAL_WHY;
	}
	
	@JSONField(name = "ARCHIVE_ID")
	public String getARCHIVE_ID() {
		return ARCHIVE_ID;
	}
	
	public void setARCHIVE_ID(String ARCHIVE_ID) {
		this.ARCHIVE_ID = ARCHIVE_ID;
	}
	
	@JSONField(name = "CHECK_FEE_TYPE")
	public String getCHECK_FEE_TYPE() {
		return CHECK_FEE_TYPE;
	}
	
	public void setCHECK_FEE_TYPE(String CHECK_FEE_TYPE) {
		this.CHECK_FEE_TYPE = CHECK_FEE_TYPE;
	}
	
	@JSONField(name = "FAMILY_FOLLOWUP_ID")
	public String getFAMILY_FOLLOWUP_ID() {
		return FAMILY_FOLLOWUP_ID;
	}
	
	public void setFAMILY_FOLLOWUP_ID(String FAMILY_FOLLOWUP_ID) {
		this.FAMILY_FOLLOWUP_ID = FAMILY_FOLLOWUP_ID;
	}
}

+ 10 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/followup/Followup.java

@ -65,9 +65,10 @@ public class Followup extends IdEntity {
	private Integer signType;
	// 行政团队
	private Long adminTeamCode;
	//签约表Code
	private String signCode;
	//关联的续方CODE
	private String prescriptionCode;
	public Date getFollowupPlanDate() {
		return followupPlanDate;
@ -272,4 +273,12 @@ public class Followup extends IdEntity {
	public void setJworgCode(String jworgCode) {
		this.jworgCode = jworgCode;
	}
	
	public String getPrescriptionCode() {
		return prescriptionCode;
	}
	
	public void setPrescriptionCode(String prescriptionCode) {
		this.prescriptionCode = prescriptionCode;
	}
}

+ 94 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionFollowupContent.java

@ -0,0 +1,94 @@
package com.yihu.wlyy.entity.patient.prescription;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;
/**
 * 续方咨询随访问卷表
 * @author huangwenjie
 * @date 2017/11/1 12:05
 */
@Entity
@Table(name = "wlyy_prescription_followup_content")
public class PrescriptionFollowupContent extends IdEntity {
	private String code;
	private String prescriptionCode;  //续方COE
	private String followupId;        //随访记录ID
	private String followupProject;   //随访问卷详情类型ID(目前有1-10,和随访信息详情分类一致)
	private String followupKey;       //随访问卷详情指标KEY(和随访记录一致)
	private String followupValue;     //随访问卷详情指标值(和随访记录一致)
	private Date createTime;
	
	@Basic
	@Column(name = "code")
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	@Basic
	@Column(name = "prescription_code")
	public String getPrescriptionCode() {
		return prescriptionCode;
	}
	
	public void setPrescriptionCode(String prescriptionCode) {
		this.prescriptionCode = prescriptionCode;
	}
	
	@Basic
	@Column(name = "followup_id")
	public String getFollowupId() {
		return followupId;
	}
	
	public void setFollowupId(String followupId) {
		this.followupId = followupId;
	}
	
	@Basic
	@Column(name = "followup_project")
	public String getFollowupProject() {
		return followupProject;
	}
	
	public void setFollowupProject(String followupProject) {
		this.followupProject = followupProject;
	}
	
	@Basic
	@Column(name = "followup_key")
	public String getFollowupKey() {
		return followupKey;
	}
	
	public void setFollowupKey(String followupKey) {
		this.followupKey = followupKey;
	}
	
	@Basic
	@Column(name = "followup_value")
	public String getFollowupValue() {
		return followupValue;
	}
	
	public void setFollowupValue(String followupValue) {
		this.followupValue = followupValue;
	}
	
	@Basic
	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
}

+ 1 - 1
patient-co-service/wlyy_service/src/main/resources/application.yml

@ -112,7 +112,7 @@ im:
spring:
  profiles: production
  datasource:
    url: jdbc:mysql://10.95.22.7:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    url: jdbc:mysql://10.95.22.143:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: jkzlehr@123
    driverClassName: com.mysql.jdbc.Driver

+ 1 - 1
patient-co-service/wlyy_sign/src/main/resources/application.yml

@ -75,7 +75,7 @@ spring:
spring:
  profiles: production
  datasource:
    url: jdbc:mysql://10.95.22.7:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    url: jdbc:mysql://10.95.22.143:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: jkzlehr@123
    driverClassName: com.mysql.jdbc.Driver

+ 93 - 93
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/es/ElasticFactory.java

@ -1,93 +1,93 @@
//package com.yihu.wlyy.config.es;
//
//import io.searchbox.client.JestClient;
//import io.searchbox.client.JestClientFactory;
//import io.searchbox.client.config.HttpClientConfig;
//import org.elasticsearch.client.Client;
//import org.elasticsearch.client.transport.TransportClient;
//import org.elasticsearch.common.settings.Settings;
//import org.elasticsearch.common.transport.InetSocketTransportAddress;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//import org.springframework.util.StringUtils;
//
//import javax.annotation.PostConstruct;
//import java.net.InetAddress;
//import java.net.UnknownHostException;
//import java.util.concurrent.TimeUnit;
//
///**
// * Created by chenweida on 2017/6/5.
// */
//@Component
//public class ElasticFactory {
//    private static JestClientFactory factory = null;
//
//    @Value("${es.host}")
//    private String esHost;
//    @Value("${es.port}")
//    private String port;
//    @Value("${es.tPort}")
//    private String tPort;
//    @Value("${es.clusterName}")
//    private String clusterName;
////-----------------------------------jestClient----------------------------------------
//
//    /**
//     * @param "http://localhost:9200"
//     * @return
//     */
//    @PostConstruct
//    public JestClient getJestClient() {
//        synchronized (ElasticFactory.class) {
//            if (factory == null) {
//                //初始化链接
//                init();
//            }
//        }
//        return factory.getObject();
//    }
//
//    /**
//     * 初始化链接
//     */
//    public synchronized void init() {
//
//        // Construct a new Jest client according to configuration via factory
//        factory = new JestClientFactory();
//        factory.setHttpClientConfig(new HttpClientConfig
//                .Builder("http://" + esHost + ":" + port)
//                .multiThreaded(true)
//                .maxTotalConnection(50)// 最大链接
//                .maxConnectionIdleTime(120, TimeUnit.SECONDS)//链接等待时间
//                .connTimeout(30000)
//                .discoveryEnabled(true)
//                .readTimeout(30000)//30秒
//                .build());//得到链接
//    }
//
//    //-----------------------------------TransportClient----------------------------------------
//    private Client transportClient;
//
//    public Client getTransportClient() {
//        try {
//            initTranClient();
//            return transportClient;
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return null;
//    }
//
//    private synchronized void initTranClient() throws UnknownHostException {
//        if (transportClient == null) {
//            Settings settings = Settings.settingsBuilder()
//                    .put("client.transport.sniff", true)//开启嗅探功能
//                    .put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
//                    .build();
//
//            transportClient = TransportClient.builder().settings(settings).build()
//                    .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(esHost), Integer.valueOf(tPort)));
//        }
//    }
//}
package com.yihu.wlyy.config.es;
import io.searchbox.client.JestClient;
import io.searchbox.client.JestClientFactory;
import io.searchbox.client.config.HttpClientConfig;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.annotation.PostConstruct;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.TimeUnit;
/**
 * Created by chenweida on 2017/6/5.
 */
@Component
public class ElasticFactory {
	private static JestClientFactory factory = null;
	
	@Value("${es.host}")
	private String esHost;
	@Value("${es.port}")
	private String port;
	@Value("${es.tPort}")
	private String tPort;
	@Value("${es.clusterName}")
	private String clusterName;
//-----------------------------------jestClient----------------------------------------
	
	/**
	 * @param "http://localhost:9200"
	 * @return
	 */
	//@PostConstruct
	public JestClient getJestClient() {
		synchronized (ElasticFactory.class) {
			if (factory == null) {
				//初始化链接
				init();
			}
		}
		return factory.getObject();
	}
	
	/**
	 * 初始化链接
	 */
	public synchronized void init() {
		
		// Construct a new Jest client according to configuration via factory
		factory = new JestClientFactory();
		factory.setHttpClientConfig(new HttpClientConfig
				.Builder("http://" + esHost + ":" + port)
				.multiThreaded(true)
				.maxTotalConnection(50)// 最大链接
				.maxConnectionIdleTime(120, TimeUnit.SECONDS)//链接等待时间
				.connTimeout(30000)
				.discoveryEnabled(true)
				.readTimeout(30000)//30秒
				.build());//得到链接
	}
	
	//-----------------------------------TransportClient----------------------------------------
	private Client transportClient;
	
	public Client getTransportClient() {
		try {
			initTranClient();
			return transportClient;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	private synchronized void initTranClient() throws UnknownHostException {
		if (transportClient == null) {
			Settings settings = Settings.settingsBuilder()
					.put("client.transport.sniff", true)//开启嗅探功能
					.put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
					.build();
			
			transportClient = TransportClient.builder().settings(settings).build()
					.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(esHost), Integer.valueOf(tPort)));
		}
	}
}

+ 51 - 49
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/es/ElastricSearchSave.java

@ -1,49 +1,51 @@
//package com.yihu.wlyy.config.es;
//
//import io.searchbox.client.JestClient;
//import io.searchbox.core.Bulk;
//import io.searchbox.core.BulkResult;
//import io.searchbox.core.Index;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Scope;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//
//;
//
///**
// * Created by chenweida on 2017/6/2.
// */
//@Component
//@Scope("prototype")
//public class ElastricSearchSave {
//
//    private Logger logger = LoggerFactory.getLogger(ElastricSearchSave.class);
//    @Autowired
//    private ElasticFactory elasticFactory;
//
//    public Boolean save(List  sms,String esIndex,String esType) {
//        try {
//            //得到链接
//            JestClient jestClient = elasticFactory.getJestClient();
//
//            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
//            for (Object obj : sms) {
//                Index index = new Index.Builder(obj).build();
//                bulk.addAction(index);
//            }
//            BulkResult br = jestClient.execute(bulk.build());
//            logger.info("save data count:" + sms.size());
//            logger.info("save flag:" + br.isSucceeded());
//            return br.isSucceeded();
//        } catch (Exception e) {
//            e.printStackTrace();
//            logger.error(" save error :" + e.getMessage());
//        }
//        return null;
//    }
//
//}
package com.yihu.wlyy.config.es;
import com.alibaba.fastjson.JSONObject;
import io.searchbox.client.JestClient;
import io.searchbox.core.Bulk;
import io.searchbox.core.BulkResult;
import io.searchbox.core.Index;
import io.searchbox.core.Update;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.List;
;
/**
 * Created by chenweida on 2017/6/2.
 */
@Component
@Scope("prototype")
public class ElastricSearchSave {
	
	private Logger logger = LoggerFactory.getLogger(ElastricSearchSave.class);
	@Autowired
	private ElasticFactory elasticFactory;
	
	public Boolean save(List  sms,String esIndex,String esType) {
		try {
			//得到链接
			JestClient jestClient = elasticFactory.getJestClient();
			
			Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
			for (Object obj : sms) {
				Index index = new Index.Builder(obj).build();
				bulk.addAction(index);
			}
			BulkResult br = jestClient.execute(bulk.build());
			logger.info("save data count:" + sms.size());
			logger.info("save flag:" + br.isSucceeded());
			return br.isSucceeded();
		} catch (Exception e) {
			e.printStackTrace();
			logger.error(" save error :" + e.getMessage());
		}
		return null;
	}
	
}

+ 295 - 110
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -3,6 +3,9 @@ package com.yihu.wlyy.service.third.jw;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.FollowupContentESDO;
import com.yihu.wlyy.config.es.ElasticFactory;
import com.yihu.wlyy.config.es.ElastricSearchSave;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.followup.*;
import com.yihu.wlyy.entity.oldpeople.OldPeoplePhysicalExaminationEntity;
@ -21,9 +24,14 @@ import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import io.searchbox.client.JestClient;
import io.searchbox.core.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -85,6 +93,15 @@ public class JwPrescriptionService {
    @Autowired
    private FollowUpMappingDao followUpMappingDao;
    
    @Value("${es.type.FollowUpContent}")
    private String esType;
    @Value("${es.index.FollowUp}")
    private String esIndex;
    @Autowired
    private ElasticFactory elasticFactory;
    @Autowired
    private ElastricSearchSave elastricSearchSave;
    
    /**
     * 获取字典列表
     *
@ -694,112 +711,82 @@ public class JwPrescriptionService {
                            try {
                                followup = followUpDao.save(followup);
                                Long followupId = followup.getId();
                                //删除原有记录
                                followupContentDao.deleteByFollowupId(followup.getId());
                                
                                //组装数据
                                List<FollowupContent> newList = new ArrayList<>();
    
                                followupContent1.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("1");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContent2.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("2");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContent3.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("3");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContent4.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("4");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContent5.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("5");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContent6.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("6");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContent7.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("7");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContent8.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("8");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContent9.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("9");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContent10.forEach((k, v) -> {
                                    FollowupContent item = new FollowupContent();
                                    item.setFollowupId(followupId);
                                    item.setFollowupProject("10");
                                    item.setFollowupKey(k);
                                    item.setFollowupValue(v);
                                    item.setCreateTime(new Date());
                                    newList.add(item);
                                });
    
                                followupContentDao.save(newList);
                                List<FollowupContentESDO> newList = new ArrayList<>();
    
                                FollowupContentESDO followupContentESDO1 = new FollowupContentESDO();
                                String jsonString1 = JSON.toJSONString(followupContent1);
                                followupContentESDO1 = JSON.parseObject(jsonString1, FollowupContentESDO.class);
                                followupContentESDO1.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO1.setFollowup_project("1");
                                newList.add(followupContentESDO1);
    
                                FollowupContentESDO followupContentESDO2 = new FollowupContentESDO();
                                String jsonString2 = JSON.toJSONString(followupContent2);
                                followupContentESDO2 = JSON.parseObject(jsonString2, FollowupContentESDO.class);
                                followupContentESDO2.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO2.setFollowup_project("2");
                                newList.add(followupContentESDO2);
    
                                FollowupContentESDO followupContentESDO3 = new FollowupContentESDO();
                                String jsonString3 = JSON.toJSONString(followupContent3);
                                followupContentESDO3 = JSON.parseObject(jsonString3, FollowupContentESDO.class);
                                followupContentESDO3.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO3.setFollowup_project("3");
                                newList.add(followupContentESDO3);
    
                                FollowupContentESDO followupContentESDO4 = new FollowupContentESDO();
                                String jsonString4 = JSON.toJSONString(followupContent4);
                                followupContentESDO4 = JSON.parseObject(jsonString4, FollowupContentESDO.class);
                                followupContentESDO4.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO4.setFollowup_project("4");
                                newList.add(followupContentESDO4);
    
                                FollowupContentESDO followupContentESDO5 = new FollowupContentESDO();
                                String jsonString5 = JSON.toJSONString(followupContent5);
                                followupContentESDO5 = JSON.parseObject(jsonString5, FollowupContentESDO.class);
                                followupContentESDO5.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO5.setFollowup_project("5");
                                newList.add(followupContentESDO5);
    
                                FollowupContentESDO followupContentESDO6 = new FollowupContentESDO();
                                String jsonString6 = JSON.toJSONString(followupContent6);
                                followupContentESDO6 = JSON.parseObject(jsonString6, FollowupContentESDO.class);
                                followupContentESDO6.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO6.setFollowup_project("6");
                                newList.add(followupContentESDO6);
    
                                FollowupContentESDO followupContentESDO7 = new FollowupContentESDO();
                                String jsonString7 = JSON.toJSONString(followupContent7);
                                followupContentESDO7 = JSON.parseObject(jsonString7, FollowupContentESDO.class);
                                followupContentESDO7.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO7.setFollowup_project("7");
                                newList.add(followupContentESDO7);
    
                                FollowupContentESDO followupContentESDO8= new FollowupContentESDO();
                                String jsonString8 = JSON.toJSONString(followupContent8);
                                followupContentESDO8 = JSON.parseObject(jsonString8, FollowupContentESDO.class);
                                followupContentESDO8.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO8.setFollowup_project("8");
                                newList.add(followupContentESDO8);
    
                                FollowupContentESDO followupContentESDO9= new FollowupContentESDO();
                                String jsonString9 = JSON.toJSONString(followupContent9);
                                followupContentESDO9 = JSON.parseObject(jsonString9, FollowupContentESDO.class);
                                followupContentESDO9.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO9.setFollowup_project("9");
                                newList.add(followupContentESDO9);
                                
                                FollowupContentESDO followupContentESDO10= new FollowupContentESDO();
                                String jsonString10 = JSON.toJSONString(followupContent10);
                                followupContentESDO10 = JSON.parseObject(jsonString10, FollowupContentESDO.class);
                                followupContentESDO10.setFollowup_id(String.valueOf(followupId));
                                followupContentESDO10.setFollowup_project("10");
                                newList.add(followupContentESDO10);
    
                                //ES保存新数据
                                this.esSaveFollowupContentData(String.valueOf(followupId),newList);
                        
                                List<FollowupDrugs> DRUG_LIST = new ArrayList<>();//用药记录
                        
@ -880,11 +867,10 @@ public class JwPrescriptionService {
                    //组装请求结果MAP
                    HashMap<String,String> followupResultMap = new HashMap<>();
                    
                    List<FollowupContent> followupContents = followupContentDao.findByFollowupId(followup.getId());
                    
                    for (FollowupContent followupContent : followupContents) {
                        followupResultMap.put(followupContent.getFollowupKey(), followupContent.getFollowupValue());
                    }
                    List<FollowupContentESDO> followupContentESDOList = this.esfindFollowUpContestsByFollowupId(String.valueOf(followup.getId()));
    
                    //转MAP
                    followupResultMap =  this.operaESFollowUpContentData(followupContentESDOList);
                    
                    String OPERATOR = followup.getJwdoctorCode();//操作员&录入医生
                    if (StringUtils.isBlank(OPERATOR)) {
@ -920,6 +906,8 @@ public class JwPrescriptionService {
                        FAMILY_FOLLOWUP_CLASS_NAMES = "高血压,糖尿病";
                    } else {}
    
                    
                    
                    followupResultMap.put("FAMILY_FOLLOWUP_TYPE",FAMILY_FOLLOWUP_TYPE);
                    followupResultMap.put("ORG_CODE",JW_ORG_CODE);
                    followupResultMap.put("FOLLOWUP_SOURCE",FOLLOWUP_SOURCE);
@ -1125,4 +1113,201 @@ public class JwPrescriptionService {
        
        return re;
    }
    
    /**
     *ES 删除随访详情信息
     *@author huangwenjie
     *@date 2017/11/1 15:17
     */
    public void esDeleteFollowUpContent(List<FollowupContentESDO> datalist) throws Exception{
        try {
            JestClient jestClient = elasticFactory.getJestClient();
            //根据id批量删除
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (FollowupContentESDO obj : datalist) {
                Delete index = new Delete.Builder(obj.getId()).build();
                bulk.addAction(index);
            }
            BulkResult br = jestClient.execute(bulk.build());
            
            logger.info("delete data count:" + datalist.size());
            logger.info("delete flag:" + br.isSucceeded());
        }catch (Exception e){
            e.printStackTrace();
        }
        
    }
    
    /**
     * ES获取面访项目数据详情
     *@author huangwenjie
     *@date 2017/11/1 19:41
     */
    public List<FollowupContentESDO>  esfindFollowUpContestsByFollowupId(String id) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
        
        List<String> resultList = new ArrayList<>();
        
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
        );
        
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        
        List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
        
        return followupContentESDOList;
    }
    
    /**
     *ES 保存随访记录详情
     *@author huangwenjie
     *@date 2017/11/1 14:57
     */
    public void esSaveFollowupContentData(String followupid, List<FollowupContentESDO> newdatalist) throws Exception {
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
        );
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType).build();
        SearchResult result = jestClient.execute(search);
        List<FollowupContentESDO> dataList = result.getSourceAsObjectList(FollowupContentESDO.class);
        //删除原有记录
        this.esDeleteFollowUpContent(dataList);
        //保存新的随访详情记录
        elastricSearchSave.save(newdatalist,esIndex,esType);
    }
    
    public HashMap<String,String> operaESFollowUpContentData(List<FollowupContentESDO> esdataList){
        HashMap<String,String> result = new HashMap<>();
    
        for (FollowupContentESDO followupContentESDO: esdataList) {
            
            switch (followupContentESDO.getFollowup_project()){
                case "1":
                    result.put("NO_SYMPTOM", followupContentESDO.getNO_SYMPTOM());//无症状【0.无 1.有】
                    result.put("HEADACHE", followupContentESDO.getHEADACHE());//头痛头晕【0.无 1.有】
                    result.put("NAUSEA", followupContentESDO.getNAUSEA());//恶心呕吐【0.无 1.有】
                    result.put("VERTIGO_TINNITUS", followupContentESDO.getVERTIGO_TINNITUS());//眼花耳鸣【0.无 1.有】
                    result.put("DIFFICULTY_BREATHING", followupContentESDO.getDIFFICULTY_BREATHING());//呼吸困难【0.无 1.有】
                    result.put("PALPITATIONS",followupContentESDO.getPALPITATIONS());//心悸胸闷【0.无 1.有】
                    result.put("EPISTAXIS_BLEEDING", followupContentESDO.getEPISTAXIS_BLEEDING());//鼻衄出血不止【0.无 1.有】
                    result.put("LIMBS_NUMB", followupContentESDO.getLIMBS_NUMB());//四肢发麻【0.无 1.有】
                    result.put("EXTREMITY_EDEMA", followupContentESDO.getEXTREMITY_EDEMA());//下肢水肿【0.无 1.有】
                    result.put("SYMPTOM_OTHER", followupContentESDO.getSYMPTOM_OTHER());//"其他症状"
                    result.put("POLYDIPSIA", followupContentESDO.getPOLYDIPSIA());//多饮【0.无 1.有】
                    result.put("MORE_FOOD", followupContentESDO.getMORE_FOOD());//多食【0.无 1.有】
                    result.put("MORE_URINE", followupContentESDO.getMORE_URINE());//多尿【0.无 1.有】
                    result.put("BLURRED_VISION", followupContentESDO.getBLURRED_VISION());//视力模糊【0.无 1.有】
                    result.put("INFECTION", followupContentESDO.getINFECTION());//感染【0.无 1.有】
                    result.put("NUMB_HANDS", followupContentESDO.getNUMB_HANDS());//手脚麻木【0.无 1.有】
                    result.put("WEIGHT_LOSS", followupContentESDO.getWEIGHT());//体重明显下降【0.无 1.有】
                    result.put("HYPOG_REACT_CODE", followupContentESDO.getHYPOG_REACT_CODE());//低血糖反应【0.无;1.偶尔;2.频繁;】
                    break;
                case "2":
                    result.put("HEIGHT", followupContentESDO.getHEIGHT());//身高
                    result.put("HEIGHT_EXP", followupContentESDO.getHEIGHT_EXP());//期望身高
                    result.put("WEIGHT", followupContentESDO.getWEIGHT());//体重
                    result.put("WEIGHT_EXP", followupContentESDO.getWEIGHT_EXP());//期望体重
                    result.put("BP_D",followupContentESDO.getBP_D());//舒张压
                    result.put("BP_U", followupContentESDO.getBP_U());//收缩压
                    result.put("BS_FPG",followupContentESDO.getBS_FPG());//空腹血糖
                    result.put("NO_BS_FPG", followupContentESDO.getNO_BS_FPG());//餐后血糖
                    result.put("RANDOM_BLOOD_SUGAR",followupContentESDO.getRANDOM_BLOOD_SUGAR());//随机血糖
                    result.put("BMI", followupContentESDO.getBMI());//体质指数
                    result.put("BMI_EXP", followupContentESDO.getBMI_EXP());//期望体质
                    result.put("OTHER_POSITIVE_SIGNS", followupContentESDO.getOTHER_POSITIVE_SIGNS());//体征其他
                    result.put("POFDA_MARK", followupContentESDO.getPOFDA_MARK());//足背动脉搏动【TOUCH_DICT】
                    result.put("HEART_RATE", followupContentESDO.getHEART_RATE());//心率
                    break;
                case "3":
                    result.put("GHB", followupContentESDO.getGHB());//糖化血红蛋白
                    result.put("RENAL_FUNCTION_CREATININE", followupContentESDO.getRENAL_FUNCTION_CREATININE());//血清肌酐
                    result.put("RENAL_FUNCTION_BUN", followupContentESDO.getRENAL_FUNCTION_BUN());//血尿素氮
                    result.put("MICROALBUMINURIA",followupContentESDO.getMICROALBUMINURIA());//尿微量白蛋白
                    result.put("EXAM_DATE", followupContentESDO.getEXAM_DATE());//检查日期
                    result.put("BLOOD_FAT_TRIGLYCERIDE", followupContentESDO.getBLOOD_FAT_TRIGLYCERIDE());//甘油三酯 V01
                    result.put("BLOOD_FAT_TC", followupContentESDO.getBLOOD_FAT_TC());//总胆固醇 V02
                    result.put("BLOOD_FAT_LDLC", followupContentESDO.getBLOOD_FAT_LDLC());//血清低密度脂蛋白胆固醇 V03
                    break;
                case "4":
                    result.put("DAILY_SMOKING", followupContentESDO.getDAILY_SMOKING());//日吸烟量
                    result.put("SOMKING_EXP", followupContentESDO.getSOMKING_EXP());//日吸烟期望
                    result.put("DAILY_DRINKING",followupContentESDO.getDAILY_DRINKING());//日饮酒量
                    result.put("DRINK_EXP", followupContentESDO.getDRINK_EXP());//日饮酒期望
                    result.put("EXERCISE_FREQ_CODE", followupContentESDO.getEXERCISE_FREQ_CODE());//运动频率【HYGIENE_SPORT_FREQ_DICT】
                    result.put("EXERCISE_FREQ_CODE_EXP", followupContentESDO.getEXERCISE_FREQ_CODE_EXP());//运动频率期望【HYGIENE_SPORT_FREQ_DICT】
                    result.put("EXERCISE_DURATION_MINS", followupContentESDO.getEXERCISE_DURATION_MINS());//运动时长(min) 分钟/次
                    result.put("EXERCISE_DURATION_MINS_EXP", followupContentESDO.getEXERCISE_DURATION_MINS_EXP());//运动时长期望(min) 分钟/次期望
                    result.put("SALT_TAKEN_LEVEL_CODE", followupContentESDO.getSALT_TAKEN_LEVEL_CODE());//摄盐情况【LIGHT_WEIGHT_DICT】
                    result.put("SALT_TAKEN_LEVEL_EXP", followupContentESDO.getSALT_TAKEN_LEVEL_EXP());//摄盐情况期望【LIGHT_WEIGHT_DICT】
                    result.put("PSY_ADJUST_RESULT_CODE", followupContentESDO.getPSY_ADJUST_RESULT_CODE());//心里调整【GOOD_FAIR_POOR_DICT】
                    result.put("COMPLIANCE_RESULT_CODE", followupContentESDO.getCOMPLIANCE_RESULT_CODE());//遵医行为【GOOD_FAIR_POOR_DICT】
                    result.put("DAILY_STAPLE", followupContentESDO.getDAILY_STAPLE());//主食(克/天)
                    break;
                case "5":
                    result.put("HYP_FOLLOWUP_TYPE_CODE", followupContentESDO.getHYP_FOLLOWUP_TYPE_CODE());//高血压随访分类【FOLLOW_TYPE_DICT】
                    result.put("HYP_COMPLICATION_DETAIL", followupContentESDO.getHYP_COMPLICATION_DETAIL());//高血压随访分类--详情
                    result.put("DIA_FOLLOWUP_TYPE_CODE", followupContentESDO.getDIA_FOLLOWUP_TYPE_CODE());//糖尿病随访分类【FOLLOW_TYPE_DICT】
                    result.put("DIA_COMPLICATION_DETAIL", followupContentESDO.getDIA_COMPLICATION_DETAIL());//糖尿病随访分类--详情
                    break;
                case "6":
                    result.put("DRUG_COMPLIANCE_CODE", followupContentESDO.getDRUG_COMPLIANCE_CODE());//服药依从性【DRUG_STATE_DICT】
                    break;
                
                case "7":
                    result.put("CONTROL_DATE", followupContentESDO.getCONTROL_DATE());//控制日期 V04
                    result.put("CONTROL_CONSTITUTOR", followupContentESDO.getCONTROL_CONSTITUTOR());//制定者姓名 V05
                    result.put("CONTROL_CONSTITUTOR_DOCTORCODE", followupContentESDO.getCONTROL_CONSTITUTOR_DOCTORCODE());//制定者本地CODE V05
                    result.put("CONTROL_CONSTITUTOR_JWDOCTORCODE", followupContentESDO.getCONTROL_CONSTITUTOR_JWDOCTORCODE());//制定者本地CODE V05
                    result.put("CONTROL_BP_U", followupContentESDO.getCONTROL_BP_U());//血压收缩压 V06
                    result.put("CONTROL_BP_D", followupContentESDO.getCONTROL_BP_D());//血压舒张压 V07
                    result.put("CONTROL_BS_FPG", followupContentESDO.getCONTROL_NO_BS_FPG());//空腹血糖 V08
                    result.put("CONTROL_NO_BS_FPG", followupContentESDO.getCONTROL_NO_BS_FPG());//餐后血糖 V09
                    result.put("CONTROL_GHB", followupContentESDO.getCONTROL_GHB());//糖化血红蛋白 V10
                    result.put("CONTROL_TRIGLYCERIDE", followupContentESDO.getCONTROL_TRIGLYCERIDE());//甘油三酯 V11
                    result.put("CONTROL_TOTAL_CHOLESTEROL", followupContentESDO.getCONTROL_TOTAL_CHOLESTEROL());//总胆固醇 V12
                    result.put("CONTROL_LDL",followupContentESDO.getCONTROL_LDL());//低密度脂蛋白 V13
                    result.put("CONTROL_WEIGHT", followupContentESDO.getCONTROL_WEIGHT());//体重 V14
                    result.put("CONTROL_EXERCISE_FREQ_CODE",followupContentESDO.getCONTROL_EXERCISE_FREQ_CODE());//运动频率 V15
                    result.put("CONTROL_EXERCISE_DURATION_MINS",followupContentESDO.getCONTROL_EXERCISE_DURATION_MINS());//运动时长 V16
                    break;
                    
                case "8":
                    result.put("ARCHIVE_TIME", followupContentESDO.getARCHIVE_TIME());//健康教育日期 V17
                    result.put("ARCHIVE_OPERATOR_NAME", followupContentESDO.getARCHIVE_OPERATOR_NAME());//健康教育记录者 基卫系统医生【传中文名称】 V18
                    result.put("HEALTH_EDUCATE", followupContentESDO.getHEADACHE());//健康教育【CHRO_HEALTH_EDUCATE_DICT】 V19
                    result.put("EDUCATE_CONTENT", followupContentESDO.getEDUCATE_CONTENT());//健康教育内容 V20
                    break;
                    
                case "9":
                    result.put("DRUG_ADVERSE_MARK", followupContentESDO.getDRUG_ADVERSE_MARK());//药物不良反应【0.无;1.有;】
                    result.put("ADR_REMARK", followupContentESDO.getADR_REMARK());//药物不良反应【内容】
                    result.put("TRANSFER_RESON", followupContentESDO.getTRANSFER_RESON());//转诊原因
                    result.put("TRANSFER_ORG_DEPT", followupContentESDO.getTRANSFER_ORG_DEPT());//转诊机构科室
                    result.put("REFUSE_REFERRAL", followupContentESDO.getREFUSE_REFERRAL());//患者拒绝转诊【0 否 1 是】
                    result.put("REFUSE_REFERRAL_WHY", followupContentESDO.getREFUSE_REFERRAL_WHY());//患者拒绝转诊内容
                    break;
                case "10":
                    result.put("ARCHIVE_ID", followupContentESDO.getARCHIVE_ID());//档案ID
                    result.put("CHECK_FEE_TYPE", followupContentESDO.getCHECK_FEE_TYPE());//检测费用类型
                    result.put("FAMILY_FOLLOWUP_ID", followupContentESDO.getFAMILY_FOLLOWUP_ID());//随访细表外键随访ID
                    break;
                default:
                    break;
            }
        }
        
        return result;
        
    }
}

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml

@ -117,8 +117,12 @@ activemq:
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_dev
    Statistics: wlyy_quota_test
    FollowUp: wlyy_followup
  type:
    HealthEduArticlePatient: health_edu_article_patient_dev
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300

+ 6 - 3
patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml

@ -106,12 +106,15 @@ activemq:
    count: 10 #消费者集群数
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_dev
    HealthEduArticlePatient: wlyy_quota_test
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
  type:
    HealthEduArticlePatient: health_edu_article_patient_dev
    HealthEduArticlePatient: wlyy_quota_test
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300

+ 9 - 5
patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml

@ -116,10 +116,14 @@ activemq:
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_dev
    HealthEduArticlePatient: health_edu_article_patient_prod
    Statistics: wlyy_quota_prod
    FollowUp: wlyy_followup
  type:
    HealthEduArticlePatient: health_edu_article_patient_dev
  host: 172.19.103.68
  port: 9200
  tPort: 9300
    HealthEduArticlePatient: health_edu_article_patient_prod
    Statistics: wlyy_quota_prod
    FollowUpContent: wlyy_followup_content
  host: 59.61.92.90
  port: 9065
  tPort: 9066
  clusterName: jkzl

+ 6 - 2
patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml

@ -113,9 +113,13 @@ activemq:
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_dev
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
  type:
    HealthEduArticlePatient: health_edu_article_patient_dev
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300

+ 342 - 4
patient-co/patient-co-wlyy/doc/技术文档/es/随访记录详情新增索引.txt

@ -15,15 +15,351 @@ POST http://172.19.103.68:9200/wlyy_followup/wlyy_followup_content/_mapping
                "type": "string",
                "index": "not_analyzed"
            },
            "followup_key": {
            "create_time": {
                "type": "string",
                "index": "not_analyzed"
            },
            "followup_value": {
            "NO_SYMPTOM": {
                "type": "string",
                "index": "not_analyzed"
            },
            "create_time": {
            "HEADACHE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "NAUSEA": {
                "type": "string",
                "index": "not_analyzed"
            },
            "VERTIGO_TINNITUS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DIFFICULTY_BREATHING": {
                "type": "string",
                "index": "not_analyzed"
            },
            "PALPITATIONS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EPISTAXIS_BLEEDING": {
                "type": "string",
                "index": "not_analyzed"
            },
            "LIMBS_NUMB": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXTREMITY_EDEMA": {
                "type": "string",
                "index": "not_analyzed"
            },
            "SYMPTOM_OTHER": {
                "type": "string",
                "index": "not_analyzed"
            },
            "POLYDIPSIA": {
                "type": "string",
                "index": "not_analyzed"
            },
            "MORE_FOOD": {
                "type": "string",
                "index": "not_analyzed"
            },
            "MORE_URINE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BLURRED_VISION": {
                "type": "string",
                "index": "not_analyzed"
            },
            "INFECTION": {
                "type": "string",
                "index": "not_analyzed"
            },
            "NUMB_HANDS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "WEIGHT_LOSS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HYPOG_REACT_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HEIGHT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HEIGHT_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "WEIGHT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "WEIGHT_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BP_D": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BP_U": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BS_FPG": {
                "type": "string",
                "index": "not_analyzed"
            },
            "NO_BS_FPG": {
                "type": "string",
                "index": "not_analyzed"
            },
            "RANDOM_BLOOD_SUGAR": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BMI": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BMI_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "OTHER_POSITIVE_SIGNS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "POFDA_MARK": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HEART_RATE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "GHB": {
                "type": "string",
                "index": "not_analyzed"
            },
            "RENAL_FUNCTION_CREATININE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "RENAL_FUNCTION_BUN": {
                "type": "string",
                "index": "not_analyzed"
            },
            "MICROALBUMINURIA": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXAM_DATE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BLOOD_FAT_TRIGLYCERIDE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BLOOD_FAT_TC": {
                "type": "string",
                "index": "not_analyzed"
            },
            "BLOOD_FAT_LDLC": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DAILY_SMOKING": {
                "type": "string",
                "index": "not_analyzed"
            },
            "SOMKING_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DAILY_DRINKING": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DRINK_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXERCISE_FREQ_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXERCISE_FREQ_CODE_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXERCISE_DURATION_MINS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EXERCISE_DURATION_MINS_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "SALT_TAKEN_LEVEL_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "SALT_TAKEN_LEVEL_EXP": {
                "type": "string",
                "index": "not_analyzed"
            },
            "PSY_ADJUST_RESULT_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "COMPLIANCE_RESULT_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DAILY_STAPLE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HYP_FOLLOWUP_TYPE_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HYP_COMPLICATION_DETAIL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DIA_FOLLOWUP_TYPE_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DIA_COMPLICATION_DETAIL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DRUG_COMPLIANCE_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_DATE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_CONSTITUTOR": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_CONSTITUTOR_DOCTORCODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_CONSTITUTOR_JWDOCTORCODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_BP_U": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_BP_D": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_BS_FPG": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_NO_BS_FPG": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_GHB": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_TRIGLYCERIDE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_TOTAL_CHOLESTEROL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_LDL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_WEIGHT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_EXERCISE_FREQ_CODE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CONTROL_EXERCISE_DURATION_MINS": {
                "type": "string",
                "index": "not_analyzed"
            },
            "ARCHIVE_TIME": {
                "type": "string",
                "index": "not_analyzed"
            },
            "ARCHIVE_OPERATOR_NAME": {
                "type": "string",
                "index": "not_analyzed"
            },
            "HEALTH_EDUCATE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "EDUCATE_CONTENT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "DRUG_ADVERSE_MARK": {
                "type": "string",
                "index": "not_analyzed"
            },
            "ADR_REMARK": {
                "type": "string",
                "index": "not_analyzed"
            },
            "TRANSFER_RESON": {
                "type": "string",
                "index": "not_analyzed"
            },
            "TRANSFER_ORG_DEPT": {
                "type": "string",
                "index": "not_analyzed"
            },
            "REFUSE_REFERRAL": {
                "type": "string",
                "index": "not_analyzed"
            },
            "REFUSE_REFERRAL_WHY": {
                "type": "string",
                "index": "not_analyzed"
            },
            "ARCHIVE_ID": {
                "type": "string",
                "index": "not_analyzed"
            },
            "CHECK_FEE_TYPE": {
                "type": "string",
                "index": "not_analyzed"
            },
            "FAMILY_FOLLOWUP_ID": {
                "type": "string",
                "index": "not_analyzed"
            }
@ -37,4 +373,6 @@ PUT  http://172.19.103.68:9200/wlyy_followup/_settings
  "index": {
    "max_result_window": 500000
  }
}
}

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/es/ElastricSearchSave.java

@ -1,9 +1,11 @@
package com.yihu.wlyy.config.es;
import com.alibaba.fastjson.JSONObject;
import io.searchbox.client.JestClient;
import io.searchbox.core.Bulk;
import io.searchbox.core.BulkResult;
import io.searchbox.core.Index;
import io.searchbox.core.Update;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

+ 0 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/BusinessLogs.java

@ -1,6 +1,5 @@
package com.yihu.wlyy.logs;
import com.yihu.wlyy.util.DateUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;

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

@ -1,6 +1,5 @@
package com.yihu.wlyy.service.app.archives;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.patient.PatientEvent;
import com.yihu.wlyy.entity.patient.PatientEventImg;
import com.yihu.wlyy.logs.BusinessLogs;

+ 188 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -2,6 +2,9 @@ package com.yihu.wlyy.service.app.followup;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.es.entity.FollowupContentESDO;
import com.yihu.wlyy.config.es.ElasticFactory;
import com.yihu.wlyy.config.es.ElastricSearchSave;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.followup.Followup;
@ -23,16 +26,25 @@ import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import io.searchbox.client.JestClient;
import io.searchbox.core.*;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import javax.transaction.Transactional;
import java.util.*;
@ -45,6 +57,8 @@ import java.util.*;
@Component
@Transactional(rollbackOn = Exception.class)
public class FollowUpService extends BaseService {
    
    private static Logger logger = LoggerFactory.getLogger(FollowUpService.class);
    @Autowired
    private DoctorDao doctorDao;
@ -85,7 +99,15 @@ public class FollowUpService extends BaseService {
    private PushMsgTask pushMsgTask;
    @Autowired
    private FollowUpMappingDao followUpMappingDao;
    
    @Value("${es.type.FollowUpContent}")
    private String esType;
    @Value("${es.index.FollowUp}")
    private String esIndex;
    @Autowired
    private ElasticFactory elasticFactory;
    @Autowired
    private ElastricSearchSave elastricSearchSave;
    /**
     * 转译随访信息
@ -594,8 +616,11 @@ public class FollowUpService extends BaseService {
    public List<Map<String, String>> getFollowupProject(String id) throws Exception {
        List<Map<String, String>> re = new ArrayList<>();
        //获取已填写的面访项目
        List<String> project = followupContentDao.findProjectByFollowupId(Long.valueOf(id));
//        List<String> project = followupContentDao.findProjectByFollowupId(Long.valueOf(id));
        //修改为通过ES查询---2017.11.01--huangwenjie
        List<String> project = esfindProjectByFollowupId(id);
        //获取所有面访项目
        
        List<SystemDict> dictList = systemDictService.getDictByDictName("FOLLOWUP_PROJECT");
        if (dictList != null && dictList.size() > 0) {
            for (SystemDict dict : dictList) {
@ -826,5 +851,166 @@ public class FollowUpService extends BaseService {
            e.printStackTrace();
        }
    }
    
    /**
     *ES 保存随访记录详情
     *@author huangwenjie
     *@date 2017/11/1 14:57
     */
    @Transactional
    public void esSaveFollowupProjectData(String id, String followupProject, String followupProjectData) throws Exception {
        
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
                        .must(QueryBuilders.matchQuery("followup_project", followupProject))
        );
    
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        List<FollowupContentESDO> dataList = result.getSourceAsObjectList(FollowupContentESDO.class);
        
        //删除原有记录
        this.esDeleteFollowUpContent(dataList);
        
        //保存新的随访详情信息
        List<FollowupContentESDO> newdatalist = new ArrayList<>();
        FollowupContentESDO followupContentESDO = new FollowupContentESDO();
    
        followupContentESDO = JSON.parseObject(followupProjectData,FollowupContentESDO.class);
    
        followupContentESDO.setFollowup_id(id);
        followupContentESDO.setFollowup_project(followupProject);
        followupContentESDO.setCreate_time(new Date());
        newdatalist.add(followupContentESDO);
        elastricSearchSave.save(newdatalist,esIndex,esType);
        
        
        //如果该随访是已完成的,则添加随访信息上传映射,上传到基卫
        Followup followup = followupDao.findOne(Long.valueOf(id));
        if("1".equals(followup.getStatus())){
            FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(id));
            if(followupMapping == null){
                followupMapping = new FollowupMapping();
                followupMapping.setCode(UUID.randomUUID().toString());
                followupMapping.setFollowupId(Integer.parseInt(id));
                followupMapping.setUpdateTime(DateUtil.getNowTimestamp());
                followupMapping.setCreateTime(DateUtil.getNowTimestamp());
            }
            followupMapping.setNeedUpload(1);
            followUpMappingDao.save(followupMapping);
        }
    }
    
    /**
     * 获取面访项目数据
     */
    public FollowupContentESDO esGetFollowupProjectData(String id, String followupProject) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
    
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
                        .must(QueryBuilders.matchQuery("followup_project", followupProject))
        );
    
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        FollowupContentESDO followupContentESDO  = result.getSourceAsObject(FollowupContentESDO.class);
        return followupContentESDO;
    }
    
    /**
     *ES 删除随访详情信息
     *@author huangwenjie
     *@date 2017/11/1 15:17
     */
    public void esDeleteFollowUpContent(List<FollowupContentESDO> datalist) throws Exception{
        try {
            JestClient jestClient = elasticFactory.getJestClient();
            //根据id批量删除
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (FollowupContentESDO obj : datalist) {
                Delete index = new Delete.Builder(obj.getId()).build();
                bulk.addAction(index);
            }
            BulkResult br = jestClient.execute(bulk.build());
    
            logger.info("delete data count:" + datalist.size());
            logger.info("delete flag:" + br.isSucceeded());
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    
    /**
     * ES获取面访项目数据列表
     *@author huangwenjie
     *@date 2017/11/1 19:41
     */
    public List<String>  esfindProjectByFollowupId(String id) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
        
        List<String> resultList = new ArrayList<>();
        
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
        );
        
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
    
        List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
        
        followupContentESDOList  = result.getSourceAsObjectList(FollowupContentESDO.class);
        if(!followupContentESDOList.isEmpty()){
            for (FollowupContentESDO followupContentESDO: followupContentESDOList) {
                resultList.add(followupContentESDO.getFollowup_project());
            }
        }
        
        return resultList;
    }
    
    /**
     * ES获取面访项目数据详情
     *@author huangwenjie
     *@date 2017/11/1 19:41
     */
    public List<FollowupContentESDO>  esfindFollowUpContestsByFollowupId(String id) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
        
        List<String> resultList = new ArrayList<>();
        
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
        );
        
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        
        List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
        
        return followupContentESDOList;
    }
}

+ 12 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.web.doctor.followup;
import com.alibaba.fastjson.JSON;
import com.yihu.es.entity.FollowupContentESDO;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.logs.BusinessLogs;
@ -8,6 +10,7 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jdk.nashorn.internal.parser.JSONParser;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -276,9 +279,12 @@ public class DoctorFollowUpController extends BaseController {
                                         @ApiParam(name = "followupProject", value = "随访项目", defaultValue = "2")
                                         @RequestParam(value = "followupProject", required = true) String followupProject) {
        try {
            Map<String, String> response = followUpService.getFollowupProjectData(id, followupProject);
            return write(200, "获取随访项目数据成功!", "data", response);
//            Map<String, String> response = followUpService.getFollowupProjectData(id, followupProject);
            //修改为通过ES查询---2017.11.01--huangwenjie
            FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(id, followupProject);
            String jsonString = JSON.toJSONString(followupContentESDO);
            Map maps = (Map)JSON.parse(jsonString);
            return write(200, "获取随访项目数据成功!", "data", maps);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取随访项目数据失败!" + e.getMessage());
@ -296,7 +302,9 @@ public class DoctorFollowUpController extends BaseController {
                                          @ApiParam(name = "followupProjectData", value = "随访项目数据", defaultValue = "{\"WEIGHT\":\"76\",\"WEIGHT_EXP\":\"60\",\"BMI\":\"11\"}")
                                          @RequestParam(value = "followupProjectData", required = true) String followupProjectData) {
        try {
            followUpService.saveFollowupProjectData(id, followupProject, followupProjectData);
//            followUpService.saveFollowupProjectData(id, followupProject, followupProjectData);
            //修改为通过ES查询---2017.11.01--huangwenjie
            followUpService.esSaveFollowupProjectData(id, followupProject, followupProjectData);
            return write(200, "保存随访项目数据成功!");
        } catch (Exception e) {

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

@ -97,9 +97,11 @@ es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_dev
    Statistics: wlyy_quota_test
    FollowUp: wlyy_followup
  type:
    HealthEduArticlePatient: health_edu_article_patient_dev
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300

+ 4 - 3
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -93,11 +93,13 @@ pushMes:
  redis_prescription_title: redisPrescription
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_test
    HealthEduArticlePatient: wlyy_quota_test
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
  type:
    HealthEduArticlePatient: health_edu_article_patient_test
    HealthEduArticlePatient: wlyy_quota_test
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300
@ -116,4 +118,3 @@ activemq:
neiwang:
  enable: false
  wlyy: http://localhost:8081

+ 4 - 2
patient-co/patient-co-wlyy/src/main/resources/application-local.yml

@ -4,11 +4,11 @@ spring:
  datasource:
     wlyy:
       url: jdbc:mysql://10.95.22.7:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       url: jdbc:mysql://10.95.22.143:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       username: wlyy
       password: jkzlehr@123
     health:
       url: jdbc:mysql://10.95.22.7:3306/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       url: jdbc:mysql://10.95.22.143:3306/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       username: wlyy
       password: jkzlehr@123
@ -93,9 +93,11 @@ es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_test
    Statistics: wlyy_quota_test
    FollowUp: wlyy_followup
  type:
    HealthEduArticlePatient: health_edu_article_patient_test
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml

@ -94,9 +94,11 @@ es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_test
    Statistics: wlyy_quota_test
    FollowUp: wlyy_followup
  type:
    HealthEduArticlePatient: health_edu_article_patient_test
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300

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

@ -95,12 +95,14 @@ es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_prod
    Statistics: wlyy_quota_prod
    FollowUp: wlyy_followup
  type:
    HealthEduArticlePatient: health_edu_article_patient_prod
    Statistics: wlyy_quota_prod
  host:  59.61.92.90
  port: 9067
  tPort: 9068
    FollowUpContent: wlyy_followup_content
  host: 59.61.92.90
  port: 9065
  tPort: 9066
  clusterName: jkzl
#消息队列

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -91,9 +91,11 @@ pushMes:
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
  type:
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
  host: 172.19.103.68
  port: 9200