|
|
@ -206,56 +206,13 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
* @param docStatus
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject queryDoctorListFullInfo(String nameOrIdcard, String orgCode, String docStatus, int page, int size,String wechatId) throws Exception {
|
|
|
public JSONObject queryDoctorListFullInfo(String nameOrIdcard,String mobile, String orgCode, String docStatus, int page, int size,String wechatId) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
String orgCodeVale = null == orgCode ? "" : orgCode;
|
|
|
String del = null == docStatus ? "" : docStatus;
|
|
|
String nameOrIdcardValue = null == nameOrIdcard ? "" : "%" + nameOrIdcard + "%";
|
|
|
int start = 0 == page ? page++ : (page - 1) * size;
|
|
|
int end = 0 == size ? 15 : page * size;
|
|
|
// String sql = "select" +
|
|
|
// " tb.id as id," +
|
|
|
// " tb.name as name," +
|
|
|
// " tb.idcard as idcard, " +
|
|
|
// " tb.sex as sex, " +
|
|
|
// " tb.mobile as mobile, " +
|
|
|
// " GROUP_CONCAT(tb.org SEPARATOR ',') as orgInfo, " +
|
|
|
// " tb.job_title_name as jobTitleName, " +
|
|
|
// " tb.status as status " +
|
|
|
// "from " +
|
|
|
// " ( " +
|
|
|
// " select " +
|
|
|
// " doc.id, " +
|
|
|
// " doc.name, " +
|
|
|
// " doc.idcard, " +
|
|
|
// " case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex, " +
|
|
|
// " doc.mobile, " +
|
|
|
// " concat(hos.org_name,'/',dept.name,'/',hos.doctor_duty_name) as org, " +
|
|
|
// " doc.job_title_name, " +
|
|
|
// " case doc.del when 0 then '已失效' when 1 then '生效中' end as status, " +
|
|
|
// " doc.create_time " +
|
|
|
// " from " +
|
|
|
// " base_doctor doc, " +
|
|
|
// " base_doctor_hospital hos, " +
|
|
|
// " dict_hospital_dept dept " +
|
|
|
// " where " +
|
|
|
// " doc.id = hos.doctor_code " +
|
|
|
// " and " +
|
|
|
// " hos.org_code = dept.org_code " +
|
|
|
// " and " +
|
|
|
// " hos.dept_code = dept.code " +
|
|
|
// " and " +
|
|
|
// " ((doc.idcard like '{idcard}' or ''= '{idcard}' ) or (doc.name like '{name}' or ''= '{name}' ) and (hos.org_code = '{orgCode}' or ''= '{orgCode}') and (doc.del = '{docStatus}' or ''= '{docStatus}')) " +
|
|
|
// " ) tb " +
|
|
|
// "GROUP BY tb.id order by tb.create_time desc limit {start},{end} ";
|
|
|
// String finalSql = sql
|
|
|
// .replace("{idcard}",nameOrIdcardValue)
|
|
|
// .replace("{name}",nameOrIdcardValue)
|
|
|
// .replace("{orgCode}",orgCodeVale)
|
|
|
// .replace("{docStatus}",del)
|
|
|
// .replace("{start}",String.valueOf(start))
|
|
|
// .replace("{end}",String.valueOf(end));
|
|
|
|
|
|
String sql="SELECT\n" +
|
|
|
"\ttb.id AS \"id\",\n" +
|
|
|
"\ttb.idcard AS \"idcard\",\n" +
|
|
|
@ -311,16 +268,14 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
" base_doctor doc LEFT join base_doctor_hospital hos on doc.id = hos.doctor_code " +
|
|
|
" LEFT JOIN dict_hospital_dept dept on hos.org_code = dept.org_code" +
|
|
|
" AND hos.dept_code = dept.code"+
|
|
|
/*"\tbase_doctor doc,\n" +
|
|
|
"\tbase_doctor_hospital hos,\n" +
|
|
|
"\tdict_hospital_dept dept\n" +*/
|
|
|
" WHERE 1=1";
|
|
|
/*"\tdoc.id = hos.doctor_code\n" +
|
|
|
"AND hos.org_code = dept.org_code\n" +
|
|
|
"AND hos.dept_code = dept.code\n"*/
|
|
|
if (!StringUtils.isEmpty(nameOrIdcard)){
|
|
|
sql += " and (doc.idcard LIKE '%"+nameOrIdcard+"%' or doc.name LIKE '%"+nameOrIdcard+"%')";
|
|
|
}if (!StringUtils.isEmpty(orgCode)){
|
|
|
}
|
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(mobile)){
|
|
|
sql += " and doc.mobile like '%"+mobile+"%' ";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(orgCode)){
|
|
|
sql += " and hos.org_code = '"+orgCode+"'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(del)){
|
|
|
@ -339,65 +294,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
"ORDER BY\n" +
|
|
|
"\ttb.create_time DESC";
|
|
|
|
|
|
// if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
// sql+=" GROUP BY\n" +
|
|
|
// "\ttb. ID,\n" +
|
|
|
// "\ttb.idcard,\n" +
|
|
|
// "\ttb. NAME,\n" +
|
|
|
// "\ttb.sex,\n" +
|
|
|
// "\ttb.mobile,\n" +
|
|
|
// "\ttb.job_title_name,\n" +
|
|
|
// "\ttb.status,\n" +
|
|
|
// " tb.create_time\n" +
|
|
|
// "ORDER BY\n" +
|
|
|
// "\ttb.create_time DESC";
|
|
|
// }else {
|
|
|
// sql+=" GROUP BY\n" +
|
|
|
// "\ttb. ID\n" +
|
|
|
// "ORDER BY\n" +
|
|
|
// "\ttb.create_time DESC";
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> list=null;
|
|
|
list = hibenateUtils.createSQLQuery(sql,page,size);
|
|
|
/* if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
|
|
|
if (flag){
|
|
|
sql+=" LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
Logger.getAnonymousLogger().info("finalCountSql="+sql);
|
|
|
list = jdbcTemplate.queryForList(sql);
|
|
|
}else {
|
|
|
String oracleSql="SELECT\n" +
|
|
|
"\t*\n" +
|
|
|
"FROM\n" +
|
|
|
"\t(\n" +
|
|
|
"\t\tSELECT\n" +
|
|
|
"\t\t\tA .*\n" +
|
|
|
"\t\tFROM\n" +
|
|
|
"\t\t\t(";
|
|
|
|
|
|
oracleSql+=sql;
|
|
|
|
|
|
oracleSql+="\t\t\t) A\n" +
|
|
|
"\t\tWHERE\n" +
|
|
|
" ROWNUM <="+page*size +
|
|
|
"\t) \n" +
|
|
|
"WHERE\n" +
|
|
|
"\tROWNUM >= "+(page-1)*size;
|
|
|
Logger.getAnonymousLogger().info("oracleSql="+oracleSql);
|
|
|
list = jdbcTemplate.queryForList(oracleSql);
|
|
|
}
|
|
|
|
|
|
|
|
|
}else {
|
|
|
sql+=" LIMIT " + (page - 1) * size + "," + size + "";
|
|
|
Logger.getAnonymousLogger().info("finalCountSql="+sql);
|
|
|
list = jdbcTemplate.queryForList(sql);
|
|
|
}*/
|
|
|
|
|
|
|
|
|
String countSql = " select " +
|
|
|
" COUNT(DISTINCT (doc.id)) as count " +
|
|
|
" from " +
|
|
|
@ -419,7 +317,6 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
countSql += " and doc.del = '"+del+"'";
|
|
|
}
|
|
|
|
|
|
// List<Map<String,Object>> list = jdbcTemplate.queryForList(finalSql);
|
|
|
Logger.getAnonymousLogger().info("finalCountSql="+countSql);
|
|
|
int count = jdbcTemplate.queryForObject(countSql,Integer.class);
|
|
|
List<WlyyHospitalSysDictDO> listDict = wlyyHospitalSysDictDao.findByDictName("doctor_level");
|
|
|
@ -428,11 +325,6 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
String deptname = map.get("deptname")==null?"":map.get("deptname").toString();
|
|
|
String doctorDutyName = map.get("doctorDutyName")==null?"":map.get("doctorDutyName").toString();
|
|
|
map.put("orgInfo",orgname+"/"+deptname+"/"+doctorDutyName);
|
|
|
/*for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:listDict){
|
|
|
if (map.get("doctorlevel").toString().equals(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
map.put("levelName",wlyyHospitalSysDictDO.getDictValue());
|
|
|
}
|
|
|
}*/
|
|
|
}
|
|
|
result.put("count", count);
|
|
|
result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
|