瀏覽代碼

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

yeshijie 7 年之前
父節點
當前提交
e54d8ece96

+ 74 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/followup/FollowupMapping.java

@ -0,0 +1,74 @@
package com.yihu.wlyy.entity.followup;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;
/**
 * 随访记录映射表
 * @author huangwenjie
 * @date 2017/10/23 14:02
 */
@Entity
@Table(name = "wlyy_followup_mapping")
public class FollowupMapping extends IdEntity {
	private String code;
	private Integer followupId;
	private Integer needUpload;
	private Timestamp createTime;
	private Timestamp updateTime;
	
	@Basic
	@Column(name = "code")
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	@Basic
	@Column(name = "followup_id")
	public Integer getFollowupId() {
		return followupId;
	}
	
	public void setFollowupId(Integer followupId) {
		this.followupId = followupId;
	}
	
	@Basic
	@Column(name = "need_upload")
	public Integer getNeedUpload() {
		return needUpload;
	}
	
	public void setNeedUpload(Integer needUpload) {
		this.needUpload = needUpload;
	}
	
	@Basic
	@Column(name = "create_time")
	public Timestamp getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}
	
	@Basic
	@Column(name = "update_time")
	public Timestamp getUpdateTime() {
		return updateTime;
	}
	
	public void setUpdateTime(Timestamp updateTime) {
		this.updateTime = updateTime;
	}
}

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

@ -154,6 +154,29 @@ public class SignController {
            }
            }
        }
        }
    }
    }
    
    @RequestMapping(value = "uploadEhrSickChroDaysFollowUpRecord",method = RequestMethod.POST)
    @ApiOperation("查询家庭医生服务日常随访信息接口")
    public Result uploadEhrSickChroDaysFollowUpRecord(
            @ApiParam(name="OPERATOR",value="操作员代码",defaultValue = "")
            @RequestParam(value="OPERATOR",required = true) String OPERATOR,
            @ApiParam(name="data",value="Json格式字符串",defaultValue = "")
            @RequestParam(value="data",required = true) String data){
        try {
            String response = signZYService.uploadEhrSickChroDaysFollowUpRecord(OPERATOR,data);
            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());
            }
        }
    }

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

@ -161,4 +161,16 @@ public class SignZYService {
        String response = zysoftService.getEhrChroDaysFollowUpInfoRecordByIdcard(identity_card_no,hospitalMapping[0],hospitalMapping[1]);
        String response = zysoftService.getEhrChroDaysFollowUpInfoRecordByIdcard(identity_card_no,hospitalMapping[0],hospitalMapping[1]);
        return response;
        return response;
    }
    }
    
    /**
     * 上传家庭医生服务日常随访信息
     * @param operator
     * @param data
     * @return
     */
	public String uploadEhrSickChroDaysFollowUpRecord(String operator, String data) throws Exception{
        String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
        String response = zysoftService.uploadEhrSickChroDaysFollowUpRecord(operator,data,hospitalMapping[0],hospitalMapping[1]);
        return response;
	}
}
}

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

@ -854,4 +854,22 @@ public class ZysoftService {
    
    
        return response;
        return response;
    }
    }
    /**
     * 上传家庭医生服务日常随访信息
     * @param operator
     * @param data
     * @return
     */
	public String uploadEhrSickChroDaysFollowUpRecord(String operator, String data, String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        header.put("OPERATOR",operator);
        
        com.alibaba.fastjson.JSONObject json = JSON.parseObject(data);
        
        String response = postSecond("getEhrChroDaysFollowUpInfoRecord","查询家庭医生服务日常随访信息接口",json,header);
        
        return response;
	}
}
}

+ 0 - 1
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/common/thread/UploadRenewThread.java

@ -1,7 +1,6 @@
package com.yihu.wlyy.sign.common.thread;
package com.yihu.wlyy.sign.common.thread;
import com.yihu.wlyy.sign.common.util.DateUtil;
import com.yihu.wlyy.sign.common.util.SpringContextHolder;
import com.yihu.wlyy.sign.common.util.SpringContextHolder;
import com.yihu.wlyy.sign.service.SignRenewZYService;
import com.yihu.wlyy.sign.service.SignRenewZYService;
import com.yihu.wlyy.sign.service.SystemDictService;
import com.yihu.wlyy.sign.service.SystemDictService;

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

@ -10,12 +10,12 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
/**
/**
 * 居民随访记录
 * 居民随访记录同步JOB
 * @author huangwenjie
 * @author huangwenjie
 * @date 2017/10/19 15:02
 * @date 2017/10/19 15:02
 */
 */
public class FollowUpSynJob implements Job {
public class FollowUpSynJob implements Job {
	private static final Logger logger = LoggerFactory.getLogger(OldPeoplePhysicalExaminationSynJob.class);
	private static final Logger logger = LoggerFactory.getLogger(FollowUpSynJob.class);
	
	
	@Autowired
	@Autowired
	private JwPrescriptionService jwPrescriptionService;
	private JwPrescriptionService jwPrescriptionService;
@ -29,7 +29,7 @@ public class FollowUpSynJob implements Job {
			String startdate = DateUtil.getNextDay(DateUtil.getStringDateShort(),-1) + " 00:00:00";
			String startdate = DateUtil.getNextDay(DateUtil.getStringDateShort(),-1) + " 00:00:00";
			String enddate = DateUtil.getNextDay(DateUtil.getStringDateShort(),-1) + " 23:59:59";
			String enddate = DateUtil.getNextDay(DateUtil.getStringDateShort(),-1) + " 23:59:59";
			
			
			//根据起止时间查询家签慢病患者定标情况,并同步到本地数据库
			//根据起止时间查询家签居民随访记录,并同步到本地数据库
			jwPrescriptionService.getFollowUpByTime(startdate,enddate);
			jwPrescriptionService.getFollowUpByTime(startdate,enddate);
			
			
			logger.info("END========居民随访记录同步JOB");
			logger.info("END========居民随访记录同步JOB");

+ 32 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/FollowUpUploadJob.java

@ -0,0 +1,32 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
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;
/**
 * 居民随访记录上传(上传到基卫)JOB
 * @author huangwenjie
 * @date 2017/10/23 11:20
 */
public class FollowUpUploadJob implements Job {
	private static final Logger logger = LoggerFactory.getLogger(FollowUpUploadJob.class);
	@Autowired
	private JwPrescriptionService jwPrescriptionService;
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		logger.info("START=====上传居民随访记录JOB");
		try {
			//上传居民随访记录到基卫
			jwPrescriptionService.uploadFollowUpRecordToJW();
			logger.info("END========上传居民随访记录JOB");
		}catch (Exception e){
			e.printStackTrace();
			logger.info("END===ERROE===上传居民随访记录JOB,message:"+e.getMessage());
		}
	}
}

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

@ -15,7 +15,6 @@ import com.yihu.wlyy.entity.followup.Followup;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>, JpaSpecificationExecutor<Followup> {
public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>, JpaSpecificationExecutor<Followup> {
@ -33,4 +32,7 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    
    
    @Query(value = "select a.* from wlyy_followup a where a.followup_no = ?1",nativeQuery = true)
    @Query(value = "select a.* from wlyy_followup a where a.followup_no = ?1",nativeQuery = true)
    Followup findByFollowupNo(String followupNo) throws Exception;
    Followup findByFollowupNo(String followupNo) throws Exception;
    
    @Query(value = "select a.* from wlyy_followup a INNER JOIN  wlyy_followup_mapping b on b.followup_id = a.id AND b.need_upload=?1",nativeQuery = true)
	List<Followup> findByFollowMappingNeedUpload(Integer need_upload);
}
}

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

@ -0,0 +1,17 @@
package com.yihu.wlyy.repository.followup;
import com.yihu.wlyy.entity.followup.FollowupMapping;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 随访记录映射表
 * @author huangwenjie
 * @date 2017/10/23 14:05
 */
public interface FollowUpMappingDao extends PagingAndSortingRepository<FollowupMapping, Long>, JpaSpecificationExecutor<FollowupMapping> {
	
	List<FollowupMapping> findByNeedUpload(Integer needupload);
}

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

@ -7,6 +7,7 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.followup.FollowupContent;
import com.yihu.wlyy.entity.followup.FollowupContent;
import com.yihu.wlyy.entity.followup.FollowupDrugs;
import com.yihu.wlyy.entity.followup.FollowupDrugs;
import com.yihu.wlyy.entity.followup.FollowupMapping;
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.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.Patient;
@ -15,6 +16,7 @@ import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.followup.FollowUpMappingDao;
import com.yihu.wlyy.repository.followup.FollowupContentDao;
import com.yihu.wlyy.repository.followup.FollowupContentDao;
import com.yihu.wlyy.repository.followup.FollowupDrugsDao;
import com.yihu.wlyy.repository.followup.FollowupDrugsDao;
import com.yihu.wlyy.repository.oldpeople.OldPeoplePhysicalExaminationDao;
import com.yihu.wlyy.repository.oldpeople.OldPeoplePhysicalExaminationDao;
@ -39,6 +41,7 @@ import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.text.DecimalFormat;
import java.util.*;
import java.util.*;
import static org.bouncycastle.asn1.x509.X509ObjectIdentifiers.id;
import static org.bouncycastle.asn1.x509.X509ObjectIdentifiers.id;
@ -49,7 +52,7 @@ import static org.bouncycastle.asn1.x509.X509ObjectIdentifiers.id;
 */
 */
@Service
@Service
public class JwPrescriptionService {
public class JwPrescriptionService {
    
    private static final Logger logger = LoggerFactory.getLogger(JwPrescriptionService.class);
    private static final Logger logger = LoggerFactory.getLogger(JwPrescriptionService.class);
    //基卫服务地址
    //基卫服务地址
    @Value("${sign.check_upload}")
    @Value("${sign.check_upload}")
@ -82,50 +85,55 @@ public class JwPrescriptionService {
    private JpaTransactionManager transactionManager;
    private JpaTransactionManager transactionManager;
    @Autowired
    @Autowired
    private FollowupDrugsDao followupDrugsDao;
    private FollowupDrugsDao followupDrugsDao;
    @Autowired
    private FollowUpMappingDao followUpMappingDao;
    
    /**
    /**
     * 获取字典列表
     * 获取字典列表
     *
     * @param dictName 字典名称
     * @param dictName 字典名称
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String getDictForI(String dictName) throws Exception{
    public String getDictForI(String dictName) throws Exception {
        String url = jwUrl + "/third/prescription/getDictForI";
        String url = jwUrl + "/third/prescription/getDictForI";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("dictName", dictName));
        params.add(new BasicNameValuePair("dictName", dictName));
    
        String response = httpClientUtil.post(url, params, "UTF-8");
        String response = httpClientUtil.post(url, params, "UTF-8");
    
        return response;
        return response;
    }
    }
    
    /**
    /**
     * 获取处方模板
     * 获取处方模板
     *
     * @param doctor 医生code
     * @param doctor 医生code
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String getRecipeTemplate(String doctor) throws Exception{
    public String getRecipeTemplate(String doctor) throws Exception {
        String url = jwUrl + "/third/prescription/getRecipeTemplate";
        String url = jwUrl + "/third/prescription/getRecipeTemplate";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("doctor", doctor));
        params.add(new BasicNameValuePair("doctor", doctor));
    
        String response = httpClientUtil.post(url, params, "UTF-8");
        String response = httpClientUtil.post(url, params, "UTF-8");
    
        return response;
        return response;
    }
    }
    
    
    /**
    /**
     * 获取历史处方记录
     * 获取历史处方记录
     * @param cardNo 社保卡号
     * @param recipeNo 医嘱号
     *
     * @param cardNo        社保卡号
     * @param recipeNo      医嘱号
     * @param applyTimeFrom 开始时间
     * @param applyTimeFrom 开始时间
     * @param applyTimeEnd 结束时间
     * @param applyTimeEnd  结束时间
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String getLastRecipe(String cardNo,String recipeNo,String applyTimeFrom,String applyTimeEnd) throws Exception{
    public String getLastRecipe(String cardNo, String recipeNo, String applyTimeFrom, String applyTimeEnd) throws Exception {
        String url = jwUrl + "/third/prescription/getLastRecipe";
        String url = jwUrl + "/third/prescription/getLastRecipe";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("cardNo", cardNo));
        params.add(new BasicNameValuePair("cardNo", cardNo));
@ -136,207 +144,215 @@ public class JwPrescriptionService {
//        String response = httpClientUtil.post(url, params, "UTF-8");
//        String response = httpClientUtil.post(url, params, "UTF-8");
        String sql = "SELECT h.response from wlyy_http_log h WHERE h.id = 806287";
        String sql = "SELECT h.response from wlyy_http_log h WHERE h.id = 806287";
        List<Map<String ,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        String response = list.get(0).get("response").toString();
        String response = list.get(0).get("response").toString();
        JSONObject jsonObject = new JSONObject();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("status",200);
        jsonObject.put("data",response);
        jsonObject.put("status", 200);
        jsonObject.put("data", response);
        response = jsonObject.toString();
        response = jsonObject.toString();
    
        return response;
        return response;
    }
    }
    
    /**
    /**
     * 获取单条历史处方
     * 获取单条历史处方
     *
     * @param recipeNo
     * @param recipeNo
     * @param cardNo
     * @param cardNo
     * @return
     * @return
     */
     */
    public String getRecipe(String recipeNo,String cardNo){
    public String getRecipe(String recipeNo, String cardNo) {
        String url = jwUrl + "/third/prescription/getRecipe";
        String url = jwUrl + "/third/prescription/getRecipe";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("recipeNo", recipeNo));
        params.add(new BasicNameValuePair("recipeNo", recipeNo));
        params.add(new BasicNameValuePair("cardNo", cardNo));
        params.add(new BasicNameValuePair("cardNo", cardNo));
    
        String response = httpClientUtil.post(url, params, "UTF-8");
        String response = httpClientUtil.post(url, params, "UTF-8");
    
        return response;
        return response;
    }
    }
    
    /**
    /**
     * 处方开方接口
     * 处方开方接口
     *
     * @param prescriptionCode 续方code
     * @param prescriptionCode 续方code
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String saveRecipe(String prescriptionCode){
    public String saveRecipe(String prescriptionCode) {
        String response = null;
        String response = null;
        try {
        try {
            String url = jwUrl + "/third/prescription/saveRecipe";
            String url = jwUrl + "/third/prescription/saveRecipe";
            List<NameValuePair> params = new ArrayList<>();
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
            params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
    
            response = httpClientUtil.post(url, params, "UTF-8");
            response = httpClientUtil.post(url, params, "UTF-8");
            return response;
            return response;
        }catch (Exception e){
            logger.info("处方开方接口saveRecipe:"+response);
        } catch (Exception e) {
            logger.info("处方开方接口saveRecipe:" + response);
            throw e;
            throw e;
        }
        }
    }
    }
    
    /**
    /**
     * 待结算费用列表接口
     * 待结算费用列表接口
     *
     * @param cardNo
     * @param cardNo
     * @param visitNo
     * @param visitNo
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String getDispUnSettleFeeInfoList(String cardNo,String visitNo) throws Exception{
    public String getDispUnSettleFeeInfoList(String cardNo, String visitNo) throws Exception {
        String url = jwUrl + "/third/prescription/getDispUnSettleFeeInfoList";
        String url = jwUrl + "/third/prescription/getDispUnSettleFeeInfoList";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("cardNo", cardNo));
        params.add(new BasicNameValuePair("cardNo", cardNo));
        params.add(new BasicNameValuePair("visitNo", visitNo));
        params.add(new BasicNameValuePair("visitNo", visitNo));
    
        String response = httpClientUtil.post(url, params, "UTF-8");
        String response = httpClientUtil.post(url, params, "UTF-8");
    
        return response;
        return response;
    }
    }
    
    
    /**
    /**
     * 院内结算确认接口
     * 院内结算确认接口
     *
     * @param prescriptionCode 处方CODE
     * @param prescriptionCode 处方CODE
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String executeSickSettle(String prescriptionCode) throws Exception{
    public String executeSickSettle(String prescriptionCode) throws Exception {
        String url = jwUrl + "/third/prescription/executeSickSettle";
        String url = jwUrl + "/third/prescription/executeSickSettle";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
        params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
        String response = httpClientUtil.post(url, params, "UTF-8");
        String response = httpClientUtil.post(url, params, "UTF-8");
        if(StringUtils.isNotBlank(response)){
            JSONObject reobj =  JSON.parseObject(response);
        if (StringUtils.isNotBlank(response)) {
            JSONObject reobj = JSON.parseObject(response);
            Integer status = reobj.getInteger("status");
            Integer status = reobj.getInteger("status");
            String errmsg = reobj.getString("msg");
            String errmsg = reobj.getString("msg");
            if(200 != status){
                throw new Exception("基卫接口(院内结算确认接口)请求失败,"+errmsg);
            if (200 != status) {
                throw new Exception("基卫接口(院内结算确认接口)请求失败," + errmsg);
            }
            }
        }else{
        } else {
            throw new Exception("基卫接口(院内结算确认接口)请求失败,无数据返回!");
            throw new Exception("基卫接口(院内结算确认接口)请求失败,无数据返回!");
        }
        }
        return response;
        return response;
    }
    }
    
    /**
    /**
     * 挂号作废处方接口
     * 挂号作废处方接口
     *
     * @param prescriptionCode 续方号码
     * @param prescriptionCode 续方号码
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public String fadeRecipe(String prescriptionCode)throws Exception{
    public String fadeRecipe(String prescriptionCode) throws Exception {
    
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        if(StringUtils.isNotBlank(prescription.getVisitNo())){
    
        if (StringUtils.isNotBlank(prescription.getVisitNo())) {
            String url = jwUrl + "/third/prescription/fadeRecipe";
            String url = jwUrl + "/third/prescription/fadeRecipe";
            List<NameValuePair> params = new ArrayList<>();
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("visitNo", prescription.getVisitNo()));//挂号号
            params.add(new BasicNameValuePair("visitNo", prescription.getVisitNo()));//挂号号
            params.add(new BasicNameValuePair("fadeDept", prescription.getJwDeptCode()));//作废科室编码
            params.add(new BasicNameValuePair("fadeDept", prescription.getJwDeptCode()));//作废科室编码
            params.add(new BasicNameValuePair("fadeOperator", prescription.getJwDoctorCode()));//作废人员编码
            params.add(new BasicNameValuePair("fadeOperator", prescription.getJwDoctorCode()));//作废人员编码
            String response = httpClientUtil.post(url, params, "UTF-8");
            String response = httpClientUtil.post(url, params, "UTF-8");
            if(StringUtils.isNotBlank(response)){
                JSONObject reobj =  JSON.parseObject(response);
            if (StringUtils.isNotBlank(response)) {
                JSONObject reobj = JSON.parseObject(response);
                Integer status = reobj.getInteger("status");
                Integer status = reobj.getInteger("status");
                String errmsg = reobj.getString("msg");
                String errmsg = reobj.getString("msg");
                if(200 != status){
                    throw new Exception("基卫接口(挂号作废)请求失败,"+errmsg);
                if (200 != status) {
                    throw new Exception("基卫接口(挂号作废)请求失败," + errmsg);
                }
                }
            }else{
            } else {
                throw new Exception("基卫接口(挂号作废)请求失败,无数据返回!");
                throw new Exception("基卫接口(挂号作废)请求失败,无数据返回!");
            }
            }
        
            return response;
            return response;
        }
        }
    
        return "";
        return "";
    }
    }
    
    /**
    /**
     * ca认证接口
     * ca认证接口
     *
     * @param code 续方code
     * @param code 续方code
     * @return
     * @return
     */
     */
    public String affirmCARecipe(String code){
    public String affirmCARecipe(String code) {
        String url = jwUrl + "/third/prescription/affirmCARecipe";
        String url = jwUrl + "/third/prescription/affirmCARecipe";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("code", code));//续方code
        params.add(new BasicNameValuePair("code", code));//续方code
        String response = httpClientUtil.post(url, params, "UTF-8");
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
        return response;
    }
    }
    
    /**
    /**
     * 根据起止时间查询家签慢病患者定标情况,并同步到本地数据库
     * 根据起止时间查询家签慢病患者定标情况,并同步到本地数据库
     *
     * @param startdate
     * @param startdate
     * @param enddate
     * @param enddate
     * @return
     * @return
     */
     */
    public void getPatientDiseaseContentMapByTime(String startdate, String enddate)throws Exception {
        logger.info("查询家签慢病患者定标情况,开始时间"+startdate+",结束时间:"+enddate);
    public void getPatientDiseaseContentMapByTime(String startdate, String enddate) throws Exception {
    
        logger.info("查询家签慢病患者定标情况,开始时间" + startdate + ",结束时间:" + enddate);
    
    
        String url = jwUrl + "/third/sign/getSickFamilyDoctorSpecialistControl";
        String url = jwUrl + "/third/sign/getSickFamilyDoctorSpecialistControl";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("TIME_START", startdate));//开始时间
        params.add(new BasicNameValuePair("TIME_START", startdate));//开始时间
        params.add(new BasicNameValuePair("TIME_END", enddate));//结束时间
        params.add(new BasicNameValuePair("TIME_END", enddate));//结束时间
        String response = httpClientUtil.post(url, params, "UTF-8");
        String response = httpClientUtil.post(url, params, "UTF-8");
    
        HashMap<String, Integer> idcard_diseasecontion_map = new HashMap<>();
        HashMap<String, Integer> idcard_diseasecontion_map = new HashMap<>();
        if(StringUtils.isNotBlank(response)){
            JSONObject reobj =  JSON.parseObject(response);
    
        if (StringUtils.isNotBlank(response)) {
            JSONObject reobj = JSON.parseObject(response);
            Integer status = reobj.getInteger("status");
            Integer status = reobj.getInteger("status");
            String errmsg = reobj.getString("msg");
            String errmsg = reobj.getString("msg");
            if(200 == status){
            if (200 == status) {
                JSONObject jwData = reobj.getJSONObject("data");
                JSONObject jwData = reobj.getJSONObject("data");
                Integer jwCode = jwData.getInteger("CODE");
                Integer jwCode = jwData.getInteger("CODE");
                if(1 == jwCode){
                if (1 == jwCode) {
                    JSONArray dataArray = jwData.getJSONArray("DATA");
                    JSONArray dataArray = jwData.getJSONArray("DATA");
                    for (int i = 0; i < dataArray.size(); i++) {
                    for (int i = 0; i < dataArray.size(); i++) {
                        JSONObject json = dataArray.getJSONObject(i);
                        JSONObject json = dataArray.getJSONObject(i);
                        String idcard = json.getString("IDENTITY_CARD_NO");//身份证号码
                        String idcard = json.getString("IDENTITY_CARD_NO");//身份证号码
                        Integer diseaseCondition = json.getInteger("SPECIALIST_CONTROL");//定标情况【 0 绿标 1 黄标 2 红标】
                        Integer diseaseCondition = json.getInteger("SPECIALIST_CONTROL");//定标情况【 0 绿标 1 黄标 2 红标】
                        idcard_diseasecontion_map.put(idcard,diseaseCondition);
                        idcard_diseasecontion_map.put(idcard, diseaseCondition);
                    }
                    }
                    if(idcard_diseasecontion_map != null && !idcard_diseasecontion_map.keySet().isEmpty()){
                        logger.info("从基卫接口获取需要更新定标情况的慢病患者个数为"+idcard_diseasecontion_map.keySet().size());
    
                    if (idcard_diseasecontion_map != null && !idcard_diseasecontion_map.keySet().isEmpty()) {
                        logger.info("从基卫接口获取需要更新定标情况的慢病患者个数为" + idcard_diseasecontion_map.keySet().size());
                        patientService.updatePatientDiseascontionByIdcard(idcard_diseasecontion_map);
                        patientService.updatePatientDiseascontionByIdcard(idcard_diseasecontion_map);
                    }else{
                        logger.info("从基卫接口获取需要更新定标情况的慢病患者个数为"+idcard_diseasecontion_map.keySet().size());
                    } else {
                        logger.info("从基卫接口获取需要更新定标情况的慢病患者个数为" + idcard_diseasecontion_map.keySet().size());
                    }
                    }
                }else{
                } else {
                    String jwMessage = jwData.getString("MESSAGE");
                    String jwMessage = jwData.getString("MESSAGE");
                    throw new Exception("获取慢病患者定标情况,请求基卫接口失败:"+jwMessage);
                    throw new Exception("获取慢病患者定标情况,请求基卫接口失败:" + jwMessage);
                }
                }
            }else{
                throw new Exception("获取慢病患者定标情况请求失败,"+errmsg);
    
            } else {
                throw new Exception("获取慢病患者定标情况请求失败," + errmsg);
            }
            }
        }else{
        } else {
            throw new Exception("获取慢病患者定标情况请求失败,无数据返回!");
            throw new Exception("获取慢病患者定标情况请求失败,无数据返回!");
        }
        }
    }
    }
    
    
    /**
    /**
     * 根据起止时间查询老年人体检记录,并同步到本地数据库
     * 根据起止时间查询老年人体检记录,并同步到本地数据库
     *
     * @param startdate
     * @param startdate
     * @param enddate
     * @param enddate
     * @return
     * @return
     */
     */
    public void getOldPeoplePhysicalExaminationByTime(String startdate, String enddate)throws Exception {
    public void getOldPeoplePhysicalExaminationByTime(String startdate, String enddate) throws Exception {
        
        
        logger.info("查询老年人体检记录,开始时间"+startdate+",结束时间:"+enddate);
        logger.info("查询老年人体检记录,开始时间" + startdate + ",结束时间:" + enddate);
        
        
        
        
        String url = jwUrl + "/third/sign/getSickMedicalSimpleListInfo";
        String url = jwUrl + "/third/sign/getSickMedicalSimpleListInfo";
@ -348,14 +364,14 @@ public class JwPrescriptionService {
        //老年人体检记录列表
        //老年人体检记录列表
        List<OldPeoplePhysicalExaminationEntity> oldPeoplePhysicalExaminationEntities = new ArrayList<>();
        List<OldPeoplePhysicalExaminationEntity> oldPeoplePhysicalExaminationEntities = new ArrayList<>();
        
        
        if(StringUtils.isNotBlank(response)){
            JSONObject reobj =  JSON.parseObject(response);
        if (StringUtils.isNotBlank(response)) {
            JSONObject reobj = JSON.parseObject(response);
            Integer status = reobj.getInteger("status");
            Integer status = reobj.getInteger("status");
            String errmsg = reobj.getString("msg");
            String errmsg = reobj.getString("msg");
            if(200 == status){
            if (200 == status) {
                JSONObject jwData = reobj.getJSONObject("data");
                JSONObject jwData = reobj.getJSONObject("data");
                Integer jwCode = jwData.getInteger("CODE");
                Integer jwCode = jwData.getInteger("CODE");
                if(1 == jwCode){
                if (1 == jwCode) {
                    JSONArray dataArray = jwData.getJSONArray("DATA");
                    JSONArray dataArray = jwData.getJSONArray("DATA");
                    for (int i = 0; i < dataArray.size(); i++) {
                    for (int i = 0; i < dataArray.size(); i++) {
    
    
@ -382,35 +398,35 @@ public class JwPrescriptionService {
                        oldPeoplePhysicalExaminationEntities.add(oldPeoplePhysicalExaminationEntity);
                        oldPeoplePhysicalExaminationEntities.add(oldPeoplePhysicalExaminationEntity);
                    }
                    }
                    
                    
                    if(!oldPeoplePhysicalExaminationEntities.isEmpty()){
                        logger.info("从基卫接口获取老年人体检记录数为"+oldPeoplePhysicalExaminationEntities.size());
                    if (!oldPeoplePhysicalExaminationEntities.isEmpty()) {
                        logger.info("从基卫接口获取老年人体检记录数为" + oldPeoplePhysicalExaminationEntities.size());
                        oldPeoplePhysicalExaminationDao.save(oldPeoplePhysicalExaminationEntities);
                        oldPeoplePhysicalExaminationDao.save(oldPeoplePhysicalExaminationEntities);
                    }else{
                        logger.info("从基卫接口获取老年人体检记录数个数为"+oldPeoplePhysicalExaminationEntities.size());
                    } else {
                        logger.info("从基卫接口获取老年人体检记录数个数为" + oldPeoplePhysicalExaminationEntities.size());
                    }
                    }
                }else{
                } else {
                    String jwMessage = jwData.getString("MESSAGE");
                    String jwMessage = jwData.getString("MESSAGE");
                    throw new Exception("从基卫接口获取老年人体检记,请求基卫接口失败:"+jwMessage);
                    throw new Exception("从基卫接口获取老年人体检记,请求基卫接口失败:" + jwMessage);
                }
                }
                
                
            }else{
                throw new Exception("从基卫接口获取老年人体检记请求失败,"+errmsg);
            } else {
                throw new Exception("从基卫接口获取老年人体检记请求失败," + errmsg);
            }
            }
        }else{
        } else {
            throw new Exception("从基卫接口获取老年人体检记请求失败,无数据返回!");
            throw new Exception("从基卫接口获取老年人体检记请求失败,无数据返回!");
        }
        }
    }
    }
    
    
    /**
    /**
     * 根据起止时间查询居民随访记录,并同步到本地
     * 根据起止时间查询居民随访记录,并同步到本地
     *
     * @param startdate
     * @param startdate
     * @param enddate
     * @param enddate
     * @return
     * @return
     */
     */
    public void getFollowUpByTime(String startdate, String enddate) throws Exception {
    public void getFollowUpByTime(String startdate, String enddate) throws Exception {
    
    
        logger.info("查询居民随访记录,开始时间"+startdate+",结束时间:"+enddate);
    
        logger.info("查询居民随访记录,开始时间" + startdate + ",结束时间:" + enddate);
    
    
        String url = jwUrl + "/third/sign/getEhrChroDaysFollowUpInfoRecord";
        String url = jwUrl + "/third/sign/getEhrChroDaysFollowUpInfoRecord";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
@ -421,19 +437,18 @@ public class JwPrescriptionService {
        //居民随访记录
        //居民随访记录
        List<Followup> followups = new ArrayList<>();
        List<Followup> followups = new ArrayList<>();
    
    
        if(StringUtils.isNotBlank(response)){
            JSONObject reobj =  JSON.parseObject(response);
        if (StringUtils.isNotBlank(response)) {
            JSONObject reobj = JSON.parseObject(response);
            Integer status = reobj.getInteger("status");
            Integer status = reobj.getInteger("status");
            String errmsg = reobj.getString("msg");
            String errmsg = reobj.getString("msg");
            if(200 == status){
            if (200 == status) {
                JSONObject jwData = reobj.getJSONObject("data");
                JSONObject jwData = reobj.getJSONObject("data");
                Integer jwCode = jwData.getInteger("CODE");
                Integer jwCode = jwData.getInteger("CODE");
                if(1 == jwCode){
                if (1 == jwCode) {
                    JSONArray dataArray = jwData.getJSONArray("DATA");
                    JSONArray dataArray = jwData.getJSONArray("DATA");
                    for (int i = 0; i < dataArray.size(); i++) {
                    for (int i = 0; i < dataArray.size(); i++) {
    
                        Followup followup = new Followup();
                        Followup followup = new Followup();
                    
    
                        JSONObject json = dataArray.getJSONObject(i);
                        JSONObject json = dataArray.getJSONObject(i);
    
    
                        SignFamily sign = null;
                        SignFamily sign = null;
@ -441,23 +456,22 @@ public class JwPrescriptionService {
                        //随访主表信息
                        //随访主表信息
                        String isNewCreate = json.getString("IS_NEW_CREATE");//是否新增
                        String isNewCreate = json.getString("IS_NEW_CREATE");//是否新增
                        String followupNo = json.getString("FOLLOWUP_NO");//随访编号【基卫】:家庭医生服务随访主表ID
                        String followupNo = json.getString("FOLLOWUP_NO");//随访编号【基卫】:家庭医生服务随访主表ID
                        String dataFrom =  json.getString("FOLLOWUP_SOURCE");//随访来源 1.平台端 2.移动端 3.第三方健康之路(移动端)"
                        String dataFrom = json.getString("FOLLOWUP_SOURCE");//随访来源 1.平台端 2.移动端 3.第三方健康之路(移动端)"
                        
                        
                        if("0".equals(isNewCreate) || "3".equals(dataFrom)){//修改
                        if ("0".equals(isNewCreate) || "3".equals(dataFrom)) {//修改
                            followup = followUpDao.findByFollowupNo(followupNo);
                            followup = followUpDao.findByFollowupNo(followupNo);
                            if(followup == null){
                            if (followup == null) {
                                followup.setFollowupNo(followupNo);
                                followup.setFollowupNo(followupNo);
                            }
                            }
                        }
                        }
                        
                        
                        if("1".equals(dataFrom) || "2".equals(dataFrom)){
                        if ("1".equals(dataFrom) || "2".equals(dataFrom)) {
                            followup.setDataFrom("1");
                            followup.setDataFrom("1");
                        }else if("3".equals(dataFrom)){
                        } else if ("3".equals(dataFrom)) {
                            followup.setDataFrom("2");
                            followup.setDataFrom("2");
                        }
                        }
                        followup.setDataFrom(dataFrom);
                        followup.setDataFrom(dataFrom);
                        
                        
                        
                        String followupDate = json.getString("THIS_FOLLOWUP_VISIT_DATE");//随访时间:此次随访时间
                        String followupDate = json.getString("THIS_FOLLOWUP_VISIT_DATE");//随访时间:此次随访时间
                        followup.setFollowupDate(DateUtil.strToDate(followupDate));
                        followup.setFollowupDate(DateUtil.strToDate(followupDate));
                        String followupPlanDate = "";//随访计划时间
                        String followupPlanDate = "";//随访计划时间
@ -473,17 +487,14 @@ public class JwPrescriptionService {
                        //医院映射
                        //医院映射
                        HospitalMapping hm = hospitalMappingDao.getCodeByMapping(orgCode, "1");
                        HospitalMapping hm = hospitalMappingDao.getCodeByMapping(orgCode, "1");
                        if (hm == null) {
                        if (hm == null) {
    
                            logger.info("no mapping hospital:" + orgCode);
                            logger.info("no mapping hospital:" + orgCode);
                            continue;
                            continue;
//                            throw new Exception("no mapping hospital:" + orgCode);
                        }
                        }
                        //医生映射
                        //医生映射
                        Doctor doctor = doctorDao.findMappingDoctor(jwdoctorCode, orgCode);
                        Doctor doctor = doctorDao.findMappingDoctor(jwdoctorCode, orgCode);
                        if (doctor == null) {
                        if (doctor == null) {
                            logger.info("no mapping hospital:" + orgCode + ",familyDoctor:" + jwdoctorCode);
                            logger.info("no mapping hospital:" + orgCode + ",familyDoctor:" + jwdoctorCode);
                            continue;
                            continue;
//                            throw new Exception("no mapping hospital:" + orgCode + ",familyDoctor:" + jwdoctorCode);
                        }
                        }
                        
                        
                        String doctorCode = doctor.getCode();//医生CODE
                        String doctorCode = doctor.getCode();//医生CODE
@ -493,28 +504,38 @@ public class JwPrescriptionService {
                        followup.setDoctorName(doctorName);
                        followup.setDoctorName(doctorName);
                        followup.setOrgName(orgName);
                        followup.setOrgName(orgName);
                        
                        
                        String idcard =  json.getString("IDENTITY_CARD_NO");//患者身份证
                        String idcard = json.getString("IDENTITY_CARD_NO");//患者身份证
                        Patient patient = patientDao.findByIdcard(idcard);
                        Patient patient = patientDao.findByIdcard(idcard);
                        String patientCode = patient.getCode();//患者CODE
                        String patientCode = patient.getCode();//患者CODE
                        String patientName = patient.getName();//患者姓名
                        String patientName = patient.getName();//患者姓名
                        followup.setIdcard(idcard);
                        followup.setIdcard(idcard);
                        followup.setPatientCode(patientCode);
                        followup.setPatientCode(patientCode);
                        followup.setPatientName(patientName);
                        followup.setPatientName(patientName);
                        String followupStatus =  "1";//状态 0取消 1已完成 2未开始 3进行中 *基卫没有状态字段,传递过来的默认都是已完成的*
    
                        String followupStatus = "1";//状态 0取消 1已完成 2未开始 3进行中 *基卫没有状态字段,传递过来的默认都是已完成的*
                        String followupContentPhone = "";//电话随访内容 -------
                        String followupContentPhone = "";//电话随访内容 -------
                        String followupManagerStatus = "";//随访管理状态【字典FOLLOWUP_MANAGER_STATUS】-------
                        String followupManagerStatus = "";//随访管理状态【字典FOLLOWUP_MANAGER_STATUS】-------
                        String followupClass = json.getString("FAMILY_FOLLOWUP_CLASS_NAMES");//随访类别【1.高血压 2.糖尿病】
                        String followupClass = json.getString("FAMILY_FOLLOWUP_CLASS_NAMES");//随访类别【1.高血压 2.糖尿病】
    
                        if (followupClass.contains("高血压") && followupClass.contains("糖尿病")) {
                            followupClass = "1,2";
                        }else if(followupClass.contains("高血压")){
                            followupClass= "1";
                        }else if(followupClass.contains("糖尿病")){
                            followupClass= "2";
                        }else{}
                        
                        String visitWayCode = json.getString("VISIT_WAY_CODE");//随访来源 1.门诊,2.家庭,3.电话,4.健康小屋
                        String visitWayCode = json.getString("VISIT_WAY_CODE");//随访来源 1.门诊,2.家庭,3.电话,4.健康小屋
                        String creater = "";//创建者
                        String creater = doctor.getCode();//创建者
                        followup.setStatus(followupStatus);
                        followup.setStatus(followupStatus);
                        followup.setFollowupClass(followupClass);
                        followup.setFollowupClass(followupClass);
                        followup.setFollowupType(visitWayCode);
                        followup.setFollowupType(visitWayCode);
                        followup.setCreater(creater);
    
    
                        //判断是否存在
                        //判断是否存在
                        sign = signFamilyDao.findByIdcard(idcard);
                        sign = signFamilyDao.findByIdcard(idcard);
                        //判断是否存在签约修改身份证情况
                        //判断是否存在签约修改身份证情况
                        if(sign==null) {
                        if (sign == null) {
                            logger.info("no sign familyy patient idcard:" + idcard);
                            logger.info("no sign familyy patient idcard:" + idcard);
                            continue;
                            continue;
                        }
                        }
@ -525,139 +546,133 @@ public class JwPrescriptionService {
                        followup.setSignCode(signCode);
                        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<>();
                        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.频繁;】
                        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"));//心率
                        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("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_TC", json.getString("BLOOD_FAT_TC"));//总胆固醇 V02
                        followupContent3.put("BLOOD_FAT_LDLC",json.getString("BLOOD_FAT_LDLC"));//血清低密度脂蛋白胆固醇 V03
                        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"));//主食(克/天)
                        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"));//糖尿病随访分类--详情
                        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】
                        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
                        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
    
                        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"));//患者拒绝转诊内容
    
                        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
                        
                        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();
                        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
                        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
                        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
                        TransactionStatus transactionStatus = transactionManager.getTransaction(def); // 获得事务状态
                        TransactionStatus transactionStatus = transactionManager.getTransaction(def); // 获得事务状态
                        try {
                        try {
    
                            followup = followUpDao.save(followup);
                            followup = followUpDao.save(followup);
                            
                            Long followupId = followup.getId();
                            Long followupId = followup.getId();
                            
                            //删除原有记录
                            //删除原有记录
                            followupContentDao.deleteByFollowupId(followup.getId());
                            followupContentDao.deleteByFollowupId(followup.getId());
                            //组装数据
                            //组装数据
                            List<FollowupContent> newList = new ArrayList<>();
                            List<FollowupContent> newList = new ArrayList<>();
    
    
                            followupContent1.forEach((k,v) ->{
                            followupContent1.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("1");
                                item.setFollowupProject("1");
@ -667,7 +682,7 @@ public class JwPrescriptionService {
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
    
                            followupContent2.forEach((k,v) ->{
                            followupContent2.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("2");
                                item.setFollowupProject("2");
@ -677,7 +692,7 @@ public class JwPrescriptionService {
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
    
                            followupContent3.forEach((k,v) ->{
                            followupContent3.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("3");
                                item.setFollowupProject("3");
@ -687,7 +702,7 @@ public class JwPrescriptionService {
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
    
                            followupContent4.forEach((k,v) ->{
                            followupContent4.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("4");
                                item.setFollowupProject("4");
@ -697,7 +712,7 @@ public class JwPrescriptionService {
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
    
                            followupContent5.forEach((k,v) ->{
                            followupContent5.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("5");
                                item.setFollowupProject("5");
@ -707,7 +722,7 @@ public class JwPrescriptionService {
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
    
                            followupContent6.forEach((k,v) ->{
                            followupContent6.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("6");
                                item.setFollowupProject("6");
@ -717,7 +732,7 @@ public class JwPrescriptionService {
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
    
                            followupContent7.forEach((k,v) ->{
                            followupContent7.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("7");
                                item.setFollowupProject("7");
@ -727,7 +742,7 @@ public class JwPrescriptionService {
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
    
                            followupContent8.forEach((k,v) ->{
                            followupContent8.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("8");
                                item.setFollowupProject("8");
@ -737,7 +752,7 @@ public class JwPrescriptionService {
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
    
                            followupContent9.forEach((k,v) ->{
                            followupContent9.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("9");
                                item.setFollowupProject("9");
@ -747,7 +762,7 @@ public class JwPrescriptionService {
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
    
                            followupContent10.forEach((k,v) ->{
                            followupContent10.forEach((k, v) -> {
                                FollowupContent item = new FollowupContent();
                                FollowupContent item = new FollowupContent();
                                item.setFollowupId(followupId);
                                item.setFollowupId(followupId);
                                item.setFollowupProject("10");
                                item.setFollowupProject("10");
@ -756,36 +771,36 @@ public class JwPrescriptionService {
                                item.setCreateTime(new Date());
                                item.setCreateTime(new Date());
                                newList.add(item);
                                newList.add(item);
                            });
                            });
    
                            followupContentDao.save(newList);
                            followupContentDao.save(newList);
    
    
                            List<FollowupDrugs> DRUG_LIST = new ArrayList<>();//用药记录
                            List<FollowupDrugs> DRUG_LIST = new ArrayList<>();//用药记录
    
    
                            for (int j = 1; j < 7 ; j++) {
                                if(json.containsKey("PHYSIC_NAME"+j)){
                            for (int j = 1; j < 7; j++) {
                                if (json.containsKey("PHYSIC_NAME" + j)) {
                                    FollowupDrugs drug = new FollowupDrugs();
                                    FollowupDrugs drug = new FollowupDrugs();
                                    drug.setFollowupId(followupId);
                                    drug.setFollowupId(followupId);
                                    drug.setDrugsGroup("normal");
                                    drug.setDrugsGroup("normal");
                                    drug.setDrugsCode("");
                                    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.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.setCreateTime(new Date());
                                    DRUG_LIST.add(drug);
                                    DRUG_LIST.add(drug);
                                }
                                }
                            }
                            }
    
    
                            for (int k = 1; k < 4 ; k++) {
                                if(json.containsKey("PHYSIC_NAME"+k)){
                            for (int k = 1; k < 4; k++) {
                                if (json.containsKey("PHYSIC_NAME" + k)) {
                                    FollowupDrugs drug = new FollowupDrugs();
                                    FollowupDrugs drug = new FollowupDrugs();
                                    drug.setFollowupId(followupId);
                                    drug.setFollowupId(followupId);
                                    drug.setDrugsGroup("insulin");
                                    drug.setDrugsGroup("insulin");
                                    drug.setDrugsCode("");
                                    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.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.setCreateTime(new Date());
                                    DRUG_LIST.add(drug);
                                    DRUG_LIST.add(drug);
                                }
                                }
@ -801,16 +816,223 @@ public class JwPrescriptionService {
                            continue;
                            continue;
                        }
                        }
                    }
                    }
                }else{
                } else {
                    String jwMessage = jwData.getString("MESSAGE");
                    String jwMessage = jwData.getString("MESSAGE");
                    throw new Exception("同步随访信息报错接口失败:"+jwMessage);
                    throw new Exception("同步随访信息报错接口失败:" + jwMessage);
                }
                }
    
            } else {
                throw new Exception("同步随访信息报错请求失败," + errmsg);
            }
        } else {
            throw new Exception("同步随访信息报错请求失败,无数据返回!");
        }
    }
    
    /**
     * 上传居民随访记录到基卫
     */
    public void uploadFollowUpRecordToJW() throws Exception {
        //查找出需要上传的随访映射记录
        List<Followup> followupMappings = followUpDao.findByFollowMappingNeedUpload(1);
        
        if (!followupMappings.isEmpty()) {
            logger.info("需要上传的的随访记录数:" + followupMappings.size());
            for (Followup followup : followupMappings) {
                try {
                    //随访信息详情
                    JSONObject jsonObject = new JSONObject();
                    //组装请求结果MAP
                    HashMap<String,String> followupResultMap = new HashMap<>();
                    
                    List<FollowupContent> followupContents = followupContentDao.findByFollowupId(followup.getId());
                    
                    for (FollowupContent followupContent : followupContents) {
                        followupResultMap.put(followupContent.getFollowupKey(), followupContent.getFollowupValue());
                    }
                    
                    String OPERATOR = followup.getJwdoctorCode();//操作员&录入医生
                    if (StringUtils.isBlank(OPERATOR)) {
                        OPERATOR = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(followup.getDoctorCode(), followup.getOrgCode());
                    }
                    followupResultMap.put("OPERATOR",OPERATOR);
                    
                    String FOLLOWUP_ID = followup.getFollowupNo();//家庭医生服务随访主表ID
                    if (StringUtils.isBlank(FOLLOWUP_ID)) {
                        FOLLOWUP_ID = "0";
                    }
                    followupResultMap.put("FOLLOWUP_ID",FOLLOWUP_ID);
                    
                    String FAMILY_FOLLOWUP_TYPE = "3";//随访类型,必传值3 【必填】
                    String ORG_CODE = followup.getOrgCode();//机构编码
                    String FOLLOWUP_SOURCE = "3";//健康之路移动端
                    String IDENTITY_CARD_NO = followup.getIdcard();
                    String FAMILY_FOLLOWUP_CLASS_NAMES = followup.getFollowupClass();
                    if ("1".equals(FAMILY_FOLLOWUP_CLASS_NAMES)) {
                        FAMILY_FOLLOWUP_CLASS_NAMES = "高血压";
                    } else if ("2".equals(FAMILY_FOLLOWUP_CLASS_NAMES)) {
                        FAMILY_FOLLOWUP_CLASS_NAMES = "糖尿病";
                    } 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",ORG_CODE);
                    followupResultMap.put("FOLLOWUP_SOURCE",FOLLOWUP_SOURCE);
                    followupResultMap.put("IDENTITY_CARD_NO",IDENTITY_CARD_NO);
                    followupResultMap.put("FAMILY_FOLLOWUP_CLASS_NAMES",FAMILY_FOLLOWUP_CLASS_NAMES);
                    
                    
                    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("VISIT_WAY_CODE",VISIT_WAY_CODE);
                    
                    String ARCHIVE_ID = "";//档案ID
                    if (followupResultMap.containsKey("ARCHIVE_ID")) {
                        ARCHIVE_ID = followupResultMap.get("ARCHIVE_ID");
                    }
                    
                    if(StringUtils.isBlank(ARCHIVE_ID) || "0".equals(ARCHIVE_ID)){
                        //通过接口请求
                        ARCHIVE_ID = this.getSickArchiveFlag(IDENTITY_CARD_NO);
                        followupResultMap.put("ARCHIVE_ID",ARCHIVE_ID);
                    }
                    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);
                        }else{
                            followupDrugsNormal.add(drugs);
                        }
                    }
                    
                    if(followupDrugsNormal.size() >6 || followupDrugsInsulin.size() >3){
                        logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString());
                        continue;
                    }
    
                    DecimalFormat df = new DecimalFormat("######0.00");
    
                    //普通药品
                    if(!followupDrugsNormal.isEmpty()){
                        for (int i = 0; i < followupDrugsNormal.size(); i++) {
                            int tag = i+1;
                            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());
                            followupResultMap.put("PHYSIC_DOSE"+tag,df.format(followupDrugsNormal.get(i).getDose()));
                        }
                    }
    
                    //胰岛素类药品
                    if(!followupDrugsInsulin.isEmpty()){
                        for (int  j= 0; j < followupDrugsInsulin.size(); j++) {
                            int tag = j+1;
                            followupResultMap.put("PHYSIC_NAME"+tag,followupDrugsInsulin.get(j).getDrugsName());
                            followupResultMap.put("FREQUENCY"+tag,followupDrugsInsulin.get(j).getFrequency());
                            followupResultMap.put("PHYSIC_UNIT"+tag,followupDrugsInsulin.get(j).getUnit());
                            followupResultMap.put("PHYSIC_DOSE"+tag,df.format(followupDrugsInsulin.get(j).getDose()));
                        }
                    }
    
                    jsonObject = JSONObject.parseObject(JSON.toJSONString(followupResultMap));
                    
                    String url = jwUrl + "/third/archives/uploadEhrSickChroDaysFollowUpRecord";
    
                    List<NameValuePair> params = new ArrayList<>();
                    params.add(new BasicNameValuePair("OPERATOR", OPERATOR));
                    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");
                        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++) {
                    
                                    OldPeoplePhysicalExaminationEntity oldPeoplePhysicalExaminationEntity = new OldPeoplePhysicalExaminationEntity();
                    
                                    JSONObject json = dataArray.getJSONObject(i);
                                    
                                    String jw_followup_no = json.getString("FOLLOWUP_NO");
    
                                    followup.setFollowupNo(jw_followup_no);
    
                                    followUpDao.save(followup);//获取的基卫随访主表ID,更新回数据库
                                }
                                
                            } else {
                                String jwMessage = jwData.getString("MESSAGE");
                                logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString()+",err:"+jwMessage);
                                continue;
                            }
            
            
                        } else {
                            logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString()+",err:请求失败");
                            continue;
                        }
                    } else {
                        logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString()+",无返回值");
                        continue;
                    }
                } catch (Exception e) {
                    logger.info("随访记录上传失败,普通药品或者胰岛素类药瓶超过了上线,随访主表ID:" + followup.getId().toString()+",err"+e.getMessage());
                    continue;
                }
            }
        }
    }
    
    /**
     *  查询居民是否有建立健康档案接口
     */
    public String getSickArchiveFlag(String idcard)  throws Exception {
        String re = "0";//0 未建档,非0为档案号
        String url = jwUrl + "/third/sign/uploadEhrSickChroDaysFollowUpRecord";
        
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("idcard", idcard));
        String response = httpClientUtil.post(url, params, "UTF-8");
        
        if(!StringUtils.isEmpty(response))
        {
            org.json.JSONObject json = new org.json.JSONObject(response);
            if (!"200".equals(json.optString("status"))) {
                throw new Exception(json.optString("msg"));
            }else{
            }else{
                throw new Exception("同步随访信息报错请求失败,"+errmsg);
                String dataStr = json.getString("data");
                if(!StringUtils.isEmpty(dataStr)){
                    org.json.JSONObject data = new org.json.JSONObject(dataStr);
                    if("1".equals(data.optString("CODE")))
                    {
                        org.json.JSONArray jsonArray = data.getJSONArray("DATA");
                        re = jsonArray.getJSONObject(0).getString("ARCHIVE_ID");
                    }
                    else{
                        throw new Exception(json.optString("MESSAGE"));
                    }
                }else{
                    throw new Exception("返回结果为空!");
                }
            }
            }
        }else{
            throw new Exception("同步随访信息报错请求失败,无数据返回!");
        }
        }
        else{
            throw new Exception("返回结果为空!");
        }
        
        return re;
    }
    }
}
}

+ 12 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -193,7 +193,7 @@ public class ZyDictService {
     * @param name
     * @param name
     * @return
     * @return
     */
     */
    public List<Map<String, Object>> findDictByDoctorAndName(String doctor,String name){
    public List<Map<String, Object>> findDictByDoctorAndName(String doctor,String name,String isinsulin){
        String sql = "SELECT  yp.physic_code drugCode, " +
        String sql = "SELECT  yp.physic_code drugCode, " +
                " yp.physic_name drugName, " +
                " yp.physic_name drugName, " +
                " yp.physic_spec drugFormat, " +
                " yp.physic_spec drugFormat, " +
@ -255,6 +255,17 @@ public class ZyDictService {
                " AND com2.`code` = yp.quantity_unit " +
                " AND com2.`code` = yp.quantity_unit " +
                " AND com3.`code` = yp.pack_unit " +
                " AND com3.`code` = yp.pack_unit " +
                " AND class.class_code = yp.subject_class";
                " AND class.class_code = yp.subject_class";
        if(StringUtils.isNoneBlank(isinsulin)){
            
            String insulin = "胰岛素";
            
            if("1".equals(isinsulin)){
                sql+= " AND yp.physic_name not like '%"+insulin+"%' ";
            }
            if("2".equals(isinsulin)){
                sql+= " AND yp.physic_name like '%"+insulin+"%' and yp.subject_class like '%010%'";
            }
        }
//        subjectClass
//        subjectClass
//        drugNumUnit":"224","drugNumUnitName":"支",
//        drugNumUnit":"224","drugNumUnitName":"支",
//        physicDoseUnit":"224","physicDoseUnitName":"支",
//        physicDoseUnit":"224","physicDoseUnitName":"支",

+ 30 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -67,6 +67,31 @@ public class PrescriptionInfoController extends BaseController {
            return error(-1, "查询失败!");
            return error(-1, "查询失败!");
        }
        }
    }
    }
    
    /**
     * 获取长处方信息列表
     * @param type
     * @return
     */
    @RequestMapping(value = "/getPrescriptionInfos" , method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取长处方信息列表")
    public String getPrescriptionInfos(@RequestParam(required = true)@ApiParam(name="type",value="1:查询处方;2我的续方;3:续方记录")String type,
                                       @RequestParam(required = false)@ApiParam(name="isRenewal",value="处方是否可续方:1.是;2.无过滤")String isRenewal,
                                       @RequestParam(required = false)@ApiParam(name="recipeNo",value="医嘱号,第一次获取上一方时传入0,第二次获取上一方时传入第一次返回的医嘱号,以此类推")String recipeNo,
                                       @RequestParam(required = false)@ApiParam(name="startDate",value="开始时间")String startDate,
                                       @RequestParam(required = false)@ApiParam(name="endDate",value="结束时间")String endDate,
                                       @RequestParam(required = false,defaultValue = "0")@ApiParam(name="diagnosisCode",value="所有诊断(0 全部 1高血压 2糖尿病)")String diagnosisCode,
                                       @RequestParam(required = false)@ApiParam(name="page",value="起始页")Integer page,
                                       @RequestParam(required = false)@ApiParam(name="size",value="每页记录数")Integer size,
                                       @RequestParam(required = true)@ApiParam(name="patientCode",value="居民CODE")String patientCode){
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescriptionInfos(type,recipeNo,diagnosisCode,startDate,endDate,patientCode,isRenewal,page,size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @ApiOperation(value = "获取过滤规则信息列表")
    @ApiOperation(value = "获取过滤规则信息列表")
@ -170,10 +195,12 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/findDictByName", method = RequestMethod.GET)
    @RequestMapping(value = "/findDictByName", method = RequestMethod.GET)
    @ApiOperation(value = "药品列表")
    @ApiOperation(value = "药品列表")
    public String findDictByName(@ApiParam(name = "name", value = "药品名称(中文或拼音首字母查询)", defaultValue = "胰岛素")
    public String findDictByName(@ApiParam(name = "name", value = "药品名称(中文或拼音首字母查询)", defaultValue = "胰岛素")
                                 @RequestParam(value = "name", required = false) String name) {
                                 @RequestParam(value = "name", required = false) String name,
                                 @ApiParam(name = "isinsulin", value = "是否过滤胰岛素:1非胰岛素,2胰岛素", defaultValue = "")
                                 @RequestParam(value = "isinsulin", required = false) String isinsulin) {
        try {
        try {
//            return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName("e3b3bfb3644011e69616fa163e424525",name));
            return write(200, "操作成功!", "data", zyDictService.findDictByDoctorAndName(getUID(), name));
//            return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName("e3b3bfb3644011e69616fa163e424525",name,isinsulin));
            return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName(getUID(), name,isinsulin));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败!");
            return error(-1, "查询失败!");