Merge branch 'jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支' into dev_gy_0920

This commit is contained in:
mengkuiliang 2023-10-17 16:34:20 +08:00
commit 3bb2fd911f
13 changed files with 305 additions and 43 deletions

View File

@ -0,0 +1,47 @@
package com.xinelu.applet.controller.appletscheduleplan;
import com.xinelu.applet.dto.scheduleplan.SchedulePlanDTO;
import com.xinelu.applet.service.scheduleplan.IAppletSchedulePlanService;
import com.xinelu.applet.utils.AppointmentTimeUtil;
import com.xinelu.applet.vo.specialdisease.WeekDaysVO;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.R;
import com.xinelu.manage.vo.scheduleplan.SchedulePlanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.time.LocalDate;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.compress.utils.Lists;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @description: 小程序医生排班计划控制器
* @author: haown
* @create: 2023-09-22 10:28
**/
@Api(tags = "小程序医生排班计划控制器")
@RestController
@RequestMapping("/nurseApplet/schedule/plan")
public class AppletSchedulePlanController extends BaseController {
@Resource
private IAppletSchedulePlanService appletPlanService;
@Resource
private AppointmentTimeUtil appointmentTimeUtil;
@ApiOperation("查询医生排班明细")
@GetMapping("/getListByDoctor")
public R<List<SchedulePlanVO>> getListByDoctor(SchedulePlanDTO plan) {
LocalDate nowTime = LocalDate.now();
List<WeekDaysVO> weekDaysList = Lists.newArrayList();
appointmentTimeUtil.setWeekDayAndWeekDate(nowTime, weekDaysList);
plan.setWeekdays(weekDaysList);
List<SchedulePlanVO> list = appletPlanService.getListByDoctor(plan);
return R.ok(list);
}
}

View File

@ -1,35 +0,0 @@
package com.xinelu.applet.controller.appletscheduleplandetail;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.R;
import com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail;
import com.xinelu.manage.service.scheduleplandetail.ISchedulePlanDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @description: 小程序医生排班计划控制器
* @author: haown
* @create: 2023-09-22 10:28
**/
@Api(tags = "小程序医生排班计划控制器")
@RestController
@RequestMapping("/nurseApplet/schedule/plandetail")
public class AppletSchedulePlanController extends BaseController {
@Resource
private ISchedulePlanDetailService planDetailService;
@ApiOperation("查询医生排班明细")
@GetMapping("/getList")
public R<List<SchedulePlanDetail>> getList(SchedulePlanDetail planDetail) {
List<SchedulePlanDetail> list = planDetailService.getList(planDetail);
return R.ok(list);
}
}

View File

@ -0,0 +1,18 @@
package com.xinelu.applet.dto.scheduleplan;
import com.xinelu.applet.vo.specialdisease.WeekDaysVO;
import java.util.List;
import lombok.Data;
/**
* @description: 小程序医生排班时间列表查询传输对象
* @author: haown
* @create: 2023-10-17 10:51
**/
@Data
public class SchedulePlanDTO {
private Long doctorId;
private List<WeekDaysVO> weekdays;
}

View File

@ -151,7 +151,7 @@ public class HealthConsultationServiceImpl implements HealthConsultationService
if (Objects.isNull(patientInfo)) {
return AjaxResult.error("用户信息不存在,无法预约专家!");
}
//根据id查询当前专家是否存在
// 根据id查询当前专家是否存在
HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoMapper.selectHospitalPersonInfoById(healthConsultationOrderDTO.getHospitalPersonId());
if (Objects.isNull(hospitalPersonInfo)) {
return AjaxResult.error("当前专家信息不存在,请重新预约!");

View File

@ -0,0 +1,15 @@
package com.xinelu.applet.service.scheduleplan;
import com.xinelu.applet.dto.scheduleplan.SchedulePlanDTO;
import com.xinelu.manage.vo.scheduleplan.SchedulePlanVO;
import java.util.List;
/**
* @author haown
* @description 针对表schedule_plan(医生排班计划表)的数据库操作Service
* @createDate 2023-09-21 17:16:40
*/
public interface IAppletSchedulePlanService {
List<SchedulePlanVO> getListByDoctor(SchedulePlanDTO schedulePlan);
}

View File

@ -0,0 +1,90 @@
package com.xinelu.applet.service.scheduleplan.impl;
import com.xinelu.applet.dto.scheduleplan.SchedulePlanDTO;
import com.xinelu.applet.service.scheduleplan.IAppletSchedulePlanService;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail;
import com.xinelu.manage.mapper.scheduleplandetail.SchedulePlanDetailMapper;
import com.xinelu.manage.vo.scheduleplan.SchedulePlanVO;
import com.xinelu.manage.vo.scheduleplandetail.SchedulePlanDetailVO;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
/**
* @author haown
* @description 针对表schedule_plan(医生排班计划表)的数据库操作Service实现
* @createDate 2023-09-21 17:16:40
*/
@Service
public class AppletSchedulePlanServiceImpl implements IAppletSchedulePlanService {
@Resource
private SchedulePlanDetailMapper planDetailMapper;
@Override public List<SchedulePlanVO> getListByDoctor(SchedulePlanDTO schedulePlan) {
List<SchedulePlanVO> retList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(schedulePlan.getWeekdays())) {
for (int i = 0; i < schedulePlan.getWeekdays().size(); i++) {
// 查询排班明细表
SchedulePlanDetail query = new SchedulePlanDetail();
query.setDoctorId(schedulePlan.getDoctorId());
query.setScheduleDate(schedulePlan.getWeekdays().get(i).getHealthConsultationDate());
query.setAfter(1);
List<SchedulePlanDetail> detailList = planDetailMapper.getList(query);
List<SchedulePlanDetailVO> morningList = new ArrayList<>();
List<SchedulePlanDetailVO> afternoonList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(detailList)) {
detailList.forEach(detail -> {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
if (StringUtils.equals("1", detail.getType())) {
morningList.add(SchedulePlanDetailVO.builder().scheduleTimeSlot(detail.getScheduleStartTime().format(formatter) + "~" + detail.getScheduleEndTime().format(formatter))
.status(StringUtils.equals("0", detail.getStatus()) && StringUtils.equals("0", detail.getApplyState())).build());
}
if (StringUtils.equals("2", detail.getType())) {
afternoonList.add(SchedulePlanDetailVO.builder().scheduleTimeSlot(detail.getScheduleStartTime().format(formatter) + "~" + detail.getScheduleEndTime().format(formatter))
.status(StringUtils.equals("0", detail.getStatus()) && StringUtils.equals("0", detail.getApplyState())).build());
}
});
}
SchedulePlanVO schedulePlanVO = SchedulePlanVO.builder()
.scheduleDate(schedulePlan.getWeekdays().get(i).getHealthConsultationDate())
.week(schedulePlan.getWeekdays().get(i).getWeek())
.morningList(morningList)
.afternoonList(afternoonList).build();
retList.add(schedulePlanVO);
}
}
return retList;
}
/**
* 生成计划明细
* @param number人数
* @param startTime开始时间
* @return
*/
private List<SchedulePlanDetail> genPlanDetail(SchedulePlanDetail schedulePlanDetail, int number, LocalTime startTime, int minutesPerPatient) {
List<SchedulePlanDetail> planDetails = new ArrayList<>();
for (int i = 0; i < number; i++) {
SchedulePlanDetail planDetail = new SchedulePlanDetail();
BeanUtils.copyBeanProp(planDetail, schedulePlanDetail);
planDetail.setScheduleStartTime(startTime.plusMinutes((long) minutesPerPatient * i));
planDetail.setScheduleEndTime(startTime.plusMinutes((long) minutesPerPatient * (i + 1)));
planDetail.setApplyState("0");
planDetails.add(planDetail);
}
return planDetails;
}
}

View File

@ -46,6 +46,9 @@ public class SchedulePlanDetail implements Serializable {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private LocalDate scheduleDate;
@ApiModelProperty("类型1上午2下午")
private String type;
/**
* 开始时间
*/

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.service.scheduleplan;
import com.xinelu.manage.domain.scheduleplan.SchedulePlan;
import com.xinelu.manage.vo.scheduleplan.SchedulePlanVO;
import java.util.List;
/**
@ -14,5 +15,5 @@ public interface ISchedulePlanService {
int save(SchedulePlan schedulePlan) throws Exception;
List<SchedulePlanVO> getListByDoctor(SchedulePlan schedulePlan);
}

View File

@ -9,12 +9,16 @@ import com.xinelu.manage.mapper.schedule.ScheduleMapper;
import com.xinelu.manage.mapper.scheduleplan.SchedulePlanMapper;
import com.xinelu.manage.mapper.scheduleplandetail.SchedulePlanDetailMapper;
import com.xinelu.manage.service.scheduleplan.ISchedulePlanService;
import com.xinelu.manage.vo.scheduleplan.SchedulePlanVO;
import com.xinelu.manage.vo.scheduleplandetail.SchedulePlanDetailVO;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -71,6 +75,7 @@ public class SchedulePlanServiceImpl implements ISchedulePlanService {
schedulePlanDetail.setStatus("0");
// 生成上午计划
if (schedule.getForenoonStartTime() != null && schedule.getForenoonEndTime() != null) {
schedulePlanDetail.setType("1");
// 根据时间间隔计算时间段
long forenoonMinutes = ChronoUnit.MINUTES.between(schedule.getForenoonStartTime(), schedule.getForenoonEndTime());
if (forenoonMinutes % schedulePlan.getMinutesPerPatient() == 0) {
@ -84,6 +89,7 @@ public class SchedulePlanServiceImpl implements ISchedulePlanService {
// 生成下午计划
if (schedule.getAfternoonStartTime() != null && schedule.getAfternoonEndTime() != null) {
// 根据时间间隔计算时间段
schedulePlanDetail.setType("2");
long afternoonMinutes = ChronoUnit.MINUTES.between(schedule.getAfternoonStartTime(), schedule.getAfternoonEndTime());
if (afternoonMinutes % schedulePlan.getMinutesPerPatient() == 0) {
int number = (int) (afternoonMinutes / schedulePlan.getMinutesPerPatient());
@ -103,6 +109,41 @@ public class SchedulePlanServiceImpl implements ISchedulePlanService {
return flag;
}
@Override public List<SchedulePlanVO> getListByDoctor(SchedulePlan schedulePlan) {
List<SchedulePlanVO> retList = new ArrayList<>();
LocalDate localDate = LocalDate.now();
for (int i = 0; i < 6; i++) {
// 查询排班明细表
SchedulePlanDetail query = new SchedulePlanDetail();
query.setDoctorId(schedulePlan.getDoctorId());
query.setScheduleDate(localDate.plusDays(i));
query.setAfter(1);
List<SchedulePlanDetail> detailList = planDetailMapper.getList(query);
List<SchedulePlanDetailVO> morningList = new ArrayList<>();
List<SchedulePlanDetailVO> afternoonList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(detailList)) {
detailList.forEach(detail -> {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
if (StringUtils.equals("1", detail.getType())) {
morningList.add(SchedulePlanDetailVO.builder().scheduleTimeSlot(detail.getScheduleStartTime().format(formatter) + "~" + detail.getScheduleEndTime().format(formatter))
.status(StringUtils.equals("0", detail.getStatus()) && StringUtils.equals("0",detail.getApplyState())).build());
}
if (StringUtils.equals("2", detail.getType())) {
afternoonList.add(SchedulePlanDetailVO.builder().scheduleTimeSlot(detail.getScheduleStartTime().format(formatter) + "~" + detail.getScheduleEndTime().format(formatter))
.status(StringUtils.equals("0", detail.getStatus()) && StringUtils.equals("0",detail.getApplyState())).build());
}
});
}
SchedulePlanVO schedulePlanVO = SchedulePlanVO.builder()
.scheduleDate(localDate.plusDays(i))
.morningList(morningList)
.afternoonList(afternoonList).build();
retList.add(schedulePlanVO);
}
return retList;
}
/**
* 生成计划明细
* @param number人数

View File

@ -13,4 +13,5 @@ public interface ISchedulePlanDetailService {
int save(SchedulePlanDetail planDetail);
List<SchedulePlanDetail> getList(SchedulePlanDetail planDetail);
}

View File

@ -0,0 +1,38 @@
package com.xinelu.manage.vo.scheduleplan;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.manage.vo.scheduleplandetail.SchedulePlanDetailVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDate;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 医生排班计划视图类
* @author: haown
* @create: 2023-10-17 09:15
**/
@ApiModel("医生排班计划视图类")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SchedulePlanVO {
@ApiModelProperty("排班日期")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private LocalDate scheduleDate;
@ApiModelProperty("周几")
private String week;
@ApiModelProperty("上午排班计划")
public List<SchedulePlanDetailVO> morningList;
@ApiModelProperty("下午排班计划")
public List<SchedulePlanDetailVO> afternoonList;
}

View File

@ -0,0 +1,30 @@
package com.xinelu.manage.vo.scheduleplandetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 医生排班计划明细视图类
* @author: haown
* @create: 2023-10-17 09:20
**/
@ApiModel("医生排班计划明细视图类")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SchedulePlanDetailVO {
@ApiModelProperty("预约时间段")
private String scheduleTimeSlot;
/**
* 可预约状态0可预约 1不可预约
*/
@ApiModelProperty("可预约状态0可预约 1不可预约")
private Boolean status;
}

View File

@ -10,6 +10,7 @@
<result property="doctorId" column="doctor_id" jdbcType="BIGINT"/>
<result property="doctorName" column="doctor_name" jdbcType="VARCHAR"/>
<result property="scheduleDate" column="schedule_date" jdbcType="DATE"/>
<result property="type" column="type" jdbcType="CHAR"/>
<result property="scheduleStartTime" column="schedule_start_time" jdbcType="TIME"/>
<result property="scheduleEndTime" column="schedule_end_time" jdbcType="TIME"/>
<result property="status" column="status" jdbcType="CHAR"/>
@ -18,7 +19,7 @@
<sql id="Base_Column_List">
id,schedule_plan_id,doctor_id,
doctor_name,schedule_date,schedule_start_time,
doctor_name,schedule_date,`type`,schedule_start_time,
schedule_end_time,status,apply_state
</sql>
@ -36,10 +37,10 @@
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail" useGeneratedKeys="true">
insert into schedule_plan_detail
( id,schedule_plan_id,doctor_id
,doctor_name,schedule_date,schedule_start_time
,doctor_name,schedule_date,`type`,schedule_start_time
,schedule_end_time,status,apply_state)
values (#{id,jdbcType=BIGINT},#{schedulePlanId,jdbcType=BIGINT},#{doctorId,jdbcType=BIGINT}
,#{doctorName,jdbcType=VARCHAR},#{scheduleDate,jdbcType=DATE},#{scheduleStartTime,jdbcType=TIME}
,#{doctorName,jdbcType=VARCHAR},#{scheduleDate,jdbcType=DATE},#{type,jdbcType=CHAR},#{scheduleStartTime,jdbcType=TIME}
,#{scheduleEndTime,jdbcType=TIME},#{status,jdbcType=CHAR},#{applyState,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail" useGeneratedKeys="true">
@ -50,6 +51,7 @@
<if test="doctorId != null">doctor_id,</if>
<if test="doctorName != null">doctor_name,</if>
<if test="scheduleDate != null">schedule_date,</if>
<if test="type != null">type,</if>
<if test="scheduleStartTime != null">schedule_start_time,</if>
<if test="scheduleEndTime != null">schedule_end_time,</if>
<if test="status != null">status,</if>
@ -61,7 +63,8 @@
<if test="doctorId != null">#{doctorId,jdbcType=BIGINT},</if>
<if test="doctorName != null">#{doctorName,jdbcType=VARCHAR},</if>
<if test="scheduleDate != null">#{scheduleDate,jdbcType=DATE},</if>
<if test="scheduleStartTime != null">#{scheduleStartTime,jdbcType=TIME},</if>
<if test="type != null">#{type,jdbcType=CHAR},</if>
<if test="scheduleStartTime != null">#{scheduleStartTime,jdbcType=TIME},</if>
<if test="scheduleEndTime != null">#{scheduleEndTime,jdbcType=TIME},</if>
<if test="status != null">#{status,jdbcType=CHAR},</if>
<if test="applyState != null">#{applyState,jdbcType=VARCHAR},</if>
@ -82,6 +85,9 @@
<if test="scheduleDate != null">
schedule_date = #{scheduleDate,jdbcType=DATE},
</if>
<if test="type != null">
`type` = #{type,jdbcType=CHAR},
</if>
<if test="scheduleStartTime != null">
schedule_start_time = #{scheduleStartTime,jdbcType=TIME},
</if>
@ -104,6 +110,7 @@
doctor_id = #{doctorId,jdbcType=BIGINT},
doctor_name = #{doctorName,jdbcType=VARCHAR},
schedule_date = #{scheduleDate,jdbcType=DATE},
type = #{type,jdbcType=CHAR},
schedule_start_time = #{scheduleStartTime,jdbcType=TIME},
schedule_end_time = #{scheduleEndTime,jdbcType=TIME},
status = #{status,jdbcType=CHAR},
@ -113,11 +120,11 @@
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail" useGeneratedKeys="true">
insert into schedule_plan_detail
(schedule_plan_id,doctor_id
,doctor_name,schedule_date,schedule_start_time
,doctor_name,schedule_date,type,schedule_start_time
,schedule_end_time,status,apply_state) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.schedulePlanId},#{item.doctorId}
,#{item.doctorName},#{item.scheduleDate},#{item.scheduleStartTime}
,#{item.doctorName},#{item.scheduleDate},#{item.type},#{item.scheduleStartTime}
,#{item.scheduleEndTime},#{item.status},#{item.applyState})
</foreach>
</insert>
@ -136,6 +143,9 @@
<if test="scheduleDate != null">
and schedule_date = #{scheduleDate,jdbcType=DATE}
</if>
<if test="type != null">
and `type` = #{type,jdbcType=CHAR}
</if>
<if test="scheduleStartTime != null">
and DATE_FORMAT(schedule_start_time, '%H%i') &lt;= DATE_FORMAT(#{scheduleStartTime}, '%H%i')
</if>
@ -145,6 +155,9 @@
<if test="after != null">
and DATE_FORMAT(schedule_end_time, '%H%i') &lt; DATE_FORMAT(now(), '%H%i')
</if>
<if test="status != null">
status = #{status,jdbcType=CHAR}
</if>
</where>
</select>
</mapper>