|
@ -32,7 +32,9 @@ import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
|
import com.yihu.wlyy.service.common.SMSService;
|
|
|
import com.yihu.wlyy.util.MD5;
|
|
|
import org.apache.commons.beanutils.converters.IntegerConverter;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
@ -40,7 +42,9 @@ import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.jdbc.core.RowMapper;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springside.modules.persistence.DynamicSpecifications;
|
|
@ -713,7 +717,7 @@ public class DoctorInfoService extends BaseService {
|
|
|
|
|
|
if (doctors.size() > 0) {
|
|
|
for (Doctor doc : doctors) {
|
|
|
if(workingDoctor.size() > end){
|
|
|
if (workingDoctor.size() > end) {
|
|
|
break;
|
|
|
}
|
|
|
if (type != 1) {
|
|
@ -739,13 +743,56 @@ public class DoctorInfoService extends BaseService {
|
|
|
return returnList;
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
public JSONArray findWorkingDoctorListByDept(String dept, String hospital, String level, String key) throws Exception {
|
|
|
String sql = "select * from wlyy_doctor where dept = ? and hospital = ? and status = 1";
|
|
|
Object[] args = null;
|
|
|
|
|
|
if (!StringUtils.isEmpty(level)) {
|
|
|
sql += " and level = ? ";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(key)) {
|
|
|
sql += " and name like ? ";
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotEmpty(level) && StringUtils.isNotEmpty(key)) {
|
|
|
args = new Object[]{dept, hospital, Integer.valueOf(level), "%" + key + "%"};
|
|
|
} else if (StringUtils.isEmpty(level) && StringUtils.isNotEmpty(key)) {
|
|
|
args = new Object[]{dept, hospital, "%" + key + "%"};
|
|
|
} else if (StringUtils.isNotEmpty(level) && StringUtils.isEmpty(key)) {
|
|
|
args = new Object[]{dept, hospital, Integer.valueOf(level)};
|
|
|
} else {
|
|
|
args = new Object[]{dept, hospital};
|
|
|
}
|
|
|
|
|
|
List<Doctor> doctors = jdbcTemplate.query(sql, args, new BeanPropertyRowMapper<Doctor>(Doctor.class));
|
|
|
JSONArray workingDoctor = new JSONArray();
|
|
|
if (doctors.size() > 0) {
|
|
|
for (Doctor doc : doctors) {
|
|
|
JSONObject iswork = workTimeService.isDoctorWorking(doc.getCode());
|
|
|
if (iswork.getString("status").equals("1")) {
|
|
|
JSONObject docJson = new JSONObject(doc);
|
|
|
if (docJson.has("password")) {
|
|
|
docJson.remove("password");
|
|
|
}
|
|
|
if (docJson.has("salt")) {
|
|
|
docJson.remove("salt");
|
|
|
}
|
|
|
workingDoctor.put(docJson);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return workingDoctor;
|
|
|
}
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
public void updateTeamHealthDoctor(String newDoctorCode, String oldDoctorCode, String patient) throws Exception {
|
|
|
//得到患者的签约信息
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patient);
|
|
|
//得到签约中的健管师
|
|
|
oldDoctorCode=signFamily.getDoctorHealth();
|
|
|
oldDoctorCode = signFamily.getDoctorHealth();
|
|
|
//如果存在旧的健管师
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(oldDoctorCode)) {
|
|
|
//判断患者对旧的健管师是否存在健康咨询
|
|
@ -786,16 +833,16 @@ public class DoctorInfoService extends BaseService {
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
public int updateTeamHealthDoctorsAll(String newDoctorCode,String doctor) throws Exception {
|
|
|
public int updateTeamHealthDoctorsAll(String newDoctorCode, String doctor) throws Exception {
|
|
|
List<String> patients = signFamilyDao.findNohealthByDoctor(doctor);
|
|
|
boolean hasNoTeam = false;
|
|
|
if(patients != null){
|
|
|
if (patients != null) {
|
|
|
for (String patient : patients) {
|
|
|
try {
|
|
|
if(updateTeamHealthDoctorAll(newDoctorCode, patient) == -1){
|
|
|
if (updateTeamHealthDoctorAll(newDoctorCode, patient) == -1) {
|
|
|
hasNoTeam = true;
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
@ -808,7 +855,7 @@ public class DoctorInfoService extends BaseService {
|
|
|
public int updateTeamHealthDoctorAll(String newDoctorCode, String patient) throws Exception {
|
|
|
//得到患者的签约信息
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patient);
|
|
|
if(StringUtils.isEmpty(signFamily.getTeamCode())){
|
|
|
if (StringUtils.isEmpty(signFamily.getTeamCode())) {
|
|
|
return -1;
|
|
|
}
|
|
|
Doctor newD = doctorDao.findByCode(newDoctorCode);
|