|  | @ -2330,8 +2330,7 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |         return array;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     //门诊开单操作
 | 
	
		
			
				|  |  |     public String outPatientOrder(String jsonDate,Boolean demoFlag,String doctor,String patient) throws Exception{
 | 
	
		
			
				|  |  |         List<YkEmrJcsqDO> surveys = EntityUtils.jsonToList(jsonDate, YkEmrJcsqDO.class);
 | 
	
		
			
				|  |  |     public String outPatientOrder(List<YkEmrJcsqDO> surveys,Boolean demoFlag,String doctor,String patient) throws Exception{
 | 
	
		
			
				|  |  |         DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO =new PatientMappingDO();
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(doctor)){
 | 
	
	
		
			
				|  | @ -2349,6 +2348,7 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |         Integer brnl =0;
 | 
	
		
			
				|  |  |         String doctorHis="";
 | 
	
		
			
				|  |  |         Integer kdks = 0;
 | 
	
		
			
				|  |  |         Integer brid=0;
 | 
	
		
			
				|  |  |         JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
 | 
	
		
			
				|  |  |         if(jsonArray!=null&&jsonArray.size()>0){
 | 
	
		
			
				|  |  |             //获取居民信息
 | 
	
	
		
			
				|  | @ -2357,6 +2357,7 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |             brxm = json.getString("brxm");
 | 
	
		
			
				|  |  |             csny = json.getDate("csny");
 | 
	
		
			
				|  |  |             brnl = this.getBrnl(csny);
 | 
	
		
			
				|  |  |             brid=json.getInteger("brid");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //操作医生信息
 | 
	
		
			
				|  |  |         JSONArray jsonArray1 = findHisDoctor(doctorMappingDO.getIdcard());
 | 
	
	
		
			
				|  | @ -2370,7 +2371,7 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (surveys!=null){
 | 
	
		
			
				|  |  |             for (YkEmrJcsqDO ykEmrJcsqDO:surveys){
 | 
	
		
			
				|  |  |                 if (demoFlag){
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setBrid(brid);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setJjbz(0);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setJczt(1);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setZfbz(0);
 | 
	
	
		
			
				|  | @ -2381,16 +2382,6 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setKdys(doctorHis);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setBrks(114);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setTjys(doctorHis);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setJjbz(0);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setJczt(1);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setZfbz(0);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setQxbz(0);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setBrxb(1);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setBrxm("测试病人");
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setBrnl(18);
 | 
	
		
			
				|  |  |                     ykEmrJcsqDO.setKdys("测试医生");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             String jsonString = JSONObject.toJSONString(surveys);
 | 
	
		
			
				|  |  |             Map<String,Object> params = new HashedMap();
 | 
	
	
		
			
				|  | @ -2402,16 +2393,19 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |             logger.info("response:"+content);
 | 
	
		
			
				|  |  |             JSONObject rs = JSON.parseObject(content);
 | 
	
		
			
				|  |  |             Integer status = rs.getInteger("status");
 | 
	
		
			
				|  |  |             if (status!=null&&status == 200){
 | 
	
		
			
				|  |  |                 return rs.toString();
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 return "failed";
 | 
	
		
			
				|  |  |             JSONArray array= new JSONArray();
 | 
	
		
			
				|  |  |             if (status==200){
 | 
	
		
			
				|  |  |                 array = rs.getJSONArray("detailModelList");
 | 
	
		
			
				|  |  |                 if(array.size()>0){
 | 
	
		
			
				|  |  |                     return "success";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     return "failed";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return "faild";
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             return "failed";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |    //查询检查单
 | 
	
		
			
				|  |  |    public JSONArray findOrder()throws Exception{
 | 
	
	
		
			
				|  | @ -2434,6 +2428,7 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        return array;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    //根据病人出生年月计算病人年龄
 | 
	
		
			
				|  |  |    public Integer getBrnl(Date date){
 | 
	
		
			
				|  |  |        Calendar cal = Calendar.getInstance();
 | 
	
		
			
				|  |  |        if (cal.before(date)) {
 | 
	
	
		
			
				|  | @ -2462,4 +2457,84 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |        return age;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String outPatientOrderYk(String jsonDate,Boolean demoFlag,String doctor,String patient) throws Exception{
 | 
	
		
			
				|  |  |         List<YkEmrJcsqDO> surveys = EntityUtils.jsonToList(jsonDate,YkEmrJcsqDO.class);
 | 
	
		
			
				|  |  |         DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO =new PatientMappingDO();
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(doctor)){
 | 
	
		
			
				|  |  |             doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(StringUtils.isNotEmpty(patient)){
 | 
	
		
			
				|  |  |             patientMappingDO = patientMappingDao.findByPatient(patient);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = basePatientDao.findById(patient);
 | 
	
		
			
				|  |  |         PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
 | 
	
		
			
				|  |  |         Integer brxb = 0;
 | 
	
		
			
				|  |  |         String brxm = "";
 | 
	
		
			
				|  |  |         Date csny =null;
 | 
	
		
			
				|  |  |         Integer brnl =0;
 | 
	
		
			
				|  |  |         String doctorHis="";
 | 
	
		
			
				|  |  |         Integer kdks = 0;
 | 
	
		
			
				|  |  |         Integer brid=0;
 | 
	
		
			
				|  |  |         JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
 | 
	
		
			
				|  |  |         if(jsonArray!=null&&jsonArray.size()>0){
 | 
	
		
			
				|  |  |             //获取居民信息
 | 
	
		
			
				|  |  |             JSONObject json = jsonArray.getJSONObject(0);
 | 
	
		
			
				|  |  |             brxb = json.getInteger("brxb");
 | 
	
		
			
				|  |  |             brxm = json.getString("brxm");
 | 
	
		
			
				|  |  |             csny = json.getDate("csny");
 | 
	
		
			
				|  |  |             brnl = this.getBrnl(csny);
 | 
	
		
			
				|  |  |             brid=json.getInteger("brid");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //操作医生信息
 | 
	
		
			
				|  |  |         JSONArray jsonArray1 = findHisDoctor(doctorMappingDO.getIdcard());
 | 
	
		
			
				|  |  |         if(jsonArray1!=null&&jsonArray1.size()>0){
 | 
	
		
			
				|  |  |             JSONObject json = jsonArray1.getJSONObject(0);
 | 
	
		
			
				|  |  |             doctorHis=json.getString("code");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         // 同一个医生同一个病人,一天一条挂号记录。
 | 
	
		
			
				|  |  |         JSONArray ja = fingHlwGhmx(patientMappingDO.getMappingCode(),doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (surveys!=null){
 | 
	
		
			
				|  |  |             for (YkEmrJcsqDO ykEmrJcsqDO:surveys){
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setBrid(brid);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setJjbz(0);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setJczt(1);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setZfbz(0);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setQxbz(0);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setBrxb(brxb);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setBrxm(brxm);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setBrnl(brnl);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setKdys(doctorHis);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setBrks(114);
 | 
	
		
			
				|  |  |                 ykEmrJcsqDO.setTjys(doctorHis);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             String jsonString = JSONObject.toJSONString(surveys);
 | 
	
		
			
				|  |  |             Map<String,Object> params = new HashedMap();
 | 
	
		
			
				|  |  |             params.put("json",jsonString);
 | 
	
		
			
				|  |  |             params.put("table","ykEmrJcsqDO");
 | 
	
		
			
				|  |  |             logger.info("ykEmrJcsqDO:"+jsonString);
 | 
	
		
			
				|  |  |             HttpResponse response = HttpUtils.doGet(orderUrl,params);
 | 
	
		
			
				|  |  |             String content = response.getContent();
 | 
	
		
			
				|  |  |             logger.info("response:"+content);
 | 
	
		
			
				|  |  |             JSONObject rs = JSON.parseObject(content);
 | 
	
		
			
				|  |  |             Integer status = rs.getInteger("status");
 | 
	
		
			
				|  |  |             JSONArray array= new JSONArray();
 | 
	
		
			
				|  |  |             if (status==200){
 | 
	
		
			
				|  |  |                 array = rs.getJSONArray("detailModelList");
 | 
	
		
			
				|  |  |                 if(array.size()>0){
 | 
	
		
			
				|  |  |                     return "success";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     return "failed";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return "faild";
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             return "failed";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |