| 
					
				 | 
			
			
				@ -14,12 +14,15 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseOrgDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.PatientMedicareCardDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.OutpatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.PrescriptionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.org.dao.BaseOrgDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientMedicareCardDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.wechat.wxhttp.HttpUtil; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -75,6 +78,13 @@ public class WlyyBusinessService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DoctorMappingDao doctorMappingDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PrescriptionService prescriptionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BasePatientMedicareCardDao patientMedicareCardDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 推送系统门诊wlyy系统消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctor 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -254,7 +264,7 @@ public class WlyyBusinessService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String wlyyGetPatientAccetokenByIdcard(String patientId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String wlyyGetPatientAccetokenByIdcard(String patientId,String wxId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String idcard = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String result = ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -264,7 +274,46 @@ public class WlyyBusinessService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,String> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("idcard",idcard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String patientCardNo = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                net.sf.json.JSONArray array =prescriptionService.findPatientCard(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (int i=0;i<array.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    net.sf.json.JSONObject object = array.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String cardType = object.getString("CARD_TYPE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String cardNo = object.getString("CARD_NO"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String cardTypeName = object.getString("CARD_TYPE_NAME"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByCode(cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (patientMedicareCardDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientMedicareCardDO = new PatientMedicareCardDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientMedicareCardDO.setCode(cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientMedicareCardDO.setParentType("A"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (cardType.equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            patientMedicareCardDO.setType("A_01"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            patientCardNo = cardNo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            patientMedicareCardDO.setType("A_03"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientMedicareCardDO.setPatientCode(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientMedicareCardDO.setOrgCode("350211A1002"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientMedicareCardDO.setCityCode("350200"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientMedicareCardDO.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientMedicareCardDO.setRemark(cardTypeName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        patientMedicareCardDao.save(patientMedicareCardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //TODO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查询i健康信息,没有就注册; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,String> patientSccParams = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientSccParams.put("scc",patientCardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientSccParams.put("name",basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientSccParams.put("idCard",basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientSccParams.put("phone",basePatientDO.getPhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientSccParams.put("birthday",basePatientDO.getBirthday().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyHttpService.sendWlyyMes("wlyyFindAccountBySsc",null,params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatientAccetokenByIdcard",null,params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(rs!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer status = rs.getInteger("status"); 
			 |