|  | @ -1117,23 +1117,39 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public Map<String, Object> checkOutpatient(String patient,String wxId) throws Exception {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public Map<String, Object> checkOutpatient(String patient,String wxId,boolean flag) throws Exception {
 | 
												
													
														
															|  |         //-1卡余额不足,,-2 存在未结束的诊断热 1成功
 |  |         //-1卡余额不足,,-2 存在未结束的诊断热 1成功
 | 
												
													
														
															|  |         Map<String, Object> rs = new HashedMap();
 |  |         Map<String, Object> rs = new HashedMap();
 | 
												
													
														
															|  |         //1.余额判断改到前端判断
 |  |         //1.余额判断改到前端判断
 | 
												
													
														
															|  |         //net.sf.json.JSONObject json = entranceService.qutpatientBalance(cardNo,demoFlag);
 |  |         //net.sf.json.JSONObject json = entranceService.qutpatientBalance(cardNo,demoFlag);
 | 
												
													
														
															|  |         if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
 |  | 
 | 
												
													
														
															|  |             List<WlyyOutpatientDO> outpatientDOS = outpatientDao.findByPatientListByStatus(patient);
 |  | 
 | 
												
													
														
															|  |             if (outpatientDOS!=null&&outpatientDOS.size()!=0){
 |  | 
 | 
												
													
														
															|  |                 WlyyOutpatientDO outpatientDO = outpatientDOS.get(0);
 |  | 
 | 
												
													
														
															|  |                 if (outpatientDO.getHisStatus()!=null){
 |  | 
 | 
												
													
														
															|  |                     logger.info("您上一次就诊进入"+outpatientDO.getHisStatus());
 |  | 
 | 
												
													
														
															|  |                     if(outpatientDO.getHisStatus()!=1&&outpatientDO.getHisStatus()!=-1){
 |  | 
 | 
												
													
														
															|  |                         logger.info("您上一次就诊进入======"+outpatientDO.getHisStatus());
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (flag){
 | 
												
													
														
															|  | 
 |  |             if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
 | 
												
													
														
															|  | 
 |  |                 List<WlyyOutpatientDO> outpatientDOS = outpatientDao.findByPatientListByStatus(patient);
 | 
												
													
														
															|  | 
 |  |                 if (outpatientDOS!=null&&outpatientDOS.size()!=0){
 | 
												
													
														
															|  | 
 |  |                     WlyyOutpatientDO outpatientDO = outpatientDOS.get(0);
 | 
												
													
														
															|  | 
 |  |                     if (outpatientDO.getHisStatus()!=null){
 | 
												
													
														
															|  | 
 |  |                         logger.info("您上一次就诊进入"+outpatientDO.getHisStatus());
 | 
												
													
														
															|  | 
 |  |                         if(outpatientDO.getHisStatus()!=1&&outpatientDO.getHisStatus()!=-1){
 | 
												
													
														
															|  | 
 |  |                             logger.info("您上一次就诊进入======"+outpatientDO.getHisStatus());
 | 
												
													
														
															|  | 
 |  |                             rs.put("outpatient", outpatientDO);
 | 
												
													
														
															|  | 
 |  |                             rs.put("code", -3);
 | 
												
													
														
															|  | 
 |  |                             rs.put("mes", "您上一次就诊未结算,请结算后才能发起复诊。");
 | 
												
													
														
															|  | 
 |  |                             List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wxId, patient);
 | 
												
													
														
															|  | 
 |  |                             if (patientWechatDos == null || patientWechatDos.size() == 0) {
 | 
												
													
														
															|  | 
 |  |                                 throw new Exception("openid不存在!");
 | 
												
													
														
															|  | 
 |  |                             }
 | 
												
													
														
															|  | 
 |  |                             WxWechatDO wxWechatDO = wechatDao.findById(wxId);
 | 
												
													
														
															|  | 
 |  |                             BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
 | 
												
													
														
															|  | 
 |  |                             String payUrl = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(),patientWechatDo.getOpenid(),outpatientDO.getCardNo(),"WX");
 | 
												
													
														
															|  | 
 |  |                             rs.put("payUrl",payUrl);
 | 
												
													
														
															|  | 
 |  |                             return rs;
 | 
												
													
														
															|  | 
 |  |                         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |                     }else if (outpatientDO.getHisStatus()==null){
 | 
												
													
														
															|  |                         rs.put("outpatient", outpatientDO);
 |  |                         rs.put("outpatient", outpatientDO);
 | 
												
													
														
															|  |                         rs.put("code", -3);
 |  |                         rs.put("code", -3);
 | 
												
													
														
															|  |                         rs.put("mes", "您上一次就诊未结算,请结算后才能发起复诊。");
 |  |                         rs.put("mes", "您上一次就诊未结算,请结算后才能发起复诊。");
 | 
												
													
														
															|  |                         List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wxId, patient);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getConsumer());
 | 
												
													
														
															|  |                         if (patientWechatDos == null || patientWechatDos.size() == 0) {
 |  |                         if (patientWechatDos == null || patientWechatDos.size() == 0) {
 | 
												
													
														
															|  |                             throw new Exception("openid不存在!");
 |  |                             throw new Exception("openid不存在!");
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
											
												
													
														
															|  | @ -1143,26 +1159,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                         rs.put("payUrl",payUrl);
 |  |                         rs.put("payUrl",payUrl);
 | 
												
													
														
															|  |                         return rs;
 |  |                         return rs;
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 }else if (outpatientDO.getHisStatus()==null){
 |  | 
 | 
												
													
														
															|  |                     rs.put("outpatient", outpatientDO);
 |  | 
 | 
												
													
														
															|  |                     rs.put("code", -3);
 |  | 
 | 
												
													
														
															|  |                     rs.put("mes", "您上一次就诊未结算,请结算后才能发起复诊。");
 |  | 
 | 
												
													
														
															|  |                     List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getConsumer());
 |  | 
 | 
												
													
														
															|  |                     if (patientWechatDos == null || patientWechatDos.size() == 0) {
 |  | 
 | 
												
													
														
															|  |                         throw new Exception("openid不存在!");
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                     WxWechatDO wxWechatDO = wechatDao.findById(wxId);
 |  | 
 | 
												
													
														
															|  |                     BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
 |  | 
 | 
												
													
														
															|  |                     String payUrl = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(),patientWechatDo.getOpenid(),outpatientDO.getCardNo(),"WX");
 |  | 
 | 
												
													
														
															|  |                     rs.put("payUrl",payUrl);
 |  | 
 | 
												
													
														
															|  |                     return rs;
 |  | 
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //2.判断是否有未结束的
 |  |         //2.判断是否有未结束的
 | 
												
													
														
															|  |         List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient);
 |  |         List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient);
 | 
												
													
														
															|  |         if (list != null && list.size() > 0) {
 |  |         if (list != null && list.size() > 0) {
 |