| 
					
				 | 
			
			
				@ -171,7 +171,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取居民就诊记录接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endTime 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -179,36 +178,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:" + patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:"+patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(patNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo " + patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo "+patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS30025(patNo,null,startTime,endTime,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询单条门诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param conNo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientVO findOutpatientInfo(String patient, String conNo) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:" + patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientVO findOutpatientInfo(String patient,String conNo)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:"+patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(patNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo:" + patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo, conNo, null, null, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo:"+patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo,conNo,null,null,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyOutpatientVO outpatientVO = list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientVO.setSex(patientDO.getSex() + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientVO.setSex(patientDO.getSex()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientVO.setBirthday(patientDO.getBirthday()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return outpatientVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -218,19 +216,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn, String patient, String realOrder, String admNo, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String realOrder,String admNo,boolean demoFlag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(patNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOriginPrescriptionList: registerSn:" + registerSn + " patient" + patient + " patNo:" + patNo + " realOrder:" + realOrder + " admNo:" + admNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS16017(registerSn, realOrder, patNo, admNo, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" realOrder:"+realOrder+" admNo:"+admNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS16017(registerSn,realOrder,patNo,admNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取单条处方记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param registerSn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param admNo 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -239,13 +236,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyPrescriptionVO findOriginPrescription(String registerSn, String patient, String admNo, String realOrder, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyPrescriptionVO findOriginPrescription(String registerSn, String patient, String admNo, String realOrder, boolean demoFlag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(patNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> rs = entranceService.BS16017(registerSn, realOrder, patNo, admNo, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rs != null && rs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> rs = entranceService.BS16017(registerSn,realOrder,patNo,admNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null&&rs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return rs.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -253,14 +250,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取复诊记录列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findReOutpatientList(String patient, Integer status, String startTime, String endTime, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findReOutpatientList(String patient,Integer status,String startTime,String endTime,Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " COUNT(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -269,24 +265,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = ? AND o.outpatient_type != '2' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Object> totalParams = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        totalParams.add(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (status != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql +=  " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time >= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(startTime + " 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(startTime+" 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time <= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(endTime + " 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(endTime+" 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql, totalParams.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql,totalParams.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rstotal != null && rstotal.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = (Long) rstotal.get(0).get("total"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.adm_no AS admNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_adm_no AS originAdmNo, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -323,102 +319,101 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Object> params = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (status != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=  " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.create_time >= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(startTime + " 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(startTime+" 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.create_time <= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(endTime + " 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(endTime+" 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC LIMIT " + (page - 1) * size + "," + size + " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class), params.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class),params.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取单条复诊记录信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId, String prescriptionId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //复诊信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("outpatient", convertToModel(outpatientDO, WlyyOutpatientVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("outpatient",convertToModel(outpatientDO,WlyyOutpatientVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientName", basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("photo", basePatientDO.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientId", basePatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("idCard", basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientName",basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("photo",basePatientDO.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientId",basePatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("idCard",basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("sex", basePatientDO.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(), outpatientDO.getPatient(), "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("ssc", cardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("age", IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("address", basePatientDO.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mobile", basePatientDO.getMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("birthday", DateUtil.dateToStr(basePatientDO.getBirthday(), "yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),outpatientDO.getPatient(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("ssc",cardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("address",basePatientDO.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mobile",basePatientDO.getMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("birthday",DateUtil.dateToStr(basePatientDO.getBirthday(),"yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //获取处方信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDO> prescriptionDOs = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(prescriptionId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(prescriptionId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDOs = prescriptionDao.findById(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (prescriptionDOs != null && prescriptionDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            convertToModels(prescriptionDOs, prescriptionVOs, WlyyPrescriptionVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (WlyyPrescriptionVO vo : prescriptionVOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(prescriptionDOs!=null&&prescriptionDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            convertToModels(prescriptionDOs,prescriptionVOs,WlyyPrescriptionVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyPrescriptionVO vo:prescriptionVOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //疾病信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setDiagnosisVOs(findDiagnosisById(vo.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //药品信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()), infoVOs, WlyyPrescriptionInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()),infoVOs,WlyyPrescriptionInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //检查检验信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyInspectionVO> inspectionVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId()), inspectionVOs, WlyyInspectionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId()),inspectionVOs,WlyyInspectionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("prescriptions", prescriptionVOs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("prescriptions",prescriptionVOs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByOutpatientId(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (expressageDOs != null && expressageDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage", convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(expressageDOs!=null&&expressageDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage",convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //物流配送新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageLogDO>  expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (expressageLogDOs != null && expressageLogDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(expressageLogDOs!=null&&expressageLogDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs",convertToModels(expressageLogDOs,expressageLogVOs, WlyyPrescriptionExpressageLogVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //预约记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (timeDOs != null && timeDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("register", timeDOs.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("register", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(timeDOs!=null&&timeDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("register",timeDOs.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("register",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -427,7 +422,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询历史 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startTime 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -436,24 +430,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findPrescriptionList(String patient, String status, String startTime, String endTime, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findPrescriptionList(String patient, String status,String startTime, String endTime, Integer page, Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_prescription p "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        totalSql += " WHERE 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patient)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND p.patient_code ='" + patient + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND p.patient_code ='"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND p.status IN (" + status + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND p.status IN ("+status+")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time >='"+startTime+" 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time <='"+endTime+" 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -462,7 +456,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = (Long) rstotal.get(0).get("total"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.real_order AS realOrder," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.origin_real_order AS originRealOrder," + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -508,70 +502,70 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_prescription p " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patient)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND p.patient_code ='" + patient + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND p.patient_code ='"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND p.status IN (" + status + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND p.status IN ("+status+")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time >='"+startTime+" 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time <='"+endTime+" 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " LIMIT " + (page - 1) * size + "," + size + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyPrescriptionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置病种,药品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (WlyyPrescriptionVO vo : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyPrescriptionVO vo:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setDiagnosisVOs(findDiagnosisById(vo.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()), infoVOs, WlyyPrescriptionInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()),infoVOs,WlyyPrescriptionInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionDiagnosisVO> findDiagnosisById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionDiagnosisVO> findDiagnosisById(String id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisDO> list = prescriptionDiagnosisDao.findByPrescriptionId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return convertToModels(list, rs, WlyyPrescriptionDiagnosisVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return convertToModels(list,rs,WlyyPrescriptionDiagnosisVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> findPrescriptionInfo(String prescriptionId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> findPrescriptionInfo(String prescriptionId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //续方信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("prescription", convertToModel(wlyyPrescriptionDO, WlyyPrescriptionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("prescription",convertToModel(wlyyPrescriptionDO,WlyyPrescriptionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(wlyyPrescriptionDO.getPatientCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientName", basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientId", basePatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("idCard", basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientName",basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientId",basePatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("idCard",basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("sex", basePatientDO.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(), wlyyPrescriptionDO.getPatientCode(), "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("ssc", cardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("age", IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),wlyyPrescriptionDO.getPatientCode(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("ssc",cardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //诊断信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("diagnosis", findDiagnosisById(wlyyPrescriptionDO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("diagnosis",findDiagnosisById(wlyyPrescriptionDO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //药品信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("infos", prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("infos",prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean checkPrescription(String patient) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean checkPrescription(String patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDO> list = prescriptionDao.findByPatientCode(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -580,16 +574,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 发起图文和视频复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientJson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param expressageJson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientDO appointmentRevisit(String outpatientJson,String expressageJson,String registerJson,String chargeType)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.保存就诊实体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setMjz("mz"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -599,7 +592,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setOutpatientType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (outpatientDO.getRegisterDate() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(outpatientDO.getRegisterDate()==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setRegisterDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -609,25 +602,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //如果是视频预约咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(registerJson)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(registerJson)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO = objectMapper.readValue(registerJson,WlyyPatientRegisterTimeDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientRegisterTimeDao.save(registerTimeDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new RuntimeException("号源已经被预约,请选择其他号源"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson,WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionExpressageDao.save(expressageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //3.创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createRoom(outpatient, chargeType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createRoom(outpatient,chargeType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return outpatient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -635,11 +628,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean createRoom(WlyyOutpatientDO outpatientDO, String chargeType) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean createRoom(WlyyOutpatientDO outpatientDO,String chargeType){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -649,7 +641,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setHospitalName(outpatientDO.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //是否是有协同门诊医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -659,18 +651,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationTime(outpatientDO.getRegisterDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setVisitStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置复诊类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType()) ? Integer.parseInt(outpatientDO.getOutpatientType()) : 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType())?Integer.parseInt(outpatientDO.getOutpatientType()):1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setSort(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(outpatientDO.getDoctor())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientDO.getDoctor())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setDoctor(outpatientDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setDoctorName(outpatientDO.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setOutpatientId(outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setChargeType(chargeType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2654,6 +2646,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(doctorDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("doctor",doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("doctorSex",doctorDO.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNoneBlank(doctorDO.getIdcard())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("doctorAge",IdCardUtil.getAgeForIdcard(doctorDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("doctorAge",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("doctor",doctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("jobTitleCode",doctorDO.getJobTitleCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("jobTitleName",doctorDO.getJobTitleName()); 
			 |