Exemple #1
0
        //public async Task<string> AddHCP(HCPInfo newHcp)
        //{
        //    try
        //    {
        //        HCPInfo respatient = await _hCPManagementDBContext.HCPInfo.AsNoTracking().Where(x => x.HCPId == newHcp.HCPId || x.HCPName == newHcp.HCPName || x.EmailId == newHcp.EmailId).FirstOrDefaultAsync();
        //        string res = "";
        //        using (HttpClient client = new HttpClient())
        //        {

        //            var response = await client.GetAsync("https://localhost:44335/api/PracticeManagement/View PracticeById?practiceId=" + newHcp.PracticeID);
        //            res = response.StatusCode.ToString();


        //        }

        //        if (respatient == null  && res.Contains("OK"))
        //        {
        //            newHcp.InsertedDate = DateTime.Now;
        //            newHcp.UpdatedDate = DateTime.Now;
        //            newHcp.ActiveFlg = 1;
        //            _hCPManagementDBContext.HCPInfo.AddRange(newHcp);
        //            await _hCPManagementDBContext.SaveChangesAsync();
        //            return "HCP Details added successfully";
        //        }
        //        return "Enter valid details ";


        //    }

        //    catch (Exception ex)
        //    {

        //        Logger.Addlog(ex, "HCP");
        //        return "Unable to add HCP Details";
        //    }
        //}

        //public async Task<string> ModifyHCP(HCPInfo newHcp)
        //{
        //    try
        //    {
        //        HCPInfo respatient = await _hCPManagementDBContext.HCPInfo.AsNoTracking().Where(x => x.HCPId == newHcp.HCPId).FirstOrDefaultAsync();
        //        string res = "";
        //        using (HttpClient client = new HttpClient())
        //        {

        //            var response = await client.GetAsync("https://localhost:44335/api/PracticeManagement/View PracticeById?practiceId=" + newHcp.PracticeID);
        //            res = response.StatusCode.ToString();


        //        }

        //        if (respatient != null && respatient.ActiveFlg == 1 && res.Contains("OK"))
        //        {
        //            newHcp.InsertedDate = DateTime.Now;
        //            newHcp.UpdatedDate = DateTime.Now;
        //            newHcp.ActiveFlg = 1;
        //            _hCPManagementDBContext.HCPInfo.Update(newHcp);
        //            await _hCPManagementDBContext.SaveChangesAsync();
        //            return "HCP Details modified successfully";
        //        }
        //        return "Enter valid details ";


        //    }

        //    catch (Exception ex)
        //    {

        //        Logger.Addlog(ex, "HCP");
        //        return "Unable to modify HCP Details";
        //    }
        //}

        public async Task <string> AddDocSignature(DocumentInfo docinfo)
        {
            try
            {
                HCPInteractionInfo reshcp = await _hCPManagementDBContext.HCPInteractionInfo.AsNoTracking().Where(x => x.HCPInteractionId == docinfo.DiagnosisId).FirstOrDefaultAsync();

                DocumentInfo resdoc = await _hCPManagementDBContext.DocumentInfo.AsNoTracking().Where(x => x.DiagnosisId == docinfo.DiagnosisId && x.HCPSignature == docinfo.HCPSignature).FirstOrDefaultAsync();

                string      apiUrl         = _config.GetSection("app").GetSection("ApiUrl_SelectPatientById").Value;
                string      apiUrlUser     = _config.GetSection("app").GetSection("ApiUrl_SelectUserById").Value;
                PatientInfo pobj           = new PatientInfo();
                int         pat_practiceid = 0;
                using (HttpClient client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDE0NTI2ODQsImlzcyI6IlRlc3QuY29tIiwiYXVkIjoiVGVzdC5jb20ifQ.uQGmxaAJ3kSEycD0xSPhbQUXI2vEQBeOJJ3XuTB-zZk");
                    var response = await client.GetAsync(apiUrl + reshcp.PatientId);

                    pobj           = JsonConvert.DeserializeObject <PatientInfo>(await response.Content.ReadAsStringAsync());
                    pat_practiceid = pobj.PracticeID;
                }


                UserInfo dobj           = new UserInfo();
                int      doc_practiceid = 0;
                using (HttpClient client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDE0NTI2ODQsImlzcyI6IlRlc3QuY29tIiwiYXVkIjoiVGVzdC5jb20ifQ.uQGmxaAJ3kSEycD0xSPhbQUXI2vEQBeOJJ3XuTB-zZk");
                    var response = await client.GetAsync(apiUrlUser + reshcp.HCPId);

                    dobj           = JsonConvert.DeserializeObject <UserInfo>(await response.Content.ReadAsStringAsync());
                    doc_practiceid = dobj.PracticeId;
                }
                if (reshcp != null && resdoc == null)
                {
                    docinfo.InsertedDate = DateTime.Now;
                    docinfo.UpdatedDate  = DateTime.Now;
                    if (dobj.RoleId == 3)
                    {
                        Report.GeneratePDF(reshcp, docinfo, pobj, dobj);
                    }

                    _hCPManagementDBContext.DocumentInfo.AddRange(docinfo);

                    await _hCPManagementDBContext.SaveChangesAsync();

                    return("Signature and Document addedd successfully");
                }
                return("Add Valid Details");
            }
            catch (Exception ex)
            {
                Logger.Addlog(ex, "HCP");
                return("Error occurred in adding Signature");
            }
        }
 public async Task <string> AddHcpInteractionInfo(HCPInteractionInfo interactionInfo)
 {
     return(await _hCPManagementRepository.AddHcpInteractionInfo(interactionInfo));
 }
Exemple #3
0
        public async Task <string> AddHcpInteractionInfo(HCPInteractionInfo interactionInfo)
        {
            try
            {
                HCPInteractionInfo resdiagnosis = await _hCPManagementDBContext.HCPInteractionInfo.AsNoTracking().Where(x => x.HCPId == interactionInfo.HCPId && x.PatientId == interactionInfo.PatientId).FirstOrDefaultAsync();

                //string patientPractice = "";
                //string hcpPractice = "";
                //using (HttpClient client = new HttpClient())
                //{

                //    var patientPracticeresponse= await client.GetAsync("https://localhost:44325/api/PatientManagement/SelectPatientById?PatientId" + interactionInfo.PatientId);
                //    patientPractice = patientPracticeresponse.StatusCode.ToString();


                //}
                //using (HttpClient client = new HttpClient())
                //{

                //    var hcpPracticeresponse = await client.GetAsync("https://localhost:44385/api/User/SelectUserbyId?userId" + interactionInfo.HCPId);
                //    hcpPractice = hcpPracticeresponse.StatusCode.ToString();


                //}
                string      apiUrl         = _config.GetSection("app").GetSection("ApiUrl_SelectPatientById").Value;
                string      apiUrlUser     = _config.GetSection("app").GetSection("ApiUrl_SelectUserById").Value;
                string      respatient     = "";
                PatientInfo pobj           = new PatientInfo();
                int         pat_practiceid = 0;
                using (HttpClient client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDE0NTI2ODQsImlzcyI6IlRlc3QuY29tIiwiYXVkIjoiVGVzdC5jb20ifQ.uQGmxaAJ3kSEycD0xSPhbQUXI2vEQBeOJJ3XuTB-zZk");
                    var response = await client.GetAsync(apiUrl + interactionInfo.PatientId);

                    respatient     = response.StatusCode.ToString();
                    pobj           = JsonConvert.DeserializeObject <PatientInfo>(await response.Content.ReadAsStringAsync());
                    pat_practiceid = pobj.PracticeID;
                }


                string   reshcp         = "";
                UserInfo dobj           = new UserInfo();
                int      doc_practiceid = 0;
                using (HttpClient client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDE0NTI2ODQsImlzcyI6IlRlc3QuY29tIiwiYXVkIjoiVGVzdC5jb20ifQ.uQGmxaAJ3kSEycD0xSPhbQUXI2vEQBeOJJ3XuTB-zZk");
                    var response = await client.GetAsync(apiUrlUser + interactionInfo.HCPId);

                    reshcp         = response.StatusCode.ToString();
                    dobj           = JsonConvert.DeserializeObject <UserInfo>(await response.Content.ReadAsStringAsync());
                    doc_practiceid = dobj.PracticeId;
                }

                if (resdiagnosis == null && pat_practiceid == doc_practiceid && dobj.RoleId == 3)
                {
                    interactionInfo.InsertedDate = DateTime.Now;
                    interactionInfo.UpdatedDate  = DateTime.Now;
                    interactionInfo.VisitDate    = DateTime.Now;
                    _hCPManagementDBContext.HCPInteractionInfo.AddRange(interactionInfo);
                    //HCPInteractionInfo diaginfo = await _hCPManagementDBContext.HCPInteractionInfo.AsNoTracking().Where(x => x.PatientVisitId != 0).FirstOrDefaultAsync();
                    await _hCPManagementDBContext.SaveChangesAsync();

                    return("Patient Interaction Details updated successfully");
                }
                return("Add Valid Details");
            }
            catch (Exception ex)
            {
                Logger.Addlog(ex, "HCP");
                return("Error occurred in adding Interaction details");
            }
        }
 public async Task <string> AddHcpInteractionInfo(HCPInteractionInfo interactionInfo) => await _iHCPManagementService.AddHcpInteractionInfo(interactionInfo);