Search in sources :

Example 1 with CreateMessageRequest

use of com.google.api.services.healthcare.v1.model.CreateMessageRequest in project java-docs-samples by GoogleCloudPlatform.

the class HL7v2MessageCreate method hl7v2MessageCreate.

public static void hl7v2MessageCreate(String hl7v2StoreName, String messageId, String filePath) throws IOException {
    // String hl7v2StoreName =
    // String.format(
    // HL7v2_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-hl7v2-id");
    // String messageId = "your-message-id";
    // String filePath = "path/to/file.txt";
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Load the data from file representing the message.
    List<String> lines = Files.readAllLines(Paths.get(filePath), Charset.defaultCharset());
    String data = String.join("\n", lines);
    Message message = new Message().setData(data).setName(messageId);
    CreateMessageRequest createRequest = new CreateMessageRequest().setMessage(message);
    // Create request and configure any parameters.
    Messages.Create request = client.projects().locations().datasets().hl7V2Stores().messages().create(hl7v2StoreName, createRequest);
    // Execute the request and process the results.
    Message response = request.execute();
    System.out.println("HL7v2 message created: " + response.toPrettyString());
}
Also used : Messages(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores.Messages) Message(com.google.api.services.healthcare.v1.model.Message) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) CreateMessageRequest(com.google.api.services.healthcare.v1.model.CreateMessageRequest)

Example 2 with CreateMessageRequest

use of com.google.api.services.healthcare.v1.model.CreateMessageRequest in project beam by apache.

the class HttpHealthcareApiClient method createHL7v2Message.

@Override
public Message createHL7v2Message(String hl7v2Store, Message msg) throws IOException {
    CreateMessageRequest createMessageRequest = new CreateMessageRequest();
    createMessageRequest.setMessage(msg);
    return client.projects().locations().datasets().hl7V2Stores().messages().create(hl7v2Store, createMessageRequest).execute();
}
Also used : CreateMessageRequest(com.google.api.services.healthcare.v1.model.CreateMessageRequest)

Aggregations

CreateMessageRequest (com.google.api.services.healthcare.v1.model.CreateMessageRequest)2 CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)1 Messages (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.Hl7V2Stores.Messages)1 Message (com.google.api.services.healthcare.v1.model.Message)1