|
@ -80,7 +80,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
*/
|
|
|
public Envelop queryList(String city, String hospital, String status, String name, String type, String typeCode, String dept, int page, int pageSize){
|
|
|
public Envelop queryList(String city, String hospital, String status,String chargeType,String conditionKey, String name, String type, String typeCode, String dept, int page, int pageSize){
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
String sqlTotal ="SELECT " +
|
|
|
" COUNT(1) AS \"total\" " +
|
|
@ -103,6 +103,15 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
sqlTotal += " AND a.del =:status";
|
|
|
params.put("status",status);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(chargeType)){
|
|
|
sqlTotal += " AND (a.twfz_charge_type=:chargeType or a.spfz_charge_type=:chargeType or a.xtfz_charge_type=:chargeType or a.xgsz_charge_type=:chargeType) ";
|
|
|
params.put("chargeType",chargeType);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(conditionKey)){
|
|
|
conditionKey = "%"+conditionKey+"%";
|
|
|
sqlTotal += " AND (a.name like:conditionKey or a.idcard like:conditionKey or a.mobile like :conditionKey)";
|
|
|
params.put("conditionKey",conditionKey);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(name)){
|
|
|
name = "%"+name+"%";
|
|
|
sqlTotal += " AND (a.name like:name or b.dept_name like:name or c.mapping_code like :name)";
|
|
@ -133,6 +142,10 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
" a.NAME AS \"name\", " +
|
|
|
" a.introduce AS \"introduce\", " +
|
|
|
" a.expertise AS \"expertise\", " +
|
|
|
" a.idcard AS \"idcard\", " +
|
|
|
" a.job_title_code AS \"jobTitleCode\", " +
|
|
|
" a.mobile AS \"mobile\", " +
|
|
|
" a.job_title_name AS \"jobTitleName\", " +
|
|
|
" a.outpatient_type AS \"outpatientType\", " +
|
|
|
" a.del AS \"del\", " +
|
|
|
" b.dept_name AS \"deptName\", " +
|
|
@ -146,12 +159,14 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
"\tv.req_fee as \"twzxFee\",\n" +
|
|
|
"\td.req_fee as \"xtzxFee\",\n" +
|
|
|
"\tg.req_fee as \"jyzxFee\",\n" +
|
|
|
"\th.req_fee as \"xgszFee\",\n" +
|
|
|
"\tm.charge_type as \"twfzType\",\n" +
|
|
|
"\tn.charge_type as \"spfzType\",\n" +
|
|
|
"\tp.charge_type as \"spzxType\",\n" +
|
|
|
"\tv.charge_type as \"twzxType\",\n" +
|
|
|
"\td.charge_type as \"xtzxType\",\n" +
|
|
|
"\tg.charge_type as \"jyzxType\"\n" +
|
|
|
"\tg.charge_type as \"jyzxType\",\n" +
|
|
|
"\th.charge_type as \"xgszType\"\n" +
|
|
|
" FROM " +
|
|
|
" base_doctor a " +
|
|
|
" JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
|
|
@ -162,6 +177,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
" LEFT JOIN wlyy_charge_dict v ON a.twzx_charge_type = v.charge_type and v.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict d ON a.xtfz_charge_type = d.charge_type and d.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON a.jyzx_charge_type = g.charge_type and g.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict h ON a.xgsz_charge_type = h.charge_type and h.is_del='1'\n" +
|
|
|
" LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
|
|
|
" WHERE 1=1";
|
|
|
if (StringUtils.isNotBlank(city)){
|
|
@ -173,8 +189,19 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
if (StringUtils.isNotBlank(status)){
|
|
|
sql += " AND a.del =:status";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(chargeType)){
|
|
|
sql += " AND (a.twfz_charge_type=:chargeType or a.spfz_charge_type=:chargeType or a.xtfz_charge_type=:chargeType or a.xgsz_charge_type=:chargeType) ";
|
|
|
params.put("chargeType",chargeType);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(conditionKey)){
|
|
|
conditionKey = "%"+conditionKey+"%";
|
|
|
sql += " AND (a.name like:conditionKey or a.idcard like:conditionKey or a.mobile like :conditionKey)";
|
|
|
params.put("conditionKey",conditionKey);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(name)){
|
|
|
name = "%"+name+"%";
|
|
|
sql += " AND (a.name like:name or b.dept_name like:name or c.mapping_code like:name)";
|
|
|
params.put("name",name);
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(type)){
|
|
|
sql += " AND a.outpatient_type like:type";
|
|
@ -204,6 +231,9 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
" a.id AS \"id\", " +
|
|
|
" a.NAME AS \"name\", " +
|
|
|
" a.job_title_name AS \"jobTitleName\", " +
|
|
|
" a.idcard AS \"idcard\", " +
|
|
|
" a.job_title_code AS \"jobTitleCode\", " +
|
|
|
" a.mobile AS \"mobile\", " +
|
|
|
" a.introduce AS \"introduce\", " +
|
|
|
" a.expertise AS \"expertise\", " +
|
|
|
" a.photo AS \"photo\", " +
|
|
@ -221,12 +251,14 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
"\tv.req_fee as \"twzxFee\",\n" +
|
|
|
"\tq.req_fee as \"xtzxFee\",\n" +
|
|
|
"\tg.req_fee as \"jyzxFee\",\n" +
|
|
|
"\tk.req_fee as \"xgszFee\",\n" +
|
|
|
"\tm.charge_type as \"twfzType\",\n" +
|
|
|
"\tn.charge_type as \"spfzType\",\n" +
|
|
|
"\tp.charge_type as \"spzxType\",\n" +
|
|
|
"\tv.charge_type as \"twzxType\",\n" +
|
|
|
"\tq.charge_type as \"xtzxType\",\n" +
|
|
|
"\tg.charge_type as \"jyzxType\"\n" +
|
|
|
"\tg.charge_type as \"jyzxType\",\n" +
|
|
|
"\tk.charge_type as \"xgszType\"\n" +
|
|
|
" FROM " +
|
|
|
" base_doctor a " +
|
|
|
" LEFT JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
|
|
@ -240,6 +272,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
" LEFT JOIN wlyy_charge_dict v ON a.twzx_charge_type = v.charge_type and v.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict q ON a.xtfz_charge_type = q.charge_type and q.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict g ON a.jyzx_charge_type = g.charge_type and g.is_del='1'\n" +
|
|
|
" LEFT JOIN wlyy_charge_dict k ON a.xgsz_charge_type = k.charge_type and k.is_del='1'\n" +
|
|
|
" WHERE 1=1 ";
|
|
|
if(StringUtils.isNotBlank(doctorId)){
|
|
|
sql+=" AND a.id =:id";
|
|
@ -296,17 +329,24 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
public Boolean update(JSONObject jsonObject)throws Exception{
|
|
|
//取出数据
|
|
|
String doctorId = jsonObject.get("doctorId").toString();
|
|
|
String introduce = jsonObject.get("introduce").toString();
|
|
|
String expertise = jsonObject.get("expertise").toString();
|
|
|
String photo = jsonObject.get("photo").toString();
|
|
|
String outpatientType = jsonObject.get("outpatientType").toString();
|
|
|
String newSpecialDisease = jsonObject.get("specialDisease").toString();
|
|
|
String newSpecialDiseaseCode = jsonObject.get("specialDiseaseCode").toString();
|
|
|
String introduce = jsonObject.get("introduce")!=null?jsonObject.getString("introduce"):null;
|
|
|
String expertise = jsonObject.get("expertise")!=null?jsonObject.getString("expertise"):null;
|
|
|
String photo = jsonObject.get("photo")!=null?jsonObject.getString("photo"):null;
|
|
|
String outpatientType = jsonObject.get("outpatientType")!=null?jsonObject.getString("outpatientType"):null;
|
|
|
String newSpecialDisease = jsonObject.get("specialDisease")!=null?jsonObject.getString("specialDisease"):null;
|
|
|
String newSpecialDiseaseCode = jsonObject.get("specialDiseaseCode")!=null?jsonObject.getString("specialDiseaseCode"):null;
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.findOne(doctorId);
|
|
|
if (doctorDO!=null){
|
|
|
doctorDO.setIntroduce(introduce);
|
|
|
doctorDO.setExpertise(expertise);
|
|
|
doctorDO.setPhoto(photo);
|
|
|
if (StringUtils.isNoneBlank(introduce)){
|
|
|
doctorDO.setIntroduce(introduce);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(expertise)){
|
|
|
doctorDO.setExpertise(expertise);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(photo)){
|
|
|
doctorDO.setPhoto(photo);
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNoneBlank(outpatientType)){
|
|
|
doctorDO.setOutpatientType(outpatientType);
|
|
|
}else {
|
|
@ -360,28 +400,44 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
|
|
|
doctorDO.setXtfzChargeType(jsonObject.get("XTFZType").toString());
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(jsonObject.get("XTFZFee")==null?"":jsonObject.get("XTFZFee").toString())){
|
|
|
String chargeType = findOrCreateChargeType(jsonObject.get("XTFZFee").toString(),doctorDO.getName());
|
|
|
doctorDO.setXtfzChargeType(chargeType);
|
|
|
}else {
|
|
|
if (jsonObject.get("XTFZType")!=null){
|
|
|
doctorDO.setXtfzChargeType(jsonObject.get("XTFZType").toString());
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(jsonObject.get("XGSZFee")==null?"":jsonObject.get("XGSZFee").toString())){
|
|
|
String chargeType = findOrCreateChargeType(jsonObject.get("XGSZFee").toString(),doctorDO.getName());
|
|
|
doctorDO.setXgszChargeType(chargeType);
|
|
|
}else {
|
|
|
if (jsonObject.get("XGSZType")!=null){
|
|
|
doctorDO.setXgszChargeType(jsonObject.get("XGSZType").toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//baseDoctorDao.update(doctorId,introduce,expertise,photo,outpatientType);
|
|
|
baseDoctorDao.save(doctorDO);
|
|
|
//删除医生旧专病门诊,保存新专病门诊
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
String sqlTotal ="SELECT " +
|
|
|
" COUNT(1) AS \"total\" " +
|
|
|
" FROM " +
|
|
|
" wlyy_doctor_special_disease a " +
|
|
|
" WHERE " +
|
|
|
" 1 = 1";
|
|
|
sqlTotal += " AND a.doctor_code =:doctorId";
|
|
|
params.put("doctorId",doctorId);
|
|
|
Long count = 0L;
|
|
|
List<Map<String, Object>> total = hibenateUtils.createSQLQuery(sqlTotal, params);
|
|
|
//mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
|
|
|
count = hibenateUtils.objTransformLong(total.get(0).get("total"));
|
|
|
if (count > 0){
|
|
|
specialDiseaseDao.deleteByDoctorCode(doctorId);
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(newSpecialDisease) && StringUtils.isNotBlank(newSpecialDiseaseCode)){
|
|
|
//删除医生旧专病门诊,保存新专病门诊
|
|
|
Map<String,Object> params = new HashedMap();
|
|
|
String sqlTotal ="SELECT " +
|
|
|
" COUNT(1) AS \"total\" " +
|
|
|
" FROM " +
|
|
|
" wlyy_doctor_special_disease a " +
|
|
|
" WHERE " +
|
|
|
" 1 = 1";
|
|
|
sqlTotal += " AND a.doctor_code =:doctorId";
|
|
|
params.put("doctorId",doctorId);
|
|
|
Long count = 0L;
|
|
|
List<Map<String, Object>> total = hibenateUtils.createSQLQuery(sqlTotal, params);
|
|
|
//mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
|
|
|
count = hibenateUtils.objTransformLong(total.get(0).get("total"));
|
|
|
if (count > 0){
|
|
|
specialDiseaseDao.deleteByDoctorCode(doctorId);
|
|
|
}
|
|
|
String[] split = newSpecialDisease.split(",");
|
|
|
String[] splitCode = newSpecialDiseaseCode.split(",");
|
|
|
specialDiseaseDao.deleteByDoctorCode(doctorId);
|