AllergyIntolerance
查詢參數
| Name | Type | Description | Sample |
|---|---|---|---|
| _id | token | Standard Parameters | |
| asserter | reference | Source of the information about the allergy | |
| category | token | food | medication | environment | biologic | |
| clinical-status | token | active | inactive | resolved | |
| code | token | Code that identifies the allergy or intolerance | |
| criticality | token | low | high | unable-to-assess | |
| date | date | Date first version of the resource instance was recorded | |
| identifier | token | External ids for this item | |
| last-date | date | Date(/time) of last known occurrence of a reaction | |
| manifestation | token | Clinical symptoms/signs associated with the Event | |
| onset | date | Date(/time) when manifestations showed | |
| patient | reference | Who the sensitivity is for | |
| recorder | reference | Who recorded the sensitivity | |
| route | token | How the subject was exposed to the substance | |
| severity | token | mild | moderate | severe (of event as a whole) | |
| type | token | allergy | intolerance - Underlying mechanism (if known) | |
| verification-status | token | unconfirmed | confirmed | refuted | entered-in-error |
1. 前置準備作業
2-2. FHIR資源讀檔
2-3. 上傳資料
2-4. 回傳資訊
2-2. 上傳資料
2-3. 回傳資訊
2-2. 上傳資料
2-3. 回傳資訊
1-1. 準備一個.json的檔案,並儲存格式的FHIR資料(使用PUT的方式必須要填寫id欄位),範例如下顯示:
2. 範例程式
PYTHON
2-1. 宣告
import requests
from bs4 import BeautifulSoup
import json
server_url = 'https://hapi.fhir.org/baseR4/' #可替代為自己的FHIR伺服器網址
FileName = 'Json/.json' #可替代為自己的檔案位置及檔名
with open(FileName, "r", encoding="utf-8") as json_file:
Data = json.load(json_file)
access_token = requests.put(server_url+"//"+Data['id'], json = Data, verify=False) #使用PUT方式必須在網址中加上id RequestResult = json.loads(str(access_token.text)) print(RequestResult) #印出回傳資訊
上傳成功則回傳資訊包含使用者所設定的id,並顯示versionId
JAVA
2-1. 宣告
package com.example.FHIR; //需替換成自己設置的專案名稱
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import net.minidev.json.JSONObject;
import net.minidev.json.parser.JSONParser;
String server_url = "https://hapi.fhir.org/baseR4/"; //可替代為自己的FHIR伺服器網址 Object ReadData = new JSONParser().parse(new FileReader(".json")); //可替代為自己的檔案位置及檔名 JSONObject Data = (JSONObject) ReadData; URL url = new URL(server_url + "/" + (String) Data.get("id")); //使用PUT方式必須在網址中加上id HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setRequestMethod("PUT"); httpCon.setDoOutput(true); httpCon.setRequestProperty("Content-Type", "application/json"); OutputStream os = httpCon.getOutputStream(); os.write(Data.toString().getBytes("UTF-8")); os.close(); httpCon.disconnect(); StringBuilder content = new StringBuilder(); try (BufferedReader in = new BufferedReader(new InputStreamReader(httpCon.getInputStream()))) { String line; while ((line = in.readLine()) != null) { content.append(line); } } System.out.println(content);
上傳成功則回傳資訊包含使用者所設定的id,並顯示versionId
C#
2-1. 宣告
using FHIR_json.Models;//需替換成自己設置的專案名稱
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
String server_url = "https://hapi.fhir.org/baseR4/"; //可替代為自己的FHIR伺服器網址 StreamReader Json_Example = new StreamReader(@"C:\Users\.json"); //可替代為自己的檔案位置及檔名 string jsonString = Json_Example.ReadToEnd(); JObject jsonObject = JObject.Parse(jsonString); var data = new StringContent(jsonString, Encoding.UTF8, "application/json"); HttpClient client = new HttpClient(); var response = await client.PutAsync(server_url + "/" + (string)jsonObject["id"], data); //使用PUT方式必須在網址中加上id var result = JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result); Console.WriteLine(result);
上傳成功則回傳資訊包含使用者所設定的id,並顯示versionId
1. 前置準備作業
2-2. FHIR資源讀檔
2-3. 上傳資料
2-4. 回傳資訊
2-2. 上傳資料
2-3. 回傳資訊
2-2. 上傳資料
2-3. 回傳資訊
1-1. 準備一個.json的檔案,並儲存格式的FHIR資料(使用POST的方式id欄位可選填),範例如下顯示:
2. 範例程式
PYTHON
2-1. 宣告
import requests
from bs4 import BeautifulSoup
import json
server_url = 'https://hapi.fhir.org/baseR4/' #可替代為自己的 FHIR 伺服器網址
FileName = 'Json/.json' #可替代為自己的檔案位置及檔名
with open(FileName, "r", encoding="utf-8") as json_file:
Data = json.load(json_file)
access_token = requests.post(server_url+"/", json = Data, verify=False)
RequestResult = json.loads(str(access_token.text))
print(RequestResult) #印出回傳資訊
上傳成功則回傳包含流水號id的資料,並顯示versionId
JAVA
2-1. 宣告
package com.example.FHIR; //需替換成自己設置的專案名稱
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import net.minidev.json.JSONObject;
import net.minidev.json.parser.JSONParser;
String server_url = "https://hapi.fhir.org/baseR4/"; //可替代為自己的FHIR伺服器網址
Object ReadData = new JSONParser().parse(new FileReader(".json"));
JSONObject Data = (JSONObject) ReadData;
URL url = new URL(server_url + "");
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
httpCon.setRequestMethod("POST");
httpCon.setDoOutpost(true);
httpCon.setRequestProperty("Content-Type", "application/json");
OutpostStream os = httpCon.getOutpostStream();
os.write(Data.toString().getBytes("UTF-8"));
os.close();
httpCon.disconnect();
StringBuilder content = new StringBuilder();
try (BufferedReader in = new BufferedReader(new InpostStreamReader(httpCon.getInpostStream()))) {
String line;
while ((line = in.readLine()) != null) {
content.append(line);
}
}
System.out.println(content);
上傳成功則回傳包含流水號id的資料,並顯示versionId
C#
2-1. 宣告
using FHIR_json.Models;//需替換成自己設置的專案名稱
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
String server_url = "https://hapi.fhir.org/baseR4/"; //可替代為自己的FHIR伺服器網址 StreamReader Json_Example = new StreamReader(@"C:\Users\.json"); //可替代為自己的檔案位置及檔名 string jsonString = Json_Example.ReadToEnd(); var data = new StringContent(jsonString, Encoding.UTF8, "application/json"); HttpClient client = new HttpClient(); var response = await client.PostAsync(server_url + "", data); var result = JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result); Console.WriteLine(result);
上傳成功則回傳包含流水號id的資料,並顯示versionId
1. 前置準備作業
2-2. 搜尋資料
2-3. 回傳資訊
2-2. 搜尋資料
2-3. 回傳資訊
2-2. 搜尋資料
2-3. 回傳資訊
1-1. 準備好需查詢的資源id,或依照的查詢參數選擇查詢項目
2. 範例程式
PYTHON
2-1. 宣告
import requests
from bs4 import BeautifulSoup
import json
server_url = 'https://hapi.fhir.org/baseR4/' #可替代為自己的 FHIR 伺服器網址
SearchCode = "" #可填入想要搜尋的參數,若為空則搜尋整個
access_token = requests.get(server_url+"/" + SearchCode, verify=False)
RequestResult = json.loads(str(access_token.text))
print(RequestResult)
成功則回傳Json格式的FHIR資料
JAVA
2-1. 宣告
package com.example.FHIR; //需替換成自己設置的專案名稱
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import net.minidev.json.JSONObject;
import net.minidev.json.parser.JSONParser;
String server_url = "https://hapi.fhir.org/baseR4/"; //可替代為自己的FHIR伺服器網址 String SearchCode = ""; //可填入想要搜尋的參數,若為空則搜尋整個 URL url = new URL(server_url + "" + SearchCode); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setRequestMethod("GET"); InputStream is = httpCon.getInputStream(); try (BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8"))) { String line; while ((line = in.readLine()) != null) { System.out.println(line); } }
成功則回傳Json格式的FHIR資料
C#
2-1. 宣告
using FHIR_json.Models;//需替換成自己設置的專案名稱
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
String server_url = "https://hapi.fhir.org/baseR4/"; //可替代為自己的FHIR伺服器網址 HttpClient client = new HttpClient(); String SearchCode = ""; //可填入想要搜尋的參數,若為空則搜尋整個 HttpResponseMessage response = await client.GetAsync(server_url + "" + SearchCode); var result = JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result); Console.WriteLine(result);
成功則回傳Json格式的FHIR資料
1. 前置準備作業
2-2. 刪除資料
2-3. 回傳資訊
2-2. 刪除資料
2-3. 回傳資訊
2-2. 刪除資料
2-3. 回傳資訊
1-1. 準備好需刪除的資源id,或依照的查詢參數選擇刪除項目
2. 範例程式
PYTHON
2-1. 宣告
import requests
from bs4 import BeautifulSoup
import json
server_url = 'https://hapi.fhir.org/baseR4/' #可替代為自己的 FHIR 伺服器網址
SearchCode = "/id" #填入想刪除的id,也可填入搜尋參數一次刪除多個資源 access_token = requests.delete(server_url+"/" + SearchCode, verify=False) RequestResult = json.loads(str(access_token.text)) print(RequestResult)
成功則會回傳Successfully deleted的資訊
JAVA
2-1. 宣告
package com.example.FHIR; //需替換成自己設置的專案名稱
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import net.minidev.json.JSONObject;
import net.minidev.json.parser.JSONParser;
String server_url = "https://hapi.fhir.org/baseR4/"; //可替代為自己的FHIR伺服器網址 String SearchCode = "/id"; //填入想刪除的id,也可填入搜尋參數一次刪除多個資源 URL url = new URL(server_url + "" + SearchCode); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setRequestMethod("DELETE"); httpCon.disconnect(); StringBuilder content = new StringBuilder(); try (BufferedReader in = new BufferedReader(new InputStreamReader(httpCon.getInputStream()))) { String line; while ((line = in.readLine()) != null) { content.append(line); } } System.out.println(content);
上傳成功則回傳包含流水號id的資料,並顯示versionId
C#
2-1. 宣告
using FHIR_json.Models;//需替換成自己設置的專案名稱
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
String server_url = "https://hapi.fhir.org/baseR4/"; //可替代為自己的FHIR伺服器網址 HttpClient client = new HttpClient(); String SearchCode = "/id"; var response = await client.DeleteAsync(server_url + "" + SearchCode); var result = JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result); Console.WriteLine(result);
上傳成功則回傳包含流水號id的資料,並顯示versionId