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 CdaDocumentListResult GetExchangeHistory(string patientDfn, int page, int itemsPerPage) { // *** Get list of exchanged documents for a patient *** // *** Supports paging *** CdaDocumentListResult result = new CdaDocumentListResult(); // *** Check broker *** if (this.broker != null) { // *** Create the command *** //DsioIhePatientListCommand command = new DsioIhePatientListCommand(this.broker); DsioGetIheDocsCommand command = new DsioGetIheDocsCommand(this.broker); // *** Add the arguments, patient, paging *** command.AddCommandArguments(patientDfn, "", page, itemsPerPage); // *** Execute the command *** RpcResponse response = command.Execute(); // *** Add results to return *** result.Success = (response.Status == RpcResponseStatus.Success); result.Message = response.InformationalMessage; // *** If successful, continue *** if (result.Success) { // *** Add total results to return *** result.TotalResults = command.TotalResults; if (result.TotalResults > 0) { // *** Check if we have something and loop *** if (command.DocumentList != null) { if (command.DocumentList.Count > 0) { foreach (DsioCdaDocument dsioDoc in command.DocumentList) { // *** Create strongly typed object from string-based Dsio object *** CdaDocumentData docData = GetDocumentData(dsioDoc); // *** If we have something to work with... *** if (docData != null) { // *** Add patient dfn *** docData.PatientDfn = patientDfn; // *** Add to return list *** result.DocumentList.Add(docData); } } } } } } } return(result); }
public void TestPatientListEmpty() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); DsioGetIheDocsCommand command = new DsioGetIheDocsCommand(broker); command.AddCommandArguments(TestConfiguration.DefaultPatientDfn, "", 1, 100); RpcResponse response = command.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); } }
public void TestGetIheDocsForPatient() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); //DsioIhePatientListCommand command = new DsioIhePatientListCommand(broker); DsioGetIheDocsCommand command = new DsioGetIheDocsCommand(broker); command.AddCommandArguments("126", "", 1, 100); RpcResponse response = command.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); } }
public void TestGetDocEmpty() { using (RpcBroker broker = this.GetConnectedBroker()) { this.SignonToBroker(broker, 2); string addedIen = ""; DsioGetIheDocsCommand command = new DsioGetIheDocsCommand(broker); command.AddCommandArguments("", addedIen, -1, -1); RpcResponse response = command.Execute(); Assert.IsNotNull(response); Assert.AreEqual(RpcResponseStatus.Success, response.Status); Assert.IsNull(command.DocumentList); } }
public CdaDocumentResult GetDocumentData(string id) { // *** Get data for a single document (Header and Content) *** CdaDocumentResult result = new CdaDocumentResult(); // *** Check broker *** if (this.broker != null) { // *** Create the command *** //DsioIheGetDocCommand command = new DsioIheGetDocCommand(this.broker); DsioGetIheContentCommand contentCommand = new DsioGetIheContentCommand(this.broker); contentCommand.AddCommandArguments(id); // *** Execute *** RpcResponse response = contentCommand.Execute(); // *** Record success/message *** result.Success = (response.Status == RpcResponseStatus.Success); result.Message = response.InformationalMessage; // *** If successful continue *** if (result.Success) { if (contentCommand.Document != null) { // *** Hold the content *** string tempContent = contentCommand.Document.Content; DsioGetIheDocsCommand docCommand = new DsioGetIheDocsCommand(this.broker); docCommand.AddCommandArguments("", id, -1, -1); // *** Execute the command *** response = docCommand.Execute(); // *** Add results to return *** result.Success = (response.Status == RpcResponseStatus.Success); result.Message = response.InformationalMessage; // *** If successful continue *** if (result.Success) { if (docCommand.DocumentList != null) { if (docCommand.DocumentList.Count == 1) { // *** Get the document (header) data *** result.DocumentData = GetDocumentData(docCommand.DocumentList[0]); // *** Add the content from previous call *** result.DocumentData.DocumentContent = tempContent; // *** Repopulate ien *** result.DocumentData.Ien = id; } } } } } } 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); } }