liubing 4 lat temu
rodzic
commit
80ee40fb67

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

@ -421,4 +421,5 @@ CREATE TABLE `base_emergency_assistance_order` (
-- 2021-04-13 lb
ALTER table base_doctor ADD COLUMN `doctor_lat` varchar(100) DEFAULT NULL COMMENT '医生当前定位地址纬度';
ALTER table base_doctor ADD COLUMN `doctor_lon` varchar(100) DEFAULT NULL COMMENT '医生当前定位地址经度';
ALTER table base_doctor ADD COLUMN `doctor_lon` varchar(100) DEFAULT NULL COMMENT '医生当前定位地址经度';
alter TABLE base_emergency_assistance_order add COLUMN complete_time timestamp NULL DEFAULT NULL COMMENT '医生确认完成时间';

+ 10 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/assistance/EmergencyAssistanceDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by Bing on 2021/4/12.
@ -30,6 +31,7 @@ public class EmergencyAssistanceDO extends UuidIdentityEntityWithOperator {
    private String conclusion; //服务完成笔记
    private String conclusionImg; //服务相关附件
    private Integer status; //工单状态 -1已取消 0已完成 1申请中
    private Date completeTime;//完成时间
    private String sendMessage;//
    private Integer patientAge;
@ -172,7 +174,6 @@ public class EmergencyAssistanceDO extends UuidIdentityEntityWithOperator {
    public void setServeAddress(String serveAddress) {
        this.serveAddress = serveAddress;
    }
    public String getDoctorAddress() {
        return doctorAddress;
    }
@ -181,6 +182,14 @@ public class EmergencyAssistanceDO extends UuidIdentityEntityWithOperator {
        this.doctorAddress = doctorAddress;
    }
    public Date getCompleteTime() {
        return completeTime;
    }
    public void setCompleteTime(Date completeTime) {
        this.completeTime = completeTime;
    }
    @Transient
    public String getSendMessage() {
        return sendMessage;

+ 11 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java

@ -64,13 +64,21 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getTabStatusCounts")
    @ApiOperation(value = "查看居民救助历史tab数量")
    @ApiOperation(value = "医生或居民查看救助历史tab数量")
    public ObjEnvelop getTabStatusCounts(
                                    @ApiParam(name="patient",value = "患者")
                                    @RequestParam(value = "patient") String patient
                                    @RequestParam(value = "patient",required = false) String patient,
                                    @ApiParam(name="doctor",value = "医生")
                                    @RequestParam(value = "doctor",required = false) String doctor
    ){
        try {
            JSONObject result = assistanceService.getTabStatusCounts(patient);
            if (StringUtils.isBlank(patient)&&StringUtils.isBlank(doctor)){
                return ObjEnvelop.getError("请求参数错误");
            }
            if (StringUtils.isNotBlank(patient)&&StringUtils.isNotBlank(doctor)){
                return ObjEnvelop.getError("请求参数错误");
            }
            JSONObject result = assistanceService.getTabStatusCounts(patient,doctor);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }

+ 20 - 10
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.assistance;
import com.alibaba.fastjson.JSON;
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.sign.ServicePackageSignRecordDao;
import com.yihu.jw.care.dao.team.BaseTeamMemberDao;
@ -69,6 +70,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        assistanceDO.setStatus(1);
        assistanceDO.setPatient(patient);
        assistanceDO.setPatientIdcard(patientDO.getIdcard());
        assistanceDO.setPatientName(patientDO.getName());
@ -128,9 +130,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            }
        }
        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()));
        assistanceDO.setDistance(distance);
        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;
    }
@ -163,14 +163,23 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
     * @param patient
     * @return
     */
    public JSONObject getTabStatusCounts(String patient){
    public JSONObject getTabStatusCounts(String patient,String doctor){
        JSONObject result = new JSONObject();
        JSONObject tmpObj = new JSONObject();
        tmpObj.put("status_-1",0);//已取消
        tmpObj.put("status_0",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());
        for (Map<String,Object> map:sqlResult){
            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()));
            assistanceDO.setDistance(distance);
            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.resultMsg,tmpObj);
        }
@ -228,7 +237,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        if (StringUtils.isNotBlank(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);
        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)){
            assistanceDO.setConclusionImg(conclusionImg);
        }
        assistanceDO.setCompleteTime(new Date());
        assistanceDO.setStatus(0);
        assistanceDO.setUpdateUser(doctor);
        assistanceDO.setUpdateUserName(assistanceDO.getDoctorName());
@ -343,13 +353,13 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            String failMsg = "患者不存在";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        if (consultTeam!=null){
            imUtill.sendTopicIM(patient,patientDO.getName(),consultTeam.getId(),"1",content,null);
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg,"发送成功");
        }
        return result;
    }
}

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

@ -69,7 +69,7 @@ public class DoctorMessageService {
            }
            listTmp.sort(Comparator.comparing(obj ->  obj.get("create_time").toString()));
            tmpJson.put("count",count);
            if (listTmp.size()>0){
            if (listTmp.size()>0&&listTmp.get(0).get("patient_name")!=null){
                tmpJson.put("message",listTmp.get(0).get("patient_name").toString()+"居民申请床位");
                tmpJson.put("time",listTmp.get(0).get("create_time").toString());
            }
@ -94,7 +94,7 @@ public class DoctorMessageService {
            }
            listTmp.add(sqlResult);
            tmpJson.put("count",count);
            if (listTmp.size()>0){
            if (listTmp.size()>0&&listTmp.get(0).get("patient_name")!=null){
                tmpJson.put("message",listTmp.get(0).get("patient_name").toString()+"居民"+listTmp.get(0).get("serve_desc").toString());
                tmpJson.put("time",listTmp.get(0).get("create_time"));
            }