feat(surgicalschedule): 将手术安排日期查询改为日期范围选择 BUG#305

- 将前端日期选择器从单日期改为日期范围选择器
- 修改查询参数从 scheduleDate 改为 scheduleDateRange 数组
- 新增 scheduleDateStart 和 scheduleDateEnd 参数用于后端查询
- 在后端 DTO 中添加日期范围查询字段并配置格式化注解
- 更新 MyBatis XML 映射文件中的日期查询条件逻辑
- 实现前端日期范围到查询参数的转换处理逻辑
This commit is contained in:
2026-03-31 16:10:34 +08:00
parent b7993885bb
commit 6accaa35c9
3 changed files with 50 additions and 16 deletions

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.openhis.surgicalschedule.domain.OpSchedule; import com.openhis.surgicalschedule.domain.OpSchedule;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate; import java.time.LocalDate;
@@ -18,6 +19,20 @@ import java.time.LocalDate;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class OpScheduleDto extends OpSchedule { public class OpScheduleDto extends OpSchedule {
/**
* 手术安排日期开始(查询用)
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate scheduleDateStart;
/**
* 手术安排日期结束(查询用)
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate scheduleDateEnd;
/** /**
* 患者姓名 * 患者姓名
*/ */

View File

@@ -47,8 +47,11 @@
<if test="dto.applyDeptId != null and dto.applyDeptId != ''"> <if test="dto.applyDeptId != null and dto.applyDeptId != ''">
AND cs.apply_dept_id = #{dto.applyDeptId} AND cs.apply_dept_id = #{dto.applyDeptId}
</if> </if>
<if test="dto.scheduleDate != null"> <if test="dto.scheduleDateStart != null">
AND os.schedule_date = #{dto.scheduleDate} AND DATE(os.schedule_date) &gt;= #{dto.scheduleDateStart}
</if>
<if test="dto.scheduleDateEnd != null">
AND DATE(os.schedule_date) &lt;= #{dto.scheduleDateEnd}
</if> </if>
<if test="dto.operCode != null and dto.operCode != ''"> <if test="dto.operCode != null and dto.operCode != ''">
AND os.oper_code LIKE CONCAT('%', #{dto.operCode}, '%') AND os.oper_code LIKE CONCAT('%', #{dto.operCode}, '%')
@@ -134,7 +137,8 @@
<if test="dto.applyId != null"> AND os.apply_id = #{dto.applyId}</if> <if test="dto.applyId != null"> AND os.apply_id = #{dto.applyId}</if>
<if test="dto.operCode != null and dto.operCode != ''"> AND os.oper_code = #{dto.operCode}</if> <if test="dto.operCode != null and dto.operCode != ''"> AND os.oper_code = #{dto.operCode}</if>
<if test="dto.operName != null and dto.operName != ''"> AND os.oper_name LIKE CONCAT('%', #{dto.operName}, '%')</if> <if test="dto.operName != null and dto.operName != ''"> AND os.oper_name LIKE CONCAT('%', #{dto.operName}, '%')</if>
<if test="dto.scheduleDate != null"> AND os.schedule_date = #{dto.scheduleDate}</if> <if test="dto.scheduleDateStart != null"> AND DATE(os.schedule_date) &gt;= #{dto.scheduleDateStart}</if>
<if test="dto.scheduleDateEnd != null"> AND DATE(os.schedule_date) &lt;= #{dto.scheduleDateEnd}</if>
<if test="dto.orgId != null and dto.orgId != ''"> AND cs.org_id = #{dto.orgId}</if> <if test="dto.orgId != null and dto.orgId != ''"> AND cs.org_id = #{dto.orgId}</if>
<if test="dto.applyDeptId != null and dto.applyDeptId != ''"> AND cs.apply_dept_id = #{dto.applyDeptId}</if> <if test="dto.applyDeptId != null and dto.applyDeptId != ''"> AND cs.apply_dept_id = #{dto.applyDeptId}</if>
<if test="dto.patientName != null and dto.patientName != ''"> AND ap.name LIKE CONCAT('%', #{dto.patientName}, '%')</if> <if test="dto.patientName != null and dto.patientName != ''"> AND ap.name LIKE CONCAT('%', #{dto.patientName}, '%')</if>

View File

@@ -11,16 +11,16 @@
style="width: 200px" style="width: 200px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="安排时间" prop="scheduleDate"> <el-form-item label="安排时间" prop="scheduleDateRange">
<el-tooltip :content="queryParams.scheduleDate" placement="top" :disabled="!queryParams.scheduleDate"> <el-date-picker
<el-date-picker v-model="queryParams.scheduleDateRange"
v-model="queryParams.scheduleDate" type="daterange"
type="date" range-separator=""
placeholder="请选择安排时间" start-placeholder="开始日期"
value-format="YYYY-MM-DD" end-placeholder="结束日期"
style="width: 200px" value-format="YYYY-MM-DD"
/> style="width: 240px"
</el-tooltip> />
</el-form-item> </el-form-item>
<el-form-item label="卫生机构" prop="tenantId"> <el-form-item label="卫生机构" prop="tenantId">
<el-select v-model="queryParams.tenantId" placeholder="请选择卫生机构" style="width: 200px"> <el-select v-model="queryParams.tenantId" placeholder="请选择卫生机构" style="width: 200px">
@@ -872,7 +872,9 @@ const surgeryList = ref([])
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
scheduleDate: undefined, scheduleDateRange: [],
scheduleDateStart: undefined,
scheduleDateEnd: undefined,
tenantId: undefined, tenantId: undefined,
applyDeptId: undefined, applyDeptId: undefined,
patientName: undefined, patientName: undefined,
@@ -1166,7 +1168,18 @@ function loadOperatingRoomList() {
// 获取手术安排列表 // 获取手术安排列表
function getList() { function getList() {
loading.value = true loading.value = true
getSurgerySchedulePage(queryParams).then((res) => { // 处理日期范围
const params = { ...queryParams }
if (params.scheduleDateRange && params.scheduleDateRange.length === 2) {
params.scheduleDateStart = params.scheduleDateRange[0]
params.scheduleDateEnd = params.scheduleDateRange[1]
} else {
params.scheduleDateStart = undefined
params.scheduleDateEnd = undefined
}
delete params.scheduleDateRange
getSurgerySchedulePage(params).then((res) => {
surgeryList.value = res.data.records surgeryList.value = res.data.records
total.value = res.data.total total.value = res.data.total
}).catch(error => { }).catch(error => {
@@ -1192,7 +1205,9 @@ function resetQuery() {
Object.assign(queryParams, { Object.assign(queryParams, {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
scheduleDate: undefined, scheduleDateRange: [],
scheduleDateStart: undefined,
scheduleDateEnd: undefined,
tenantId: undefined, tenantId: undefined,
applyDeptId: undefined, applyDeptId: undefined,
patientName: undefined, patientName: undefined,