| 
					
				 | 
			
			
				@ -7,28 +7,23 @@ import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.mapping.dao.HospitalDeptMappingDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyHisPrescriptionVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.ListEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.util.WebserviceUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.xml.XMLSerializer; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.core.io.ClassPathResource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.core.io.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.RequestParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.transaction.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.BufferedReader; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.InputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.InputStreamReader; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.regex.Matcher; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.regex.Pattern; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -114,22 +109,29 @@ public class EntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(demoFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp=getJosnFileResullt(fid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject msg=new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msg.put("endNum","20000"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msg.put("Msg", new net.sf.json.JSONArray() ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject query=new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            query.put("@compy","="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            query.put("@item","CARD_NO"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            query.put("@splice","and"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            query.put("@value",cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msg.put("query",query); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msg.put("startNum",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<String> stringList=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            stringList.add(cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //获取消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = MqSdkUtil.putReqAndGetResp(msg.toString(), fid, "1",stringList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //解析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp= MqSdkUtil.xml2jsonObject(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //先调用银医通获取下载余额到his,再查询his中卡余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            net.sf.json.JSONObject jsonObject= callYYTServerService(cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if(null!=jsonObject && "1".equals(jsonObject.get("code").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               JSONObject msg=new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               msg.put("endNum","20000"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               msg.put("Msg", new net.sf.json.JSONArray() ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               JSONObject query=new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               query.put("@compy","="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               query.put("@item","CARD_NO"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               query.put("@splice","and"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               query.put("@value",cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               msg.put("query",query); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               msg.put("startNum",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               List<String> stringList=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               stringList.add(cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               //获取消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               resp = MqSdkUtil.putReqAndGetResp(msg.toString(), fid, "1",stringList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               //解析 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               resp= MqSdkUtil.xml2jsonObject(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               return jsonObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  ConvertUtil.convertObjectEnvelopByString(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -376,8 +378,8 @@ public class EntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray BS30025(String PAT_NO,String admNo,String registerSn,String startTime,String endTime,boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String fid=BS30025; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public  List<WlyyOutpatientVO> BS30025(String PAT_NO,String admNo,String registerSn,String startTime,String endTime,boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String fid = BS30025; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resp = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (demoFlag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = getJosnFileResullt(fid); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -409,7 +411,39 @@ public class EntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = MqSdkUtil.xml2jsonArrayRootRow(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ConvertUtil.convertListEnvelopInRow(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = ConvertUtil.convertListEnvelopInRow(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientVO wlyyOutpatientVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Object object : jsonArray) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            net.sf.json.JSONObject jsonObjectMgsInfo = (net.sf.json.JSONObject) object; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null != jsonObjectMgsInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO = new WlyyOutpatientVO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("ADM_NO") ? "" : jsonObjectMgsInfo.get("ADM_NO") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("ADM_SPEC") ? "" : jsonObjectMgsInfo.get("ADM_SPEC") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("ADM_SPEC_NAME") ? "" : jsonObjectMgsInfo.get("ADM_SPEC_NAME") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setPatient(null == jsonObjectMgsInfo.get("PAT_NO") ? "" : jsonObjectMgsInfo.get("PAT_NO") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setPatientName(null == jsonObjectMgsInfo.get("PAT_NAME") ? "" : jsonObjectMgsInfo.get("PAT_NAME") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setDoctor(null == jsonObjectMgsInfo.get("CON_DOC") ? "" : jsonObjectMgsInfo.get("CON_DOC") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setDoctorName(null == jsonObjectMgsInfo.get("CON_DOC_NAME") ? "" : jsonObjectMgsInfo.get("CON_DOC_NAME") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setIdcard(null == jsonObjectMgsInfo.get("social_no") ? "" : jsonObjectMgsInfo.get("social_no") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String icds = null == jsonObjectMgsInfo.get("icd_name") ? "" : jsonObjectMgsInfo.get("icd_name") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] icdcodeAndName = icds.split("&"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setIcd10(icdcodeAndName.length > 1 ? icdcodeAndName[1].toString() : ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setIcd10Name(icdcodeAndName.length > 0 ? icdcodeAndName[0].toString() : ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String admDate = null == jsonObjectMgsInfo.get("ADM_NO") ? "" : jsonObjectMgsInfo.get("ADM_NO") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String conDate = null == jsonObjectMgsInfo.get("ADM_NO") ? "" : jsonObjectMgsInfo.get("ADM_NO") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setAdmDate(DateUtil.strToDate(admDate, DateUtil.YYYY_MM_DD_HH_MM_SS_)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setConDate(DateUtil.strToDate(conDate, DateUtil.YYYY_MM_DD_HH_MM_SS_)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVOS.add(wlyyOutpatientVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return wlyyOutpatientVOS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -819,4 +853,127 @@ public class EntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 银医通下载 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param cardNo 待查询的卡号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     **/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public net.sf.json.JSONObject callYYTServerService(String cardNo) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String re = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        net.sf.json.JSONObject jsonObject=new net.sf.json.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String action = "CallYYTServerService"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String info_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<root><ip>172.16.50.40</ip><port>5516</port></root>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String reqmsg_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<root><sick_id>" + cardNo + "</sick_id><cus_card_no>" + cardNo + "</cus_card_no>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<req_type>2001</req_type><trade_type>2001</trade_type><req_oper>8644</req_oper><req_term>192001019019</req_term><win_no>6</win_no></root>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, String> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("ServerInfo", info_xml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("RegMsg", reqmsg_xml); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String urlString = "http://172.16.50.40:80/ZyXmyytRequestService/ZyXmyytRequestServiceWs.dll?Handler=ZyXmyytRequestServiceWsService"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String namespace = "zysoft"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        re = WebserviceUtil.post(urlString, namespace, action, params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        XMLSerializer xmlSerializer = new XMLSerializer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSON json = xmlSerializer.read(re); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Object errorCode = ((net.sf.json.JSONObject) json).get("error_code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("ok".equals(errorCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSON json2 = xmlSerializer.read(((net.sf.json.JSONObject) json).get("response").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            System.out.println("银医通下载response:" + json2.toString(1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.element("code","1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.element("obj",json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Object errorMsg = ((net.sf.json.JSONObject) json).get("error_msg"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.element("code","-1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.element("obj","银医通下载失败," +errorMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //{"error_type":"0","error_code":"10002","error_msg":"卡号无效"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isEmpty(re)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("返回为空!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (re.startsWith("error")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception(re); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jsonObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  患者门诊就诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  按照患者唯一号、科室、医生、获取当前时间往前24小时的挂号记录。获取最新一条判断是否有效(医保当天有效,自费24小时有效) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  若是自费,则有效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  若是医保,判断日期是否和当前时间同一天,否则无效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  @param patNo 居民唯一号 必传参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  @param dept 挂号科室 必传参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  @param doctor 挂号医生 必传参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return true 已挂号 ,false 未挂号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public boolean guahao(String patNo,String dept,String doctor,boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String fid = BS30025; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer sbs = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (demoFlag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = getJosnFileResullt(fid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //AccessControl :用户、密码、服务id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sbs.append("<ESBEntry><AccessControl><Fid>" + fid + "</Fid><UserName>JKZL</UserName><Password>123456</Password></AccessControl>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //MessageHeader :固定值 消费方系统编号 S60,提供方系统编号 S01 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>S60</SourceSysCode><TargetSysCode>S01</TargetSysCode></MessageHeader>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查询信息拼接 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sbs.append("<MsgInfo><onceFlag>1</onceFlag><startNum>1</startNum><endNum>50000</endNum><Msg/>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sbs.append("<query compy=\"=\" item=\"PAT_NO\" splice=\"and\" value=\"'" + patNo + "'\"/>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sbs.append("<query compy=\"=\" item=\"ADM_SPEC\" splice=\"and\" value=\"'" + dept + "'\"/>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(doctor)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sbs.append("<query compy=\"=\" item=\"CON_DOC\" splice=\"and\" value=\"'" + doctor + "'\"/>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //获取当前时间 查询当前时间往前推24小时是否有挂号 (医保当天有效,自费24小时有效) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String now = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD_HH_MM_SS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String preday = DateUtil.dateToStr(DateUtil.getPreDays(DateUtil.getNowDate(), -1), DateUtil.YYYY_MM_DD_HH_MM_SS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(preday)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sbs.append("<query compy=\">\" item=\"ADM_DAT\" splice=\"and\" value=\"'" + preday + "'\"/>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(now)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sbs.append("<query compy=\"<\" item=\"ADM_DAT\" splice=\"and\" value=\"'" + now + "'\"/>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sbs.append("<order item=\"ADM_DAT\" sort=\"desc\"/>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查询信息结束 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sbs.append("</MsgInfo></ESBEntry>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resp = MqSdkUtil.xml2jsonArrayRootRow(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //解析返回结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null != jsonObject.get("MsgInfo")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            net.sf.json.JSONArray jsonArray = (net.sf.json.JSONArray) jsonObject.get("MsgInfo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //获取第一条 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            net.sf.json.JSONObject object = (net.sf.json.JSONObject) jsonArray.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(null!=object){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                object = (net.sf.json.JSONObject) object.get("row"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String ybFlag=null != object.get("yb_flag")?object.get("yb_flag").toString():""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //市医保,1;省医保,2;自费,3,其他医保,99) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("2".equals(ybFlag)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (("1".equals(ybFlag) || "3".equals(ybFlag))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String admDateStr = object.get("ADM_DAT")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //挂号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Date admDate = DateUtil.strToDate(admDateStr + "", DateUtil.YYYY_MM_DD_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SimpleDateFormat format = new SimpleDateFormat(DateUtil.YYYY_MM_DD_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //获取当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String dateString = format.format(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Date nowDate = DateUtil.strToDate(dateString, DateUtil.YYYY_MM_DD_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (0 == nowDate.compareTo(admDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |