|
@ -13,6 +13,8 @@ import com.yihu.mysql.query.BaseJpaService;
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@ -23,6 +25,9 @@ import java.util.Map;
|
|
@Service
|
|
@Service
|
|
public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDao> {
|
|
public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDao> {
|
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(BaseDoctorService.class);
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private BaseDoctorDao baseDoctorDao;
|
|
private BaseDoctorDao baseDoctorDao;
|
|
@Autowired
|
|
@Autowired
|
|
@ -42,15 +47,15 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
* @param page
|
|
* @param page
|
|
* @param pageSize
|
|
* @param pageSize
|
|
*/
|
|
*/
|
|
public Envelop queryList(String city, String hospital, String status, String name, String type, int page, int pageSize){
|
|
|
|
|
|
public Envelop queryList(String city, String hospital, String status, String name, String type,String typeCode, int page, int pageSize){
|
|
Map<String,Object> params = new HashedMap();
|
|
Map<String,Object> params = new HashedMap();
|
|
String sqlTotal ="SELECT " +
|
|
String sqlTotal ="SELECT " +
|
|
" COUNT(1) AS \"total\" " +
|
|
" COUNT(1) AS \"total\" " +
|
|
" FROM " +
|
|
" FROM " +
|
|
" base_doctor a " +
|
|
" base_doctor a " +
|
|
" JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
|
|
" JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
|
|
" JOIN wlyy_charge_dict e ON a.charge_type = e.charge_type " +
|
|
|
|
" JOIN base_doctor_mapping c ON a.id = c.doctor " +
|
|
|
|
|
|
" LEFT JOIN wlyy_charge_dict e ON a.charge_type = e.charge_type " +
|
|
|
|
" LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
|
|
" WHERE " +
|
|
" WHERE " +
|
|
" 1 = 1";
|
|
" 1 = 1";
|
|
if (StringUtils.isNotBlank(city)){
|
|
if (StringUtils.isNotBlank(city)){
|
|
@ -75,8 +80,10 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
sqlTotal += " AND a.outpatient_type like:type";
|
|
sqlTotal += " AND a.outpatient_type like:type";
|
|
params.put("type",type);
|
|
params.put("type",type);
|
|
}
|
|
}
|
|
sqlTotal += " AND e.dept_type_code =:typeCode";
|
|
|
|
params.put("typeCode",6);
|
|
|
|
|
|
if(StringUtils.isNotBlank(typeCode)){
|
|
|
|
sqlTotal += " AND e.dept_type_code =:typeCode";
|
|
|
|
params.put("typeCode",typeCode);
|
|
|
|
}
|
|
Long count = 0L;
|
|
Long count = 0L;
|
|
List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlTotal,params);
|
|
List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlTotal,params);
|
|
if(count!=null){
|
|
if(count!=null){
|
|
@ -95,8 +102,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
" FROM " +
|
|
" FROM " +
|
|
" base_doctor a " +
|
|
" base_doctor a " +
|
|
" JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
|
|
" JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
|
|
" JOIN wlyy_charge_dict e ON a.charge_type = e.charge_type " +
|
|
|
|
" JOIN base_doctor_mapping c ON a.id = c.doctor " +
|
|
|
|
|
|
" LEFT JOIN wlyy_charge_dict e ON a.charge_type = e.charge_type " +
|
|
|
|
" LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
|
|
" WHERE 1=1";
|
|
" WHERE 1=1";
|
|
if (StringUtils.isNotBlank(city)){
|
|
if (StringUtils.isNotBlank(city)){
|
|
sql += " AND a.city_name =:city";
|
|
sql += " AND a.city_name =:city";
|
|
@ -113,7 +120,11 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
if (StringUtils.isNotBlank(type)){
|
|
if (StringUtils.isNotBlank(type)){
|
|
sql += " AND a.outpatient_type like:type";
|
|
sql += " AND a.outpatient_type like:type";
|
|
}
|
|
}
|
|
sql += " AND e.dept_type_code =:typeCode";
|
|
|
|
|
|
if(StringUtils.isNotBlank(typeCode)){
|
|
|
|
sql += " AND e.dept_type_code =:typeCode";
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.info("queryList sql:"+sql);
|
|
|
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pageSize);
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pageSize);
|
|
|
|
|
|
@ -125,7 +136,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
* @param doctorId
|
|
* @param doctorId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public Object queryById(String doctorId) {
|
|
|
|
|
|
public Object queryById(String doctorId,String typeCode) {
|
|
Map<String,Object> params = new HashedMap();
|
|
Map<String,Object> params = new HashedMap();
|
|
String sql ="SELECT " +
|
|
String sql ="SELECT " +
|
|
" a.NAME AS \"name\", " +
|
|
" a.NAME AS \"name\", " +
|
|
@ -151,8 +162,12 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
sql+=" AND a.id =:id";
|
|
sql+=" AND a.id =:id";
|
|
params.put("id",doctorId);
|
|
params.put("id",doctorId);
|
|
}
|
|
}
|
|
sql+=" AND e.dept_type_code =:typeCode";
|
|
|
|
params.put("typeCode",6);
|
|
|
|
|
|
if(StringUtils.isNotBlank(typeCode)){
|
|
|
|
sql+=" AND e.dept_type_code =:typeCode";
|
|
|
|
params.put("typeCode",typeCode);
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.info("queryById sql:"+sql);
|
|
|
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params);
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params);
|
|
StringBuilder disease = new StringBuilder();
|
|
StringBuilder disease = new StringBuilder();
|