Преглед на файлове

每日同步居民随访信息JOB

huangwenjie преди 7 години
родител
ревизия
eeea6d7b60

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

@ -35,6 +35,8 @@ public class Followup extends IdEntity {
	private String doctorCode;
	private String doctorCode;
	//医生姓名
	//医生姓名
	private String doctorName;
	private String doctorName;
	//基卫医生CODE
	private String jwdoctorCode;
	//社区代码
	//社区代码
	private String orgCode;
	private String orgCode;
	//社区名称
	//社区名称
@ -252,4 +254,12 @@ public class Followup extends IdEntity {
	public void setSignCode(String signCode) {
	public void setSignCode(String signCode) {
		this.signCode = signCode;
		this.signCode = signCode;
	}
	}
	
	public String getJwdoctorCode() {
		return jwdoctorCode;
	}
	
	public void setJwdoctorCode(String jwdoctorCode) {
		this.jwdoctorCode = jwdoctorCode;
	}
}
}

+ 31 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/SignController.java

@ -103,7 +103,7 @@ public class SignController {
    }
    }
    
    
    @RequestMapping(value = "getSickMedicalSimpleListInfo",method = RequestMethod.POST)
    @RequestMapping(value = "getSickMedicalSimpleListInfo",method = RequestMethod.POST)
    @ApiOperation("查询老年人体检记录接口")
    @ApiOperation("查询家签老年人体检记录接口")
    public Result getSickMedicalSimpleListInfo (
    public Result getSickMedicalSimpleListInfo (
            @ApiParam(name="TIME_START",value="修改的开始时间",defaultValue = "2012-2-6 00:00:00")
            @ApiParam(name="TIME_START",value="修改的开始时间",defaultValue = "2012-2-6 00:00:00")
            @RequestParam(value="TIME_START",required = false) String TIME_START,
            @RequestParam(value="TIME_START",required = false) String TIME_START,
@ -124,6 +124,36 @@ public class SignController {
            }
            }
        }
        }
    }
    }
    
    @RequestMapping(value = "getEhrChroDaysFollowUpInfoRecord",method = RequestMethod.POST)
    @ApiOperation("查询家庭医生服务日常随访信息接口")
    public Result getEhrChroDaysFollowUpInfoRecord(
            @ApiParam(name="TIME_START",value="修改的开始时间",defaultValue = "2017-06-6 00:00:00")
            @RequestParam(value="TIME_START",required = false) String TIME_START,
            @ApiParam(name="TIME_END",value="修改的开始时间",defaultValue = "2017-06-7 23:59:59")
            @RequestParam(value="TIME_END",required = false) String TIME_END,
            @ApiParam(name="IDENTITY_CARD_NO",value="身份证号",defaultValue = "350221197506113526")
            @RequestParam(value="IDENTITY_CARD_NO",required = false) String IDENTITY_CARD_NO){
        try {
            String response = "";
            if(StringUtils.isBlank(IDENTITY_CARD_NO)){
                response = signZYService.getEhrChroDaysFollowUpInfoRecord(TIME_START,TIME_END);
            }else{
                response = signZYService.getEhrChroDaysFollowUpInfoRecordByIdcard(IDENTITY_CARD_NO);
            }
            return Result.success("查询成功!",response);
        } catch (Exception ex) {
            ex.printStackTrace();
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                return Result.error(apiEx.errorCode(),ex.getMessage());
            }
            else{
                return Result.error(ex.getMessage());
            }
        }
    }

+ 22 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/SignZYService.java

@ -139,4 +139,26 @@ public class SignZYService {
        String response = zysoftService.getSickMedicalSimpleListInfo(time_start,time_end,hospitalMapping[0],hospitalMapping[1]);
        String response = zysoftService.getSickMedicalSimpleListInfo(time_start,time_end,hospitalMapping[0],hospitalMapping[1]);
        return response;
        return response;
	}
	}
    /**
     * 根据时间范围查询家庭医生服务日常随访信息
     * @param time_start
     * @param time_end
     * @return
     */
	public String getEhrChroDaysFollowUpInfoRecord(String time_start, String time_end)  throws Exception{
        String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
        String response = zysoftService.getEhrChroDaysFollowUpInfoRecord(time_start,time_end,hospitalMapping[0],hospitalMapping[1]);
        return response;
	}
    
    /**
     * 根据身份证号查询家庭医生服务日常随访信息
     * @param identity_card_no
     * @return
     */
    public String getEhrChroDaysFollowUpInfoRecordByIdcard(String identity_card_no)  throws Exception{
        String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
        String response = zysoftService.getEhrChroDaysFollowUpInfoRecordByIdcard(identity_card_no,hospitalMapping[0],hospitalMapping[1]);
        return response;
    }
}
}

+ 39 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftService.java

@ -815,4 +815,43 @@ public class ZysoftService {
        
        
        return response;
        return response;
	}
	}
    
    /**
     * 根据时间范围查询家庭医生服务日常随访信息
     * @param time_start
     * @param time_end
     * @return
     */
	public String getEhrChroDaysFollowUpInfoRecord(String time_start, String time_end,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        
        Map<String,String> params = new HashMap<>();
        params.put("TIME_START",time_start);
        params.put("TIME_END",time_end);
        
        String response = postSecond("getEhrChroDaysFollowUpInfoRecord","查询家庭医生服务日常随访信息接口",params,header,false);
        
        return response;
	}
    
    /**
     * 根据身份证号查询家庭医生服务日常随访信息
     * @param identity_card_no
     * @return
     */
    public String getEhrChroDaysFollowUpInfoRecordByIdcard(String identity_card_no,String hospital,String licence) throws Exception{
    
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
    
        Map<String,String> params = new HashMap<>();
        params.put("IDENTITY_CARD_NO",identity_card_no);
    
        String response = postSecond("getEhrChroDaysFollowUpInfoRecord","查询家庭医生服务日常随访信息接口",params,header,false);
    
        return response;
    }
}
}

+ 41 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/FollowUpSynJob.java

@ -0,0 +1,41 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.util.DateUtil;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * 居民随访记录
 * @author huangwenjie
 * @date 2017/10/19 15:02
 */
public class FollowUpSynJob implements Job {
	private static final Logger logger = LoggerFactory.getLogger(OldPeoplePhysicalExaminationSynJob.class);
	
	@Autowired
	private JwPrescriptionService jwPrescriptionService;
	
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		logger.info("START=====居民随访记录同步JOB");
		try {
			
			//获取前一天的时间范围
			String startdate = DateUtil.getNextDay(DateUtil.getStringDateShort(),-1) + " 00:00:00";
			String enddate = DateUtil.getNextDay(DateUtil.getStringDateShort(),-1) + " 23:59:59";
			
			//根据起止时间查询家签慢病患者定标情况,并同步到本地数据库
			jwPrescriptionService.getFollowUpByTime(startdate,enddate);
			
			logger.info("END========居民随访记录同步JOB");
		}catch (Exception e){
			e.printStackTrace();
			logger.info("END===ERROE===居民随访记录同步JOB,message:"+e.getMessage());
		}
	}
}

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

@ -158,4 +158,7 @@ public interface DoctorDao extends PagingAndSortingRepository<Doctor, Long>, Jpa
    @Modifying
    @Modifying
    @Query("update Doctor set checkPassword = ?2 ,checkSalt = ?3  where code = ?1")
    @Query("update Doctor set checkPassword = ?2 ,checkSalt = ?3  where code = ?1")
    int updateCheckPassword(String code, String checkPassword, String checkSalt);
    int updateCheckPassword(String code, String checkPassword, String checkSalt);
    
    @Query("select a from Doctor a,DoctorMapping b where a.code = b.doctorCode and b.jwDoctor = ?1 and b.jwDoctorHospital = ?2")
    Doctor findMappingDoctor(String jwDoctor,String jwHospital);
}
}

+ 28 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/doctor/DoctorMappingDao.java

@ -0,0 +1,28 @@
package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.DoctorMapping;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 医生映射接口
 **/
public interface DoctorMappingDao extends PagingAndSortingRepository<DoctorMapping, Long>,JpaSpecificationExecutor<DoctorMapping> {
	
	
	@Query("select a.jwDoctor from DoctorMapping a where a.doctorCode = ?1 and a.jwDoctorHospital = ?2")
	String findByDocotrCodeAndJwDoctorHospital(String docotrCode,String jwDoctorHospital);
	
	DoctorMapping findByJwDoctorHospitalAndJwDoctor(String jwDoctorHospital,String jwDoctor);
	
	@Query("select a from Doctor a,DoctorMapping b where a.code = b.doctorCode and b.jwDoctorHospital = ?1 and b.jwDoctor = ?2")
	Doctor getDoctorByJw(String jwDoctorHospital, String jwDoctor);
	
	@Query("select a from Doctor a,DoctorMapping b where a.code = b.doctorCode and a.code = ?1 and b.jwDoctorHospital = ?2")
	Doctor getDoctor(String docotrCode,String jwDoctorHospital);
	
	@Query("from DoctorMapping a where a.jwDoctorHospital = ?1 and a.doctorCode = ?2")
	DoctorMapping findByJwDoctorHospitalAndDoctorCode(String jwDoctorHospital,String doctorCode);
}

+ 3 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -30,4 +30,7 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select d.code,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus,c.code,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo from Followup a, Doctor d, Doctor c where a.doctorCode = d.code and a.creater = c.code and a.patientCode = ?1 and a.adminTeamCode = ?2 and a.status > 0")
    @Query("select d.code,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus,c.code,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo from Followup a, Doctor d, Doctor c where a.doctorCode = d.code and a.creater = c.code and a.patientCode = ?1 and a.adminTeamCode = ?2 and a.status > 0")
    Page<Object> findByPatientAndTeam(String patient, Long teamCode, Pageable pageable);
    Page<Object> findByPatientAndTeam(String patient, Long teamCode, Pageable pageable);
    
    @Query(value = "select a.* from wlyy_followup a where a.followup_no = ?1",nativeQuery = true)
    Followup findByFollowupNo(String followupNo) throws Exception;
}
}

+ 2 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/followup/FollowupContentDao.java

@ -20,4 +20,6 @@ public interface FollowupContentDao extends PagingAndSortingRepository<FollowupC
    List<FollowupContent> findByFollowupIdAndFollowupProject(Long followupId,String followupProject);
    List<FollowupContent> findByFollowupIdAndFollowupProject(Long followupId,String followupProject);
    List<FollowupContent> findByFollowupId(Long followupId);
    List<FollowupContent> findByFollowupId(Long followupId);
    
    void deleteByFollowupId(Long followupId);
}
}

+ 3 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/organization/HospitalMappingDao.java

@ -20,9 +20,9 @@ public interface HospitalMappingDao extends PagingAndSortingRepository<HospitalM
	@Query("select a.mappingCode from HospitalMapping a where a.code=?1 and a.type=?2")
	@Query("select a.mappingCode from HospitalMapping a where a.code=?1 and a.type=?2")
	String getMappingCode(String code,String type);
	String getMappingCode(String code,String type);
	@Query("select a.code from HospitalMapping a where a.mappingCode=?1 and a.type=?2")
	String getCodeByMapping(String mappingCode,String type);
	
	@Query("select a from HospitalMapping a where a.mappingCode=?1 and a.type=?2")
	HospitalMapping getCodeByMapping(String mappingCode, String type);
	@Query("select a from HospitalMapping a where a.appId=?1 ")
	@Query("select a from HospitalMapping a where a.appId=?1 ")
	HospitalMapping findByAppId(String appId);
	HospitalMapping findByAppId(String appId);

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

@ -3,9 +3,24 @@ package com.yihu.wlyy.service.third.jw;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.followup.FollowupContent;
import com.yihu.wlyy.entity.followup.FollowupDrugs;
import com.yihu.wlyy.entity.oldpeople.OldPeoplePhysicalExaminationEntity;
import com.yihu.wlyy.entity.oldpeople.OldPeoplePhysicalExaminationEntity;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.followup.FollowupContentDao;
import com.yihu.wlyy.repository.followup.FollowupDrugsDao;
import com.yihu.wlyy.repository.oldpeople.OldPeoplePhysicalExaminationDao;
import com.yihu.wlyy.repository.oldpeople.OldPeoplePhysicalExaminationDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
@ -18,10 +33,16 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.util.*;
import java.util.*;
import static org.bouncycastle.asn1.x509.X509ObjectIdentifiers.id;
/**
/**
 * 基位长处方接口
 * 基位长处方接口
 * Created by yeshijie on 2017/8/3.
 * Created by yeshijie on 2017/8/3.
@ -43,6 +64,24 @@ public class JwPrescriptionService {
    private PatientService patientService;
    private PatientService patientService;
    @Autowired
    @Autowired
    private OldPeoplePhysicalExaminationDao oldPeoplePhysicalExaminationDao;
    private OldPeoplePhysicalExaminationDao oldPeoplePhysicalExaminationDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private HospitalMappingDao hospitalMappingDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private FollowUpDao followUpDao;
    @Autowired
    private FollowupContentDao followupContentDao;
    @Autowired
    private JpaTransactionManager transactionManager;
    @Autowired
    private FollowupDrugsDao followupDrugsDao;
    /**
    /**
     * 获取字典列表
     * 获取字典列表
@ -361,4 +400,417 @@ public class JwPrescriptionService {
            throw new Exception("从基卫接口获取老年人体检记请求失败,无数据返回!");
            throw new Exception("从基卫接口获取老年人体检记请求失败,无数据返回!");
        }
        }
    }
    }
    
    /**
     * 根据起止时间查询居民随访记录,并同步到本地
     * @param startdate
     * @param enddate
     * @return
     */
    public void getFollowUpByTime(String startdate, String enddate) throws Exception {
    
        logger.info("查询居民随访记录,开始时间"+startdate+",结束时间:"+enddate);
    
    
        String url = jwUrl + "/third/sign/getEhrChroDaysFollowUpInfoRecord";
        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");
    
        //居民随访记录
        List<Followup> followups = new ArrayList<>();
    
        if(StringUtils.isNotBlank(response)){
            JSONObject reobj =  JSON.parseObject(response);
            Integer status = reobj.getInteger("status");
            String errmsg = reobj.getString("msg");
            if(200 == status){
                JSONObject jwData = reobj.getJSONObject("data");
                Integer jwCode = jwData.getInteger("CODE");
                if(1 == jwCode){
                    JSONArray dataArray = jwData.getJSONArray("DATA");
                    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.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));
    
                        /******************* 医生机构映射 ****************/
    
                        String orgCode = json.getString("ORG_CODE");//机构编码
                        followup.setOrgCode(orgCode);
                        String jwdoctorCode = json.getString("FOLLOWUP_VISIT_DOCTOR_NAME");//基卫医生CODE:随访医生 基卫系统的随访医生ID
                        followup.setJwdoctorCode(jwdoctorCode);
                        //医院映射
                        HospitalMapping hm = hospitalMappingDao.getCodeByMapping(orgCode, "1");
                        if (hm == null) {
    
                            logger.info("no mapping hospital:" + orgCode);
                            continue;
//                            throw new Exception("no mapping hospital:" + orgCode);
                        }
                        //医生映射
                        Doctor doctor = doctorDao.findMappingDoctor(jwdoctorCode, orgCode);
                        if (doctor == null) {
                            logger.info("no mapping hospital:" + orgCode + ",familyDoctor:" + jwdoctorCode);
                            continue;
//                            throw new Exception("no mapping hospital:" + orgCode + ",familyDoctor:" + jwdoctorCode);
                        }
                        
                        String doctorCode = doctor.getCode();//医生CODE
                        String doctorName = doctor.getName();//医生姓名 "FOLLOWUP_VISIT_DOCTOR_NAME_N":"随访医生 基卫系统的随访医生中文名"
                        String orgName = hm.getName();//机构名称
                        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
                        String patientName = patient.getName();//患者姓名
                        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.糖尿病】
                        String visitWayCode = json.getString("VISIT_WAY_CODE");//随访来源 1.门诊,2.家庭,3.电话,4.健康小屋
                        String creater = "";//创建者
                        followup.setStatus(followupStatus);
                        followup.setFollowupClass(followupClass);
                        followup.setFollowupType(visitWayCode);
    
                        //判断是否存在
                        sign = signFamilyDao.findByIdcard(idcard);
                        //判断是否存在签约修改身份证情况
                        if(sign==null) {
                            logger.info("no sign familyy patient idcard:" + idcard);
                            continue;
                        }
                        Integer signType = Integer.parseInt(sign.getSignSource());//签约类型 1三师 2家庭
                        Long adminTeamCode = new Long(sign.getAdminTeamId());//行政团队
                        String signCode = sign.getCode();//签约表Code
                        followup.setAdminTeamCode(adminTeamCode);
                        followup.setSignCode(signCode);
                        
                        //随访记录详
                        HashMap<String,String> followupContent1 = new HashMap<>();
                        HashMap<String,String> followupContent2 = new HashMap<>();
                        HashMap<String,String> followupContent3 = new HashMap<>();
                        HashMap<String,String> followupContent4 = new HashMap<>();
                        HashMap<String,String> followupContent5 = new HashMap<>();
                        HashMap<String,String> followupContent6 = new HashMap<>();
                        HashMap<String,String> followupContent7 = new HashMap<>();
                        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.有】
                        followupContent1.put("NAUSEA",json.getString("NAUSEA"));//恶心呕吐【0.无 1.有】
                        followupContent1.put("VERTIGO_TINNITUS",json.getString("VERTIGO_TINNITUS"));//眼花耳鸣【0.无 1.有】
                        followupContent1.put("DIFFICULTY_BREATHING",json.getString("DIFFICULTY_BREATHING"));//呼吸困难【0.无 1.有】
                        followupContent1.put("PALPITATIONS",json.getString("PALPITATIONS"));//心悸胸闷【0.无 1.有】
                        followupContent1.put("EPISTAXIS_BLEEDING",json.getString("EPISTAXIS_BLEEDING"));//鼻衄出血不止【0.无 1.有】
                        followupContent1.put("LIMBS_NUMB",json.getString("LIMBS_NUMB"));//四肢发麻【0.无 1.有】
                        followupContent1.put("EXTREMITY_EDEMA",json.getString("EXTREMITY_EDEMA"));//下肢水肿【0.无 1.有】
                        followupContent1.put("SYMPTOM_OTHER",json.getString("SYMPTOM_OTHER"));//"其他症状"
                        followupContent1.put("POLYDIPSIA",json.getString("POLYDIPSIA"));//多饮【0.无 1.有】
                        followupContent1.put("MORE_FOOD",json.getString("MORE_FOOD"));//多食【0.无 1.有】
                        followupContent1.put("MORE_URINE",json.getString("MORE_URINE"));//多尿【0.无 1.有】
                        followupContent1.put("BLURRED_VISION",json.getString("BLURRED_VISION"));//视力模糊【0.无 1.有】
                        followupContent1.put("INFECTION",json.getString("INFECTION"));//感染【0.无 1.有】
                        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"));//期望身高
                        followupContent2.put("WEIGHT",json.getString("WEIGHT"));//体重
                        followupContent2.put("WEIGHT_EXP",json.getString("WEIGHT_EXP"));//期望体重
                        followupContent2.put("BP_D",json.getString("BP_D"));//舒张压
                        followupContent2.put("BP_U",json.getString("BP_U"));//收缩压
                        followupContent2.put("BS_FPG",json.getString("BS_FPG"));//空腹血糖
                        followupContent2.put("NO_BS_FPG",json.getString("NO_BS_FPG"));//餐后血糖
                        followupContent2.put("RANDOM_BLOOD_SUGAR",json.getString("RANDOM_BLOOD_SUGAR"));//随机血糖
                        followupContent2.put("BMI",json.getString("BMI"));//体质指数
                        followupContent2.put("BMI_EXP",json.getString("BMI_EXP"));//期望体质
                        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"));//血清肌酐
                        followupContent3.put("RENAL_FUNCTION_BUN",json.getString("RENAL_FUNCTION_BUN"));//血尿素氮
                        followupContent3.put("MICROALBUMINURIA",json.getString("MICROALBUMINURIA"));//尿微量白蛋白
                        followupContent3.put("EXAM_DATE",json.getString("EXAM_DATE"));//检查日期
                        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"));//日吸烟期望
                        followupContent4.put("DAILY_DRINKING",json.getString("DAILY_DRINKING"));//日饮酒量
                        followupContent4.put("DRINK_EXP",json.getString("DRINK_EXP"));//日饮酒期望
                        followupContent4.put("EXERCISE_FREQ_CODE",json.getString("EXERCISE_FREQ_CODE"));//运动频率【HYGIENE_SPORT_FREQ_DICT】
                        followupContent4.put("EXERCISE_FREQ_CODE_EXP",json.getString("EXERCISE_FREQ_CODE_EXP"));//运动频率期望【HYGIENE_SPORT_FREQ_DICT】
                        followupContent4.put("EXERCISE_DURATION_MINS",json.getString("EXERCISE_DURATION_MINS"));//运动时长(min) 分钟/次
                        followupContent4.put("EXERCISE_DURATION_MINS_EXP",json.getString("EXERCISE_DURATION_MINS_EXP"));//运动时长期望(min) 分钟/次期望
                        followupContent4.put("SALT_TAKEN_LEVEL_CODE",json.getString("SALT_TAKEN_LEVEL_CODE"));//摄盐情况【LIGHT_WEIGHT_DICT】
                        followupContent4.put("SALT_TAKEN_LEVEL_EXP",json.getString("SALT_TAKEN_LEVEL_EXP"));//摄盐情况期望【LIGHT_WEIGHT_DICT】
                        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
                        followupContent7.put("CONTROL_CONSTITUTOR",json.getString("CONTROL_CONSTITUTOR"));//制定者 V05
                        followupContent7.put("CONTROL_BP_U",json.getString("CONTROL_BP_U"));//血压收缩压 V06
                        followupContent7.put("CONTROL_BP_D",json.getString("CONTROL_BP_D"));//血压舒张压 V07
                        followupContent7.put("CONTROL_BS_FPG",json.getString("CONTROL_BS_FPG"));//空腹血糖 V08
                        followupContent7.put("CONTROL_NO_BS_FPG",json.getString("CONTROL_NO_BS_FPG"));//餐后血糖 V09
                        followupContent7.put("CONTROL_GHB",json.getString("CONTROL_GHB"));//糖化血红蛋白 V10
                        followupContent7.put("CONTROL_TRIGLYCERIDE",json.getString("CONTROL_TRIGLYCERIDE"));//甘油三酯 V11
                        followupContent7.put("CONTROL_TOTAL_CHOLESTEROL",json.getString("CONTROL_TOTAL_CHOLESTEROL"));//总胆固醇 V12
                        followupContent7.put("CONTROL_LDL",json.getString("CONTROL_LDL"));//低密度脂蛋白 V13
                        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"));//药物不良反应【内容】
                        followupContent9.put("TRANSFER_RESON",json.getString("TRANSFER_RESON"));//转诊原因
                        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<FollowupDrugs> DRUG_LIST = new ArrayList<>();//用药记录
    
                            for (int j = 1; j < 7 ; j++) {
                                if(json.containsKey("PHYSIC_NAME"+j)){
                                    FollowupDrugs drug = new FollowupDrugs();
                                    drug.setFollowupId(followupId);
                                    drug.setDrugsGroup("normal");
                                    drug.setDrugsCode("");
                                    drug.setDrugsName(json.getString("PHYSIC_NAME"+j));//药物名称
                                    drug.setDose(Double.valueOf(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();
                                    drug.setFollowupId(followupId);
                                    drug.setDrugsGroup("insulin");
                                    drug.setDrugsCode("");
                                    drug.setDrugsName(json.getString("INSULIN_NAME"+k));//胰岛素药物名称
                                    drug.setDose(Double.valueOf(json.getString("INSULIN_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());
                                    DRUG_LIST.add(drug);
                                }
                            }
                            //删除原有用药记录
                            followupDrugsDao.deleteByFollowupId(followupId);
                            followupDrugsDao.save(DRUG_LIST);
                            
                            transactionManager.commit(transactionStatus);
                        } catch (Exception ex) {
                            logger.info("同步随访信息报错,errmessage:" + ex.toString());
                            transactionManager.rollback(transactionStatus);
                            continue;
                        }
                    }
                }else{
                    String jwMessage = jwData.getString("MESSAGE");
                    throw new Exception("同步随访信息报错接口失败:"+jwMessage);
                }
            
            }else{
                throw new Exception("同步随访信息报错请求失败,"+errmsg);
            }
        }else{
            throw new Exception("同步随访信息报错请求失败,无数据返回!");
        }
    }
}
}