liubing 4 rokov pred
rodič
commit
7b2eb184ec

+ 4 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/apply/PatientBedApplyDao.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.dao.apply;
import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -18,4 +19,7 @@ public interface PatientBedApplyDao extends PagingAndSortingRepository<PatientBe
    List<PatientBedApplyDo> findByOrgCodeAndStatusIn(String orgCode,Integer[] status ,Sort sort);
    List<PatientBedApplyDo> queryByIdcardAndOrgCodeAndStatusIn(String idcard, String orgCode, Integer[] status);
    @Query("select count(1) from PatientBedApplyDo p where p.orgCode=?1 and p.status<>-1 and p.status<>0")
    Integer findUnCompleteByOrgCode(String orgCode);
}

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

@ -0,0 +1,39 @@
package com.yihu.jw.care.endpoint.message;
import com.yihu.jw.care.service.message.DoctorMessageService;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Bing on 2021/4/10.
 */
@RestController
@RequestMapping(value = "doctor/message")
@Api(description = "医生消息")
public class DoctorMessageEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private DoctorMessageService doctorMessageService;
    @GetMapping(value = "messages")
    @ApiOperation("应用消息")
    public ObjEnvelop messages(@ApiParam(name = "type", value = "消息类型 10床位申请,11安全监护")
                               @RequestParam(value = "type", required = false) String type){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.findDoctorAllMessage(getUID(),type));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败"+e.getMessage());
        }
    }
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java

@ -68,7 +68,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getSecurityOrderUnCompleteList")
    @ApiOperation(value = "获取安防工单列表")
    @ApiOperation(value = "获取医生机构下未结束的安防工单")
    public ListEnvelop getSecurityOrderUnCompleteList(@ApiParam(name="doctor",value = "医生ID,当前查看列表医生",required = true)
                                            @RequestParam(value = "doctor")String doctor){

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

@ -0,0 +1,76 @@
package com.yihu.jw.care.service.message;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.apply.PatientBedApplyDao;
import com.yihu.jw.care.dao.security.SecurityMonitoringOrderDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
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.restmodel.ResponseContant;
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 java.util.List;
/**
 * Created by Bing on 2021/4/10.
 */
@Service
public class DoctorMessageService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private PatientBedApplyDao patientBedApplyDao;
    @Autowired
    private SecurityMonitoringOrderDao securityMonitoringOrderDao;
    /**
     *
     * @param doctor
     * @param type  床位申请,11安全监护
     * @return
     */
    public JSONObject findDoctorAllMessage(String doctor,String type){
        JSONObject result = new JSONObject();
        JSONObject tmp = new JSONObject();
        boolean typeNull = StringUtils.isBlank(type);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        if (doctorDO==null){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"患者今年已做过能力评估报告,不可重复操作");
        }
        List<BaseDoctorHospitalDO> hospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctor);
        Integer count;
        if (typeNull||type.equals("10")){//床位申请//未处理
            count=0;
            for (BaseDoctorHospitalDO obj:hospitalDO){
                String sql ="select count(*) from base_patient_bed_apply where org_code='"+obj.getOrgCode()+"' " +
                        "and status =1";
                Integer sqlCount = jdbcTemplate.queryForObject(sql,Integer.class);
                count +=sqlCount;
            }
            result.put("bedApply",count);
        }
        if (typeNull||type.equals("11")){//安全监护
            count=0;
            for (BaseDoctorHospitalDO obj:hospitalDO){
                String sql ="select count(*) from base_security_monitoring_order where hospital='"+obj.getOrgCode()+"' " +
                        "and status <>-1 and ord.status<> 7";
                Integer sqlCount = jdbcTemplate.queryForObject(sql,Integer.class);
                count +=sqlCount;
            }
            result.put("security",count);
        }
        return result;
    }
}

+ 11 - 9
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -286,17 +286,19 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
    }
    public List<Map<String,Object>> getSecurityOrderUnCompleteList(String doctor){
        List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctor);
        String sql = " select p.id patientCode,p.name,p.sex,p.idcard,ord.id orderId,ord.number,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time,ord.`status`,ord.doctor," +
                "ord.doctor_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                "where ord.status <>-1 and ord.status<> 7  ";
        List<Map<String,Object>> result = new ArrayList<>();
        if (hospitalDOs.size()>0){
              sql += "and ord.hospital = '"+hospitalDOs.get(0).getOrgCode()+"' ";
              sql +=" order by ord.create_time asc ";
            List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
            return result;
        }else  {
            return new ArrayList<>();
            for (BaseDoctorHospitalDO obj:hospitalDOs){
                String sql = " select p.id patientCode,p.name,p.sex,p.idcard,ord.id orderId,ord.number,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time,ord.`status`,ord.doctor," +
                        "ord.doctor_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                        "where ord.status <>-1 and ord.status<> 7  ";
                sql += "and ord.hospital = '"+obj.getOrgCode()+"' ";
                sql +=" order by ord.create_time asc ";
                List<Map<String,Object>> tmp= jdbcTemplate.queryForList(sql);
                result.addAll(tmp);
            }
        }
        return result;
    }
    /**