Browse Source

IM类ORACLE 兼容修改

huangwenjie 5 years ago
parent
commit
3c6108caf9
1 changed files with 86 additions and 88 deletions
  1. 86 88
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

+ 86 - 88
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -245,7 +245,7 @@ public class ImService {
	public Long countConsultRecordByPatient(String patient, String id,String type, String title) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor d " +
@ -317,7 +317,7 @@ public class ImService {
	public JSONObject  getUnfinishedConsultByActualSender(String patient, String general_doctor) {
		JSONObject result = new JSONObject();
		
		String totalSql = "SELECT a.consult as consultCode,a.doctor as specialDoctor " +
		String totalSql = "SELECT a.consult as \"consultCode\",a.doctor as \"specialDoctor\"  " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"WHERE a.consult=b.consult " +
				"AND a.patient= '" +patient+"' "+
@ -1495,7 +1495,7 @@ public class ImService {
	 * @return
	 */
	public String getOutpatientidByConsoultCode(String consult) {
		String totalSql = "SELECT relation_code FROM wlyy_consult WHERE id='"+consult+"' ";
		String totalSql = "SELECT relation_code as \"relation_code\" FROM wlyy_consult WHERE id='"+consult+"' ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		String id = "";
		if (rstotal != null && rstotal.size() > 0) {
@ -1592,15 +1592,15 @@ public class ImService {
	public List<Map<String,Object>> getEvaluationByConsultCode(String consult) {
		//查询评价明细
		String sqlScoreList = "SELECT " +
				"a.score as score," +
				"a.score_type as score_type," +
				"a.content as content," +
				"b.create_time as create_time," +
				"c.type as type," +
				"c.name as patientname," +
				"b.id as id," +
				"c.photo as patientphoto," +
				"b.type as niming " +
				"a.score as \"score\"," +
				"a.score_type as \"score_type\"," +
				"a.content as \"content\"," +
				"b.create_time as \"create_time\"," +
				"c.type as \"type\"," +
				"c.name as \"patientname\"," +
				"b.id as \"id\"," +
				"c.photo as \"patientphoto\"," +
				"b.type as \"niming\" " +
				"FROM " +
				"base_evaluate a " +
				"LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
@ -1710,18 +1710,18 @@ public class ImService {
		//专家咨询
		if("1".equals(type) || "15".equals(type) || type.contains(",")){
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d " +
@ -1730,22 +1730,22 @@ public class ImService {
		}else{
			
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"op.id as outpatientid," +
					"op.type as consultType," +
					"op.general_doctor as generalDoctor," +
					"op.icd10_name as icd10Name," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"op.id as \"outpatientid\"," +
					"op.type as \"consultType\"," +
					"op.general_doctor as \"generalDoctor\"," +
					"op.icd10_name as \"icd10Name\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d, " +
@ -1812,7 +1812,7 @@ public class ImService {
	public Long countConsultRecordByDoctor(String doctor, String id,String type, Integer status,String title,String start_time,String end_time) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_patient d," +
@ -2101,20 +2101,20 @@ public class ImService {
		}
		
		String  sql = "SELECT " +
				"a.id AS id," +
				"a.type AS type," +
				"a.title AS title," +
				"a.symptoms AS symptoms," +
				"a.czrq AS czrq," +
				"b.status AS status," +
				"b.evaluate AS evaluate," +
				"d.name AS patientName," +
				"d.id as patientId," +
				"d.idcard as patientIdcard," +
				"d.sex as patientsex," +
				"d.photo AS patientphoto, " +
				"doctor.name AS doctorName, " +
				"doctor.job_title_name AS jobTitleName " +
				"a.id AS \"id\"," +
				"a.type AS \"type\"," +
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\"," +
				"a.czrq AS \"czrq\"," +
				"b.status AS \"status\"," +
				"b.evaluate AS \"evaluate\"," +
				"d.name AS \"patientName\"," +
				"d.id as \"patientId\"," +
				"d.idcard as \"patientIdcard\"," +
				"d.sex as \"patientsex\"," +
				"d.photo AS \"patientphoto\", " +
				"doctor.name AS \"doctorName\", " +
				"doctor.job_title_name AS \"jobTitleName\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor doctor," +
@ -2180,7 +2180,7 @@ public class ImService {
	public Long findexpertConsultRecordByDoctor(String doctor, String id,Integer type, Integer status,String title,String start_time,String end_time,String patient) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_patient d " +
@ -2260,7 +2260,7 @@ public class ImService {
				break;
		}
		
		String sql = "select id, session_id, sender_id, sender_name, content_type, content, timestamp from " + data_base_name + "." +
		String sql = "id AS \"id\",session_id AS \"session_id\",sender_id AS \"sender_id\",sender_name AS \"sender_name\",content_type AS \"content_type\",content AS \"content\",timestamp AS \"timestamp\"  from " + data_base_name + "." +
				tableName + " where id in(" + content + ") order by timestamp desc ";
		List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
		com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
@ -2398,28 +2398,26 @@ public class ImService {
	 * 医生待办事项列表
	 * @param doctorCode
	 * @param type
	 * @param page
	 * @param pagesize
	 * @return
	 */
	public List<ConsultVO> doctorUpcomingList(String doctorCode, String type) {
		String sql = "";
		if("1,15".equals(type)) {
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"b.doctor AS doctorCode," +
					"b.actual_sender AS generalDoctor," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"b.doctor AS \"doctorCode\"," +
					"b.actual_sender AS \"generalDoctor\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d  " +
@ -2429,20 +2427,20 @@ public class ImService {
		}
		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
			sql = "SELECT " +
					"op.description AS title," +
					"op.description AS symptoms," +
					"op.create_time AS czrq," +
					"op.status AS status," +
					"op.evaluate_status AS evaluate," +
					"op.doctor AS doctorCode," +
					"op.general_doctor AS generalDoctor," +
					"patient.NAME AS patientName," +
					"patient.id AS patientId," +
					"patient.idcard AS patientIdcard," +
					"patient.sex AS patientsex," +
					"patient.photo AS patientphoto," +
					"op.id AS outpatientid," +
					"op.register_date AS registerDate," +
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\"," +
					"op.create_time AS \"czrq\"," +
					"op.status AS \"status\"," +
					"op.evaluate_status AS \"evaluate\"," +
					"op.doctor AS \"doctorCode\"," +
					"op.general_doctor AS \"generalDoctor\"," +
					"patient.NAME AS \"patientName\"," +
					"patient.id AS \"patientId\"," +
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\"," +
					"op.id AS \"outpatientid\"," +
					"op.register_date AS \"registerDate\"," +
					"op.status AS outpatientstatus " +
					"FROM wlyy_outpatient op," +
					"base_patient patient " +
@ -2493,7 +2491,7 @@ public class ImService {
	public List<Map<String,Object>>  getDoctorConsultCount(String doctorids) throws Exception{
		//医生角色
		String sql = "SELECT " +
				"count(id) AS total," +
				"count(id) AS \"total\"," +
				"doctor " +
				"FROM wlyy_consult_team " +
				"WHERE doctor IN ("+doctorids+") AND (type=1 OR type=15) and status = 0 GROUP BY doctor";