Beispiel #1
0
        private void UpdateCommTable(PCPCommunication comm)
        {
            comm.ScheduledTime = DateTime.Now;
            PatientLogModel db = new PatientLogModel();

            db.PCPCommunications.Add(comm);
            db.SaveChanges();
            db.Dispose();
        }
Beispiel #2
0
        private void UpdateStatus(PCPCommunication comm, string status)
        {
            PatientLogModel db = new PatientLogModel();

            comm.CommStatus      = status;
            db.Entry(comm).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            db.Dispose();
        }
Beispiel #3
0
        // GET: PCPCommunication/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PCPCommunication pCPCommunication = await db.PCPCommunications.FindAsync(id);

            if (pCPCommunication == null)
            {
                return(HttpNotFound());
            }
            return(View(pCPCommunication));
        }
Beispiel #4
0
        public async Task <ActionResult> jsonSubmitPatientAndFax(PatientLog patientLog)
        {
            if (ModelState.IsValid)
            {
                patientLog.LastUpdated     = DateTime.Now;
                db.Entry(patientLog).State = EntityState.Modified;
                await db.SaveChangesAsync();

                string commType = (from f in db.FaxServiceTypes
                                   where f.Service == patientLog.ServiceType
                                   select f.FaxType).Single().ToString();

                PCPCommunication comm = new PCPCommunication(patientLog.Physician, commType + "Notification", patientLog.Hospital, patientLog.PatientName, patientLog.ID, "313-867-5309", patientLog.DOB);
                db.Entry(comm).State = EntityState.Added;
                await db.SaveChangesAsync();

                return(Content("Patient information has been saved successfully!"));
            }
            else
            {
                return(Content("Something went wrong when saving this patient. Please notify IT"));
            }
        }
Beispiel #5
0
        public void SendFax(string strRepType, Microsoft.Reporting.WebForms.ReportViewer AIMSReportViewer, string strFaxFolder, string strFaxNumber, string strHospital,
                            string strUserID, string strPcpID, string strPcpName, int intPtLogRecord, string strPatientName,
                            string strComment, string strGeneralHeading, string strNotification, string strDOB, string password, string strSub, string strTo, string additonalComments)
        {
            string strReportPath;
            string strFileName;
            string strFilePath;
            string strCompleteFilePath;
            string sourceFile;

            string timeoffax = DateTime.Now.ToString().Substring(10, 7).Replace(":", "") + DateTime.Now.Millisecond;

            strFaxNumber        = strFaxNumber.Substring(0, 3) + strFaxNumber.Substring(4, 3) + strFaxNumber.Substring(8, 4);
            strReportPath       = "\\AdDisNotice\\" + strRepType + strHospital + ".rdlc";
            strFileName         = strRepType + strHospital + strUserID + "_" + intPtLogRecord.ToString() + "_" + timeoffax + ".pdf";
            strFilePath         = strFaxFolder + strRepType + "\\";
            strCompleteFilePath = strFilePath + strFileName;
            sourceFile          = strFilePath;

            CreatePDFDocument(strCompleteFilePath, AIMSReportViewer, strCompleteFilePath);

            if (strFilePath.Substring(1, 1) == ":")
            {
                strFilePath = MACHINE_PATH + strFilePath.Substring(2);
            }

            bool isFax   = false;
            bool isEmail = false;

            if (strNotification == "")
            {
                isFax = true;
            }
            else
            {
                string[] arrNotification = strNotification.Split(new char[] { ';' });

                if (arrNotification.Contains("Fax"))
                {
                    isFax = true;
                }
                if (arrNotification.Contains("Email"))
                {
                    isEmail = true;
                }
            }

            if (strDOB == "N/A")
            {
                strDOB = "";
            }

            PCPCommunication comm = new PCPCommunication();

            comm.AdditionalComments = additonalComments;
            comm.Comments           = strComment;
            comm.CommStatus         = "Created";
            //Try to convert DOB to DateTime, revert to default if fails
            try
            {
                comm.DOB = DateTime.Parse(strDOB);
            }
            catch
            {
                comm.DOB = DateTime.Parse("1/1/1900");
            }
            comm.DocumentName = strFileName;
            comm.DocumentPath = strFilePath;
            comm.DocumentType = strRepType;
            //comm.EmailID =
            comm.FaxCover      = FAX_COVER;
            comm.FaxNo         = strFaxNumber;
            comm.GenComHeading = strGeneralHeading;
            comm.Hospital      = strHospital;
            //comm.Pages =
            comm.PatientName = strPatientName;
            comm.PLRecord    = intPtLogRecord;
            comm.ToUserID    = strPcpID;
            comm.UserID      = strUserID;

            if (isFax)
            {
                comm.CommType = "Fax";
                UpdateCommTable(comm);
            }

            if (isEmail)
            {
                comm.CommType = "Email";
                if (strTo != "")
                {
                    if (password == "")
                    {
                        password = "******";
                    }
                }
                string[] ret        = CreateEncryptedPDF(sourceFile, strFileName, password);
                string   outputFile = ret[0];
                int      pages      = Convert.ToInt32(ret[1]);
                string   strMsg     = DateTime.Now.ToString();
                UpdateCommTable(comm);

                try
                {
                    if (HubSecurity.Debug() == true)
                    {
                        strTo = "*****@*****.**";
                    }
                    SendMail("*****@*****.**", strTo, strSub, strMsg, outputFile, "fax", "aimsfx2345", null);
                    UpdateStatus(comm, "Mail Forwarded");
                    strMsg = "<html><body><b>" + strSub + "</b> has been sent to <br/><br/><table><tr><td> <b>PCP</b>: </td><td>" + strPcpName + "</td></tr>" +
                             "<tr><td><b>Mail Id: </b></td><td>" + strTo + "</td></tr>" +
                             "<tr><td><b>Time: </b></td><td>" + DateTime.Now.ToString() + "</td></tr></table><br/><br/> Please access AIMS Hub to view details.</body></html>";

                    string strToCC = AimsHub.Security.HubSecurity.getLoggedInUserID() + "@aims.us.com";
                    SendMail("*****@*****.**", strToCC, strSub, strMsg, null, "fax", "aimsfx2345", null);
                }
                catch
                {
                    UpdateStatus(comm, "Send Failed");
                }
                File.Delete(outputFile);
            }
        }