Curl 将捆绑中的患者导入FHIR服务器
我正在尝试使用cURL将患者资源包导入FHIR服务器。这是我的命令和回应:Curl 将捆绑中的患者导入FHIR服务器,curl,bundle,hl7-fhir,Curl,Bundle,Hl7 Fhir,我正在尝试使用cURL将患者资源包导入FHIR服务器。这是我的命令和回应: curl --header "Content-Type:application/json" -X POST -k -i -u 'fhiruser:change-password' --data @10patients.json 'https://localhost:9443/fhir-server/api/v4/Bundle' HTTP/2 201 location: https://localho
curl --header "Content-Type:application/json" -X POST -k -i -u 'fhiruser:change-password' --data @10patients.json 'https://localhost:9443/fhir-server/api/v4/Bundle'
HTTP/2 201
location: https://localhost:9443/fhir-server/api/v4/Bundle/17621baad7c-6fdc1153-38d8-4987-9be3-0d4f0983dbac/_history/1
etag: W/"1"
last-modified: Wed, 02 Dec 2020 04:34:10 GMT
date: Wed, 02 Dec 2020 04:34:10 GMT
content-length: 0
content-language: en-US
这似乎奏效了。如果我自己得到包裹,我可以做到;但是,如果我试图通过id访问任何单个患者资源或获取所有患者资源,我将一无所获。似乎它们只能作为捆绑包的一部分访问。例如:
curl -i -s -k -u 'fhiruser:change-password' -X GET 'https://localhost:9443/fhir-server/api/v4/Patient'
或
一无所获
以下是包含患者资源的数据文件的开头:
{
"resourceType": "Bundle",
"id": "b248b1b2-1686-4b94-9936-37d7a5f94b51",
"meta": {
"lastUpdated": "2012-05-29T23:45:32Z"
},
"type": "batch",
"entry": [
{
"fullUrl": "http://hl7.org/fhir/Patient/1",
"resource": {
"resourceType": "Patient",
"id": "1",
"meta": {
"lastUpdated": "2012-05-29T23:45:32Z"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Everywoman, Eve. SSN:\n 444222222</div>"
},
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS"
}
]
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "444222222"
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Everywoman",
"given": [
"Eve"
]
}
],
"telecom": [
{
"system": "phone",
"value": "555-555-2003",
"use": "work"
}
],
"gender": "female",
"birthDate": "1973-05-31",
"address": [
{
"use": "home",
"line": [
"2222 Home Street"
]
}
],
"managingOrganization": {
"reference": "Organization/hl7"
}
},
"request": {
"method": "POST",
"url": "Patient"
}
},
{
"fullUrl": "http://hl7.org/fhir/Patient/2",
"resource": {
"resourceType": "Patient",
"id": "2",
"meta": {
"lastUpdated": "2012-05-29T23:45:32Z"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Everyman, Adam. SSN:\n 444333333</div>"
},
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS"
}
]
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "444333333"
}
],
"active": true,
"name": [
{
"use": "official",
...
{
“resourceType”:“Bundle”,
“id”:“b248b1b2-1686-4b94-9936-37d7a5f94b51”,
“元”:{
“最新更新”:“2012-05-29T23:45:32Z”
},
“类型”:“批次”,
“条目”:[
{
“完整URL”:http://hl7.org/fhir/Patient/1",
“资源”:{
“资源类型”:“患者”,
“id”:“1”,
“元”:{
“最新更新”:“2012-05-29T23:45:32Z”
},
“文本”:{
“状态”:“已生成”,
div:“Eve.SSN:\n 44422222”
},
“标识符”:[
{
“类型”:{
“编码”:[
{
“系统”:http://terminology.hl7.org/CodeSystem/v2-0203",
“代码”:“SS”
}
]
},
“系统”:http://hl7.org/fhir/sid/us-ssn",
“值”:“44422222”
}
],
“主动”:正确,
“姓名”:[
{
“使用”:“官方”,
“家庭”:“每个女人”,
“给定”:[
“夏娃”
]
}
],
“电信”:[
{
“系统”:“电话”,
“价值”:“555-555-2003”,
“使用”:“工作”
}
],
“性别”:“女性”,
“出生日期”:“1973-05-31”,
“地址”:[
{
“使用”:“家”,
“行”:[
“家街2222号”
]
}
],
“管理组织”:{
“参考文件”:“组织机构/hl7”
}
},
“请求”:{
“方法”:“发布”,
“url”:“患者”
}
},
{
“完整URL”:http://hl7.org/fhir/Patient/2",
“资源”:{
“资源类型”:“患者”,
“id”:“2”,
“元”:{
“最新更新”:“2012-05-29T23:45:32Z”
},
“文本”:{
“状态”:“已生成”,
div:“普通人,亚当。SSN:\n 444333333”
},
“标识符”:[
{
“类型”:{
“编码”:[
{
“系统”:http://terminology.hl7.org/CodeSystem/v2-0203",
“代码”:“SS”
}
]
},
“系统”:http://hl7.org/fhir/sid/us-ssn",
“值”:“444333333”
}
],
“主动”:正确,
“姓名”:[
{
“使用”:“官方”,
...
如您所见,我在数据文件中使用了“type”:“batch”。我也尝试了“type”:“transaction”,但结果相同。
显然,我可以使用shell脚本一次导入患者,但我更愿意一次导入整个捆绑包。根据标准,当您将捆绑包发布到[base]/bundle时,您要求服务器像存储任何其他捆绑包一样存储批处理/事务。当您将其发布到[base]时,它将被处理
请参见根据标准,当您将包发布到[base]/bundle时,您要求服务器像存储任何其他包一样存储批处理/事务。当您将其发布到[base]时,它将被处理 看
{
"resourceType": "Bundle",
"id": "b248b1b2-1686-4b94-9936-37d7a5f94b51",
"meta": {
"lastUpdated": "2012-05-29T23:45:32Z"
},
"type": "batch",
"entry": [
{
"fullUrl": "http://hl7.org/fhir/Patient/1",
"resource": {
"resourceType": "Patient",
"id": "1",
"meta": {
"lastUpdated": "2012-05-29T23:45:32Z"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Everywoman, Eve. SSN:\n 444222222</div>"
},
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS"
}
]
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "444222222"
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Everywoman",
"given": [
"Eve"
]
}
],
"telecom": [
{
"system": "phone",
"value": "555-555-2003",
"use": "work"
}
],
"gender": "female",
"birthDate": "1973-05-31",
"address": [
{
"use": "home",
"line": [
"2222 Home Street"
]
}
],
"managingOrganization": {
"reference": "Organization/hl7"
}
},
"request": {
"method": "POST",
"url": "Patient"
}
},
{
"fullUrl": "http://hl7.org/fhir/Patient/2",
"resource": {
"resourceType": "Patient",
"id": "2",
"meta": {
"lastUpdated": "2012-05-29T23:45:32Z"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Everyman, Adam. SSN:\n 444333333</div>"
},
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS"
}
]
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "444333333"
}
],
"active": true,
"name": [
{
"use": "official",
...