|  | @ -131,12 +131,15 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public  List<WlyyOutpatientVO> findOutpatientList(String patient, String cardNo, String startTime, String endTime, boolean demoFlag, String ksdm)throws Exception{
 | 
	
		
			
				|  |  |     public  List<WlyyOutpatientVO> findOutpatientList(String patient, String cardNo, String startTime, String endTime, boolean demoFlag, String ksdm,String flag)throws Exception{
 | 
	
		
			
				|  |  |         logger.info("findOutpatientList patient:"+patient);
 | 
	
		
			
				|  |  |         String patNo ="";
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(cardNo)){
 | 
	
		
			
				|  |  |             BasePatientDO patientDO = basePatientDao.findByIdAndDel(patient,"1");
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(flag)&&flag.equalsIgnoreCase("his")){
 | 
	
		
			
				|  |  |             patNo = patient;
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(cardNo)){
 | 
	
		
			
				|  |  |                 BasePatientDO patientDO = basePatientDao.findByIdAndDel(patient,"1");
 | 
	
		
			
				|  |  |             /*JSONArray res = ykyyEntranceService.findPatientCodeByCardNo(cardNo,false);
 | 
	
		
			
				|  |  |             if(res !=null&&res.size()>0){
 | 
	
		
			
				|  |  |                 JSONObject object = (JSONObject) res.get(0);
 | 
	
	
		
			
				|  | @ -144,31 +147,33 @@ public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pr
 | 
	
		
			
				|  |  |                     patNo = object.get("brid").toString();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }*/
 | 
	
		
			
				|  |  |             JSONArray res = tnyyEntranceService.selectPatientMappingCode(patientDO.getIdcard());
 | 
	
		
			
				|  |  |             if (res!=null&&res.size()!=0){
 | 
	
		
			
				|  |  |                 JSONObject object = res.getJSONObject(0);
 | 
	
		
			
				|  |  |                 patNo = object.getString("BRID");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if(!StringUtils.isBlank(patNo)){
 | 
	
		
			
				|  |  |                 if (patientMappingDO!=null){
 | 
	
		
			
				|  |  |                     patientMappingDO.setMappingCode(patNo);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     patientMappingDO = new PatientMappingDO();
 | 
	
		
			
				|  |  |                     patientMappingDO.setMappingCode(patNo);
 | 
	
		
			
				|  |  |                     patientMappingDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                     patientMappingDO.setSource("1");
 | 
	
		
			
				|  |  |                     patientMappingDO.setPatient(patient);
 | 
	
		
			
				|  |  |                     patientMappingDO.setIdcard(patientDO.getIdcard());
 | 
	
		
			
				|  |  |                     patientMappingDO.setPatientName(patientDO.getName());
 | 
	
		
			
				|  |  |                 JSONArray res = tnyyEntranceService.selectPatientMappingCode(patientDO.getIdcard());
 | 
	
		
			
				|  |  |                 if (res!=null&&res.size()!=0){
 | 
	
		
			
				|  |  |                     JSONObject object = res.getJSONObject(0);
 | 
	
		
			
				|  |  |                     patNo = object.getString("BRID");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if(!StringUtils.isBlank(patNo)){
 | 
	
		
			
				|  |  |                     if (patientMappingDO!=null){
 | 
	
		
			
				|  |  |                         patientMappingDO.setMappingCode(patNo);
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         patientMappingDO = new PatientMappingDO();
 | 
	
		
			
				|  |  |                         patientMappingDO.setMappingCode(patNo);
 | 
	
		
			
				|  |  |                         patientMappingDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                         patientMappingDO.setSource("1");
 | 
	
		
			
				|  |  |                         patientMappingDO.setPatient(patient);
 | 
	
		
			
				|  |  |                         patientMappingDO.setIdcard(patientDO.getIdcard());
 | 
	
		
			
				|  |  |                         patientMappingDO.setPatientName(patientDO.getName());
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     patientMappingDao.save(patientMappingDO);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 patientMappingDao.save(patientMappingDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             if (patientMappingDO!=null){
 | 
	
		
			
				|  |  |                 patNo = patientMappingDO.getMappingCode();
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 if (patientMappingDO!=null){
 | 
	
		
			
				|  |  |                     patNo = patientMappingDO.getMappingCode();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(StringUtils.isBlank(patNo)){
 | 
	
		
			
				|  |  |             return null;
 | 
	
		
			
				|  |  |         }
 |