|  | @ -1140,18 +1140,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String, Object> checkOutpatient(String patient,String wxId,boolean flag,String outpatientType) throws Exception {
 | 
	
		
			
				|  |  |         //-1卡余额不足,,-2 存在未结束的诊断热 1成功
 | 
	
		
			
				|  |  |         Map<String, Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         //1.余额判断改到前端判断
 | 
	
		
			
				|  |  |         //net.sf.json.JSONObject json = entranceService.qutpatientBalance(cardNo,demoFlag);
 | 
	
		
			
				|  |  |             WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("consultAccount");
 | 
	
		
			
				|  |  |         String accountControl = "0";
 | 
	
		
			
				|  |  |         if (null!=wlyyHospitalSysDictDO){
 | 
	
		
			
				|  |  |             accountControl = wlyyHospitalSysDictDO.getDictValue();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //1.判断
 | 
	
		
			
				|  |  |         //net.sf.json.JS余额判断改到前端ONObject json = entranceService.qutpatientBalance(cardNo,demoFlag);
 | 
	
		
			
				|  |  |         if (flag){
 | 
	
		
			
				|  |  |             if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
 | 
	
		
			
				|  |  |                 List<WlyyOutpatientDO> outpatientDOS = outpatientDao.findByPatientListByStatus(patient,outpatientType);
 | 
	
		
			
				|  |  |                 List<WlyyOutpatientDO> outpatientDOS = new ArrayList<>();
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotBlank(outpatientType)){
 | 
	
		
			
				|  |  |                     outpatientDOS = outpatientDao.findByPatientListByStatusAndType(patient,outpatientType);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     outpatientDOS = outpatientDao.findByPatientListByStatus(patient);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (outpatientDOS!=null&&outpatientDOS.size()!=0){
 | 
	
		
			
				|  |  |                     WlyyOutpatientDO outpatientDO = outpatientDOS.get(0);
 | 
	
		
			
				|  |  |                     if (outpatientDO.getHisStatus()!=null){
 | 
	
		
			
				|  |  |                     if (outpatientDO.getHisStatus()!=null&&"0".equalsIgnoreCase(accountControl)){
 | 
	
		
			
				|  |  |                         logger.info("您上一次就诊进入"+outpatientDO.getHisStatus());
 | 
	
		
			
				|  |  |                         if(outpatientDO.getHisStatus()!=1&&outpatientDO.getHisStatus()!=-1){
 | 
	
		
			
				|  |  |                             logger.info("您上一次就诊进入======"+outpatientDO.getHisStatus());
 | 
	
	
		
			
				|  | @ -1169,7 +1178,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                             return rs;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     }else if (outpatientDO.getHisStatus()==null){
 | 
	
		
			
				|  |  |                     }else if (outpatientDO.getHisStatus()==null&&"0".equalsIgnoreCase(accountControl)){
 | 
	
		
			
				|  |  |                         rs.put("outpatient", outpatientDO);
 | 
	
		
			
				|  |  |                         rs.put("code", -3);
 | 
	
		
			
				|  |  |                         rs.put("mes", "您上一次就诊未结算,请结算后才能发起复诊。");
 | 
	
	
		
			
				|  | @ -1187,16 +1196,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //2.判断是否有未结束的
 | 
	
		
			
				|  |  |         List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient);
 | 
	
		
			
				|  |  |         List<WlyyOutpatientDO> list = new ArrayList<>();
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(outpatientType)&&outpatientType.equalsIgnoreCase("3")){
 | 
	
		
			
				|  |  |             list = outpatientDao.findByPatientAndDoctorList(patient);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             list = outpatientDao.findByPatientList(patient);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |             rs.put("outpatient", list.get(0));
 | 
	
		
			
				|  |  |             rs.put("code", -2);
 | 
	
		
			
				|  |  |             rs.put("mes", "存在未结束的诊断");
 | 
	
		
			
				|  |  |             return rs;
 | 
	
		
			
				|  |  |             if(!list.get(0).getOutpatientType().equalsIgnoreCase("3")){
 | 
	
		
			
				|  |  |                 rs.put("outpatient", list.get(0));
 | 
	
		
			
				|  |  |                 rs.put("code", -2);
 | 
	
		
			
				|  |  |                 rs.put("mes", "存在未结束的诊断");
 | 
	
		
			
				|  |  |                 return rs;
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 rs.put("outpatient", list.get(0));
 | 
	
		
			
				|  |  |                 rs.put("code", -2);
 | 
	
		
			
				|  |  |                 rs.put("mes", "存在未结束的咨询");
 | 
	
		
			
				|  |  |                 return rs;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         rs.put("code", 1);
 | 
	
		
			
				|  |  |         rs.put("mes", "验证通过");
 | 
	
	
		
			
				|  | @ -4520,7 +4539,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_type=2 ";
 | 
	
		
			
				|  |  |         } else if (4==type){
 | 
	
		
			
				|  |  |             //专家咨询
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_type=2 AND room.consult_type in (1,2,3)";
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_type=3 AND room.consult_type in (1,2,3)";
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             //在线复诊
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_type=1 AND room.consult_type=" + type;
 | 
	
	
		
			
				|  | @ -4569,8 +4588,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                        if (StringUtils.isNotBlank(basePatientDO.getIdcard())){
 | 
	
		
			
				|  |  |                            patientAge = DateUtil.getAgeForIdcard(basePatientDO.getIdcard());
 | 
	
		
			
				|  |  |                            outpatient.put("patientAge", DateUtil.getAgeForIdcard(basePatientDO.getIdcard()));
 | 
	
		
			
				|  |  |                            patientSex =basePatientDO.getSex();
 | 
	
		
			
				|  |  |                        }
 | 
	
		
			
				|  |  |                        patientSex =basePatientDO.getSex();
 | 
	
		
			
				|  |  |                    }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 outpatient.put("patientAge", patientAge);
 | 
	
	
		
			
				|  | @ -5975,7 +5994,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(outpatientType)){
 | 
	
		
			
				|  |  |             sql+=" AND outpatient.type= 2 and outpatient.outpatient_type ="+outpatientType;
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             sql+="AND room.consult_type= 2 ";
 | 
	
		
			
				|  |  |             sql+=" AND room.consult_type= 2 ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             if(flag){
 |