|
@ -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;
|
|
|
|
|
|
/**
|
|
|
* 获取字典列表
|
|
|
*
|
|
@ -96,9 +113,9 @@ public class JwPrescriptionService {
|
|
|
String url = jwUrl + "/third/prescription/getDictForI";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("dictName", dictName));
|
|
|
|
|
|
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -113,9 +130,9 @@ public class JwPrescriptionService {
|
|
|
String url = jwUrl + "/third/prescription/getRecipeTemplate";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("doctor", doctor));
|
|
|
|
|
|
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -147,7 +164,7 @@ public class JwPrescriptionService {
|
|
|
jsonObject.put("status", 200);
|
|
|
jsonObject.put("data", response);
|
|
|
response = jsonObject.toString();
|
|
|
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -163,9 +180,9 @@ public class JwPrescriptionService {
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("recipeNo", recipeNo));
|
|
|
params.add(new BasicNameValuePair("cardNo", cardNo));
|
|
|
|
|
|
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -182,7 +199,7 @@ public class JwPrescriptionService {
|
|
|
String url = jwUrl + "/third/prescription/saveRecipe";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
|
|
|
|
|
|
|
|
|
response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
return response;
|
|
|
} catch (Exception e) {
|
|
@ -204,9 +221,9 @@ public class JwPrescriptionService {
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("cardNo", cardNo));
|
|
|
params.add(new BasicNameValuePair("visitNo", visitNo));
|
|
|
|
|
|
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -244,9 +261,9 @@ public class JwPrescriptionService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String fadeRecipe(String prescriptionCode) throws Exception {
|
|
|
|
|
|
|
|
|
Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(prescription.getVisitNo())) {
|
|
|
String url = jwUrl + "/third/prescription/fadeRecipe";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
@ -264,10 +281,10 @@ public class JwPrescriptionService {
|
|
|
} else {
|
|
|
throw new Exception("基卫接口(挂号作废)请求失败,无数据返回!");
|
|
|
}
|
|
|
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
|
|
|
return "";
|
|
|
}
|
|
|
|
|
@ -293,18 +310,18 @@ public class JwPrescriptionService {
|
|
|
* @return
|
|
|
*/
|
|
|
public void getPatientDiseaseContentMapByTime(String startdate, String enddate) throws Exception {
|
|
|
|
|
|
|
|
|
logger.info("查询家签慢病患者定标情况,开始时间" + startdate + ",结束时间:" + enddate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String url = jwUrl + "/third/sign/getSickFamilyDoctorSpecialistControl";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("TIME_START", startdate));//开始时间
|
|
|
params.add(new BasicNameValuePair("TIME_END", enddate));//结束时间
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
|
|
|
HashMap<String, Integer> idcard_diseasecontion_map = new HashMap<>();
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(response)) {
|
|
|
JSONObject reobj = JSON.parseObject(response);
|
|
|
Integer status = reobj.getInteger("status");
|
|
@ -320,7 +337,7 @@ public class JwPrescriptionService {
|
|
|
Integer diseaseCondition = json.getInteger("SPECIALIST_CONTROL");//定标情况【 0 绿标 1 黄标 2 红标】
|
|
|
idcard_diseasecontion_map.put(idcard, diseaseCondition);
|
|
|
}
|
|
|
|
|
|
|
|
|
if (idcard_diseasecontion_map != null && !idcard_diseasecontion_map.keySet().isEmpty()) {
|
|
|
logger.info("从基卫接口获取需要更新定标情况的慢病患者个数为" + idcard_diseasecontion_map.keySet().size());
|
|
|
patientService.updatePatientDiseascontionByIdcard(idcard_diseasecontion_map);
|
|
@ -331,7 +348,7 @@ public class JwPrescriptionService {
|
|
|
String jwMessage = jwData.getString("MESSAGE");
|
|
|
throw new Exception("获取慢病患者定标情况,请求基卫接口失败:" + jwMessage);
|
|
|
}
|
|
|
|
|
|
|
|
|
} else {
|
|
|
throw new Exception("获取慢病患者定标情况请求失败," + errmsg);
|
|
|
}
|
|
@ -371,18 +388,21 @@ public class JwPrescriptionService {
|
|
|
if (1 == jwCode) {
|
|
|
JSONArray dataArray = jwData.getJSONArray("DATA");
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
|
|
|
|
|
|
|
OldPeoplePhysicalExaminationEntity oldPeoplePhysicalExaminationEntity = new OldPeoplePhysicalExaminationEntity();
|
|
|
|
|
|
|
|
|
JSONObject json = dataArray.getJSONObject(i);
|
|
|
String idcard = json.getString("IDENTITY_CARD_NO");//身份证号码
|
|
|
String medicalNo = json.getString("MEDICAL_NO");//体检编码
|
|
|
String patientName = json.getString("SICK_NAME");//姓名
|
|
|
if(StringUtils.isNoneBlank(patientName) && patientName.length() >200){
|
|
|
patientName = patientName.substring(0,200);
|
|
|
}
|
|
|
String orgName = json.getString("ORG_NAME");//医院名称
|
|
|
String orgCode = json.getString("ORG_CODE");//医院机构编码
|
|
|
String jwDoctorCode = json.getString("MEDICAL_OPERATOR");//体检医生
|
|
|
String medicalTime = json.getString("MEDICAL_TIME");//体检时间
|
|
|
|
|
|
|
|
|
oldPeoplePhysicalExaminationEntity.setCode(UUID.randomUUID().toString());
|
|
|
oldPeoplePhysicalExaminationEntity.setIdCard(idcard);
|
|
|
oldPeoplePhysicalExaminationEntity.setMedicalNo(medicalNo);
|
|
@ -422,11 +442,11 @@ public class JwPrescriptionService {
|
|
|
* @return
|
|
|
*/
|
|
|
public void getFollowUpByTime(String startdate, String enddate) throws Exception {
|
|
|
|
|
|
|
|
|
logger.info("查询居民随访记录,开始时间" + startdate + ",结束时间:" + enddate);
|
|
|
List<HospitalMapping> list = hospitalMappingDao.findJwOrg();
|
|
|
for (HospitalMapping hospitalMapping: list) {
|
|
|
|
|
|
|
|
|
String url = jwUrl + "/third/sign/getEhrChroDaysFollowUpInfoRecord";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("TIME_START", startdate));//开始时间
|
|
@ -434,10 +454,10 @@ public class JwPrescriptionService {
|
|
|
params.add(new BasicNameValuePair("ORG_CODE", hospitalMapping.getCode()));//机构编码
|
|
|
// params.add(new BasicNameValuePair("IDENTITY_CARD_NO", "350221197506113526"));//身份证
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
|
|
|
//居民随访记录
|
|
|
List<Followup> followups = new ArrayList<>();
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(response)) {
|
|
|
JSONObject reobj = JSON.parseObject(response);
|
|
|
Integer status = reobj.getInteger("status");
|
|
@ -447,48 +467,49 @@ public class JwPrescriptionService {
|
|
|
Integer jwCode = jwData.getInteger("CODE");
|
|
|
if (1 == jwCode) {
|
|
|
JSONArray dataArray = jwData.getJSONArray("DATA");
|
|
|
logger.info("从基卫获取随访信息数量"+ dataArray.size());
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
|
Followup followup = new Followup();
|
|
|
|
|
|
|
|
|
JSONObject json = dataArray.getJSONObject(i);
|
|
|
|
|
|
|
|
|
SignFamily sign = null;
|
|
|
|
|
|
|
|
|
//随访主表信息
|
|
|
String isNewCreate = json.getString("IS_NEW_CREATE");//是否新增
|
|
|
String followupNo = json.getString("FOLLOWUP_NO");//随访编号【基卫】:家庭医生服务随访主表ID
|
|
|
String dataFrom = json.getString("FOLLOWUP_SOURCE");//随访来源 1.平台端 2.移动端 3.第三方健康之路(移动端)"
|
|
|
|
|
|
|
|
|
// if ("0".equals(isNewCreate) || "3".equals(dataFrom)) {//修改
|
|
|
// followup = followUpDao.findByFollowupNo(followupNo);
|
|
|
// if(followup == null){
|
|
|
// followup = new Followup();
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
followup = followUpDao.findByFollowupNo(followupNo);
|
|
|
if(followup == null){
|
|
|
followup = new Followup();
|
|
|
}
|
|
|
|
|
|
|
|
|
followup.setFollowupNo(followupNo);
|
|
|
|
|
|
|
|
|
if ("1".equals(dataFrom) || "2".equals(dataFrom)) {
|
|
|
followup.setDataFrom("1");
|
|
|
} else if ("3".equals(dataFrom)) {
|
|
|
followup.setDataFrom("2");
|
|
|
}
|
|
|
followup.setDataFrom(dataFrom);
|
|
|
|
|
|
|
|
|
String followupDate = json.getString("THIS_FOLLOWUP_VISIT_DATE");//随访时间:此次随访时间
|
|
|
followup.setFollowupDate(DateUtil.strToDate(followupDate));
|
|
|
String followupPlanDate = "";//随访计划时间
|
|
|
String followupNextDate = json.getString("NEXT_FOLLOWUP_DATE");//计划下次随访时间:下次随访时间
|
|
|
followup.setFollowupNextDate(DateUtil.strToDate(followupNextDate));
|
|
|
followup.setFollowupPlanDate(DateUtil.strToDate(followupDate));
|
|
|
|
|
|
|
|
|
/******************* 医生机构映射 ****************/
|
|
|
|
|
|
|
|
|
String jworgCode = json.getString("ORG_CODE");//基卫机构编码
|
|
|
followup.setJworgCode(jworgCode);//基卫机构编码
|
|
|
String jwdoctorCode = json.getString("FOLLOWUP_VISIT_DOCTOR_NAME");//基卫医生CODE:随访医生 基卫系统的随访医生ID
|
|
@ -512,7 +533,7 @@ public class JwPrescriptionService {
|
|
|
followup.setDoctorCode(doctorCode);
|
|
|
followup.setDoctorName(doctorName);
|
|
|
followup.setOrgName(orgName);
|
|
|
|
|
|
|
|
|
String idcard = json.getString("IDENTITY_CARD_NO");//患者身份证
|
|
|
Patient patient = patientDao.findByIdcard(idcard);
|
|
|
String patientCode = patient.getCode();//患者CODE
|
|
@ -520,12 +541,12 @@ public class JwPrescriptionService {
|
|
|
followup.setIdcard(idcard);
|
|
|
followup.setPatientCode(patientCode);
|
|
|
followup.setPatientName(patientName);
|
|
|
|
|
|
|
|
|
String followupStatus = "1";//状态 0取消 1已完成 2未开始 3进行中 *基卫没有状态字段,传递过来的默认都是已完成的*
|
|
|
String followupContentPhone = "";//电话随访内容 -------
|
|
|
String followupManagerStatus = "";//随访管理状态【字典FOLLOWUP_MANAGER_STATUS】-------
|
|
|
String followupClass = json.getString("FAMILY_FOLLOWUP_CLASS_NAMES");//随访类别【1.高血压 2.糖尿病】
|
|
|
|
|
|
|
|
|
if (followupClass.contains("高血压") && followupClass.contains("糖尿病")) {
|
|
|
followupClass = "1,2";
|
|
|
}else if(followupClass.contains("高血压")){
|
|
@ -533,14 +554,14 @@ public class JwPrescriptionService {
|
|
|
}else if(followupClass.contains("糖尿病")){
|
|
|
followupClass= "2";
|
|
|
}else{}
|
|
|
|
|
|
|
|
|
String visitWayCode = json.getString("VISIT_WAY_CODE");//随访来源 1.门诊,2.家庭,3.电话,4.健康小屋
|
|
|
String creater = doctor.getCode();//创建者
|
|
|
followup.setStatus(followupStatus);
|
|
|
followup.setFollowupClass(followupClass);
|
|
|
followup.setFollowupType(visitWayCode);
|
|
|
followup.setCreater(creater);
|
|
|
|
|
|
|
|
|
//判断是否存在
|
|
|
sign = signFamilyDao.findByIdcard(idcard);
|
|
|
//判断是否存在签约修改身份证情况
|
|
@ -553,7 +574,7 @@ public class JwPrescriptionService {
|
|
|
String signCode = sign.getCode();//签约表Code
|
|
|
followup.setAdminTeamCode(adminTeamCode);
|
|
|
followup.setSignCode(signCode);
|
|
|
|
|
|
|
|
|
//随访记录详
|
|
|
HashMap<String, String> followupContent1 = new HashMap<>();
|
|
|
HashMap<String, String> followupContent2 = new HashMap<>();
|
|
@ -565,7 +586,7 @@ public class JwPrescriptionService {
|
|
|
HashMap<String, String> followupContent8 = new HashMap<>();
|
|
|
HashMap<String, String> followupContent9 = new HashMap<>();
|
|
|
HashMap<String, String> followupContent10 = new HashMap<>();
|
|
|
|
|
|
|
|
|
//症状
|
|
|
followupContent1.put("NO_SYMPTOM", json.getString("NO_SYMPTOM"));//无症状【0.无 1.有】
|
|
|
followupContent1.put("HEADACHE", json.getString("HEADACHE"));//头痛头晕【0.无 1.有】
|
|
@ -585,7 +606,7 @@ public class JwPrescriptionService {
|
|
|
followupContent1.put("NUMB_HANDS", json.getString("NUMB_HANDS"));//手脚麻木【0.无 1.有】
|
|
|
followupContent1.put("WEIGHT_LOSS", json.getString("WEIGHT_LOSS"));//体重明显下降【0.无 1.有】
|
|
|
followupContent1.put("HYPOG_REACT_CODE", json.getString("HYPOG_REACT_CODE"));//低血糖反应【0.无;1.偶尔;2.频繁;】
|
|
|
|
|
|
|
|
|
//体征信息
|
|
|
followupContent2.put("HEIGHT", json.getString("HEIGHT"));//身高
|
|
|
followupContent2.put("HEIGHT_EXP", json.getString("HEIGHT_EXP"));//期望身高
|
|
@ -601,7 +622,7 @@ public class JwPrescriptionService {
|
|
|
followupContent2.put("OTHER_POSITIVE_SIGNS", json.getString("OTHER_POSITIVE_SIGNS"));//体征其他
|
|
|
followupContent2.put("POFDA_MARK", json.getString("POFDA_MARK"));//足背动脉搏动【TOUCH_DICT】
|
|
|
followupContent2.put("HEART_RATE", json.getString("HEART_RATE"));//心率
|
|
|
|
|
|
|
|
|
//检查室检查
|
|
|
followupContent3.put("GHB", json.getString("GHB"));//糖化血红蛋白
|
|
|
followupContent3.put("RENAL_FUNCTION_CREATININE", json.getString("RENAL_FUNCTION_CREATININE"));//血清肌酐
|
|
@ -611,7 +632,7 @@ public class JwPrescriptionService {
|
|
|
followupContent3.put("BLOOD_FAT_TRIGLYCERIDE", json.getString("BLOOD_FAT_TRIGLYCERIDE"));//甘油三酯 V01
|
|
|
followupContent3.put("BLOOD_FAT_TC", json.getString("BLOOD_FAT_TC"));//总胆固醇 V02
|
|
|
followupContent3.put("BLOOD_FAT_LDLC", json.getString("BLOOD_FAT_LDLC"));//血清低密度脂蛋白胆固醇 V03
|
|
|
|
|
|
|
|
|
//生活方式
|
|
|
followupContent4.put("DAILY_SMOKING", json.getString("DAILY_SMOKING"));//日吸烟量
|
|
|
followupContent4.put("SOMKING_EXP", json.getString("SOMKING_EXP"));//日吸烟期望
|
|
@ -626,16 +647,16 @@ public class JwPrescriptionService {
|
|
|
followupContent4.put("PSY_ADJUST_RESULT_CODE", json.getString("PSY_ADJUST_RESULT_CODE"));//心里调整【GOOD_FAIR_POOR_DICT】
|
|
|
followupContent4.put("COMPLIANCE_RESULT_CODE", json.getString("COMPLIANCE_RESULT_CODE"));//遵医行为【GOOD_FAIR_POOR_DICT】
|
|
|
followupContent4.put("DAILY_STAPLE", json.getString("DAILY_STAPLE"));//主食(克/天)
|
|
|
|
|
|
|
|
|
//随访评价
|
|
|
followupContent5.put("HYP_FOLLOWUP_TYPE_CODE", json.getString("HYP_FOLLOWUP_TYPE_CODE"));//高血压随访分类【FOLLOW_TYPE_DICT】
|
|
|
followupContent5.put("HYP_COMPLICATION_DETAIL", json.getString("HYP_COMPLICATION_DETAIL"));//高血压随访分类--详情
|
|
|
followupContent5.put("DIA_FOLLOWUP_TYPE_CODE", json.getString("DIA_FOLLOWUP_TYPE_CODE"));//糖尿病随访分类【FOLLOW_TYPE_DICT】
|
|
|
followupContent5.put("DIA_COMPLICATION_DETAIL", json.getString("DIA_COMPLICATION_DETAIL"));//糖尿病随访分类--详情
|
|
|
|
|
|
|
|
|
//用药情况
|
|
|
followupContent6.put("DRUG_COMPLIANCE_CODE", json.getString("DRUG_COMPLIANCE_CODE"));//服药依从性【DRUG_STATE_DICT】
|
|
|
|
|
|
|
|
|
//控制目标
|
|
|
followupContent7.put("CONTROL_DATE", json.getString("CONTROL_DATE"));//控制日期 V04
|
|
|
|
|
@ -664,13 +685,13 @@ public class JwPrescriptionService {
|
|
|
followupContent7.put("CONTROL_WEIGHT", json.getString("CONTROL_WEIGHT"));//体重 V14
|
|
|
followupContent7.put("CONTROL_EXERCISE_FREQ_CODE", json.getString("CONTROL_EXERCISE_FREQ_CODE"));//运动频率 V15
|
|
|
followupContent7.put("CONTROL_EXERCISE_DURATION_MINS", json.getString("CONTROL_EXERCISE_DURATION_MINS"));//运动时长 V16
|
|
|
|
|
|
|
|
|
//健康教育
|
|
|
followupContent8.put("ARCHIVE_TIME", json.getString("ARCHIVE_TIME"));//健康教育日期 V17
|
|
|
followupContent8.put("ARCHIVE_OPERATOR_NAME", json.getString("ARCHIVE_OPERATOR_NAME"));//健康教育记录者 基卫系统医生【传中文名称】 V18
|
|
|
followupContent8.put("HEALTH_EDUCATE", json.getString("HEALTH_EDUCATE"));//健康教育【CHRO_HEALTH_EDUCATE_DICT】 V19
|
|
|
followupContent8.put("EDUCATE_CONTENT", json.getString("EDUCATE_CONTENT"));//健康教育内容 V20
|
|
|
|
|
|
|
|
|
//转诊
|
|
|
followupContent9.put("DRUG_ADVERSE_MARK", json.getString("DRUG_ADVERSE_MARK"));//药物不良反应【0.无;1.有;】
|
|
|
followupContent9.put("ADR_REMARK", json.getString("ADR_REMARK"));//药物不良反应【内容】
|
|
@ -678,127 +699,97 @@ public class JwPrescriptionService {
|
|
|
followupContent9.put("TRANSFER_ORG_DEPT", json.getString("TRANSFER_ORG_DEPT"));//转诊机构科室
|
|
|
followupContent9.put("REFUSE_REFERRAL", json.getString("REFUSE_REFERRAL"));//患者拒绝转诊【0 否 1 是】
|
|
|
followupContent9.put("REFUSE_REFERRAL_WHY", json.getString("REFUSE_REFERRAL_WHY"));//患者拒绝转诊内容
|
|
|
|
|
|
|
|
|
//多余字段
|
|
|
followupContent10.put("ARCHIVE_ID", json.getString("ARCHIVE_ID"));//档案ID
|
|
|
followupContent10.put("CHECK_FEE_TYPE", json.getString("CHECK_FEE_TYPE"));//检测费用类型
|
|
|
followupContent10.put("FAMILY_FOLLOWUP_ID", json.getString("FAMILY_FOLLOWUP_ID"));//随访细表外键随访ID
|
|
|
|
|
|
|
|
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
|
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
|
|
|
TransactionStatus transactionStatus = transactionManager.getTransaction(def); // 获得事务状态
|
|
|
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<>();//用药记录
|
|
|
|
|
|
|
|
|
for (int j = 1; j < 7; j++) {
|
|
|
if (json.containsKey("PHYSIC_NAME" + j)) {
|
|
|
FollowupDrugs drug = new FollowupDrugs();
|
|
@ -806,17 +797,14 @@ public class JwPrescriptionService {
|
|
|
drug.setDrugsGroup("normal");
|
|
|
drug.setDrugsCode("");
|
|
|
drug.setDrugsName(json.getString("PHYSIC_NAME" + j));//药物名称
|
|
|
if(StringUtils.isNoneBlank(json.getString("PHYSIC_DOSE" + j))){
|
|
|
drug.setDose(Double.valueOf(json.getString("PHYSIC_DOSE" + j)));//剂量
|
|
|
}
|
|
|
|
|
|
drug.setDose(json.getString("PHYSIC_DOSE" + j));//剂量
|
|
|
drug.setUnit(json.getString("PHYSIC_UNIT" + j));//单位【MEASURE_UNIT_DICT】
|
|
|
drug.setFrequency(json.getString("FREQUENCY" + j));//频次【RECIPE_FREQUENCY_DICT】
|
|
|
drug.setCreateTime(new Date());
|
|
|
DRUG_LIST.add(drug);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
for (int k = 1; k < 4; k++) {
|
|
|
if (json.containsKey("PHYSIC_NAME" + k)) {
|
|
|
FollowupDrugs drug = new FollowupDrugs();
|
|
@ -824,9 +812,7 @@ public class JwPrescriptionService {
|
|
|
drug.setDrugsGroup("insulin");
|
|
|
drug.setDrugsCode("");
|
|
|
drug.setDrugsName(json.getString("INSULIN_NAME" + k));//胰岛素药物名称
|
|
|
if(StringUtils.isNoneBlank(json.getString("INSULIN_DOSE" + k))){
|
|
|
drug.setDose(Double.valueOf(json.getString("INSULIN_DOSE" + k)));//胰岛素剂量
|
|
|
}
|
|
|
drug.setDose(json.getString("PHYSIC_DOSE" + k));//剂量
|
|
|
drug.setUnit(json.getString("INSULIN_UNIT" + k));//v单位【MEASURE_UNIT_DICT】
|
|
|
drug.setFrequency(json.getString("INSULIN_FREQUENCY" + k));//胰岛素频次【RECIPE_FREQUENCY_DICT】
|
|
|
drug.setCreateTime(new Date());
|
|
@ -836,9 +822,12 @@ public class JwPrescriptionService {
|
|
|
//删除原有用药记录
|
|
|
followupDrugsDao.deleteByFollowupId(followupId);
|
|
|
followupDrugsDao.save(DRUG_LIST);
|
|
|
|
|
|
|
|
|
transactionManager.commit(transactionStatus);
|
|
|
} catch (Exception ex) {
|
|
|
logger.info("查询居民随访记录,开始时间" + startdate + ",结束时间:" + enddate);
|
|
|
logger.info("查询居民随访记录,机构" + hospitalMapping.getName() + ",编码:" + hospitalMapping.getCode());
|
|
|
logger.info("基卫随访信息报文:"+json.toString());
|
|
|
logger.info("同步随访信息报错,errmessage:" + ex.toString());
|
|
|
transactionManager.rollback(transactionStatus);
|
|
|
continue;
|
|
@ -849,7 +838,7 @@ public class JwPrescriptionService {
|
|
|
logger.info("同步随访信息报错接口失败:" + jwMessage+",hosipitalcode" + hospitalMapping.getCode());
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
} else {
|
|
|
logger.info("同步随访信息报错接口失败:" + errmsg+",hosipitalcode" + hospitalMapping.getCode());
|
|
|
continue;
|
|
@ -878,11 +867,10 @@ public class JwPrescriptionService {
|
|
|
//组装请求结果MAP
|
|
|
HashMap<String,String> followupResultMap = new HashMap<>();
|
|
|
|
|
|
List<FollowupContent> followupContents = followupContentDao.findByFollowupId(followup.getId());
|
|
|
List<FollowupContentESDO> followupContentESDOList = this.esfindFollowUpContestsByFollowupId(String.valueOf(followup.getId()));
|
|
|
|
|
|
for (FollowupContent followupContent : followupContents) {
|
|
|
followupResultMap.put(followupContent.getFollowupKey(), followupContent.getFollowupValue());
|
|
|
}
|
|
|
//转MAP
|
|
|
followupResultMap = this.operaESFollowUpContentData(followupContentESDOList);
|
|
|
|
|
|
String OPERATOR = followup.getJwdoctorCode();//操作员&录入医生
|
|
|
if (StringUtils.isBlank(OPERATOR)) {
|
|
@ -917,7 +905,9 @@ public class JwPrescriptionService {
|
|
|
} else if ("1,2".equals(FAMILY_FOLLOWUP_CLASS_NAMES)) {
|
|
|
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);
|
|
@ -928,7 +918,7 @@ public class JwPrescriptionService {
|
|
|
String THIS_FOLLOWUP_VISIT_DATE = DateUtil.dateToStr(followup.getFollowupDate(), DateUtil.YYYY_MM_DD_HH_MM_SS);
|
|
|
String NEXT_FOLLOWUP_DATE = DateUtil.dateToStr(followup.getFollowupPlanDate(), DateUtil.YYYY_MM_DD_HH_MM_SS);
|
|
|
String VISIT_WAY_CODE = followup.getFollowupType();//随访方式【FOLLOWUP_WAY_DICT】【必填】
|
|
|
|
|
|
|
|
|
followupResultMap.put("THIS_FOLLOWUP_VISIT_DATE",THIS_FOLLOWUP_VISIT_DATE);
|
|
|
followupResultMap.put("NEXT_FOLLOWUP_DATE",NEXT_FOLLOWUP_DATE);
|
|
|
followupResultMap.put("FOLLOWUP_VISIT_DOCTOR_NAME",followup.getJwdoctorCode());
|
|
@ -953,13 +943,13 @@ public class JwPrescriptionService {
|
|
|
}else{
|
|
|
//基卫控制目标操作者,判断是否有控制者名称或者控制者CODE
|
|
|
if(followupResultMap.containsKey("CONTROL_CONSTITUTOR") || followupResultMap.containsKey("CONTROL_CONSTITUTOR_DOCTORCODE")){
|
|
|
|
|
|
|
|
|
String CONTROL_CONSTITUTOR = "";
|
|
|
if(followupResultMap.containsKey("CONTROL_CONSTITUTOR_DOCTORCODE")){
|
|
|
|
|
|
|
|
|
CONTROL_CONSTITUTOR_DOCTORCODE = followupResultMap.get("CONTROL_CONSTITUTOR_DOCTORCODE");
|
|
|
CONTROL_CONSTITUTOR = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(CONTROL_CONSTITUTOR_DOCTORCODE, followup.getOrgCode());
|
|
|
|
|
|
|
|
|
followupResultMap.put("CONTROL_CONSTITUTOR",CONTROL_CONSTITUTOR);//基卫控制目标操作者
|
|
|
}
|
|
|
|
|
@ -968,13 +958,13 @@ public class JwPrescriptionService {
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<FollowupDrugs> followupDrugs = followupDrugsDao.findByFollowupId(followup.getId());
|
|
|
List<FollowupDrugs> followupDrugsNormal = new ArrayList<>();//其他药品
|
|
|
List<FollowupDrugs> followupDrugsInsulin = new ArrayList<>();//胰岛素
|
|
|
|
|
|
|
|
|
for (FollowupDrugs drugs : followupDrugs) {
|
|
|
if("insulin".equals(drugs.getDrugsGroup()) || "474A3255574347758ABE7BC00223F14A".equals(drugs.getDrugsGroup())){
|
|
|
followupDrugsInsulin.add(drugs);
|
|
@ -987,31 +977,31 @@ public class JwPrescriptionService {
|
|
|
logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString());
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
DecimalFormat df = new DecimalFormat("######0.00");
|
|
|
|
|
|
|
|
|
//普通药品
|
|
|
// if(!followupDrugsNormal.isEmpty()){
|
|
|
for (int i = 0; i <= 6; i++) {
|
|
|
int tag = i+1;
|
|
|
if( !followupDrugsNormal.isEmpty() && followupDrugsNormal.size() >0 && followupDrugsNormal.size() <= tag){
|
|
|
followupResultMap.put("PHYSIC_NAME"+tag,followupDrugsNormal.get(i).getDrugsName());
|
|
|
followupResultMap.put("FREQUENCY"+tag,followupDrugsNormal.get(i).getFrequency());
|
|
|
followupResultMap.put("PHYSIC_UNIT"+tag,followupDrugsNormal.get(i).getUnit());
|
|
|
if(followupDrugsNormal.get(i).getDose() !=null){
|
|
|
followupResultMap.put("PHYSIC_DOSE"+tag,df.format(followupDrugsNormal.get(i).getDose()));
|
|
|
}else{
|
|
|
followupResultMap.put("PHYSIC_DOSE"+tag,"");
|
|
|
}
|
|
|
for (int i = 0; i <= 6; i++) {
|
|
|
int tag = i+1;
|
|
|
if( !followupDrugsNormal.isEmpty() && followupDrugsNormal.size() >0 && followupDrugsNormal.size() <= tag){
|
|
|
followupResultMap.put("PHYSIC_NAME"+tag,followupDrugsNormal.get(i).getDrugsName());
|
|
|
followupResultMap.put("FREQUENCY"+tag,followupDrugsNormal.get(i).getFrequency());
|
|
|
followupResultMap.put("PHYSIC_UNIT"+tag,followupDrugsNormal.get(i).getUnit());
|
|
|
if(followupDrugsNormal.get(i).getDose() !=null){
|
|
|
followupResultMap.put("PHYSIC_DOSE"+tag,df.format(followupDrugsNormal.get(i).getDose()));
|
|
|
}else{
|
|
|
followupResultMap.put("PHYSIC_NAME"+tag,"");
|
|
|
followupResultMap.put("FREQUENCY"+tag,"");
|
|
|
followupResultMap.put("PHYSIC_UNIT"+tag,"");
|
|
|
followupResultMap.put("PHYSIC_DOSE"+tag,"");
|
|
|
}
|
|
|
}else{
|
|
|
followupResultMap.put("PHYSIC_NAME"+tag,"");
|
|
|
followupResultMap.put("FREQUENCY"+tag,"");
|
|
|
followupResultMap.put("PHYSIC_UNIT"+tag,"");
|
|
|
followupResultMap.put("PHYSIC_DOSE"+tag,"");
|
|
|
}
|
|
|
}
|
|
|
// }
|
|
|
|
|
|
|
|
|
//胰岛素类药品
|
|
|
if(!followupDrugsInsulin.isEmpty()){
|
|
|
for (int j= 0; j < followupDrugsInsulin.size(); j++) {
|
|
@ -1027,17 +1017,17 @@ public class JwPrescriptionService {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
jsonObject = JSONObject.parseObject(JSON.toJSONString(followupResultMap));
|
|
|
|
|
|
String url = jwUrl + "/third/sign/uploadEhrSickChroDaysFollowUpRecord";
|
|
|
|
|
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("OPERATOR", OPERATOR));
|
|
|
params.add(new BasicNameValuePair("ORG_CODE", ORG_CODE));
|
|
|
params.add(new BasicNameValuePair("data", jsonObject.toString()));
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(response)) {
|
|
|
JSONObject reobj = JSON.parseObject(response);
|
|
|
Integer status = reobj.getInteger("status");
|
|
@ -1048,15 +1038,15 @@ public class JwPrescriptionService {
|
|
|
if (1 == jwCode) {
|
|
|
JSONArray dataArray = jwData.getJSONArray("DATA");
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
|
|
|
|
|
|
|
JSONObject json = dataArray.getJSONObject(i);
|
|
|
|
|
|
String jw_followup_no = json.getString("FOLLOWUP_NO");
|
|
|
|
|
|
|
|
|
followup.setFollowupNo(jw_followup_no);
|
|
|
|
|
|
|
|
|
followUpDao.save(followup);//获取的基卫随访主表ID,更新回数据库
|
|
|
|
|
|
|
|
|
String strid = String.valueOf(followup.getId());
|
|
|
|
|
|
followUpMappingDao.updateNeedUploadByFollowupId(0,Integer.parseInt(strid));
|
|
@ -1067,7 +1057,7 @@ public class JwPrescriptionService {
|
|
|
logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err:"+jwMessage);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
} else {
|
|
|
logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err:请求失败"+errmsg);
|
|
|
continue;
|
|
@ -1123,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;
|
|
|
|
|
|
}
|
|
|
}
|