public string GetModuleData(string EMRID, string ModuleID, string EMRPatientID) { try { //string EMRID = "1"; //string ModuleID = "11"; string UserID = string.Empty; string PatDemoAPIURL = ""; //string EMRPatientID = "1447"; string DepartmentID = string.Empty; // Get the variable values from JSON oMasterConnection.EMRIntegrationMasterConStr = ConfigurationManager.ConnectionStrings["EMRIntegrationMaster"].ConnectionString; SqlConnection oConnMaster = new SqlConnection(oMasterConnection.EMRIntegrationMasterConStr); oMasterConnection.oConnEmrMaster = oConnMaster; oMasterConnection.EmrStagingDBConStr = ConfigurationManager.ConnectionStrings["EMRStagingDB"].ConnectionString; SqlConnection oConnStaging = new SqlConnection(oMasterConnection.EmrStagingDBConStr); oMasterConnection.oConnEmrStagingDB = oConnStaging; string RequestID = objLog.LogRequest(oMasterConnection, Logs.Status.GotDataPullRequestFromIntelliH, EMRID, ModuleID, EMRPatientID); switch (EMRID) { case "1": //Athena objLog.LogRequest(oMasterConnection, Logs.Status.ConnectionRequestSentToEMR, RequestID, EMRID, ModuleID, EMRPatientID); EMRIntegrations.Athena.AthenaAPI objAthenaAPI = new EMRIntegrations.Athena.AthenaAPI(); objLog.LogRequest(oMasterConnection, Logs.Status.ConnectionEstablishedWithEMR, RequestID, EMRID, ModuleID, EMRPatientID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPullRequestSendingToEMR, RequestID, EMRID, ModuleID, EMRPatientID); switch (ModuleID) { case "11": //PatientDemographics DataTable dtPatientData = objAthenaAPI.GetPatientDemographics(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objAthenaAPI.SavePatientDemographics(dtPatientData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); string JSONString = objAthenaAPI.GetJSONPatientDemographics(dtPatientData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); PostDataToIntelliH("https://apis-dev.intellih.com/api/EMR/SaveDataFromStagingToIntelliH", JSONString); break; case "5": //Medication DataTable dtMedication = objAthenaAPI.GetMedications(EMRPatientID, DepartmentID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objAthenaAPI.SaveMedications(dtMedication, oMasterConnection.EmrStagingDBConStr, RequestID); break; default: break; } objLog.LogRequest(oMasterConnection, Logs.Status.DataSentToIntelliH, RequestID, EMRID, ModuleID, EMRPatientID); break; default: return("EMRID is not found"); } //if (EMRIntegration.Data.SqlHelper.TestSQLConnection(Startup.ConnectionString) == false) //{ // //Generate Log file // return new DataTable(); //} return("Data has been posted to IntelliH database"); } catch (Exception ex) { return(ex.Message + " " + ex.StackTrace); } }
public string GetModuleData(string EMRID, string ModuleID, string EMRPatientID, string AccessToken) { StringBuilder JSONStringReturn = new StringBuilder(); string RequestID = string.Empty; try { string UserID = string.Empty; string DepartmentID = "1"; string JSONString = string.Empty; // Get the variable values from JSON oMasterConnection.EMRIntegrationMasterConStr = ConfigurationManager.ConnectionStrings["EMRIntegrationMaster"].ConnectionString; SqlConnection oConnMaster = new SqlConnection(oMasterConnection.EMRIntegrationMasterConStr); oMasterConnection.oConnEmrMaster = oConnMaster; oMasterConnection.EmrStagingDBConStr = ConfigurationManager.ConnectionStrings["EMRStagingDB"].ConnectionString; SqlConnection oConnStaging = new SqlConnection(oMasterConnection.EmrStagingDBConStr); oMasterConnection.oConnEmrStagingDB = oConnStaging; switch (EMRID) { case "1": //Athena EMRIntegrations.Athena.AthenaAPI objAthenaAPI; switch (ModuleID) { case "11": //PatientDemographics RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objAthenaAPI = new EMRIntegrations.Athena.AthenaAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtPatientData = objAthenaAPI.GetPatientDemographics(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objAthenaAPI.SavePatientDemographics(dtPatientData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objAthenaAPI.GetJSONPatientDemographics(dtPatientData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); //PostDataToIntelliH("https://apis-dev.intellih.com/api/EMR/SaveDataFromStagingToIntelliH", JSONString); break; case "15": //Allergy RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objAthenaAPI = new EMRIntegrations.Athena.AthenaAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtAllergy = objAthenaAPI.GetAllergy(EMRPatientID, DepartmentID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objAthenaAPI.SaveAllergy(dtAllergy, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objAthenaAPI.GetJSONAllergy(dtAllergy, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "5": //Medications RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objAthenaAPI = new EMRIntegrations.Athena.AthenaAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtMedication = objAthenaAPI.GetMedications(EMRPatientID, DepartmentID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objAthenaAPI.SaveMedications(dtMedication, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objAthenaAPI.GetJSONMedications(dtMedication, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "12": //PatientInsurance RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objAthenaAPI = new EMRIntegrations.Athena.AthenaAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtInsurance = objAthenaAPI.GetInsurances(EMRPatientID, DepartmentID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objAthenaAPI.SaveInsurances(dtInsurance, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objAthenaAPI.GetJSONInsurances(dtInsurance, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "13": //PatientPicture RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objAthenaAPI = new EMRIntegrations.Athena.AthenaAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtPicture = objAthenaAPI.GetPatientPicture(EMRPatientID, DepartmentID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objAthenaAPI.SavePictures(dtPicture, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objAthenaAPI.GetJSONPictures(dtPicture, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; default: JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"ModuleID is not Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } objLog.LogRequest(oMasterConnection, Logs.Status.DataSentToIntelliH, RequestID, EMRID, ModuleID, EMRPatientID); break; case "2": //Cerner EMRIntegrations.CernerMillenium.CernerMilleniumAPI objCernerAPI; switch (ModuleID) { case "11": //PatientDemographics RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objCernerAPI = new EMRIntegrations.CernerMillenium.CernerMilleniumAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtPatientData = objCernerAPI.GetPatientDemographics(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); if (dtPatientData.Rows.Count == 0) { JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"No Patient Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objCernerAPI.SavePatientDemographics(dtPatientData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objCernerAPI.GetJSONPatientDemographics(dtPatientData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); //PostDataToIntelliH("https://apis-dev.intellih.com/api/EMR/SaveDataFromStagingToIntelliH", JSONString); break; case "15": //Allergy RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objCernerAPI = new EMRIntegrations.CernerMillenium.CernerMilleniumAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtAllergyData = objCernerAPI.GetAllergy(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objCernerAPI.SaveAllergy(dtAllergyData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objCernerAPI.GetJSONAllergy(dtAllergyData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "5": //Medications RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objCernerAPI = new EMRIntegrations.CernerMillenium.CernerMilleniumAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtMedicationData = objCernerAPI.GetMedications(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objCernerAPI.SaveMedications(dtMedicationData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objCernerAPI.GetJSONMedications(dtMedicationData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); //PostDataToIntelliH("https://apis-dev.intellih.com/api/EMR/SaveDataFromStagingToIntelliH", JSONString); break; default: JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"ModuleID is not Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } objLog.LogRequest(oMasterConnection, Logs.Status.DataSentToIntelliH, RequestID, EMRID, ModuleID, EMRPatientID); break; case "3": //Epic EMRIntegrations.Epic.EpicAPI objEpicAPI; switch (ModuleID) { case "11": //PatientDemographics RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objEpicAPI = new EMRIntegrations.Epic.EpicAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtPatientData = objEpicAPI.GetPatientDemographics(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); if (dtPatientData.Rows.Count == 0) { JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"No Patient Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objEpicAPI.SavePatientDemographics(dtPatientData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objEpicAPI.GetJSONPatientDemographics(dtPatientData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "15": //Allergy RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objEpicAPI = new EMRIntegrations.Epic.EpicAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtAllergyData = objEpicAPI.GetAllergy(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objEpicAPI.SaveAllergy(dtAllergyData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objEpicAPI.GetJSONAllergy(dtAllergyData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "5": //Medications RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objEpicAPI = new EMRIntegrations.Epic.EpicAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtMedicationData = objEpicAPI.GetMedications(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objEpicAPI.SaveMedications(dtMedicationData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objEpicAPI.GetJSONMedications(dtMedicationData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); //PostDataToIntelliH("https://apis-dev.intellih.com/api/EMR/SaveDataFromStagingToIntelliH", JSONString); break; case "1": //Vitals RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objEpicAPI = new EMRIntegrations.Epic.EpicAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtVitalsData = objEpicAPI.GetVitals(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objEpicAPI.SaveVitals(dtVitalsData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objEpicAPI.GetJSONVitals(dtVitalsData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; default: JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"ModuleID is not Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } objLog.LogRequest(oMasterConnection, Logs.Status.DataSentToIntelliH, RequestID, EMRID, ModuleID, EMRPatientID); break; case "5": //EpicR4 EMRIntegrations.EpicR4.EpicR4API objEpicR4API; switch (ModuleID) { case "11": //PatientDemographics RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objEpicR4API = new EMRIntegrations.EpicR4.EpicR4API(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtPatientData = objEpicR4API.GetPatientDemographics(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); if (dtPatientData.Rows.Count == 0) { JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"No Patient Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objEpicR4API.SavePatientDemographics(dtPatientData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objEpicR4API.GetJSONPatientDemographics(dtPatientData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "15": //Allergy RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objEpicR4API = new EMRIntegrations.EpicR4.EpicR4API(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtAllergyData = objEpicR4API.GetAllergy(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objEpicR4API.SaveAllergy(dtAllergyData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objEpicR4API.GetJSONAllergy(dtAllergyData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "5": //Medications RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objEpicR4API = new EMRIntegrations.EpicR4.EpicR4API(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtMedicationData = objEpicR4API.GetMedications(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objEpicR4API.SaveMedications(dtMedicationData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objEpicR4API.GetJSONMedications(dtMedicationData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); //PostDataToIntelliH("https://apis-dev.intellih.com/api/EMR/SaveDataFromStagingToIntelliH", JSONString); break; default: JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"ModuleID is not Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } objLog.LogRequest(oMasterConnection, Logs.Status.DataSentToIntelliH, RequestID, EMRID, ModuleID, EMRPatientID); break; case "6": //DrChrono EMRIntegrations.DrChrono.DrChronoAPI objDrChronoAPI; switch (ModuleID) { case "11": //PatientDemographics RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objDrChronoAPI = new EMRIntegrations.DrChrono.DrChronoAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtPatientData = objDrChronoAPI.GetPatientDemographics(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID, AccessToken); if (dtPatientData.Rows.Count == 0) { JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"No Patient Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objDrChronoAPI.SavePatientDemographics(dtPatientData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objDrChronoAPI.GetJSONPatientDemographics(dtPatientData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "5": //Medications RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objDrChronoAPI = new EMRIntegrations.DrChrono.DrChronoAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtMedicationData = objDrChronoAPI.GetMedications(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID, AccessToken); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objDrChronoAPI.SaveMedications(dtMedicationData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objDrChronoAPI.GetJSONMedications(dtMedicationData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "12": //Problemlist RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objDrChronoAPI = new EMRIntegrations.DrChrono.DrChronoAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtProblemlistData = objDrChronoAPI.GetProblemlist(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID, AccessToken); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objDrChronoAPI.SaveProblemlist(dtProblemlistData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objDrChronoAPI.GetJSONProblemlist(dtProblemlistData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; case "15": //Allergy RequestID = InitialLog1(EMRID, ModuleID, EMRPatientID); objDrChronoAPI = new EMRIntegrations.DrChrono.DrChronoAPI(); InitialLog2(EMRID, ModuleID, EMRPatientID, RequestID); DataTable dtAllergyData = objDrChronoAPI.GetAllergy(EMRPatientID, oMasterConnection.EmrStagingDBConStr, RequestID, AccessToken); objLog.LogRequest(oMasterConnection, Logs.Status.DataPulledInMemoryFromEMR, RequestID, EMRID, ModuleID, EMRPatientID); objDrChronoAPI.SaveAllergy(dtAllergyData, oMasterConnection.EmrStagingDBConStr, RequestID); objLog.LogRequest(oMasterConnection, Logs.Status.DataSavedInStagingDatabase, RequestID, EMRID, ModuleID, EMRPatientID); JSONString = objDrChronoAPI.GetJSONAllergy(dtAllergyData, EMRPatientID, RequestID, EMRID, ModuleID, UserID); break; default: JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"ModuleID is not Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } objLog.LogRequest(oMasterConnection, Logs.Status.DataSentToIntelliH, RequestID, EMRID, ModuleID, EMRPatientID); break; default: JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"EMRID is not Found\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } //if (EMRIntegration.Data.SqlHelper.TestSQLConnection(Startup.ConnectionString) == false) //{ // //Generate Log file // return new DataTable(); //} return(JSONString); } catch (Exception ex) { JSONStringReturn.Append("{"); JSONStringReturn.Append("\"EMRPatientId\":" + "\"" + EMRPatientID + "\","); JSONStringReturn.Append("\"EMRId\":" + "\"" + EMRID + "\","); JSONStringReturn.Append("\"ModuleId\":" + "\"" + ModuleID + "\","); JSONStringReturn.Append("\"RequestId\":" + "\"" + RequestID + "\","); JSONStringReturn.Append("\"CreatedBy\":" + "\"\","); JSONStringReturn.Append("\"EMRUserExtensionLogDetails\":"); JSONStringReturn.Append("\"" + ex.Message + "\""); JSONStringReturn.Append("}"); return(JSONStringReturn.ToString()); } }