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