|  | @ -2,7 +2,6 @@ package com.yihu.wlyy.service.third.jw;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.system.SystemDictService;
 | 
	
		
			
				|  |  | 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;
 | 
	
	
		
			
				|  | @ -805,4 +804,148 @@ public class JwArchivesService {
 | 
	
		
			
				|  |  |             throw new Exception("返回结果为空!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /*****************************************建档相关******************************************************************/
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *  查询居民是否有建立健康档案接口
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String getSickArchiveFlag(String idcard)  throws Exception
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  |         String re = "0";//0 未建档,非0为档案号
 | 
	
		
			
				|  |  |         String url = jwUrl + "/third/archives/getSickArchiveFlag";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<NameValuePair> params = new ArrayList<>();
 | 
	
		
			
				|  |  |         params.add(new BasicNameValuePair("idcard", idcard));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String response = HttpClientUtil.post(url, params, "UTF-8");
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(response))
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject(response);
 | 
	
		
			
				|  |  |             if (!"200".equals(json.optString("status"))) {
 | 
	
		
			
				|  |  |                 throw new Exception(json.optString("msg"));
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 String dataStr = json.getString("data");
 | 
	
		
			
				|  |  |                 if(!StringUtils.isEmpty(dataStr)){
 | 
	
		
			
				|  |  |                     JSONObject data = new JSONObject(dataStr);
 | 
	
		
			
				|  |  |                     if("1".equals(data.optString("CODE")))
 | 
	
		
			
				|  |  |                     {
 | 
	
		
			
				|  |  |                         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("返回结果为空!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询居民健康档案信息接口
 | 
	
		
			
				|  |  |      * @param idcard
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONArray getSickArchiveRecord(String idcard)  throws Exception
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  |         JSONArray re = new JSONArray();
 | 
	
		
			
				|  |  |         String url = jwUrl + "/third/archives/getSickArchiveRecord";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<NameValuePair> params = new ArrayList<>();
 | 
	
		
			
				|  |  |         params.add(new BasicNameValuePair("idcard", idcard));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String response = HttpClientUtil.post(url, params, "UTF-8");
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(response))
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject(response);
 | 
	
		
			
				|  |  |             if (!"200".equals(json.optString("status"))) {
 | 
	
		
			
				|  |  |                 throw new Exception(json.optString("msg"));
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 String dataStr = json.getString("data");
 | 
	
		
			
				|  |  |                 if(!StringUtils.isEmpty(dataStr)){
 | 
	
		
			
				|  |  |                     JSONObject data = new JSONObject(dataStr);
 | 
	
		
			
				|  |  |                     if("1".equals(data.optString("CODE")))
 | 
	
		
			
				|  |  |                     {
 | 
	
		
			
				|  |  |                         JSONArray jsonArray = data.getJSONArray("DATA");
 | 
	
		
			
				|  |  |                         // {"ARCHIVE_ID":"档案ID","SICK_NAME":"病人姓名","SICK_SEX":"性别","BIRTHDAY":"出生日期","IDENTITY_CARD_NO":"身份证号码","ZONE_CODE":"归属辖区","HOME_ADDRESS":"现住址","INSUR_CARD_NO":"医保卡号"}
 | 
	
		
			
				|  |  |                         jsonArray.forEach(one->{
 | 
	
		
			
				|  |  |                             JSONObject jsonObject = new JSONObject(one);
 | 
	
		
			
				|  |  |                             JSONObject js = new JSONObject();
 | 
	
		
			
				|  |  |                             js.put("archiveId",jsonObject.get("ARCHIVE_ID"));
 | 
	
		
			
				|  |  |                             js.put("sickName",jsonObject.get("SICK_NAME"));
 | 
	
		
			
				|  |  |                             js.put("sickSex",jsonObject.get("SICK_SEX"));
 | 
	
		
			
				|  |  |                             js.put("birthday",jsonObject.get("BIRTHDAY"));
 | 
	
		
			
				|  |  |                             js.put("idCard",jsonObject.get("IDENTITY_CARD_NO"));
 | 
	
		
			
				|  |  |                             js.put("zoneCode",jsonObject.get("ZONE_CODE"));
 | 
	
		
			
				|  |  |                             js.put("homeAddress",jsonObject.get("HOME_ADDRESS"));
 | 
	
		
			
				|  |  |                             js.put("ssc",jsonObject.get("INSUR_CARD_NO"));
 | 
	
		
			
				|  |  |                             re.put(js);
 | 
	
		
			
				|  |  |                         });
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     else{
 | 
	
		
			
				|  |  |                         throw new Exception(json.optString("MESSAGE"));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                     throw new Exception("返回结果为空!");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         else{
 | 
	
		
			
				|  |  |             throw new Exception("返回结果为空!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 上传居民档案建档信息接口
 | 
	
		
			
				|  |  |      * @param param 入参json对象,成功返回档案号
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String saveSickArchiveRecord(String param,String doctor) throws Exception{
 | 
	
		
			
				|  |  |         String re = "0";//0 未建档,非0为档案号
 | 
	
		
			
				|  |  |         String url = jwUrl + "/third/archives/saveSickArchiveRecord";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<NameValuePair> params = new ArrayList<>();
 | 
	
		
			
				|  |  |         params.add(new BasicNameValuePair("json", param));
 | 
	
		
			
				|  |  |         params.add(new BasicNameValuePair("doctor", doctor));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String response = HttpClientUtil.post(url, params, "UTF-8");
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(response))
 | 
	
		
			
				|  |  |         {
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject(response);
 | 
	
		
			
				|  |  |             if (!"200".equals(json.optString("status"))) {
 | 
	
		
			
				|  |  |                 throw new Exception(json.optString("msg"));
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 String dataStr = json.getString("data");
 | 
	
		
			
				|  |  |                 if(!StringUtils.isEmpty(dataStr)){
 | 
	
		
			
				|  |  |                     JSONObject data = new JSONObject(dataStr);
 | 
	
		
			
				|  |  |                     if("1".equals(data.optString("CODE")))
 | 
	
		
			
				|  |  |                     {
 | 
	
		
			
				|  |  |                         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("返回结果为空!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |