如何使用Google Healthcare API Node.js按起止日期过滤Appointment
解决Google Healthcare API中Appointment日期范围过滤的重复参数问题
在Google Healthcare Node.js客户端中,重复的查询参数可以通过数组形式传递,客户端会自动将数组元素转换为多个同名的URL查询参数,完美匹配你需要的date=ge2023-02-03T04:00:00.000Z&date=le2023-02-05T04:00:00.000Z格式。
修改后的代码如下:
const parent = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}`; const params = { parent, resourceType, date: [`ge${start}`, `le${end}`] // 用数组传递多个date过滤条件 }; const resource = await healthcare.projects.locations.datasets.fhirStores.fhir.search(params);
这样设置后,客户端会自动生成包含两个date参数的查询字符串,实现日期范围(大于等于起始时间且小于等于结束时间)的过滤逻辑。
内容的提问来源于stack exchange,提问作者Jorge Luis
相关产品推荐
相关产品推荐

