|
@ -4,10 +4,15 @@ package com.yihu.wlyy.service.specialist;/**
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.repository.organization.HospitalDao;
|
|
import com.yihu.wlyy.repository.organization.HospitalDao;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
|
import com.yihu.wlyy.service.app.family.FamilyService;
|
|
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@ -34,6 +39,10 @@ public class SpecialistHospitalItemService extends BaseService {
|
|
private HttpClientUtil httpClientUtil;
|
|
private HttpClientUtil httpClientUtil;
|
|
@Value("${specialist.url}")
|
|
@Value("${specialist.url}")
|
|
private String specialistUrl;
|
|
private String specialistUrl;
|
|
|
|
@Autowired
|
|
|
|
private DoctorService doctorService;
|
|
|
|
@Autowired
|
|
|
|
private FamilyService familyService;
|
|
|
|
|
|
public List<Hospital> selectHospital(){
|
|
public List<Hospital> selectHospital(){
|
|
List<Hospital> hospitals = hospitalDao.findAllHospital();
|
|
List<Hospital> hospitals = hospitalDao.findAllHospital();
|
|
@ -45,16 +54,16 @@ public class SpecialistHospitalItemService extends BaseService {
|
|
* @param hospitals
|
|
* @param hospitals
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject selectByHospital(String hospitals){
|
|
|
|
|
|
public JSONArray selectByHospital(String hospitals){
|
|
String response = null;
|
|
String response = null;
|
|
JSONObject object = new JSONObject();
|
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
String url =specialistUrl + "svr-specialist/selectByHospital";
|
|
String url =specialistUrl + "svr-specialist/selectByHospital";
|
|
Map<String,String> params = new HashMap<>();
|
|
Map<String,String> params = new HashMap<>();
|
|
params.put("hospitals",hospitals);
|
|
params.put("hospitals",hospitals);
|
|
try {
|
|
try {
|
|
response = httpClientUtil.httpPost(url,params);
|
|
response = httpClientUtil.httpPost(url,params);
|
|
object = JSONObject.parseObject(response);
|
|
|
|
JSONArray array = object.getJSONArray("detailModelList");
|
|
|
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
|
array = object.getJSONArray("detailModelList");
|
|
for (int i = 0;i<array.size();i++){
|
|
for (int i = 0;i<array.size();i++){
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
String hospital = jsonObject.getString("hospital");
|
|
String hospital = jsonObject.getString("hospital");
|
|
@ -65,7 +74,7 @@ public class SpecialistHospitalItemService extends BaseService {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
logger.error(e.getMessage());
|
|
logger.error(e.getMessage());
|
|
}
|
|
}
|
|
return object;
|
|
|
|
|
|
return array;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -75,16 +84,16 @@ public class SpecialistHospitalItemService extends BaseService {
|
|
* @param ids
|
|
* @param ids
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject selectByIds(String ids){
|
|
|
|
|
|
public JSONArray selectByIds(String ids){
|
|
String response = null;
|
|
String response = null;
|
|
JSONObject object = new JSONObject();
|
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
String url =specialistUrl + "svr-specialist/selectById";
|
|
String url =specialistUrl + "svr-specialist/selectById";
|
|
Map<String,String> params = new HashMap<>();
|
|
Map<String,String> params = new HashMap<>();
|
|
params.put("ids",ids);
|
|
params.put("ids",ids);
|
|
try {
|
|
try {
|
|
response = httpClientUtil.httpPost(url,params);
|
|
response = httpClientUtil.httpPost(url,params);
|
|
object = JSONObject.parseObject(response);
|
|
|
|
JSONArray array = object.getJSONArray("detailModelList");
|
|
|
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
|
array = object.getJSONArray("detailModelList");
|
|
for (int i = 0;i<array.size();i++){
|
|
for (int i = 0;i<array.size();i++){
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
String hospital = jsonObject.getString("hospital");
|
|
String hospital = jsonObject.getString("hospital");
|
|
@ -95,6 +104,27 @@ public class SpecialistHospitalItemService extends BaseService {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
logger.error(e.getMessage());
|
|
logger.error(e.getMessage());
|
|
}
|
|
}
|
|
return object;
|
|
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONArray getHospital(String doctor, String patient, String serviceItemName) throws Exception{
|
|
|
|
String response = null;
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
String url =specialistUrl + "svr-specialist/selectByHospital1";
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
SignFamily signFamily = new SignFamily();
|
|
|
|
Doctor d = doctorService.findDoctorByCode(doctor);
|
|
|
|
params.put("docHospital",d.getHospital());
|
|
|
|
if(StringUtils.isNotBlank(patient)) {
|
|
|
|
signFamily = familyService.findByPatient(patient);
|
|
|
|
params.put("hospital", signFamily.getHospital());
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(serviceItemName)) {
|
|
|
|
params.put("serviceItemName", serviceItemName);
|
|
|
|
}
|
|
|
|
response = httpClientUtil.httpPost(url, params);
|
|
|
|
object = JSONObject.parseObject(response);
|
|
|
|
JSONArray array = object.getJSONArray("detailModelList");
|
|
|
|
return array;
|
|
}
|
|
}
|
|
}
|
|
}
|