|  | @ -14,11 +14,16 @@ import com.yihu.jw.entity.base.score.BaseEvaluateDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.dao.ConsultDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.dao.ConsultTeamDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.dao.ConsultTeamDoctorDao;
 | 
	
	
		
			
				|  | @ -121,6 +126,9 @@ public class ImService {
 | 
	
		
			
				|  |  | 	@Value("${fastDFS.fastdfs_file_url}")
 | 
	
		
			
				|  |  | 	private String fastdfs_file_url;
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@Value("${demo.flag}")
 | 
	
		
			
				|  |  | 	private boolean demoFlag;
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  | 	
 | 
	
	
		
			
				|  | @ -130,6 +138,13 @@ public class ImService {
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private OutpatientDao outpatientDao;
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private EntranceService entranceService;
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private DoctorMappingService doctorMappingService;
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private WlyyHttpLogDao wlyyHttpLogDao;
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	/**
 | 
	
	
		
			
				|  | @ -877,13 +892,45 @@ public class ImService {
 | 
	
		
			
				|  |  | 	public JSONObject addPrescriptionConsult(String outpatientCode, String patient,String doctorCode, ConsultTeamDo ct, String reason, Integer type) throws Exception {
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		synchronized (outpatientCode.intern()) {
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			//1、获取his就诊记录详情(保存续方表、药品续方信息表、续方疾病类型表)
 | 
	
		
			
				|  |  | 			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outpatientCode);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			//2. 调用HIS挂号接口---START
 | 
	
		
			
				|  |  | 			DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(doctorCode,wlyyOutpatientDO.getHospital());
 | 
	
		
			
				|  |  | 			if(doctorMappingDO==null){
 | 
	
		
			
				|  |  | 				throw new RuntimeException("未找到医生映射信息");
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			net.sf.json.JSONObject rs = entranceService.BS10111(wlyyOutpatientDO.getCardNo(),doctorMappingDO.getMappingCode(),wlyyOutpatientDO.getDept(),null,wlyyOutpatientDO.getWinNo(),demoFlag);
 | 
	
		
			
				|  |  | 			String rsCode = (String)rs.get("@RESULT");
 | 
	
		
			
				|  |  | 			if("0".equals(rsCode)){
 | 
	
		
			
				|  |  | 				//存储挂号号
 | 
	
		
			
				|  |  | 				String serialNo = (String)rs.get("serial_no");
 | 
	
		
			
				|  |  | 				wlyyOutpatientDO.setRegisterNo(serialNo);
 | 
	
		
			
				|  |  | 				String conNo = (String)rs.get("@times");
 | 
	
		
			
				|  |  | 				wlyyOutpatientDO.setConNo(conNo);
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			//保存日志
 | 
	
		
			
				|  |  | 			WlyyHttpLogDO log = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  | 			log.setCode("registerOutPatient");
 | 
	
		
			
				|  |  | 			log.setName("挂号");
 | 
	
		
			
				|  |  | 			log.setPatient(wlyyOutpatientDO.getPatient());
 | 
	
		
			
				|  |  | 			log.setDoctor(doctorCode);
 | 
	
		
			
				|  |  | 			log.setResponse(rs.toString());
 | 
	
		
			
				|  |  | 			log.setRequest("outPatientId="+outpatientCode+"&doctor="+doctorCode);
 | 
	
		
			
				|  |  | 			log.setStatus(rsCode);
 | 
	
		
			
				|  |  | 			log.setCreateTime(new Date());
 | 
	
		
			
				|  |  | 			wlyyHttpLogDao.save(log);
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			// 调用HIS挂号接口---END
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			/**
 | 
	
		
			
				|  |  | 			 * toto 判断是否存在未审核的复诊
 | 
	
		
			
				|  |  | 			 */
 | 
	
		
			
				|  |  | //			String check = prescriptionInfoService.presCheckState(jwCode);
 | 
	
		
			
				|  |  | //			if ("0".equals(check)) {//存在未审核的续方
 | 
	
		
			
				|  |  | //				return -1;
 | 
	
		
			
				|  |  | //			}
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			BaseDoctorDO doctor = baseDoctorDao.findById(doctorCode);
 | 
	
	
		
			
				|  | @ -891,8 +938,7 @@ public class ImService {
 | 
	
		
			
				|  |  | 			// 查询患者信息
 | 
	
		
			
				|  |  | 			BasePatientDO p = basePatientDao.findById(patient);
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			//1、获取his就诊记录详情(保存续方表、药品续方信息表、续方疾病类型表)
 | 
	
		
			
				|  |  | 			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outpatientCode);
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			if(!"0".equals(wlyyOutpatientDO.getStatus())){
 | 
	
		
			
				|  |  | 				throw new RuntimeException("该就诊记录已被取消,无法接单!");
 | 
	
	
		
			
				|  | @ -920,14 +966,6 @@ public class ImService {
 | 
	
		
			
				|  |  | 			// 设置患者信息
 | 
	
		
			
				|  |  | 			ct.setPatient(patient);
 | 
	
		
			
				|  |  | 			ct.setSymptoms(wlyyOutpatientDO.getDescription());
 | 
	
		
			
				|  |  | //			if (1 == type) {
 | 
	
		
			
				|  |  | //				ct.setSymptoms("高血压");
 | 
	
		
			
				|  |  | //			} else if (2 == type) {
 | 
	
		
			
				|  |  | //				ct.setSymptoms("糖尿病");
 | 
	
		
			
				|  |  | //			} else if (3 == type) {
 | 
	
		
			
				|  |  | //				ct.setSymptoms("高血压,糖尿病");
 | 
	
		
			
				|  |  | //			} else {
 | 
	
		
			
				|  |  | //			}
 | 
	
		
			
				|  |  | 			
 | 
	
		
			
				|  |  | 			// 设置患者姓名
 | 
	
		
			
				|  |  | 			ct.setName(p.getName());
 |