本文整理匯總了Java中com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.withRegion方法的典型用法代碼示例。如果您正苦於以下問題:Java AmazonDynamoDBClient.withRegion方法的具體用法?Java AmazonDynamoDBClient.withRegion怎麽用?Java AmazonDynamoDBClient.withRegion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient
的用法示例。
在下文中一共展示了AmazonDynamoDBClient.withRegion方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dynamoInsertHl7Json
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient; //導入方法依賴的package包/類
public static void dynamoInsertHl7Json(String hl7Json, String mirthTable, String mirthId, String mirthDate) {
String firstName = "NONE";
String lastName = "NONE";
String dob = "NONE";
String docType = "hl7";
String messageType = "NONE";
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
client.withRegion(Regions.US_WEST_2);
DynamoDB dynamoDB = new DynamoDB(client);
Table table = dynamoDB.getTable(mirthTable);
try {
JSONObject obj = new JSONObject(hl7Json);
firstName = obj.getJSONObject("HL7Message").getJSONObject("PID").getJSONObject("PID.5").getString("PID.5.2");
lastName = obj.getJSONObject("HL7Message").getJSONObject("PID").getJSONObject("PID.5").getString("PID.5.1");
dob = obj.getJSONObject("HL7Message").getJSONObject("PID").getJSONObject("PID.7").getString("PID.7.1");
messageType = obj.getJSONObject("HL7Message").getJSONObject("MSH").getJSONObject("MSH.9").getString("MSH.9.1");
} catch (org.json.JSONException e) { System.out.println("HL7 JSON ERROR"); }
//replace empyty string with value representing blank
hl7Json = hl7Json.replaceAll("\"\"","\"NONE\"");
Item item =
new Item()
.withPrimaryKey("mirthid", mirthId)
.withString("mirthdate", mirthDate)
.withString("type", docType)
.withString("FirstName", firstName)
.withString("LastName", lastName)
.withString("DOB", dob)
.withString("HL7Type", messageType)
.withString("Processed", "N")
.withJSON("document", hl7Json);
table.putItem(item);
}
示例2: dynamoInsertJson
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient; //導入方法依賴的package包/類
public static void dynamoInsertJson(String ccdJson, String mirthTable, String mirthId, String mirthDate) {
System.out.println( "Performing insert into DynamoDB" );
String firstName = "NONE";
String lastName = "NONE";
String dob = "NONE";
String docType = "ccda";
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
client.withRegion(Regions.US_WEST_2);
DynamoDB dynamoDB = new DynamoDB(client);
Table table = dynamoDB.getTable(mirthTable);
//System.out.println(ccdJson);
try {
JSONObject obj = new JSONObject(ccdJson);
firstName = obj.getJSONObject("data").getJSONObject("demographics").getJSONObject("name").getString("first");
lastName = obj.getJSONObject("data").getJSONObject("demographics").getJSONObject("name").getString("last");
dob = obj.getJSONObject("data").getJSONObject("demographics").getJSONObject("dob").getJSONObject("point").getString("date");
//System.out.println(firstName);
} catch (org.json.JSONException e) { System.out.println("JSON ERROR"); }
ccdJson = ccdJson.replaceAll("\"\"","\"NONE\"");
Item item =
new Item()
.withPrimaryKey("mirthid", mirthId)
.withString("mirthdate", mirthDate)
.withString("type", docType)
.withString("FirstName", firstName)
.withString("LastName", lastName)
.withString("DOB", dob)
.withString("Processed", "N")
.withJSON("document", ccdJson);
table.putItem(item);
}
示例3: dynamoInsertDicom
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient; //導入方法依賴的package包/類
public static void dynamoInsertDicom(String dicomJson, String mirthTable, String mirthId, String mirthDate) {
System.out.println( "Performing insert into DynamoDB" );
String firstName = "EMPTY";
String lastName = "EMPTY";
String dob = "EMPTY";
String docType = "dicom";
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
client.withRegion(Regions.US_WEST_2);
DynamoDB dynamoDB = new DynamoDB(client);
Table table = dynamoDB.getTable(mirthTable);
try {
JSONObject obj = new JSONObject(dicomJson);
//DICOM stores patient name in tag 00100010
if(obj.has("00100010")) {
if(obj.getJSONObject("00100010").has("Value")) {
JSONArray lastNameArray = obj.getJSONObject("00100010").getJSONArray("Value");
if(lastNameArray !=null) {
JSONObject lastNameObj = lastNameArray.getJSONObject(0);
if(lastNameObj.has("Alphabetic")) {
String patientName = lastNameObj.getString("Alphabetic");
String[] patientNameArray = patientName.split("\\^");
//some sample DICOM files only have one name string rather than
//delimited strings like in production messages.
//in that case, we use that string as the last name
//the else statement covers when we have a first and last name
if(patientNameArray.length == 1) {
lastName = lastNameObj.getString("Alphabetic");
} else if(patientNameArray.length > 1) {
lastName = patientNameArray[0];
firstName = patientNameArray[1];
}
}
}
}
}
//DICOM stores Date of Birth in tag 00100030
if(obj.has("00100030")) {
if(obj.getJSONObject("00100030").has("Value")) {
JSONArray dobArray = obj.getJSONObject("00100030").getJSONArray("Value");
if(dobArray !=null) {
dob = dobArray.getString(0);
}
}
}
} catch (org.json.JSONException e) { System.out.println("JSON ERROR"); }
//ccdJson = ccdJson.replaceAll("\"\"","\"NONE\"");
Item item =
new Item()
.withPrimaryKey("mirthid", mirthId)
.withString("mirthdate", mirthDate)
.withString("type", docType)
.withString("FirstName", firstName)
.withString("LastName", lastName)
.withString("DOB", dob)
.withString("Processed", "N")
.withJSON("document", dicomJson);
table.putItem(item);
}