|
@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.yihu.jw.care.dao.apply.PatientBedApplyDao;
|
|
|
import com.yihu.jw.care.dao.device.BaseDeviceRepairDao;
|
|
|
import com.yihu.jw.care.dao.device.DeviceDetailDao;
|
|
|
import com.yihu.jw.care.dao.message.OrgNoticeDao;
|
|
|
import com.yihu.jw.care.dao.message.UserNoticeDao;
|
|
|
import com.yihu.jw.care.dao.security.SecurityMonitoringOrderDao;
|
|
@ -14,9 +16,13 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.notice.UserNoticeDO;
|
|
|
import com.yihu.jw.entity.care.device.DeviceDetail;
|
|
|
import com.yihu.jw.entity.care.message.OrgNoticeDO;
|
|
|
import com.yihu.jw.entity.patient.BaseDeviceRepairEntity;
|
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.entity.EntityUtils;
|
|
@ -24,6 +30,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
@ -54,6 +61,12 @@ public class DoctorMessageService {
|
|
|
private DoctorServicePermissionsService doctorServicePermissionsService;
|
|
|
@Autowired
|
|
|
private RoleService roleService;
|
|
|
@Autowired
|
|
|
private BaseDeviceRepairDao baseDeviceRepairDao;
|
|
|
@Autowired
|
|
|
private PatientMessageService patientMessageService;
|
|
|
@Autowired
|
|
|
private DeviceDetailDao deviceDetailDao;
|
|
|
|
|
|
/**
|
|
|
*
|
|
@ -476,4 +489,88 @@ public class DoctorMessageService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 登记维护信息
|
|
|
* @param id 消息id
|
|
|
* @param patientId 居民code
|
|
|
* @param deviceCode 设备sn
|
|
|
* @param deviceName 设备名称
|
|
|
* @param doctorId 医生id
|
|
|
* @param doctorName 医生名字
|
|
|
* @param content 处理内容
|
|
|
* @param img 图片
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
public Envelop submitRepairMessage(String id,String patientId,String deviceCode,String deviceName,String doctorId,String doctorName,String content,String img){
|
|
|
BaseDeviceRepairEntity baseDeviceRepairEntity = new BaseDeviceRepairEntity();
|
|
|
baseDeviceRepairEntity.setOrderId(id);
|
|
|
baseDeviceRepairEntity.setDeviceSn(deviceCode);
|
|
|
if(StringUtils.isBlank(deviceName)){
|
|
|
//查设备
|
|
|
//String sql = "SELECT IFNULL(device_name,'') from wlyy_devices where device_code = '"+relationCode+"' limit 1";
|
|
|
//device_name = jdbcTemplate.queryForObject(sql, String.class);
|
|
|
DeviceDetail bySn = deviceDetailDao.findBySn(deviceCode);
|
|
|
if(bySn != null){
|
|
|
deviceName = bySn.getDeviceName();
|
|
|
}
|
|
|
}
|
|
|
baseDeviceRepairEntity.setDeviceName(deviceName);
|
|
|
baseDeviceRepairEntity.setBindUser(patientId);
|
|
|
//查居民名字
|
|
|
String nameSql = "SELECT name from base_patient where id = '"+patientId+"'";
|
|
|
String userName = jdbcTemplate.queryForObject(nameSql, String.class);
|
|
|
baseDeviceRepairEntity.setBindUserName(userName);
|
|
|
|
|
|
baseDeviceRepairEntity.setStatus(1);
|
|
|
baseDeviceRepairEntity.setRepairPeoper(patientId);
|
|
|
baseDeviceRepairEntity.setRepairPeoperName(userName);
|
|
|
Date nowDate = DateUtil.getNowDate();
|
|
|
baseDeviceRepairEntity.setCreateTime(nowDate);
|
|
|
baseDeviceRepairEntity.setImg(img);
|
|
|
baseDeviceRepairEntity.setDealTime(nowDate);
|
|
|
baseDeviceRepairEntity.setFeedback(content);
|
|
|
baseDeviceRepairEntity.setType(0);
|
|
|
baseDeviceRepairEntity.setDealPeoper(doctorId);
|
|
|
baseDeviceRepairEntity.setDealPeoperName(doctorName);
|
|
|
baseDeviceRepairDao.save(baseDeviceRepairEntity);
|
|
|
patientMessageService.delMessageRead(id);
|
|
|
return Envelop.getSuccess("操作成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 维护信息列表
|
|
|
* @param doctorId
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
* @param name
|
|
|
* @return
|
|
|
*/
|
|
|
public PageEnvelop getRepairMassageList(String doctorId,Integer page,Integer pageSize,String name){
|
|
|
page = page>0?page-1:0;
|
|
|
String selectSql = "SELECT re.id,re.order_id orderId,p.name patientName,re.device_sn deviceSn,re.device_name deviceName,CAST(DATE_FORMAT(re.deal_time,'%Y-%m-%d %H:%i:%S') as char) dealTime,re.deal_peoper dealPeoper,re.deal_peoper_name dealPeoperName,p.photo ";
|
|
|
String sql = " from base_device_repair re left join base_patient p on re.bind_user = p.id " +
|
|
|
" where re.type = 0 and re.status = 1 and re.deal_peoper = '"+doctorId+"' ";
|
|
|
if(StringUtils.isNotBlank(name)){
|
|
|
sql += " and ( p.name like '%"+name+"%' or p.idcard like '%"+name+"%') ";
|
|
|
}
|
|
|
String pageSql = " limit "+page*pageSize+","+pageSize+" ";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(selectSql + sql + pageSql);
|
|
|
String countSql = "SELECT COUNT(re.id) ";
|
|
|
Long total = jdbcTemplate.queryForObject(countSql + sql, Long.class);
|
|
|
return PageEnvelop.getSuccessListWithPage("获取成功",list,page,pageSize,total);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据id获取一条维护信息
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
public ObjEnvelop getRepairMessageListById(Integer id){
|
|
|
String sql = "SELECT re.id,re.order_id orderId,p.name patientName,re.device_sn deviceSn,re.device_name deviceName,CAST(DATE_FORMAT(re.deal_time,'%Y-%m-%d %H:%i:%S') as char) dealTime,re.deal_peoper dealPeoper,re.deal_peoper_name dealPeoperName,p.photo,re.feedback,re.img " +
|
|
|
" from base_device_repair re left join base_patient p on re.bind_user = p.id where re.type = 0 and re.id = "+id;
|
|
|
Map<String, Object> map = jdbcTemplate.queryForMap(sql);
|
|
|
return ObjEnvelop.getSuccess("获取成功",map);
|
|
|
}
|
|
|
|
|
|
}
|