package com.yihu.wlyy.service.third.jw;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.service.third.ehr.EhrService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by hzp on 2016/12/19.
 * 基卫签约服务
 */
@Service
public class JwSignService {

    //基卫服务地址
    private String jwUrl = SystemConf.getInstance().getJwUrl();



    /****************************************************************************************************************************/
    /**
     * 上传家庭签约记录
     */
    public String uploadSignFamily(String code) {
        String url = jwUrl + "/third/sign/UploadSignFamily";

        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("code", code));

        return HttpClientUtil.post(url, params, "UTF-8");

    }

    /**
     * 获取患者三师签约信息
     */
    public String getSignSanshi(String idcard) {
        String url = jwUrl + "/third/zysoftservice/getSickSanShiTeamSignInfo";

        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("idcard", idcard));

        return HttpClientUtil.post(url, params, "UTF-8");

    }

    /**
     * 获取患者家庭签约信息
     */
    public String getSignFamily(String idcard) {
        String url = jwUrl + "/third/zysoftservice/getSickCurrnetFamilySignInfo";

        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("idcard", idcard));

        return HttpClientUtil.post(url, params, "UTF-8");

    }
}
