|
@ -42,12 +42,15 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
|
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import jxl.write.*;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
@ -145,7 +148,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
List<WlyyOutpatientVO> list = entranceService.BS30025(patNo,conNo,null,null,demoFlag);
|
|
|
|
|
|
if(list!=null&&list.size()>0){
|
|
|
return list.get(0);
|
|
|
WlyyOutpatientVO outpatientVO = list.get(0);
|
|
|
BasePatientDO patientDO = basePatientDao.findById(outpatientVO.getPatient());
|
|
|
outpatientVO.setSex(patientDO.getSex()+"");
|
|
|
outpatientVO.setBirthday(patientDO.getBirthday());
|
|
|
return outpatientVO;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@ -663,12 +670,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取医生列表
|
|
|
* 获取医生列表.
|
|
|
* @param orgCode
|
|
|
* @param dept
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept,String chargeType,String doctorCode){
|
|
|
public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept,String chargeType,String doctorCode,String outpatientType,String startDate,String endDate,String key,String consultStatus){
|
|
|
String sql ="SELECT " +
|
|
|
" d.id, " +
|
|
|
" d.photo, " +
|
|
@ -677,16 +684,46 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
" d.introduce," +
|
|
|
" d.job_title_code AS jobTitleCode, " +
|
|
|
" d.job_title_name AS jobTitleName," +
|
|
|
" d.charge_type AS chargeType" +
|
|
|
" d.charge_type AS chargeType," +
|
|
|
" d.outpatient_type AS outpatientType," +
|
|
|
" d.consult_status AS consultStatus" +
|
|
|
" FROM " +
|
|
|
" base_doctor d " +
|
|
|
" JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
|
|
|
" WHERE " +
|
|
|
" h.dept_code = '"+dept+"' " +
|
|
|
" AND h.org_code = '"+orgCode+"'";
|
|
|
" 1=1";
|
|
|
if(StringUtils.isNotBlank(dept)){
|
|
|
sql+= " AND h.dept_code = '"+dept+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(orgCode)){
|
|
|
sql+= " AND h.org_code = '"+orgCode+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(chargeType)){
|
|
|
sql+=" AND d.charge_type ='"+chargeType+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(outpatientType)){
|
|
|
sql+=" AND d.outpatient_type like'%"+outpatientType+"%'";
|
|
|
}else{
|
|
|
sql+=" AND d.outpatient_type is not null ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(key)){
|
|
|
sql+=" AND (h.dept_name like '%"+key+"%' OR d.name like '%"+key+"%' OR d.expertise like '%"+key+"%') ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(consultStatus)){
|
|
|
sql+=" AND d.consult_status = '"+consultStatus+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)&&StringUtils.isNotBlank(startDate)){
|
|
|
sql+=" AND EXISTS ( " +
|
|
|
" SELECT " +
|
|
|
" 1 " +
|
|
|
" FROM " +
|
|
|
" wlyy_doctor_work_time t " +
|
|
|
" WHERE " +
|
|
|
" t.doctor = d.id " +
|
|
|
" AND t.start_time >='" +startDate+"'" +
|
|
|
" AND t.start_time <='"+endDate+"'"+
|
|
|
" )";
|
|
|
}
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
if(list!=null&&list.size()>0&&StringUtils.isNotBlank(doctorCode)){
|
|
@ -708,7 +745,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param dept
|
|
|
* @return
|
|
|
*/
|
|
|
public MixEnvelop findDoctorWithWork(String orgCode,String dept,String chargeType,String doctorCode,Integer page,Integer size){
|
|
|
public MixEnvelop findDoctorWithWork(String orgCode,String dept,String chargeType,String doctorCode,String outpatientType,String startDate,String endDate,String key,String consultStatus,Integer page,Integer size){
|
|
|
|
|
|
String totalSql ="SELECT " +
|
|
|
" count(1) AS total " +
|
|
@ -716,10 +753,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
" base_doctor d " +
|
|
|
" JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
|
|
|
" WHERE " +
|
|
|
" h.dept_code = '"+dept+"' " +
|
|
|
" AND h.org_code = '"+orgCode+"'";
|
|
|
" 1=1 ";
|
|
|
if(StringUtils.isNotBlank(dept)){
|
|
|
totalSql+= " AND h.dept_code = '"+dept+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(orgCode)){
|
|
|
totalSql+= " AND h.org_code = '"+orgCode+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(chargeType)){
|
|
|
totalSql+=" AND d.charge_type ='"+chargeType+"'";
|
|
|
totalSql+= " AND d.charge_type ='"+chargeType+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(outpatientType)){
|
|
|
totalSql+= " AND d.outpatient_type like'%"+outpatientType+"%'";
|
|
|
}else{
|
|
|
totalSql+=" AND d.outpatient_type is not null ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(key)){
|
|
|
totalSql+=" AND (h.dept_name like '%"+key+"%' OR d.name like '%"+key+"%' OR d.expertise like '%"+key+"%') ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(consultStatus)){
|
|
|
totalSql+=" AND d.consult_status = '"+consultStatus+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)&&StringUtils.isNotBlank(startDate)){
|
|
|
totalSql+=" AND EXISTS ( " +
|
|
|
" SELECT " +
|
|
|
" 1 " +
|
|
|
" FROM " +
|
|
|
" wlyy_doctor_work_time t " +
|
|
|
" WHERE " +
|
|
|
" t.doctor = d.id " +
|
|
|
" AND t.start_time >='" +startDate+"'" +
|
|
|
" AND t.start_time <='"+endDate+"'"+
|
|
|
" )";
|
|
|
}
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
|
|
|
|
|
@ -738,15 +803,45 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
" d.job_title_name AS jobTitleName," +
|
|
|
" d.charge_type AS chargeType," +
|
|
|
" h.dept_code AS deptCode," +
|
|
|
" h.dept_Name AS deptName" +
|
|
|
" h.dept_Name AS deptName," +
|
|
|
" d.outpatient_type AS outpatientType," +
|
|
|
" d.consult_status AS consultStatus" +
|
|
|
" FROM " +
|
|
|
" base_doctor d " +
|
|
|
" JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
|
|
|
" WHERE " +
|
|
|
" h.dept_code = '"+dept+"' " +
|
|
|
" AND h.org_code = '"+orgCode+"'";
|
|
|
" WHERE " +
|
|
|
" 1=1" ;
|
|
|
if(StringUtils.isNotBlank(dept)){
|
|
|
sql+= " AND h.dept_code = '"+dept+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(orgCode)){
|
|
|
sql+= " AND h.org_code = '"+orgCode+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(chargeType)){
|
|
|
sql+=" AND d.charge_type ='"+chargeType+"'";
|
|
|
sql+= " AND d.charge_type ='"+chargeType+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(outpatientType)){
|
|
|
sql+= " AND d.outpatient_type like'%"+outpatientType+"%'";
|
|
|
}else{
|
|
|
sql+= " AND d.outpatient_type is not null ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(key)){
|
|
|
sql+=" AND (h.dept_name like '%"+key+"%' OR d.name like '%"+key+"%' OR d.expertise like '%"+key+"%') ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(consultStatus)){
|
|
|
sql+=" AND d.consult_status = '"+consultStatus+"'";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)&&StringUtils.isNotBlank(startDate)){
|
|
|
sql+=" AND EXISTS ( " +
|
|
|
" SELECT " +
|
|
|
" 1 " +
|
|
|
" FROM " +
|
|
|
" wlyy_doctor_work_time t " +
|
|
|
" WHERE " +
|
|
|
" t.doctor = d.id " +
|
|
|
" AND t.start_time >='" +startDate+"'" +
|
|
|
" AND t.start_time <='"+endDate+"'"+
|
|
|
" )";
|
|
|
}
|
|
|
sql += " LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
@ -1491,7 +1586,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return rs.size();
|
|
|
}
|
|
|
|
|
|
public Map<String,Object> findDoctorInfo(String doctor){
|
|
|
public Map<String,Object> findDoctorInfo(String doctor,String withWork){
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findOne(doctor);
|
|
|
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
@ -1502,6 +1597,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
rs.put("jobTitleName",doctorDO.getJobTitleName());
|
|
|
rs.put("chargeType",doctorDO.getChargeType());
|
|
|
rs.put("photo",doctorDO.getPhoto());
|
|
|
rs.put("consultStatus",doctorDO.getConsultStatus());
|
|
|
rs.put("outpatientType",doctorDO.getOutpatientType());
|
|
|
|
|
|
//机构科室信息
|
|
|
List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
|
|
@ -1511,6 +1608,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
rs.put("hospital",null);
|
|
|
}
|
|
|
|
|
|
|
|
|
//医生角色
|
|
|
String sql = "SELECT " +
|
|
|
" t. CODE AS roleCode, " +
|
|
|
" t. NAME AS roleName" +
|
|
@ -1526,6 +1625,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}else{
|
|
|
rs.put("roles",null);
|
|
|
}
|
|
|
//医生预约量
|
|
|
List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctor(doctor);
|
|
|
if(registerTimeDOs!=null&®isterTimeDOs.size()>0){
|
|
|
rs.put("registerCount",registerTimeDOs.size());
|
|
|
}else{
|
|
|
rs.put("registerCount",0);
|
|
|
}
|
|
|
//医生问诊量
|
|
|
List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorAndStatus(doctor,"2");
|
|
|
if(wlyyOutpatientDOs!=null&&wlyyOutpatientDOs.size()>0){
|
|
|
rs.put("outpatientCount",wlyyOutpatientDOs.size());
|
|
|
}else{
|
|
|
rs.put("outpatientCount",0);
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(withWork)&&"1".equals(withWork)){
|
|
|
List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor);
|
|
|
rs.put("workTime",times);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return rs;
|
|
@ -1989,4 +2107,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>();
|
|
|
return convertToModels(times,timeVOs,WlyyDoctorWorkTimeVO.class);
|
|
|
}
|
|
|
|
|
|
// public Map<String,Object> findPatientInfo(String patient){
|
|
|
//
|
|
|
// }
|
|
|
|
|
|
@Autowired
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
public String test() {
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("clientId", "ihealth_pa8DIRJasL"));
|
|
|
params.add(new BasicNameValuePair("clientSecret", "jkzl1h7aj39dnasyi23fnkv92"));
|
|
|
params.add(new BasicNameValuePair("code", "334e4232777e4edabea4a4334bf1997c"));
|
|
|
params.add(new BasicNameValuePair("openid","oULM4xIoqe3DwEClan_Rq-bQ4JDE"));
|
|
|
String res = null;
|
|
|
res = httpClientUtil.post("http://www.xmtyw.cn/wlyy/iHealth/userInfo", params, "UTF-8");
|
|
|
return res;
|
|
|
}
|
|
|
}
|