|
@ -2,6 +2,7 @@ package com.yihu.jw.care.service.assistance;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.yihu.jw.care.dao.assistance.EmergencyAssistanceDao;
|
|
import com.yihu.jw.care.dao.assistance.EmergencyAssistanceDao;
|
|
import com.yihu.jw.care.dao.sign.ServicePackageSignRecordDao;
|
|
import com.yihu.jw.care.dao.sign.ServicePackageSignRecordDao;
|
|
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
|
|
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
|
|
@ -69,6 +70,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
result.put(ResponseContant.resultMsg,failMsg);
|
|
result.put(ResponseContant.resultMsg,failMsg);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
assistanceDO.setStatus(1);
|
|
assistanceDO.setPatient(patient);
|
|
assistanceDO.setPatient(patient);
|
|
assistanceDO.setPatientIdcard(patientDO.getIdcard());
|
|
assistanceDO.setPatientIdcard(patientDO.getIdcard());
|
|
assistanceDO.setPatientName(patientDO.getName());
|
|
assistanceDO.setPatientName(patientDO.getName());
|
|
@ -128,9 +130,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
}
|
|
}
|
|
}
|
|
}
|
|
emergencyAssistanceDao.save(assistanceDO);
|
|
emergencyAssistanceDao.save(assistanceDO);
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
|
|
result.put(ResponseContant.resultMsg,assistanceDO);
|
|
|
|
return result;
|
|
|
|
|
|
return getOrderDetail(assistanceDO.getId());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -154,7 +154,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
double distance=countDistance.getDistance(Double.parseDouble(assistanceDO.getServeLat()),Double.parseDouble(assistanceDO.getServeLon()),Double.parseDouble(assistanceDO.getDoctorLat()),Double.parseDouble(assistanceDO.getDoctorLon()));
|
|
double distance=countDistance.getDistance(Double.parseDouble(assistanceDO.getServeLat()),Double.parseDouble(assistanceDO.getServeLon()),Double.parseDouble(assistanceDO.getDoctorLat()),Double.parseDouble(assistanceDO.getDoctorLon()));
|
|
assistanceDO.setDistance(distance);
|
|
assistanceDO.setDistance(distance);
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
result.put(ResponseContant.resultMsg,assistanceDO);
|
|
|
|
|
|
result.put(ResponseContant.resultMsg,JSONObject.parseObject(JSON.toJSONStringWithDateFormat(assistanceDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue)));
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@ -163,14 +163,23 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
* @param patient
|
|
* @param patient
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject getTabStatusCounts(String patient){
|
|
|
|
|
|
public JSONObject getTabStatusCounts(String patient,String doctor){
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
JSONObject tmpObj = new JSONObject();
|
|
JSONObject tmpObj = new JSONObject();
|
|
tmpObj.put("status_-1",0);//已取消
|
|
tmpObj.put("status_-1",0);//已取消
|
|
tmpObj.put("status_0",0);//已完成
|
|
tmpObj.put("status_0",0);//已完成
|
|
tmpObj.put("status_1",0);//申请中
|
|
tmpObj.put("status_1",0);//申请中
|
|
StringBuilder sql = new StringBuilder(" select ord.status,count(ord.id) count from base_emergency_assistance_order ord where 1=1" +
|
|
|
|
" and ord.patient='"+patient+"' group by ord.status ");
|
|
|
|
|
|
StringBuilder sql = new StringBuilder(" select ord.status,count(ord.id) count from base_emergency_assistance_order ord where 1=1") ;
|
|
|
|
if (StringUtils.isNotBlank(patient)){
|
|
|
|
sql.append( " and ord.patient='"+patient+"' group by ord.status ");
|
|
|
|
}
|
|
|
|
else if (StringUtils.isNotBlank(doctor)) {
|
|
|
|
sql.append(" AND EXISTS (" +
|
|
|
|
"SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
|
|
|
|
"base_team_member m " +
|
|
|
|
"where ord.patient = CONVERT(sr.patient USING utf8) and sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and m.team_code = i.team_code " +
|
|
|
|
" and i.del = 1 and sr.`status`=1 and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') group by ord.status");
|
|
|
|
}
|
|
List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql.toString());
|
|
List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql.toString());
|
|
for (Map<String,Object> map:sqlResult){
|
|
for (Map<String,Object> map:sqlResult){
|
|
tmpObj.put("status_"+map.get("status"),map.get("count"));
|
|
tmpObj.put("status_"+map.get("status"),map.get("count"));
|
|
@ -203,7 +212,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
double distance=countDistance.getDistance(Double.parseDouble(assistanceDO.getServeLat()),Double.parseDouble(assistanceDO.getServeLon()),Double.parseDouble(assistanceDO.getDoctorLat()),Double.parseDouble(assistanceDO.getDoctorLon()));
|
|
double distance=countDistance.getDistance(Double.parseDouble(assistanceDO.getServeLat()),Double.parseDouble(assistanceDO.getServeLon()),Double.parseDouble(assistanceDO.getDoctorLat()),Double.parseDouble(assistanceDO.getDoctorLon()));
|
|
assistanceDO.setDistance(distance);
|
|
assistanceDO.setDistance(distance);
|
|
tmpObj.put("exist","true");
|
|
tmpObj.put("exist","true");
|
|
tmpObj.put("assistanceDO",assistanceDO);
|
|
|
|
|
|
tmpObj.put("assistanceDO",JSONObject.parseObject(JSON.toJSONStringWithDateFormat(assistanceDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue)));
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
result.put(ResponseContant.resultMsg,tmpObj);
|
|
result.put(ResponseContant.resultMsg,tmpObj);
|
|
}
|
|
}
|
|
@ -228,7 +237,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
if (StringUtils.isNotBlank(patient)){
|
|
if (StringUtils.isNotBlank(patient)){
|
|
sql.append(" and ord.patient = '"+patient+"' ");
|
|
sql.append(" and ord.patient = '"+patient+"' ");
|
|
}
|
|
}
|
|
sql.append(" and ord.status in ( '").append(status.replace(",","','")).append("' ");
|
|
|
|
|
|
sql.append(" and ord.status in ( '").append(status.replace(",","','")).append("') ");
|
|
sql.append(" order by ord.create_time "+sort+" limit "+page*pageSize+","+pageSize);
|
|
sql.append(" order by ord.create_time "+sort+" limit "+page*pageSize+","+pageSize);
|
|
|
|
|
|
List<EmergencyAssistanceDO> resultList = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(EmergencyAssistanceDO.class));
|
|
List<EmergencyAssistanceDO> resultList = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(EmergencyAssistanceDO.class));
|
|
@ -295,6 +304,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
if (StringUtils.isNotBlank(conclusionImg)){
|
|
if (StringUtils.isNotBlank(conclusionImg)){
|
|
assistanceDO.setConclusionImg(conclusionImg);
|
|
assistanceDO.setConclusionImg(conclusionImg);
|
|
}
|
|
}
|
|
|
|
assistanceDO.setCompleteTime(new Date());
|
|
assistanceDO.setStatus(0);
|
|
assistanceDO.setStatus(0);
|
|
assistanceDO.setUpdateUser(doctor);
|
|
assistanceDO.setUpdateUser(doctor);
|
|
assistanceDO.setUpdateUserName(assistanceDO.getDoctorName());
|
|
assistanceDO.setUpdateUserName(assistanceDO.getDoctorName());
|
|
@ -343,13 +353,13 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
String failMsg = "患者不存在";
|
|
String failMsg = "患者不存在";
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
result.put(ResponseContant.resultMsg,failMsg);
|
|
result.put(ResponseContant.resultMsg,failMsg);
|
|
|
|
return result;
|
|
}
|
|
}
|
|
if (consultTeam!=null){
|
|
if (consultTeam!=null){
|
|
imUtill.sendTopicIM(patient,patientDO.getName(),consultTeam.getId(),"1",content,null);
|
|
imUtill.sendTopicIM(patient,patientDO.getName(),consultTeam.getId(),"1",content,null);
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
result.put(ResponseContant.resultMsg,"发送成功");
|
|
result.put(ResponseContant.resultMsg,"发送成功");
|
|
}
|
|
}
|
|
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
}
|