|  | @ -857,6 +857,7 @@ public class HcyyEntranceService {
 | 
	
		
			
				|  |  |         XMLSerializer xmlSerializer = new XMLSerializer();
 | 
	
		
			
				|  |  |         String json = xmlSerializer.read(xml).toString();
 | 
	
		
			
				|  |  |         logger.info("getOriginPrescriptionList json:"+json);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return json;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -2189,7 +2190,7 @@ public class HcyyEntranceService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取心脏医院token
 | 
	
		
			
				|  |  |      * 获取海沧医院微信token
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
	
		
			
				|  | @ -2380,194 +2381,6 @@ public class HcyyEntranceService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取卡信息
 | 
	
		
			
				|  |  |      * @param cardNo 就诊卡
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject selectCardInfo(String cardNo){
 | 
	
		
			
				|  |  |         JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"getCardInfo?cardNo="+cardNo;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         if (object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
 | 
	
		
			
				|  |  |             if (array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                 jsonObject = array.getJSONObject(0);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonObject;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public String savePatientMapping(String patient){
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = patientDao.findById(patient);
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String idCard = patientDO.getIdcard();
 | 
	
		
			
				|  |  |         String url = entranceUrl+"findPatientCard?idCard="+idCard;
 | 
	
		
			
				|  |  |         String mappingCode="";
 | 
	
		
			
				|  |  |         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);
 | 
	
		
			
				|  |  |             if (array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                 JSONObject object1 = array.getJSONObject(0);
 | 
	
		
			
				|  |  |                 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"));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 mappingCode=object1.getString("SICKID");
 | 
	
		
			
				|  |  |                 patientMappingDO = patientMappingDao.save(patientMappingDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return mappingCode;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     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);
 | 
	
		
			
				|  |  |                 logger.info("判断卡号是否相同:"+object1.getString("CARD_NO")+"cardNo:"+cardNo);
 | 
	
		
			
				|  |  |                 if (object1.getString("CARD_NO").equalsIgnoreCase(cardNo)){
 | 
	
		
			
				|  |  |                     logger.info("卡号相同");
 | 
	
		
			
				|  |  |                     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
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<WlyyOutpatientVO> selectOutpatientList(String patient,String startTime,String endTime,String cardNo) throws Exception {
 | 
	
		
			
				|  |  |         List<WlyyOutpatientVO> wlyyOutpatientVOList = new ArrayList<>();
 | 
	
		
			
				|  |  |         JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         patient = updatePatientMapping(patient,cardNo);
 | 
	
		
			
				|  |  |         String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&startTime="+startTime+"&endTime="+endTime;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         logger.info("response:"+response);
 | 
	
		
			
				|  |  |         JSONObject jsonObject = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if (jsonObject.getInteger("status")==200){
 | 
	
		
			
				|  |  |             array = JSONArray.parseArray(jsonObject.getString("obj")).getJSONArray(0);
 | 
	
		
			
				|  |  |             for (int i=0;i<array.size();i++){
 | 
	
		
			
				|  |  |                 JSONObject object = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                 WlyyOutpatientVO outpatientVO = new WlyyOutpatientVO();
 | 
	
		
			
				|  |  |                 outpatientVO.setAdmNo(isEmty(object.getString("ADMNO")));
 | 
	
		
			
				|  |  |                 outpatientVO.setOriginAdmNo(isEmty(object.getString("ORIGINADMNO")));
 | 
	
		
			
				|  |  |                 outpatientVO.setRegisterNo(isEmty(object.getString("REGISTERNO")));
 | 
	
		
			
				|  |  |                 outpatientVO.setOriginRegisterNo(isEmty(object.getString("ORIGINREGISTERNO")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDept(isEmty(object.getString("DEPT")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDeptName(isEmty(object.getString("DEPTNAME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setPatient(isEmty(object.getString("PATIENT")));
 | 
	
		
			
				|  |  |                 outpatientVO.setPatientName(isEmty(object.getString("PATIENTNAME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDoctor(isEmty(object.getString("DOCTOR")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDoctorName(isEmty(object.getString("DOCTORNAME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setIdcard(isEmty(object.getString("IDCARD")));
 | 
	
		
			
				|  |  |                 outpatientVO.setMjz(isEmty(object.getString("MJZ")));
 | 
	
		
			
				|  |  |                 outpatientVO.setIcd10(isEmty(object.getString("ICDCODE")));
 | 
	
		
			
				|  |  |                 outpatientVO.setIcd10Name(isEmty(object.getString("ICDNAME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setAdmDate(DateUtil.strToDate(object.getString("ADMDATE")));
 | 
	
		
			
				|  |  |                 outpatientVO.setConDate(DateUtil.strToDate(object.getString("CONDATE")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDescription(isEmty(object.getString("DESCRIPTION")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDiseaseImg(isEmty(object.getString("DISEASEIMG")));
 | 
	
		
			
				|  |  |                 outpatientVO.setCreateTime(DateUtil.strToDate(object.getString("CREATETIME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setStatus(isEmty(object.getString("STATUS")));
 | 
	
		
			
				|  |  |                 outpatientVO.setConNo(isEmty(object.getString("VISITNUM")));
 | 
	
		
			
				|  |  |                 outpatientVO.setPatient(patient);
 | 
	
		
			
				|  |  |                 wlyyOutpatientVOList.add(outpatientVO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return wlyyOutpatientVOList;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取单条门诊就诊记录
 | 
	
		
			
				|  |  |      * @param patient 居民id
 | 
	
		
			
				|  |  |      * @param conNo 就诊次数
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public WlyyOutpatientVO selectOutpatientInfo(String patient,String conNo){
 | 
	
		
			
				|  |  |         WlyyOutpatientVO outpatientVO = new WlyyOutpatientVO();
 | 
	
		
			
				|  |  |         JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = patientDao.findById(patient);
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
 | 
	
		
			
				|  |  |         if (patientMappingDO!=null){
 | 
	
		
			
				|  |  |             patient = patientMappingDO.getMappingCode();
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             patient = savePatientMapping(patient);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&conNo="+conNo;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         logger.info("response:"+response);
 | 
	
		
			
				|  |  |         JSONObject jsonObject = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if (jsonObject.getInteger("status")==200){
 | 
	
		
			
				|  |  |             array = JSONArray.parseArray(jsonObject.getString("obj")).getJSONArray(0);
 | 
	
		
			
				|  |  |             if (array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                 JSONObject object = array.getJSONObject(0);
 | 
	
		
			
				|  |  |                 outpatientVO.setAdmNo(isEmty(object.getString("ADMNO")));
 | 
	
		
			
				|  |  |                 outpatientVO.setOriginAdmNo(isEmty(object.getString("ORIGINADMNO")));
 | 
	
		
			
				|  |  |                 outpatientVO.setRegisterNo(isEmty(object.getString("REGISTERNO")));
 | 
	
		
			
				|  |  |                 outpatientVO.setOriginRegisterNo(isEmty(object.getString("ORIGINREGISTERNO")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDept(isEmty(object.getString("DEPT")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDeptName(isEmty(object.getString("DEPTNAME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setPatientName(isEmty(object.getString("PATIENTNAME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDoctor(isEmty(object.getString("DOCTOR")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDoctorName(isEmty(object.getString("DOCTORNAME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setIdcard(isEmty(object.getString("IDCARD")));
 | 
	
		
			
				|  |  |                 outpatientVO.setMjz(isEmty(object.getString("MJZ")));
 | 
	
		
			
				|  |  |                 outpatientVO.setIcd10(isEmty(object.getString("ICDCODE")));
 | 
	
		
			
				|  |  |                 outpatientVO.setIcd10Name(isEmty(object.getString("ICDNAME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setAdmDate(DateUtil.strToDate(object.getString("ADMDATE")));
 | 
	
		
			
				|  |  |                 outpatientVO.setConDate(DateUtil.strToDate(object.getString("CONDATE")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDescription(isEmty(object.getString("DESCRIPTION")));
 | 
	
		
			
				|  |  |                 outpatientVO.setDiseaseImg(isEmty(object.getString("DISEASEIMG")));
 | 
	
		
			
				|  |  |                 outpatientVO.setCreateTime(DateUtil.strToDate(object.getString("CREATETIME")));
 | 
	
		
			
				|  |  |                 outpatientVO.setStatus(isEmty(object.getString("STATUS")));
 | 
	
		
			
				|  |  |                 outpatientVO.setConNo(isEmty(object.getString("VISITNUM")));
 | 
	
		
			
				|  |  |                 outpatientVO.setHospitalName("厦门大学附属心血管病医院");
 | 
	
		
			
				|  |  |                 outpatientVO.setHospital("350211A5010");
 | 
	
		
			
				|  |  |                 outpatientVO.setSex(patientDO.getSex()+"");
 | 
	
		
			
				|  |  |                 outpatientVO.setPatient(patientDO.getId());
 | 
	
		
			
				|  |  |                 outpatientVO.setBirthday(patientDO.getBirthday());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return outpatientVO;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> updatePreStatusLocal(String admNo,String realOrder,String status) throws Exception {
 | 
	
		
			
				|  |  |         Map<String,Object> map = new HashedMap();
 | 
	
	
		
			
				|  | @ -2655,185 +2468,6 @@ public class HcyyEntranceService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取门诊下所有处方信息
 | 
	
		
			
				|  |  |      * @param registerSn 流水号
 | 
	
		
			
				|  |  |      * @param patNo 居民id
 | 
	
		
			
				|  |  |      * @param admNo 住院唯一号
 | 
	
		
			
				|  |  |      * @param realOrder 处方号
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<WlyyPrescriptionVO> selectOriginPrescriptionList(String registerSn,String patNo,String admNo,String realOrder){
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionVO> prescriptionVOList = new ArrayList<>();
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String params = "";
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(realOrder)){
 | 
	
		
			
				|  |  |             params +="&realOrder="+realOrder;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         logger.info("处方request:"+registerSn+"=="+patNo+"==="+admNo+"===="+realOrder);
 | 
	
		
			
				|  |  |         String url = entranceUrl+"getOriginPrescriptionList?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+params;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         logger.info("处方response:"+response+"===="+url);
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if (object!=null&&object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |             array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
 | 
	
		
			
				|  |  |             for (int i=0;i<array.size();i++){
 | 
	
		
			
				|  |  |                 WlyyPrescriptionVO wlyyPrescriptionVO = new WlyyPrescriptionVO();
 | 
	
		
			
				|  |  |                 JSONObject jsonObject = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setCreateTime(DateUtil.strToDate(isEmty(jsonObject.getString("CREATETIME"))));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setCreateUser(isEmty(jsonObject.getString("CREATEUSER")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setCreateUserName(isEmty(jsonObject.getString("CREATENAME")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setUpdateTime(DateUtil.strToDate(isEmty(jsonObject.getString("UPDATETIME"))));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setUpdateUser(isEmty(jsonObject.getString("UPDATEUSER")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setUpdateUserName(isEmty(jsonObject.getString("UPDATEUSERNAME")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setRealOrder(isEmty(jsonObject.getString("REALORDER")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setOriginRealOrder(isEmty(jsonObject.getString("ORIGINREALORDER")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setAdmNo(isEmty(jsonObject.getString("ADMNO")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setOriginAdmNo(isEmty(jsonObject.getString("ORIGINADMNO")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setSerialNo(isEmty(jsonObject.getString("SERIALNO")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setOriginSerialNo(isEmty(jsonObject.getString("ORIGINSERIALNO")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setType(jsonObject.getInteger("TYPE"));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setPatientCode(isEmty(jsonObject.getString("PATIENTCODE")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setPatientName(isEmty(jsonObject.getString("PATEINTNAME")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setIdcard(isEmty(jsonObject.getString("IDCARD")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setCardNo(isEmty(jsonObject.getString("CARDNO")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setSsc(isEmty(jsonObject.getString("SSC")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDoctor(isEmty(jsonObject.getString("DOCTOR")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDoctorName(isEmty(jsonObject.getString("DOCTORNAME")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setStatus(jsonObject.getInteger("STATUS"));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setMkFailReason(isEmty(jsonObject.getString("MKFAILREASON")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setMkTime(DateUtil.strToDate(isEmty(jsonObject.getString("MKTIME"))));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setPrescribeTime(DateUtil.strToDate(isEmty(jsonObject.getString("PRESCRIBETIME"))));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setPrescribeReason(isEmty(jsonObject.getString("PRESCRIBEREASON")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setPayTime(DateUtil.strToDate(isEmty(jsonObject.getString("PAYTIME"))));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDosageTime(DateUtil.strToDate(isEmty(jsonObject.getString("DOSAGETIME"))));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setFinishTime(DateUtil.strToDate(isEmty(jsonObject.getString("FINISHTIME"))));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDept(isEmty(jsonObject.getString("DEPT")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDeptName(isEmty(jsonObject.getString("DEPTNAME")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setHospital(isEmty(jsonObject.getString("HOSPITAL")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setHospitalName(isEmty(jsonObject.getString("HOSPITALNAME")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setConsult(isEmty(jsonObject.getString("CONSULT")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDispensaryType(isEmty(jsonObject.getString("DISPENSARYTYPE"))!=null?Integer.parseInt(isEmty(jsonObject.getString("DISPENSARYTYPE"))):null);
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setReason(isEmty(jsonObject.getString("REASON")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDiseaseImg(isEmty(jsonObject.getString("DISEASEIMG")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setRemark(isEmty(jsonObject.getString("REMARK")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setCancelReason(isEmty(jsonObject.getString("CANCELREASON")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setCaCertData(isEmty(jsonObject.getString("CACERTDATA")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setCaMessage(isEmty(jsonObject.getString("CAMESSAGE")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDigitalSignNo(isEmty(jsonObject.getString("DIGITALSIGNNO")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setOriginalDataAbstract(isEmty(jsonObject.getString("ORIGINALDATAABSTRACT")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setStrOriginalData(isEmty(jsonObject.getString("STRORIGINALDATA")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setHisDeptCode(isEmty(jsonObject.getString("HISDEPTCODE")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setHisDoctorCode(isEmty(jsonObject.getString("HISDOCTORCODE")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setHisGisterTypeCode(isEmty(jsonObject.getString("HISGISTERTYPECODE")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setHisRateTypeCode(isEmty(jsonObject.getString("HISRATETYPECODE")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setHisHospital(isEmty(jsonObject.getString("HISHOSPITAL")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setHisRegisterFee(isEmty(jsonObject.getString("HISREGISTERFEE"))!=null?Integer.parseInt(isEmty(jsonObject.getString("HISREGISTERFEE"))):null);
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setPayStatus(isEmty(jsonObject.getString("PAYSTATUS"))!=null?Integer.parseInt(isEmty(jsonObject.getString("PAYSTATUS"))):null);
 | 
	
		
			
				|  |  |                 //TODO 快递数据
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDispUser(isEmty(jsonObject.getString("DISPUSER")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDispUserName(isEmty(jsonObject.getString("DISPUSERNAME")));
 | 
	
		
			
				|  |  |                 wlyyPrescriptionVO.setDispDate(DateUtil.strToDate(isEmty(jsonObject.getString("DISPDATE"))));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //诊断
 | 
	
		
			
				|  |  |                 String disagnosisUrl = entranceUrl+"getOutpatientDiagnosis?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
 | 
	
		
			
				|  |  |                 String disagnosisResponse = httpClientUtil.get(disagnosisUrl,"GBK");
 | 
	
		
			
				|  |  |                 logger.info("诊断disagnosisResponse:"+disagnosisResponse);
 | 
	
		
			
				|  |  |                 JSONObject object1 = JSONObject.parseObject(disagnosisResponse);
 | 
	
		
			
				|  |  |                 if (object1.getString("status").equalsIgnoreCase("200")){
 | 
	
		
			
				|  |  |                     JSONArray jsonArray = object1.getJSONArray("obj").getJSONArray(0);
 | 
	
		
			
				|  |  |                     List<WlyyPrescriptionDiagnosisVO> prescriptionDiagnosisVOS = new ArrayList<>();
 | 
	
		
			
				|  |  |                     for (int j=0;j<jsonArray.size();j++){
 | 
	
		
			
				|  |  |                         JSONObject disagnosisJson = jsonArray.getJSONObject(j);
 | 
	
		
			
				|  |  |                         WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = new WlyyPrescriptionDiagnosisVO();
 | 
	
		
			
				|  |  |                         prescriptionDiagnosisVO.setCode(isEmty(disagnosisJson.getString("DIAGNOSECODE")));
 | 
	
		
			
				|  |  |                         prescriptionDiagnosisVO.setName(isEmty(disagnosisJson.getString("DIAGNOSENAME")));
 | 
	
		
			
				|  |  |                         prescriptionDiagnosisVO.setType(isEmty(disagnosisJson.getString("DIAGNOSETYPE"))==null?null:Integer.parseInt(disagnosisJson.getString("DIAGNOSETYPE")));
 | 
	
		
			
				|  |  |                         prescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     wlyyPrescriptionVO.setDiagnosisVOs(prescriptionDiagnosisVOS);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 String infoUrl = entranceUrl+"getOutpatientDrugInfo?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
 | 
	
		
			
				|  |  |                 String infoResponse = httpClientUtil.get(infoUrl,"GBK");
 | 
	
		
			
				|  |  |                 logger.info("药品infoResponse:"+infoResponse);
 | 
	
		
			
				|  |  |                 JSONObject infoObject = JSONObject.parseObject(infoResponse);
 | 
	
		
			
				|  |  |                 if (infoObject.getString("status").equalsIgnoreCase("200")) {
 | 
	
		
			
				|  |  |                     JSONArray infoArray = infoObject.getJSONArray("obj").getJSONArray(0);
 | 
	
		
			
				|  |  |                     //药品
 | 
	
		
			
				|  |  |                     List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOList = new ArrayList<>();
 | 
	
		
			
				|  |  |                     for (int j=0;j<infoArray.size();j++){
 | 
	
		
			
				|  |  |                         WlyyPrescriptionInfoVO prescriptionInfoVO = new WlyyPrescriptionInfoVO();
 | 
	
		
			
				|  |  |                         JSONObject infoJson = infoArray.getJSONObject(j);
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setDrugNo(isEmty(infoJson.getString("DRUGNO")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setDrugName(isEmty(infoJson.getString("DRUGNAME")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setDispDeposite(isEmty(infoJson.getString("DISPDEPOSITE")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setDosage(isEmty(infoJson.getString("DOSAGE")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setQuantity(isEmty(infoJson.getString("QUANTITY")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setUnit(isEmty(infoJson.getString("UNIT")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setUnitName(isEmty(infoJson.getString("UNITNAME")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setPackUnitName(isEmty(infoJson.getString("PACKUNITNAME")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setPackUnit(isEmty(infoJson.getString("PACKUNIT")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setUsageCode(isEmty(infoJson.getString("USAGECODE")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setUsageName(isEmty(infoJson.getString("USAGENAME")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setSupplyCode(isEmty(infoJson.getString("SUPPLYCODE")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setSupplyName(isEmty(infoJson.getString("SUPPLYNAME")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setDays(isEmty(infoJson.getString("DAYS")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setFrequency(isEmty(infoJson.getString("FREQUENCY")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setSerial(isEmty(infoJson.getString("SERIAL")));
 | 
	
		
			
				|  |  |                     /*    prescriptionInfoVO.setGroupNo(isEmty(infoJson.getString("groupNo")));*/
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setSpecification(isEmty(infoJson.getString("SPECIFICATION")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setPackRetprice(isEmty(infoJson.getString("PACKRETPRICE"))==null?0.0:infoJson.getDouble("PACKRETPRICE"));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setHerbalCount(isEmty(infoJson.getString("HERBALCOUNT")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setPostCount(isEmty(infoJson.getString("POSTCOUNT")));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setDel(isEmty(infoJson.getString("DEL"))==null?1:infoJson.getInteger("DEL"));
 | 
	
		
			
				|  |  |                         prescriptionInfoVO.setComm(infoJson.getString("COMM"));
 | 
	
		
			
				|  |  |                         wlyyPrescriptionInfoVOList.add(prescriptionInfoVO);
 | 
	
		
			
				|  |  |                         wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOList);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //检查检验内容
 | 
	
		
			
				|  |  |                 String inspectionUrl = entranceUrl+"getOutpatientCheckTestInfo?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+"&realOrder="+jsonObject.getString("REALORDER");
 | 
	
		
			
				|  |  |                 String inspectionResponse = httpClientUtil.get(inspectionUrl,"GBK");
 | 
	
		
			
				|  |  |                 logger.info("检查检验内容inspectionResponse:"+inspectionResponse);
 | 
	
		
			
				|  |  |                 JSONObject inspectionObject = JSONObject.parseObject(inspectionResponse);
 | 
	
		
			
				|  |  |                 if (inspectionObject.getString("status").equalsIgnoreCase("200")) {
 | 
	
		
			
				|  |  |                     List<WlyyInspectionVO> wlyyInspectionVOList = new ArrayList<>();
 | 
	
		
			
				|  |  |                     JSONArray inspectionArray = inspectionObject.getJSONArray("obj").getJSONArray(0);
 | 
	
		
			
				|  |  |                     for (int j=0;j<inspectionArray.size();j++){
 | 
	
		
			
				|  |  |                         WlyyInspectionVO inspectionVO = new WlyyInspectionVO();
 | 
	
		
			
				|  |  |                         JSONObject inspectionJson = inspectionArray.getJSONObject(j);
 | 
	
		
			
				|  |  |                         inspectionVO.setGroupName(isEmty(inspectionJson.getString("GROUPNAME")));
 | 
	
		
			
				|  |  |                         inspectionVO.setQuantity(isEmty(inspectionJson.getString("QUANTITYS"))!=null?Integer.parseInt(isEmty(inspectionJson.getString("QUANTITYS"))):null);
 | 
	
		
			
				|  |  |                         inspectionVO.setFrequency(isEmty(inspectionJson.getString("FREQUENCYS")));
 | 
	
		
			
				|  |  |                         inspectionVO.setParentCode(isEmty(inspectionJson.getString("PARENTCODE")));
 | 
	
		
			
				|  |  |                         inspectionVO.setParentName(isEmty(inspectionJson.getString("PARENTCODENAME")));
 | 
	
		
			
				|  |  |                         inspectionVO.setCode(isEmty(inspectionJson.getString("CODES")));
 | 
	
		
			
				|  |  |                         inspectionVO.setName(isEmty(inspectionJson.getString("NAMES")));
 | 
	
		
			
				|  |  |                         inspectionVO.setInformation(isEmty(inspectionJson.getString("INFORMATION")));
 | 
	
		
			
				|  |  |                         inspectionVO.setCheckEquip(isEmty(inspectionJson.getString("CHECKEQUIP")));
 | 
	
		
			
				|  |  |                         inspectionVO.setCheckPartName(isEmty(inspectionJson.getString("CHECKPARTNAME")));
 | 
	
		
			
				|  |  |                         inspectionVO.setCheckPart(isEmty(inspectionJson.getString("CHECKPART")));
 | 
	
		
			
				|  |  |                         wlyyInspectionVOList.add(inspectionVO);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     wlyyPrescriptionVO.setInspectionVOs(wlyyInspectionVOList);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 try {
 | 
	
		
			
				|  |  |                     List<WlyyPrescriptionEmrDO> listEmr = selectHistoryEmr(patNo,"");
 | 
	
		
			
				|  |  |                     if (null!=listEmr&&listEmr.size()>0){
 | 
	
		
			
				|  |  |                         wlyyPrescriptionVO.setWlyyPrescriptionEmrDO(listEmr.get(0));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 } catch (Exception e) {
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 prescriptionVOList.add(wlyyPrescriptionVO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return prescriptionVOList;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
	
		
			
				|  | @ -3068,81 +2702,15 @@ public class HcyyEntranceService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取药品字典
 | 
	
		
			
				|  |  |      * 查询药品用药方法
 | 
	
		
			
				|  |  |      * @param spellCode 拼音码
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONArray selectDrugDict(String spellCode,String drugNo) throws Exception {
 | 
	
		
			
				|  |  |     public JSONArray selectMedicineUsed(String spellCode) throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"getDrugDict?spellCode="+spellCode+"&drugNo="+drugNo;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |         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 jsonObject = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                 JSONObject object1 = new JSONObject();
 | 
	
		
			
				|  |  |                 object1.put("@action","select");
 | 
	
		
			
				|  |  |                 object1.put("charge_code",jsonObject.getString("PHYSIC_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("serial","");
 | 
	
		
			
				|  |  |                 object1.put("group_no","");
 | 
	
		
			
				|  |  |                 object1.put("drugname",jsonObject.getString("PHYSIC_NAME"));
 | 
	
		
			
				|  |  |                 object1.put("dosage",jsonObject.getString("DOSE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("MIN_DOSE",jsonObject.getString("MIN_DOSE"));
 | 
	
		
			
				|  |  |                 object1.put("mini_unit",jsonObject.getString("PHYSIC_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("pack_size",jsonObject.getString("PACK_SPEC"));
 | 
	
		
			
				|  |  |                 object1.put("retprice",jsonObject.getString("RETAIL_PRICE"));
 | 
	
		
			
				|  |  |                 object1.put("specification",jsonObject.getString("PHYSIC_SPEC"));
 | 
	
		
			
				|  |  |                 object1.put("pack_retprice",jsonObject.getString("RETAIL_PRICE"));
 | 
	
		
			
				|  |  |                 object1.put("stock_amount",jsonObject.getString("QUANTITY"));
 | 
	
		
			
				|  |  |                 object1.put("visible_flag",jsonObject.getString("VALID_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("drug_flag",jsonObject.getString("OTC_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("py_code",jsonObject.getString("SPELL_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("pack_unit",jsonObject.getString("PRICE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("manu_name",jsonObject.getString("SUPPLIER_NAME"));
 | 
	
		
			
				|  |  |                 object1.put("weigh_unit",jsonObject.getString("DOSE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("vol_unit","");
 | 
	
		
			
				|  |  |                 object1.put("mini_unit_name",jsonObject.getString("PHYSIC_UNIT"));
 | 
	
		
			
				|  |  |                 DecimalFormat df =new DecimalFormat("0.00");
 | 
	
		
			
				|  |  |                 Double packSize=Double.parseDouble(jsonObject.get("PACK_SPEC").toString().equals("[]")?"1":jsonObject.getString("PACK_SPEC"));
 | 
	
		
			
				|  |  |                 Double retprice=Double.parseDouble(jsonObject.get("RETAIL_PRICE").toString().equals("[]")?"0":jsonObject.getString("RETAIL_PRICE"));
 | 
	
		
			
				|  |  |                 Double miniUnitPrice=0.00;
 | 
	
		
			
				|  |  |                 if (0.00!=packSize){
 | 
	
		
			
				|  |  |                     miniUnitPrice=retprice/packSize;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 object1.put("mini_unit_price",df.format(miniUnitPrice));
 | 
	
		
			
				|  |  |                 object1.put("pack_unit_name",jsonObject.getString("PRICE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("weigh_unit_name",jsonObject.getString("DOSE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("vol_unit_name","");
 | 
	
		
			
				|  |  |                 object1.put("win_no","");
 | 
	
		
			
				|  |  |                 object1.put("jbyw",jsonObject.getString("BASE_PHYSIC_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("gwyp","");
 | 
	
		
			
				|  |  |                 object1.put("bz_dosage",jsonObject.getString("DOSEAGE"));
 | 
	
		
			
				|  |  |                 object1.put("bz_supply",jsonObject.getString("USAGE"));
 | 
	
		
			
				|  |  |                 object1.put("bz_supply_name",jsonObject.getString("USAGE"));
 | 
	
		
			
				|  |  |                 object1.put("bz_unit",jsonObject.getString("DOSEAGE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("bz_unit_name",jsonObject.getString("DOSEAGE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("bz_usage",jsonObject.getString("FREQUENCY"));
 | 
	
		
			
				|  |  |                 object1.put("bz_usage_name",jsonObject.getString("FREQUENCY"));
 | 
	
		
			
				|  |  |                 object1.put("QUANTITY",jsonObject.getString("QUANTITY"));
 | 
	
		
			
				|  |  |                 object1.put("DAY_COUNT",jsonObject.getString("DAY_COUNT"));
 | 
	
		
			
				|  |  |                 jsonArray.add(object1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonArray;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询药品用药方法
 | 
	
		
			
				|  |  |      * @param spellCode 拼音码
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONArray selectMedicineUsed(String spellCode) throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"getMedicineUsed?spellCode="+spellCode;
 | 
	
		
			
				|  |  |         String url = entranceUrl+"getMedicineUsed?spellCode="+spellCode;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         JSONArray jsonArray = new JSONArray();
 | 
	
	
		
			
				|  | @ -3167,512 +2735,14 @@ public class HcyyEntranceService {
 | 
	
		
			
				|  |  |         return jsonArray;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取药品用药频次字典
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONArray selectFrequencyDict() throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"getFrequencyDict";
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |         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 jsonObject = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                 JSONObject object1 = new JSONObject();
 | 
	
		
			
				|  |  |                 object1.put("@action","select");
 | 
	
		
			
				|  |  |                 object1.put("DAILY_TIMES",jsonObject.getString("FREQ_COUNT"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_CODE",jsonObject.getString("FREQ_DESCRIBE"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_DESCRIBE_CODE",jsonObject.getString("FREQ_DESCRIBE_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_DESCRIBE",jsonObject.getString("FREQ_DESCRIBE"));
 | 
	
		
			
				|  |  |                 object1.put("PHYSIC_NOTUSE_FLAG",jsonObject.getString("PHYSIC_NOTUSE_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_NAME",jsonObject.getString("FREQ_MEMO"));
 | 
	
		
			
				|  |  |                 object1.put("INSUR_FREQ_DESCRIBE",jsonObject.getString("INSUR_FREQ_DESCRIBE"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_INTERVAL",jsonObject.getString("FREQ_INTERVAL"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_INTERVAL_UNIT",jsonObject.getString("FREQ_INTERVAL_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("DEFAULT_SCHEDULE",jsonObject.getString("DEFAULT_SCHEDULE"));
 | 
	
		
			
				|  |  |                 object1.put("EXECUTE_TIME_FLAG",jsonObject.getString("EXECUTE_TIME_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("DAY_FLAG",jsonObject.getString("DAY_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("WEEK_FLAG",jsonObject.getString("WEEK_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("WEEK_1",jsonObject.getString("WEEK_1"));
 | 
	
		
			
				|  |  |                 object1.put("WEEK_2",jsonObject.getString("WEEK_2"));
 | 
	
		
			
				|  |  |                 object1.put("WEEK_3",jsonObject.getString("WEEK_3"));
 | 
	
		
			
				|  |  |                 object1.put("WEEK_4",jsonObject.getString("WEEK_4"));
 | 
	
		
			
				|  |  |                 object1.put("WEEK_5",jsonObject.getString("WEEK_5"));
 | 
	
		
			
				|  |  |                 object1.put("WEEK_6",jsonObject.getString("WEEK_6"));
 | 
	
		
			
				|  |  |                 object1.put("WEEK_7",jsonObject.getString("WEEK_7"));
 | 
	
		
			
				|  |  |                 object1.put("SPELL_CODE",jsonObject.getString("SPELL_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("VALID_FLAG",jsonObject.getString("VALID_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("WEEKLY_TIMES","");
 | 
	
		
			
				|  |  |                 object1.put("IS_OP_IP","");
 | 
	
		
			
				|  |  |                 object1.put("HOSP_CODE","");
 | 
	
		
			
				|  |  |                 object1.put("FREQ_SP",jsonObject.getString("MEMO"));
 | 
	
		
			
				|  |  |                 jsonArray.add(object1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonArray;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询检查部位
 | 
	
		
			
				|  |  |      * @param spellCode 拼音码
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONArray selectCheckBody(String spellCode) throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"getCheckBody?spellCode="+spellCode;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |         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 jsonObject = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                 JSONObject object1 = new JSONObject();
 | 
	
		
			
				|  |  |                 object1.put("@action","select");
 | 
	
		
			
				|  |  |                 object1.put("name",jsonObject.getString("NAME"));
 | 
	
		
			
				|  |  |                 object1.put("code",jsonObject.getString("CODE"));
 | 
	
		
			
				|  |  |                 object1.put("data",jsonObject.getString("DATA"));
 | 
	
		
			
				|  |  |                 object1.put("py_code",jsonObject.getString("SPELL_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("memo",jsonObject.getString("MEMO"));
 | 
	
		
			
				|  |  |                 object1.put("wb_code",jsonObject.getString("WBZX_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("sequence",jsonObject.getString("SEQUENCE"));
 | 
	
		
			
				|  |  |                 object1.put("valid",jsonObject.getString("VALID"));
 | 
	
		
			
				|  |  |                 jsonArray.add(object1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonArray;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询检查项目
 | 
	
		
			
				|  |  |      * @param spellCode 拼音码或药品名字
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONArray selectExamApply(String spellCode) throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"getExamApply?spellCode="+spellCode;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |         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 jsonObject = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                 JSONObject object1 = new JSONObject();
 | 
	
		
			
				|  |  |                 object1.put("@action","select");
 | 
	
		
			
				|  |  |                 object1.put("name",jsonObject.getString("ITEM_NAME"));
 | 
	
		
			
				|  |  |                 object1.put("code",jsonObject.getString("ITEM_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("type",jsonObject.getString("ITEM_CLASS"));
 | 
	
		
			
				|  |  |                 object1.put("py_code",jsonObject.getString("SPELL_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("charge_amount",jsonObject.getString("FACT_PRICE"));
 | 
	
		
			
				|  |  |                 object1.put("child_amount",jsonObject.getString("CHILD_PRICE"));
 | 
	
		
			
				|  |  |                 object1.put("charge_unit",jsonObject.getString("UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("wb_code",jsonObject.getString("FIVE_PEN_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("memo",jsonObject.getString("MEMO"));
 | 
	
		
			
				|  |  |                 jsonArray.add(object1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonArray;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询检验项目
 | 
	
		
			
				|  |  |      * @param spellCode 拼音码或药品名字
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONArray selectLisApply(String spellCode) throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"getLisApply?spellCode="+spellCode;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |         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 jsonObject = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                 JSONObject object1 = new JSONObject();
 | 
	
		
			
				|  |  |                 object1.put("@action","select");
 | 
	
		
			
				|  |  |                 object1.put("name",jsonObject.getString("ITEM_NAME"));
 | 
	
		
			
				|  |  |                 object1.put("code",jsonObject.getString("ITEM_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("type",jsonObject.getString("ITEM_CLASS"));
 | 
	
		
			
				|  |  |                 object1.put("py_code",jsonObject.getString("SPELL_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("charge_amount",jsonObject.getString("FACT_PRICE"));
 | 
	
		
			
				|  |  |                 object1.put("child_amount",jsonObject.getString("CHILD_PRICE"));
 | 
	
		
			
				|  |  |                 object1.put("charge_unit",jsonObject.getString("UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("wb_code",jsonObject.getString("FIVE_PEN_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("memo",jsonObject.getString("MEMO"));
 | 
	
		
			
				|  |  |                 jsonArray.add(object1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonArray;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * 检查检验项目同步his
 | 
	
		
			
				|  |  |  * @param
 | 
	
		
			
				|  |  |  * @return
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,String ApplyDept,String ApplyDoctor,String wlyyInspectionS) throws Exception {
 | 
	
		
			
				|  |  |     String response="";
 | 
	
		
			
				|  |  |     Map resultMap=new HashMap();
 | 
	
		
			
				|  |  |     String url = entranceUrl+"saveInspectToHospital?IoFlag="+IoFlag+"&PayCardNo="+PayCardNo+"&NullahNumber="+NullahNumber+
 | 
	
		
			
				|  |  |             "&ApplyDept="+ApplyDept+
 | 
	
		
			
				|  |  |             "&ApplyDoctor="+ApplyDoctor+"&wlyyInspectionS="+wlyyInspectionS;
 | 
	
		
			
				|  |  |     response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |     JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |     if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |         String obj = object.getString("obj");
 | 
	
		
			
				|  |  |         JSONObject rootObject = JSONObject.parseObject(obj);
 | 
	
		
			
				|  |  |         if (null!=rootObject&&"0".equalsIgnoreCase(rootObject.getString("code"))){
 | 
	
		
			
				|  |  |             resultMap.put("success",rootObject.getString("success"));
 | 
	
		
			
				|  |  |             resultMap.put("code",rootObject.getString("code"));
 | 
	
		
			
				|  |  |             resultMap.put("msg",rootObject.getString("msg"));
 | 
	
		
			
				|  |  |             JSONObject dataObj = JSONObject.parseObject(rootObject.getString("data"));
 | 
	
		
			
				|  |  |             if (null!=dataObj){
 | 
	
		
			
				|  |  |                 JSONObject presDetailobj = JSONObject.parseObject(dataObj.getString("PresDetail"));
 | 
	
		
			
				|  |  |                 resultMap.put("msg",presDetailobj.getString("PresNo"));
 | 
	
		
			
				|  |  |                 logger.info("his医嘱号:"+presDetailobj.getString("PresNo"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else if(null!=rootObject&&!"0".equalsIgnoreCase(rootObject.getString("code"))){
 | 
	
		
			
				|  |  |             resultMap.put("success",rootObject.getString("success"));
 | 
	
		
			
				|  |  |             resultMap.put("code",rootObject.getString("code"));
 | 
	
		
			
				|  |  |             resultMap.put("msg",rootObject.getString("msg"));
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             resultMap.put("success","obj转化失败");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }else {
 | 
	
		
			
				|  |  |         resultMap.put("success","调用entrance接口返回失败");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     return resultMap;
 | 
	
		
			
				|  |  | }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 保存处方到entrance
 | 
	
		
			
				|  |  |      * @param ioFlag 门诊住院标志
 | 
	
		
			
				|  |  |      * @param payCardNo 就诊卡号
 | 
	
		
			
				|  |  |      * @param nullahNumber 挂号流水号
 | 
	
		
			
				|  |  |      * @param applyDept 执行科室
 | 
	
		
			
				|  |  |      * @param applyDoctor 开单医生
 | 
	
		
			
				|  |  |      * @param executeDept 执行科室(药房)
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject savePrescriptionToEntrance(String ioFlag,String payCardNo,String nullahNumber,String applyDept,String applyDoctor,String executeDept,List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         String response = "";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"savePrescriptionToHospital";
 | 
	
		
			
				|  |  |         ObjectMapper mapper = new ObjectMapper();
 | 
	
		
			
				|  |  |         JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |         for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
 | 
	
		
			
				|  |  |             array.add(wlyyPrescriptionInfoDO);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         Map<String,String> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("IoFlag",ioFlag);
 | 
	
		
			
				|  |  |         params.put("PayCardNo",payCardNo);
 | 
	
		
			
				|  |  |         params.put("NullahNumber",nullahNumber);
 | 
	
		
			
				|  |  |         params.put("ApplyDept",applyDept);
 | 
	
		
			
				|  |  |         params.put("ApplyDoctor",applyDoctor);
 | 
	
		
			
				|  |  |         params.put("ExecuteDept",executeDept);
 | 
	
		
			
				|  |  |         params.put("prescriptionInfoDOS", array.toJSONString());
 | 
	
		
			
				|  |  |         logger.info("prescriptionInfoDOS"+params.get("prescriptionInfoDOS"));
 | 
	
		
			
				|  |  |         logger.info("params"+params.toString());
 | 
	
		
			
				|  |  |         response = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  |         logger.info("开方成功"+response);
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |              jsonObject = object.getJSONObject("obj");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonObject;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 保存诊断到entrance
 | 
	
		
			
				|  |  |      * @param applyNo 必填,流水号
 | 
	
		
			
				|  |  |      * @param diagnosisName 必填,诊断名称
 | 
	
		
			
				|  |  |      * @param diagnosisCode 诊断代码
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject saveDiagnosisToEntrance(String applyNo,String diagnosisName,String diagnosisCode) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         String response = "";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"saveDiagnosis";
 | 
	
		
			
				|  |  |         ObjectMapper mapper = new ObjectMapper();
 | 
	
		
			
				|  |  |         Map<String,String> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("ApplyNo",applyNo);
 | 
	
		
			
				|  |  |         params.put("DiagnosisName",diagnosisName);
 | 
	
		
			
				|  |  |         params.put("DiagnosisCode",diagnosisCode);
 | 
	
		
			
				|  |  |         logger.info("params"+params.toString());
 | 
	
		
			
				|  |  |         response = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  |         logger.info("诊断同步"+response);
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             jsonObject = object.getJSONObject("obj");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonObject;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 发送退号信息到entrance
 | 
	
		
			
				|  |  |      * @param applyNo 必填,流水号
 | 
	
		
			
				|  |  |      * @param payCardNo 必填,卡号
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject refundConsultationToEntrance(String applyNo,String payCardNo) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         String response = "";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"refundConsultation";
 | 
	
		
			
				|  |  |         ObjectMapper mapper = new ObjectMapper();
 | 
	
		
			
				|  |  |         Map<String,String> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("ApplyNo",applyNo);
 | 
	
		
			
				|  |  |         params.put("PayCardNo",payCardNo);
 | 
	
		
			
				|  |  |         logger.info("params"+params.toString());
 | 
	
		
			
				|  |  |         response = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  |         logger.info("诊断同步"+response);
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             jsonObject = object.getJSONObject("obj");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonObject;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 删除处方信息
 | 
	
		
			
				|  |  |      * @param realOrder his处方号
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject deletePrescriptionToEntrance(String realOrder) throws Exception {
 | 
	
		
			
				|  |  |         Map<String,String> params = new HashedMap();
 | 
	
		
			
				|  |  |         WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
 | 
	
		
			
				|  |  |         if (null!=wlyyPrescriptionDO){
 | 
	
		
			
				|  |  |             params.put("IoFlag","0");
 | 
	
		
			
				|  |  |             WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |             if (null!=wlyyOutpatientDO){
 | 
	
		
			
				|  |  |                 params.put("PayCardNo",wlyyOutpatientDO.getCardNo());
 | 
	
		
			
				|  |  |                 params.put("ApplyDept",wlyyOutpatientDO.getDept());
 | 
	
		
			
				|  |  |                 params.put("NullahNumber",wlyyOutpatientDO.getRegisterNo());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(wlyyPrescriptionDO.getDoctor());
 | 
	
		
			
				|  |  |             if (null!=doctorMappingDO){
 | 
	
		
			
				|  |  |                 params.put("ApplyDoctor",doctorMappingDO.getDoctorName()+"/"+doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             params.put("ExecuteDept","50100");
 | 
	
		
			
				|  |  |             params.put("PresNo",realOrder);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         String response = "";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"delHisPrescriptionByHisNo";
 | 
	
		
			
				|  |  |         logger.info("params"+params.toString());
 | 
	
		
			
				|  |  |         response = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  |         logger.info("删除处方信息"+response);
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             jsonObject = object.getJSONObject("obj");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonObject;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 保存电子病历
 | 
	
		
			
				|  |  |      * @param prescriptionId 处方id
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String  saveEmrToEntrance(String prescriptionId,String baseSign) throws Exception {
 | 
	
		
			
				|  |  |         Map<String,String> params = new HashedMap();
 | 
	
		
			
				|  |  |         WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
 | 
	
		
			
				|  |  |         JSONObject paramRequest = new JSONObject();
 | 
	
		
			
				|  |  |         if (null!=wlyyPrescriptionDO){
 | 
	
		
			
				|  |  |             paramRequest.put("patientName",wlyyPrescriptionDO.getPatientName());
 | 
	
		
			
				|  |  |             PatientMappingDO patientMappingDO =  patientMappingDao.findByPatient(wlyyPrescriptionDO.getPatientCode());
 | 
	
		
			
				|  |  |             BasePatientDO basePatientDO = basePatientDao.findById(wlyyPrescriptionDO.getPatientCode());
 | 
	
		
			
				|  |  |             DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(wlyyPrescriptionDO.getDoctor());
 | 
	
		
			
				|  |  |             WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |             if(null!=patientMappingDO){
 | 
	
		
			
				|  |  |                 paramRequest.put("patientid",patientMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //获取医生编号
 | 
	
		
			
				|  |  |             BaseDoctorDO doctorDO = doctorDao.findById(wlyyOutpatientDO.getDoctor());
 | 
	
		
			
				|  |  |             String operatorId = null;
 | 
	
		
			
				|  |  |             if (doctorDO!=null){
 | 
	
		
			
				|  |  |                 String url = entranceUrl+"selectDoctorInfo?idCard="+doctorDO.getIdcard();
 | 
	
		
			
				|  |  |                 String 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);
 | 
	
		
			
				|  |  |                     if (array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                         JSONObject jsonObject = array.getJSONObject(0);
 | 
	
		
			
				|  |  |                         operatorId = jsonObject.getString("staffNo");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if(null!=doctorMappingDO){
 | 
	
		
			
				|  |  |                 paramRequest.put("operatorid",operatorId);
 | 
	
		
			
				|  |  |                 paramRequest.put("operatorname",wlyyPrescriptionDO.getDoctorName());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             paramRequest.put("type","2");
 | 
	
		
			
				|  |  |             WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO =  prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
 | 
	
		
			
				|  |  |             if (null!=wlyyPrescriptionEmrDO){
 | 
	
		
			
				|  |  |                 paramRequest.put("id",wlyyPrescriptionEmrDO.getId());
 | 
	
		
			
				|  |  |                 params.put("emrInfo",JSON.toJSONString(wlyyPrescriptionEmrDO));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (null!=basePatientDO){
 | 
	
		
			
				|  |  |                 paramRequest.put("patientAge",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
 | 
	
		
			
				|  |  |                 paramRequest.put("patientsex",IdCardUtil.getSexForIdcard(basePatientDO.getIdcard()));
 | 
	
		
			
				|  |  |                 paramRequest.put("patientName",basePatientDO.getName());
 | 
	
		
			
				|  |  |                 paramRequest.put("patientClan","0"); }
 | 
	
		
			
				|  |  |             if (null!=wlyyOutpatientDO){
 | 
	
		
			
				|  |  |                 paramRequest.put("deptCode",wlyyOutpatientDO.getDeptName());
 | 
	
		
			
				|  |  |                 paramRequest.put("outpatientCode","R"+wlyyOutpatientDO.getRegisterNo());
 | 
	
		
			
				|  |  |                 paramRequest.put("eventno","R"+wlyyOutpatientDO.getRegisterNo());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             paramRequest.put("templateid","1158");
 | 
	
		
			
				|  |  |             paramRequest.put("catalogid","50");
 | 
	
		
			
				|  |  |             paramRequest.put("emrtype","93");
 | 
	
		
			
				|  |  |             paramRequest.put("emrtitle","互联网医院");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(baseSign)){
 | 
	
		
			
				|  |  |                 //UploadVO uploadVO=fileUploadService.uploadImagesBase64(baseSign,fastdfs_file_url);
 | 
	
		
			
				|  |  |                 //paramRequest.put("baseSign","https://ih.xmheart.com/fastdfs/"+uploadVO.getFullUri());
 | 
	
		
			
				|  |  |                 paramRequest.put("baseSign",baseSign);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         params.put("jsonInfo",paramRequest.toJSONString());
 | 
	
		
			
				|  |  |         String response = "";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"returnEmrHtmlByHLW";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         logger.info("params"+params.toString());
 | 
	
		
			
				|  |  |         response = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  |         logger.info("保存电子病历"+response);
 | 
	
		
			
				|  |  |         if (response.contains("error")||response.contains("ERROR")){
 | 
	
		
			
				|  |  |             return "faild";
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             return "success";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取历史病历
 | 
	
		
			
				|  |  |      * @param patientId 病人id
 | 
	
		
			
				|  |  |      * @param eventNo 病人住院号
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<WlyyPrescriptionEmrDO> selectHistoryEmr(String patientId,String eventNo) throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"selectEmrInfo?patientId="+patientId+"&eventNo="+eventNo;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionEmrDO> wlyyPrescriptionEmrDOList = new ArrayList<>();
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             String obj = object.getString("obj");
 | 
	
		
			
				|  |  |             if("[[]]".equalsIgnoreCase(obj)||"[]".equalsIgnoreCase(obj)||StringUtils.isBlank(obj)){
 | 
	
		
			
				|  |  |                 return null;
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 logger.info("obj:" + obj);
 | 
	
		
			
				|  |  |                 JSONArray array = JSONArray.parseArray(obj.replace("[]", "\"\"")).getJSONArray(0);
 | 
	
		
			
				|  |  |                 logger.info("arrayResponse:" + array.toJSONString());
 | 
	
		
			
				|  |  |                 for (int i = 0; i < array.size(); i++) {
 | 
	
		
			
				|  |  |                     JSONObject jsonObject = array.getJSONObject(i);
 | 
	
		
			
				|  |  |                     logger.info("jsonObject:" + jsonObject);
 | 
	
		
			
				|  |  |                     WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = new WlyyPrescriptionEmrDO();
 | 
	
		
			
				|  |  |                     wlyyPrescriptionEmrDO.setComplaint(null == jsonObject.get("CHIEF_COMPLAINT") ? "" : jsonObject.get("CHIEF_COMPLAINT").toString());
 | 
	
		
			
				|  |  |                     wlyyPrescriptionEmrDO.setMedicalHistory(null == jsonObject.get("PRESENT_ILLNESS") ? "" : jsonObject.get("PRESENT_ILLNESS").toString());
 | 
	
		
			
				|  |  |                     wlyyPrescriptionEmrDO.setPastHistory(null == jsonObject.get("PAST_HISTORY") ? "" : jsonObject.get("PAST_HISTORY").toString());
 | 
	
		
			
				|  |  |                     wlyyPrescriptionEmrDO.setPhysicalExamination(null == jsonObject.get("PHYSICAL_EXAMINATION") ? "" : jsonObject.get("PHYSICAL_EXAMINATION").toString());
 | 
	
		
			
				|  |  |                     wlyyPrescriptionEmrDO.setAssistExamination(null == jsonObject.get("OBSERVE_RESULT") ? "" : jsonObject.get("OBSERVE_RESULT").toString());
 | 
	
		
			
				|  |  |                     wlyyPrescriptionEmrDO.setAllergicHistory(null == jsonObject.get("ALLERGY_HISTORY") ? "" : jsonObject.get("ALLERGY_HISTORY").toString());
 | 
	
		
			
				|  |  |                     wlyyPrescriptionEmrDO.setPopularHistory(null == jsonObject.get("EPIDEMIOLOGICAL") ? "" : jsonObject.get("EPIDEMIOLOGICAL").toString());
 | 
	
		
			
				|  |  |                     wlyyPrescriptionEmrDO.setSpecialHistory(null == jsonObject.get("SPECIAL_HISTORY") ? "" : jsonObject.get("SPECIAL_HISTORY").toString());
 | 
	
		
			
				|  |  |                     wlyyPrescriptionEmrDOList.add(wlyyPrescriptionEmrDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return wlyyPrescriptionEmrDOList;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询历次就诊门诊病历文书
 | 
	
		
			
				|  |  |      * @param templateId
 | 
	
		
			
				|  |  |      * @param patientId 病人id
 | 
	
		
			
				|  |  |      * @param eventNo 病人住院号
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String selectHistoryEmrRecord(String templateId,String patientId,String eventNo) throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"selectEmrDispRecord?templateId="+templateId+"&patientId="+patientId+"&eventNo="+eventNo;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             String obj = object.getString("obj");
 | 
	
		
			
				|  |  |             return obj;
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             return "获取失败";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONArray selectHistoryEmrFromEntrance(String patientId,String eventNo) throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |         PatientMappingDO mappingDO = patientMappingDao.findByPatient(patientId);
 | 
	
		
			
				|  |  |         String patient = null;
 | 
	
		
			
				|  |  |         if (mappingDO!=null){
 | 
	
		
			
				|  |  |             patient = mappingDO.getMappingCode();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String url = entranceUrl+"selectEmrInfo?patientId="+patient+"&eventNo="+eventNo;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionEmrDO> wlyyPrescriptionEmrDOList = new ArrayList<>();
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             String obj = object.getString("obj");
 | 
	
		
			
				|  |  |             if("[[]]".equalsIgnoreCase(obj)||"[]".equalsIgnoreCase(obj)||StringUtils.isBlank(obj)){
 | 
	
		
			
				|  |  |                 return null;
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |             logger.info("obj:"+obj);
 | 
	
		
			
				|  |  |             JSONArray array = JSONArray.parseArray(obj.replace("[]","\"\"")).getJSONArray(0);
 | 
	
		
			
				|  |  |             logger.info("arrayResponse:"+array.toJSONString());
 | 
	
		
			
				|  |  |             for (int j=0;j<array.size();j++){
 | 
	
		
			
				|  |  |                 JSONObject object1 = array.getJSONObject(j);
 | 
	
		
			
				|  |  |                 JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |                 jsonObject.put("DEPT_NAME",object1.getString("DEPT_NAME"));
 | 
	
		
			
				|  |  |                 jsonObject.put("TREAT_DATE_TIME",DateUtil.getYyyymmddhhmmss(DateUtil.strToDateLong(object1.getString("VISIT_TIME"))));
 | 
	
		
			
				|  |  |                 jsonObject.put("OPID",object1.getString("EMR_ID"));
 | 
	
		
			
				|  |  |                 String firstFlag = object1.getString("FIRST_FLAG");
 | 
	
		
			
				|  |  |                 if (firstFlag.equalsIgnoreCase("复诊")){
 | 
	
		
			
				|  |  |                     jsonObject.put("TREAT_DOCTOR_NAME",object1.getString("RETURN_DOC_SIGN"));
 | 
	
		
			
				|  |  |                 }else if (firstFlag.equalsIgnoreCase("初诊")){
 | 
	
		
			
				|  |  |                     jsonObject.put("TREAT_DOCTOR_NAME",object1.getString("DOCTOR_SIGNATURE"));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 jsonArray.add(jsonObject);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return jsonArray;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             return null;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询病历文书html信息
 | 
	
		
			
				|  |  |      * @param bstrEmrID
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String selectBrowseSingleEMR(String bstrEmrID) throws Exception {
 | 
	
		
			
				|  |  |         String response="";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"browseSingleEMR?bstrEmrID="+bstrEmrID;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |             String obj = object.getString("obj");
 | 
	
		
			
				|  |  |             return obj;
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             return "获取失败";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //=====================hospital应用调用entrance应用============end=================
 | 
	
	
		
			
				|  | @ -3683,31 +2753,6 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询单条门诊记录
 | 
	
		
			
				|  |  |      * @param patient
 | 
	
		
			
				|  |  |      * @param conNo
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public WlyyOutpatientVO findOutpatientData(String patient, String conNo)throws Exception{
 | 
	
		
			
				|  |  |         logger.info("findOutpatientList patient:"+patient);
 | 
	
		
			
				|  |  |         String patNo =findHisPatNoByPatient(patient);
 | 
	
		
			
				|  |  |         if(StringUtils.isBlank(patNo)){
 | 
	
		
			
				|  |  |             return null;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         logger.info("findOutpatientList patNo:"+patNo);
 | 
	
		
			
				|  |  |         WlyyOutpatientVO outpatientVO=selectOutpatientInfo(patNo,conNo);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(outpatientVO!=null){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             BasePatientDO patientDO = patientDao.findById(patient);
 | 
	
		
			
				|  |  |             outpatientVO.setSex(patientDO.getSex()+"");
 | 
	
		
			
				|  |  |             outpatientVO.setBirthday(patientDO.getBirthday());
 | 
	
		
			
				|  |  |             return outpatientVO;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return outpatientVO;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String isEmty(String str){
 | 
	
		
			
				|  |  |         if (str.equalsIgnoreCase("[]")){
 | 
	
		
			
				|  |  |             return null;
 | 
	
	
		
			
				|  | @ -3740,133 +2785,7 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
 | 
	
		
			
				|  |  |         return patientId;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /*
 | 
	
		
			
				|  |  |      * @param registerSn 流水号
 | 
	
		
			
				|  |  |      * @param patient 居民code
 | 
	
		
			
				|  |  |      * @param admNo 住院唯一号
 | 
	
		
			
				|  |  |      * @param realOrder 处方号
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<WlyyPrescriptionVO> findPrescriptionList(String outPatientId,String realOrder) throws Exception {
 | 
	
		
			
				|  |  |         WlyyOutpatientDO outpatientDO = outpatientDao.findById(outPatientId);
 | 
	
		
			
				|  |  |         if (outpatientDO==null){
 | 
	
		
			
				|  |  |             throw new Exception("该门诊记录不存在!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String registerSn = outpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |         if (!StringUtils.isNoneBlank(registerSn)){
 | 
	
		
			
				|  |  |             throw new Exception("挂号流水号不存在");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String admNo = outpatientDO.getAdmNo();
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
 | 
	
		
			
				|  |  |         if (patientMappingDO==null||!StringUtils.isNoneBlank(patientMappingDO.getMappingCode())){
 | 
	
		
			
				|  |  |             throw new Exception("该居民映射表不存在!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionVO> wlyyPrescriptionVOList = selectOriginPrescriptionList(registerSn,patientMappingDO.getMappingCode(),admNo,realOrder);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return wlyyPrescriptionVOList;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<WlyyPrescriptionVO> selectPrescriptionList(String registerSn,String patNo,String admNo,String realOrder,String startTime,String endTime) throws Exception {
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patNo);
 | 
	
		
			
				|  |  |         if (patientMappingDO==null||!StringUtils.isNoneBlank(patientMappingDO.getMappingCode())){
 | 
	
		
			
				|  |  |             throw new Exception("该居民映射表不存在!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionVO> wlyyPrescriptionVOList = selectOriginPrescriptionList(registerSn,patientMappingDO.getMappingCode(),admNo,realOrder);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return wlyyPrescriptionVOList;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> updatePreStatus(String admNo,String realOrder,String status) throws Exception {
 | 
	
		
			
				|  |  |         Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |         if (status.equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByAdmNo(admNo);
 | 
	
		
			
				|  |  |             if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
 | 
	
		
			
				|  |  |                 throw new Exception("该就诊号查不到!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
 | 
	
		
			
				|  |  |                 String registerNo = wlyyOutpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |                 if (!StringUtils.isNoneBlank(registerNo)){
 | 
	
		
			
				|  |  |                     throw new Exception("挂号流水号为空!");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(wlyyOutpatientDO.getPatient());
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutpatientId(wlyyOutpatientDO.getId());
 | 
	
		
			
				|  |  |                 if (prescriptionDOList==null||prescriptionDOList.size()==0){
 | 
	
		
			
				|  |  |                     List<WlyyPrescriptionVO> prescriptionVOList = selectOriginPrescriptionList(registerNo,patientMappingDO.getMappingCode(),admNo,realOrder);
 | 
	
		
			
				|  |  |                     for (WlyyPrescriptionVO prescriptionVO:prescriptionVOList){
 | 
	
		
			
				|  |  |                         WlyyPrescriptionDO prescriptionDO =JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(prescriptionVO)),WlyyPrescriptionDO.class);
 | 
	
		
			
				|  |  |                         prescriptionDO.setOutpatientId(wlyyOutpatientDO.getId());
 | 
	
		
			
				|  |  |                         if (status.equalsIgnoreCase("3")){
 | 
	
		
			
				|  |  |                             prescriptionDO.setStatus(30);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         prescriptionDO= prescriptionDao.save(prescriptionDO);
 | 
	
		
			
				|  |  |                         //处方诊断表vo
 | 
	
		
			
				|  |  |                         List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = prescriptionVO.getDiagnosisVOs();
 | 
	
		
			
				|  |  |                         for (WlyyPrescriptionDiagnosisVO diagnosisVO:diagnosisVOS){
 | 
	
		
			
				|  |  |                             WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(diagnosisVO)),WlyyPrescriptionDiagnosisDO.class);
 | 
	
		
			
				|  |  |                             prescriptionDiagnosisDO.setPrescriptionId(prescriptionDO.getId());
 | 
	
		
			
				|  |  |                             diagnosisDao.save(prescriptionDiagnosisDO);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         //药品表
 | 
	
		
			
				|  |  |                         List<WlyyPrescriptionInfoVO> infoVOList = prescriptionVO.getInfoVOs();
 | 
	
		
			
				|  |  |                         for (WlyyPrescriptionInfoVO infoVO:infoVOList){
 | 
	
		
			
				|  |  |                             WlyyPrescriptionInfoDO infoDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(infoVO)),WlyyPrescriptionInfoDO.class);
 | 
	
		
			
				|  |  |                             infoDO.setPrescriptionId(prescriptionDO.getId());
 | 
	
		
			
				|  |  |                             prescriptionInfoDao.save(infoDO);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         List<WlyyInspectionVO> inspectionVOList = prescriptionVO.getInspectionVOs();
 | 
	
		
			
				|  |  |                         for (WlyyInspectionVO inspectionVO:inspectionVOList){
 | 
	
		
			
				|  |  |                             WlyyInspectionDO inspectionDO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(inspectionVO)),WlyyInspectionDO.class);
 | 
	
		
			
				|  |  |                             BeanUtils.copyProperties(inspectionVO,inspectionDO);
 | 
	
		
			
				|  |  |                             inspectionDO.setPrescriptionId(prescriptionDO.getId());
 | 
	
		
			
				|  |  |                             wlyyInspectionDao.save(inspectionDO);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else if (status.equalsIgnoreCase("2")){
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionDO> prescriptionDOList =  prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
 | 
	
		
			
				|  |  |             for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setStatus(-1);
 | 
	
		
			
				|  |  |                 prescriptionDao.save(wlyyPrescriptionDO);
 | 
	
		
			
				|  |  |                 //检查
 | 
	
		
			
				|  |  |                 List<WlyyInspectionDO> wlyyInspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |                 for (WlyyInspectionDO inspectionDO:wlyyInspectionDOS){
 | 
	
		
			
				|  |  |                     inspectionDO.setDel(0);
 | 
	
		
			
				|  |  |                     wlyyInspectionDao.save(inspectionDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //药品
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionInfoDO> prescriptionInfoDOS=prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |                 for (WlyyPrescriptionInfoDO prescriptionInfoDO:prescriptionInfoDOS){
 | 
	
		
			
				|  |  |                     prescriptionInfoDO.setDel(0);
 | 
	
		
			
				|  |  |                     prescriptionInfoDao.save(prescriptionInfoDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //诊断
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |                 for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOS){
 | 
	
		
			
				|  |  |                     diagnosisDO.setDel(0);
 | 
	
		
			
				|  |  |                     prescriptionDiagnosisDao.save(diagnosisDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else if (status.equalsIgnoreCase("3")){
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionDO> prescriptionDOList =  prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
 | 
	
		
			
				|  |  |             for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setStatus(30);
 | 
	
		
			
				|  |  |                 prescriptionDao.save(wlyyPrescriptionDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else if (status.equalsIgnoreCase("4")){
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionDO> prescriptionDOList =  prescriptionDao.findByAdmNoAndRealOrderList(admNo,realOrder);
 | 
	
		
			
				|  |  |             for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setStatus(100);
 | 
	
		
			
				|  |  |                 prescriptionDao.save(wlyyPrescriptionDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     //组装审药参数并发送到entrance
 | 
	
		
			
				|  |  |     public String checkInputInfo(String hisId,String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,List<WlyyPrescriptionInfoDO> infos) throws Exception{
 | 
	
		
			
				|  |  |         JSONObject jsonObject = initEntranceParam(payType,doctor,patient,diagnosisDOS);
 | 
	
	
		
			
				|  | @ -4150,6 +3069,8 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
 | 
	
		
			
				|  |  |         return jsonObject1;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //===========================entrance访问hospital============end=======================
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |