|  | @ -30,11 +30,9 @@ import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.dao.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.entrance.util.AES;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.doctor.CheckInfoVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.doctor.PersonInfoVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.base.BaseRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.http.HttpClientUtil;
 | 
	
	
		
			
				|  | @ -47,7 +45,6 @@ import net.sf.json.xml.XMLSerializer;
 | 
	
		
			
				|  |  | import nu.xom.*;
 | 
	
		
			
				|  |  | import org.apache.commons.collections.map.HashedMap;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.dom4j.DocumentHelper;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.BeanUtils;
 | 
	
	
		
			
				|  | @ -1768,6 +1765,39 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |         return patientMappingDO.getMappingCode();
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String updatePatientMapping(String patient,String cardNo){
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = patientDao.findById(patient);
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String idCard = patientDO.getIdcard();
 | 
	
		
			
				|  |  |         String url = entranceUrl+"findPatientCard?idCard="+idCard;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             String obj = object.getString("obj");
 | 
	
		
			
				|  |  |             JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
 | 
	
		
			
				|  |  |             for (int i=0;i<array.size();i++){
 | 
	
		
			
				|  |  |                 JSONObject object1 = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                 if (object1.getString("CARD_NO").equalsIgnoreCase(cardNo)){
 | 
	
		
			
				|  |  |                     if (patientMappingDO==null){
 | 
	
		
			
				|  |  |                         patientMappingDO = new PatientMappingDO();
 | 
	
		
			
				|  |  |                         patientMappingDO.setIdcard(patientDO.getIdcard());
 | 
	
		
			
				|  |  |                         patientMappingDO.setPatientName(patientDO.getName());
 | 
	
		
			
				|  |  |                         patientMappingDO.setPatient(patientDO.getId());
 | 
	
		
			
				|  |  |                         patientMappingDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                         patientMappingDO.setSource("1");
 | 
	
		
			
				|  |  |                         patientMappingDO.setMappingCode(object1.getString("SICKID"));
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         patientMappingDO.setMappingCode(object1.getString("SICKID"));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     patientMappingDO = patientMappingDao.save(patientMappingDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return patientMappingDO.getMappingCode();
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取门诊就诊记录列表
 | 
	
		
			
				|  |  |      * @param patient 居民id
 |