|  | @ -3,6 +3,9 @@ package com.yihu.jw.internet.service.ykyy;
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSONArray;
 |  | import com.alibaba.fastjson.JSONArray;
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSONObject;
 |  | import com.alibaba.fastjson.JSONObject;
 | 
												
													
														
															|  | import com.fasterxml.jackson.databind.ObjectMapper;
 |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
 |  | import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
 | 
												
													
														
															|  | import com.yihu.jw.internet.dao.HospitalImgDao;
 |  | import com.yihu.jw.internet.dao.HospitalImgDao;
 | 
												
													
														
															|  | import com.yihu.jw.internet.dao.IntUpErrorLogDao;
 |  | import com.yihu.jw.internet.dao.IntUpErrorLogDao;
 | 
												
											
												
													
														
															|  | @ -13,6 +16,8 @@ import com.yihu.jw.internet.entity.InternetUpLogDO;
 | 
												
													
														
															|  | import com.yihu.jw.internet.service.InternetUpErrorLogService;
 |  | import com.yihu.jw.internet.service.InternetUpErrorLogService;
 | 
												
													
														
															|  | import com.yihu.jw.internet.wsapi.Wsapi;
 |  | import com.yihu.jw.internet.wsapi.Wsapi;
 | 
												
													
														
															|  | import com.yihu.jw.internet.wsapi.WsapiProxy;
 |  | import com.yihu.jw.internet.wsapi.WsapiProxy;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.rm.base.BaseRequestMapping;
 | 
												
													
														
															|  | import com.yihu.jw.util.common.IdCardUtil;
 |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
												
													
														
															|  | import com.yihu.jw.util.date.DateUtil;
 |  | import com.yihu.jw.util.date.DateUtil;
 | 
												
													
														
															|  | import com.yihu.jw.utils.ImgUtils;
 |  | import com.yihu.jw.utils.ImgUtils;
 | 
												
											
												
													
														
															|  | @ -24,6 +29,7 @@ import com.yihu.mysql.query.BaseJpaService;
 | 
												
													
														
															|  | import com.ylzinfo.ehc.common.utils.DateUtils;
 |  | import com.ylzinfo.ehc.common.utils.DateUtils;
 | 
												
													
														
															|  | import org.apache.commons.collections.map.HashedMap;
 |  | import org.apache.commons.collections.map.HashedMap;
 | 
												
													
														
															|  | import org.apache.commons.lang3.StringUtils;
 |  | import org.apache.commons.lang3.StringUtils;
 | 
												
													
														
															|  | 
 |  | import org.checkerframework.checker.units.qual.A;
 | 
												
													
														
															|  | import org.slf4j.LoggerFactory;
 |  | import org.slf4j.LoggerFactory;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Value;
 |  | import org.springframework.beans.factory.annotation.Value;
 | 
												
											
												
													
														
															|  | @ -58,6 +64,10 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
 | 
												
													
														
															|  |     private WlyyHospitalSysDictDao dictDao;
 |  |     private WlyyHospitalSysDictDao dictDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private HibenateUtils hibenateUtils;
 |  |     private HibenateUtils hibenateUtils;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private BaseDoctorDao doctorDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private BasePatientDao patientDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     static String userName = "xmykzx";
 |  |     static String userName = "xmykzx";
 | 
												
													
														
															|  |     static String psw = "7j39c7";
 |  |     static String psw = "7j39c7";
 | 
												
											
												
													
														
															|  | @ -774,9 +784,12 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
 | 
												
													
														
															|  |             Map<String,Object> info = list.get(i);
 |  |             Map<String,Object> info = list.get(i);
 | 
												
													
														
															|  |             String sqlMessage ="SELECT\n" +
 |  |             String sqlMessage ="SELECT\n" +
 | 
												
													
														
															|  |                     "\tM .SENDER_NAME AS \"sender_name\",\n" +
 |  |                     "\tM .SENDER_NAME AS \"sender_name\",\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tM .SENDER_ID AS \"sender_id\",\n" +
 | 
												
													
														
															|  |                     "\tM .\"TIMESTAMP\" AS \"timestamp\",\n" +
 |  |                     "\tM .\"TIMESTAMP\" AS \"timestamp\",\n" +
 | 
												
													
														
															|  |                     "\tM . \"CONTENT\" AS \"content\",\n" +
 |  |                     "\tM . \"CONTENT\" AS \"content\",\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tM . \"CONTENT_TYPE\" AS \"content_type\",\n" +
 | 
												
													
														
															|  |                     "\tT . \"ID\" AS \"id\"\n" +
 |  |                     "\tT . \"ID\" AS \"id\"\n" +
 | 
												
													
														
															|  | 
 |  |                     "\tM . \"SESSION_ID\" AS \"session_id\"\n" +
 | 
												
													
														
															|  |                     "FROM\n" +
 |  |                     "FROM\n" +
 | 
												
													
														
															|  |                     "\tTOPICS T \n" +
 |  |                     "\tTOPICS T \n" +
 | 
												
													
														
															|  |                     "JOIN MUC_MESSAGES M ON M .SESSION_ID = T .SESSION_ID\n" +
 |  |                     "JOIN MUC_MESSAGES M ON M .SESSION_ID = T .SESSION_ID\n" +
 | 
												
											
												
													
														
															|  | @ -790,10 +803,33 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
 | 
												
													
														
															|  |                     "AND t.id = '"+info.get("consult").toString()+"' ORDER BY m.`timestamp` ASC";*/
 |  |                     "AND t.id = '"+info.get("consult").toString()+"' ORDER BY m.`timestamp` ASC";*/
 | 
												
													
														
															|  |             List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sqlMessage);
 |  |             List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sqlMessage);
 | 
												
													
														
															|  |             String content="";
 |  |             String content="";
 | 
												
													
														
															|  | 
 |  |             JSONArray array = new JSONArray();
 | 
												
													
														
															|  |             for (Map<String,Object> map:list1){
 |  |             for (Map<String,Object> map:list1){
 | 
												
													
														
															|  |                 content +=map.get("sender_name").toString()+DateUtil.dateToStr(DateUtil.strToDate(map.get("timestamp").toString(),"yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss")+map.get("content").toString()+" \n";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 String sql1= "SELECT\n" +
 | 
												
													
														
															|  | 
 |  |                         "\ts.participant_id as \"participant_id\" \n" +
 | 
												
													
														
															|  | 
 |  |                         "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "\tPARTICIPANTS s \n" +
 | 
												
													
														
															|  | 
 |  |                         "WHERE\n" +
 | 
												
													
														
															|  | 
 |  |                         "\t s.SESSION_ID = '"+map.get("session_id").toString()+"' AND S.participant_id<> '"+map.get("sender_id").toString()+"'";
 | 
												
													
														
															|  | 
 |  |                 List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql1);
 | 
												
													
														
															|  | 
 |  |                 JSONObject object =new JSONObject();
 | 
												
													
														
															|  | 
 |  |                 if (list2!=null&&list2.size()!=0){
 | 
												
													
														
															|  | 
 |  |                     Map<String,Object> map1 = list2.get(0);
 | 
												
													
														
															|  | 
 |  |                     BaseDoctorDO doctorDO = doctorDao.findById(map1.get("participant_id").toString());
 | 
												
													
														
															|  | 
 |  |                     if (doctorDO!=null){
 | 
												
													
														
															|  | 
 |  |                         object.put("receiver",doctorDO.getName());
 | 
												
													
														
															|  | 
 |  |                     }else {
 | 
												
													
														
															|  | 
 |  |                         BasePatientDO patientDO = patientDao.findById(map1.get("participant_id").toString());
 | 
												
													
														
															|  | 
 |  |                         object.put("receiver",patientDO.getName());
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 object.put("sender",map.get("sender_name"));
 | 
												
													
														
															|  | 
 |  |                 object.put("msg",map.get("content"));
 | 
												
													
														
															|  | 
 |  |                 object.put("msg_type",map.get("content_type"));
 | 
												
													
														
															|  | 
 |  |                 object.put("send_time",DateUtil.dateToStr(DateUtil.strToDate(map.get("timestamp").toString(),"yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss"));
 | 
												
													
														
															|  | 
 |  |                 array.add(object);
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             info.put("content",content);
 |  | 
 | 
												
													
														
															|  | 
 |  |             info.put("content",array.toJSONString());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 |