|
@ -40,6 +40,16 @@ public class DoctorWorkTimeService extends BaseService {
|
|
|
@Autowired
|
|
|
private FamousDoctorTimesRemainDao timesRemainDao;
|
|
|
|
|
|
@Transactional
|
|
|
public void updateDoctorWorkTime(String doctorCode) {
|
|
|
List<WlyyDoctorWorkTime> wlyyDoctorWorkTimess = doctorWorkTimeDao.findDoctorWorkTimes(doctorCode);
|
|
|
if (wlyyDoctorWorkTimess != null && wlyyDoctorWorkTimess.size() > 0) {
|
|
|
wlyyDoctorWorkTimess.stream().forEach( wt->{
|
|
|
wt.setReceiveConsult("1");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询医生工作时间列表
|
|
|
*
|
|
@ -58,10 +68,10 @@ public class DoctorWorkTimeService extends BaseService {
|
|
|
result.put("workTime", workTime != null ? new JSONObject(workTime) : "");
|
|
|
result.put("workWeeks", workWeekList != null ? new JSONArray(workWeekList) : "");
|
|
|
JSONObject docJson = new JSONObject(doc);
|
|
|
if(docJson.has("password")) {
|
|
|
if (docJson.has("password")) {
|
|
|
docJson.remove("password");
|
|
|
}
|
|
|
if(docJson.has("salt")) {
|
|
|
if (docJson.has("salt")) {
|
|
|
docJson.remove("salt");
|
|
|
}
|
|
|
result.put("doctor", doc != null ? docJson : "");
|
|
@ -182,10 +192,10 @@ public class DoctorWorkTimeService extends BaseService {
|
|
|
doctorWorkWeekDao.save(weeks);
|
|
|
}
|
|
|
|
|
|
if(doc.getIsFamous() != null && doc.getIsFamous() == 1){
|
|
|
JSONObject json = isDoctorWorkingToday(doctor);
|
|
|
if (doc.getIsFamous() != null && doc.getIsFamous() == 1) {
|
|
|
JSONObject json = isDoctorWorkingToday(doctor);
|
|
|
|
|
|
if(json.getString("status").equals("1")){
|
|
|
if (json.getString("status").equals("1")) {
|
|
|
DoctorFamousConsultTimesRemain timesRemain = timesRemainDao.findByDoctorAndConsultDate(doctor,
|
|
|
new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
|
|
|
|
|
@ -375,7 +385,7 @@ public class DoctorWorkTimeService extends BaseService {
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject isFamousDoctorWorking(String doctor) throws Exception{
|
|
|
public JSONObject isFamousDoctorWorking(String doctor) throws Exception {
|
|
|
JSONObject json = new JSONObject();
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
int week = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
|
@ -414,7 +424,7 @@ public class DoctorWorkTimeService extends BaseService {
|
|
|
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
|
|
int minute = calendar.get(Calendar.MINUTE);
|
|
|
String start = "";
|
|
|
String end ="";
|
|
|
String end = "";
|
|
|
String current = (hour < 10 ? ("0" + hour) : hour) + ":" + (hour < 10 ? ("0" + minute) : minute);
|
|
|
|
|
|
// 早上
|
|
@ -441,7 +451,7 @@ public class DoctorWorkTimeService extends BaseService {
|
|
|
if (currentEnd.length() == 4) {
|
|
|
currentEnd = "0" + currentEnd;
|
|
|
}
|
|
|
if(StringUtils.isEmpty(start)) {
|
|
|
if (StringUtils.isEmpty(start)) {
|
|
|
start = currentStart;
|
|
|
}
|
|
|
end = currentEnd;
|
|
@ -456,13 +466,13 @@ public class DoctorWorkTimeService extends BaseService {
|
|
|
if (currentEnd.length() == 4) {
|
|
|
currentEnd = "0" + currentEnd;
|
|
|
}
|
|
|
if(StringUtils.isEmpty(start)) {
|
|
|
if (StringUtils.isEmpty(start)) {
|
|
|
start = currentStart;
|
|
|
}
|
|
|
end = currentEnd;
|
|
|
}
|
|
|
|
|
|
if(current.compareTo(start) >= 0 && current.compareTo(end) < 0){
|
|
|
if (current.compareTo(start) >= 0 && current.compareTo(end) < 0) {
|
|
|
flag = 1;
|
|
|
}
|
|
|
|
|
@ -604,9 +614,9 @@ public class DoctorWorkTimeService extends BaseService {
|
|
|
if (plus >= 0) {
|
|
|
timesRemain.setTimesRemain(timesRemain.getTimesRemain() + plus);
|
|
|
} else {
|
|
|
if(workTime.getFamousConsultTimes() >= Math.abs(plus)){
|
|
|
timesRemain.setTimesRemain(timesRemain.getTimesRemain() - Math.abs(plus));
|
|
|
}else{
|
|
|
if (workTime.getFamousConsultTimes() >= Math.abs(plus)) {
|
|
|
timesRemain.setTimesRemain(timesRemain.getTimesRemain() - Math.abs(plus));
|
|
|
} else {
|
|
|
timesRemain.setTimesRemain(0);
|
|
|
}
|
|
|
}
|
|
@ -706,7 +716,7 @@ public class DoctorWorkTimeService extends BaseService {
|
|
|
DoctorFamousConsultTimesRemain timesRemain = timesRemainDao.findByDoctorAndConsultDate(doc.getCode(), date);
|
|
|
if (timesRemain == null) {
|
|
|
timesRemain = new DoctorFamousConsultTimesRemain();
|
|
|
}else{
|
|
|
} else {
|
|
|
continue;
|
|
|
}
|
|
|
timesRemain.setDoctor(doc.getCode());
|