Przeglądaj źródła

设备维护记录

xiaoyunquan 3 lat temu
rodzic
commit
b732707650

+ 6 - 1
common/common-entity/sql记录

@ -1820,4 +1820,9 @@ CREATE TABLE `base_visit_sign` (
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `del` int(2) DEFAULT NULL COMMENT '是否删除1为删除,0.为正常',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=257 DEFAULT CHARSET=utf8mb4 COMMENT='日常走访签到';
) ENGINE=InnoDB AUTO_INCREMENT=257 DEFAULT CHARSET=utf8mb4 COMMENT='日常走访签到';
ALTER TABLE `base`.`base_device_repair`
ADD COLUMN `type` tinyint(2) NULL COMMENT '类型。空是保修,0是设备异常登记维护信息' AFTER `feedback`;

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/patient/BaseDeviceRepairEntity.java

@ -31,6 +31,17 @@ public class BaseDeviceRepairEntity extends IdEntity {
    private Date dealTime; //处理时间
    private String feedback; //反馈
    private Integer type;//类型。空是保修,0是设备异常登记维护信息
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "order_id")
    public String getOrderId() {
        return orderId;

+ 59 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/DoctorMessageEndpoint.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.endpoint.message;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.care.service.message.PatientMessageService;
import com.yihu.jw.restmodel.ResponseContant;
@ -26,6 +27,8 @@ public class DoctorMessageEndpoint extends EnvelopRestEndpoint {
    private DoctorMessageService doctorMessageService;
    @Autowired
    private PatientMessageService patientMessageService;
    @Autowired
    private PermissionService permissionService;
    @GetMapping(value = "messages")
    @ApiOperation("应用消息")
@ -151,4 +154,60 @@ public class DoctorMessageEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "/submitRepairMessage")
    @ApiOperation("登记维护信息")
    @ObserverRequired
    public Envelop submitRepairMessage(@ApiParam @RequestParam String id,
                                       @ApiParam @RequestParam String patientId,
                                       @ApiParam @RequestParam String deviceCode,
                                       @ApiParam @RequestParam String content,
                                       @ApiParam @RequestParam String doctorId,
                                       @ApiParam @RequestParam String doctorName,
                                       @ApiParam @RequestParam(required = false,value = "deviceName") String deviceName,
                                       @ApiParam @RequestParam(required = false,value = "img")String img){
        try{
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("doctorId",permissionService.getUID());
            if (permissionService.noPermission(1, jsonObject)) {
                return ObjEnvelop.getError("该操作没有权限",-1);
            }
            return doctorMessageService.submitRepairMessage(id, patientId, deviceCode, deviceName,doctorId,doctorName,content,img);
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @GetMapping(value = "/getRepairMessageList")
    @ApiOperation("维护信息列表")
    public PageEnvelop getRepairMessageList(@ApiParam @RequestParam String doctorId,
                                            @ApiParam @RequestParam(required = false,value = "page",defaultValue = "1")Integer page,
                                            @ApiParam @RequestParam(required = false,value = "pageSize",defaultValue = "20")Integer pageSize,
                                            @ApiParam @RequestParam(required = false,value = "name")String name){
        try {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("doctorId",permissionService.getUID());
            if (permissionService.noPermission(1, jsonObject)) {
                return PageEnvelop.getError("该操作没有权限",-1);
            }
            return doctorMessageService.getRepairMassageList(doctorId, page, pageSize,name);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @GetMapping(value = "/getRepairMessageListById")
    @ApiOperation("根据id获取一条维护信息")
    public ObjEnvelop getRepairMessageListById(@ApiParam @RequestParam Integer id){
        try {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("doctorId",permissionService.getUID());
            if (permissionService.noPermission(1, jsonObject)) {
                return ObjEnvelop.getError("该操作没有权限",-1);
            }
            return doctorMessageService.getRepairMessageListById(id);
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
}

+ 97 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java

@ -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);
    }
}