public void TestSaveIHE() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); DsioSaveIheDocCommand command = new DsioSaveIheDocCommand(broker); // TODO: Get content somewhere else... //string content = File.ReadAllText(@"Z:\VMShared\Source\TestCCD\test_aphp_header.xml"); string content = File.ReadAllText(testFile); // This works... command.AddCommandArguments("", Guid.NewGuid().ToString("B"), "126", "OUT", DateTime.Now.ToString(), DateTime.Now.ToString(), "APS", "This is a Test Title", "VA", "Outside Clinic", content); //command.AddCommandArguments("", Guid.NewGuid().ToString("B"), "299", "OUT", DateTime.Now.ToString(), DateTime.Now.ToString(), "APS", "This is a Test Title", "VA", "Outside Clinic", ""); //command.AddCommandArguments("", Guid.NewGuid().ToString("B"), "144", "OUT", DateTime.Now.ToString(), DateTime.Now.ToString(), "APS", "This is a Test Title", "VA", "Outside Clinic", content); // These do not... //command.AddCommandArguments("", Guid.NewGuid().ToString("B"), "8", "OUT", DateTime.Now.ToString(), DateTime.Now.ToString(), "APS", "This is a Test Title", "VA", "Outside Clinic", ""); //command.AddCommandArguments("", "12345", "8", "OUT", DateTime.Now.ToString(), DateTime.Now.ToString(), "APS", "This is a Test Title", "VA", "Outside Clinic", ""); //command.AddCommandArguments("", Guid.NewGuid().ToString("B"), "144", "OUT", DateTime.Now.ToString(), DateTime.Now.ToString(), "APS", "This is a Test Title", "VA", "Outside Clinic", ""); RpcResponse response = command.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); } }
public void TestGetDoc() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); DsioSaveIheDocCommand saveCommand = new DsioSaveIheDocCommand(broker); // TODO: Get content somewhere else... string content = File.ReadAllText(testFile); // This works... saveCommand.AddCommandArguments("", Guid.NewGuid().ToString("B"), "715", "OUT", DateTime.Now.ToString(), DateTime.Now.ToString(), "APS", "This is a Test Title", "VA", "Outside Clinic", content); RpcResponse saveResponse = saveCommand.Execute(); string addedIen = saveCommand.Ien; //DsioIheGetDocCommand command = new DsioIheGetDocCommand(broker); DsioGetIheDocsCommand command = new DsioGetIheDocsCommand(broker); command.AddCommandArguments("", addedIen, -1, -1); RpcResponse response = command.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); } }
public void TestSaveIHE() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); DsioSaveIheDocCommand command = new DsioSaveIheDocCommand(broker); string content = File.ReadAllText(testFile); command.AddCommandArguments("", Guid.NewGuid().ToString("B"), TestConfiguration.DefaultPatientDfn, "OUT", DateTime.Now.ToString(), DateTime.Now.ToString(), "APS", "This is a Test Title", "VA", "Outside Clinic", content); RpcResponse response = command.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); } }
public IenResult SaveDocument(CdaDocumentData documentData) { // *** Save a document to vista *** IenResult result = new IenResult(); // *** Strings for direction to be stored in VistA *** string[] ExchangeDirectionDescription = { "IN", "OUT" }; if (this.broker != null) { // *** Create the command *** DsioSaveIheDocCommand command = new DsioSaveIheDocCommand(broker); // *** Add the arguments *** command.AddCommandArguments( documentData.Ien, documentData.Id, documentData.PatientDfn, ExchangeDirectionDescription[(int)documentData.ExchangeDirection], documentData.CreationDateTime.ToString(VistaDates.VistADateFormatFour), documentData.ImportDateTime.ToString(VistaDates.VistADateFormatFour), CdaUtility.DocumentTypeAbbreviation[(int)documentData.DocumentType], documentData.Title, documentData.Sender, documentData.IntendedRecipient, documentData.DocumentContent); // *** Execute and get response *** RpcResponse response = command.Execute(); // *** Add command response to result *** result.Success = (response.Status == RpcResponseStatus.Success); result.Message = response.InformationalMessage; if (result.Success) { result.Ien = response.Data; } } return(result); }
public void TestSaveAndRetrieve(string id) { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); DsioSaveIheDocCommand saveCommand = new DsioSaveIheDocCommand(broker); // TODO: Get content somewhere else... string content = File.ReadAllText(testFile); DateTime createdOn = DateTime.Now; DateTime importExportDate = DateTime.Now; // This works... DsioCdaDocument doc = new DsioCdaDocument() { Ien = "", Id = id, PatientDfn = "126", Direction = "OUT", CreatedOn = createdOn.ToString(VistaDates.VistADateFormatFour), ImportExportDate = importExportDate.ToString(VistaDates.VistADateFormatFour), DocumentType = "APS", Title = "Test Title", Sender = "Test Sender", IntendedRecipient = "Test Recipient", Content = content }; //saveCommand.AddCommandArguments("", "12345", "715", "OUT", DateTime.Now.ToString(), DateTime.Now.ToString(), "APS", "This is a Test Title", "VA", "Outside Clinic", content); saveCommand.AddCommandArguments( doc.Ien, doc.Id, doc.PatientDfn, doc.Direction, doc.CreatedOn, doc.ImportExportDate, doc.DocumentType, doc.Title, doc.Sender, doc.IntendedRecipient, doc.Content); RpcResponse response = saveCommand.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsFalse(string.IsNullOrWhiteSpace(saveCommand.Ien)); string ien = saveCommand.Ien; //DsioIheGetDocCommand getCommand = new DsioIheGetDocCommand(broker); DsioGetIheDocsCommand getCommand = new DsioGetIheDocsCommand(broker); getCommand.AddCommandArguments("", ien, -1, -1); response = getCommand.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNotNull(getCommand.DocumentList); Assert.IsTrue(getCommand.DocumentList.Count > 0); Assert.AreEqual(doc.Id, getCommand.DocumentList[0].Id); Assert.AreEqual(doc.PatientDfn, getCommand.DocumentList[0].PatientDfn); Assert.AreEqual(doc.Direction, getCommand.DocumentList[0].Direction); string expectedDate = createdOn.ToString("MM/dd/yyyy@HH:mm:ss").ToUpper(); Assert.AreEqual(expectedDate, getCommand.DocumentList[0].CreatedOn); expectedDate = importExportDate.ToString("MM/dd/yyyy@HH:mm:ss").ToUpper(); Assert.AreEqual(expectedDate, getCommand.DocumentList[0].ImportExportDate); Assert.AreEqual(doc.DocumentType, getCommand.DocumentList[0].DocumentType); Assert.AreEqual(doc.Title, getCommand.DocumentList[0].Title); Assert.AreEqual(doc.Sender, getCommand.DocumentList[0].Sender); Assert.AreEqual(doc.IntendedRecipient, getCommand.DocumentList[0].IntendedRecipient); DsioGetIheContentCommand contentCommand = new DsioGetIheContentCommand(broker); contentCommand.AddCommandArguments(ien); response = contentCommand.Execute(); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNotNull(contentCommand.Document); //Assert.AreEqual(contentCommand.Document.Content, content); } }