public IActionResult GetPatientDataCurrent([FromBody] InputRequestData reqData) { List <IMedXPatientData> patientdata = new List <IMedXPatientData>(); try { List <InputPatientICD> inputPatientICD = IMedXUtility.PrepareICDEntries(reqData.icdFeedData, reqData.icdColumnNames); List <InputPatientNDC> inputPatientNDC = IMedXUtility.PrepareNDCEntries(reqData.ndcFeedData, reqData.ndcColumnNames); patientdata = IMedXUtility.MergePatientData(inputPatientICD, inputPatientNDC); return(Ok(patientdata)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
static void Main(string[] args) { try { List <InputPatientICD> inputICDList = IMedXListTest.GetPatientICDDataList(); foreach (InputPatientICD p in inputICDList) { Console.WriteLine("{0}\t{1}\t{2}", p.PA, p.DOC, p.ICD); } List <InputPatientNDC> inputNDCList = IMedXListTest.GetPatientNDCDataList(); foreach (InputPatientNDC p in inputNDCList) { Console.WriteLine("{0}\t{1}\t{2}", p.PA, p.NDC, p.AMT); } List <IMedXModels.Input.IMedXPatientData> patientData = IMedXUtility.MergePatientData(inputICDList, inputNDCList); foreach (var x in patientData) { Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", x.PA, x.DOC, x.ICD, x.NDC, x.AMT); } DataTable patdt = IMedXUtility.MakePatientDataTable(patientData); string dataConnection = "Server=.\\SQLEXPRESS;Database=IMedXHR;Trusted_Connection=True"; List <string> patientDataColumns = new List <string>() { "PA", "DOC", "ICD", "NDC", "AMT", "CreatedDate" }; DBConnectify.InsertBulk(patdt, dataConnection, "IMedXPatientData", patientDataColumns, patientDataColumns); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } Console.WriteLine("Press any key to exit."); System.Console.ReadKey(); }