public JsonResult Pharmacy(HospitalLocation model)
        {
            string path11 = "";
            var    file11 = model.ImageFile11;

            if (file11 != null)
            {
                //var path = "";
                var filename  = Path.GetFileName(file11.FileName);
                var extention = Path.GetExtension(file11.FileName);
                var filenamethoutextenction = Path.GetFileNameWithoutExtension(file11.FileName);
                //  file.SaveAs(Server.MapPath("~/MRDFiles/" + file.FileName));
                //  Session["Paper"] = "/MRDFiles/" + file.FileName;

                path11 = Server.MapPath("~/") + "MRDFiles/" + file11.FileName;

                file11.SaveAs(path11);

                // Session["Paper"] = path;
                path11 = "/MRDFiles/" + file11.FileName;
                ////ViewData["ImagePath"] = "/MRDFiles/" + file10.FileName;
                TempData["Pharmacy"] = "/MRDFiles/" + file11.FileName;
            }
            return(new JsonResult {
                Data = path11, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #2
0
 public HospitalLocationTO(HospitalLocation mdo)
 {
     if (mdo == null)
     {
         return;
     }
     this.id         = mdo.Id;
     this.name       = mdo.Name;
     this.department = new TaggedText(mdo.Department);
     this.service    = new TaggedText(mdo.Service);
     this.specialty  = new TaggedText(mdo.Specialty);
     this.stopCode   = new TaggedText(mdo.StopCode);
     if (mdo.Facility != null)
     {
         this.facility = new SiteTO(mdo.Facility);
     }
     this.building               = mdo.Building;
     this.floor                  = mdo.Floor;
     this.room                   = mdo.Room;
     this.bed                    = mdo.Bed;
     this.status                 = mdo.Status;
     this.phone                  = mdo.Phone;
     this.appointmentTimestamp   = mdo.AppointmentTimestamp;
     this.type                   = mdo.Type;
     this.physicalLocation       = mdo.PhysicalLocation;
     this.askForCheckIn          = mdo.AskForCheckIn;
     this.appointmentLength      = mdo.AppointmentLength;
     this.clinicDisplayStartTime = mdo.ClinicDisplayStartTime;
     this.displayIncrements      = mdo.DisplayIncrements;
     this.availability           = new TimeSlotArray(mdo.Availability);
 }
 public HospitalLocationTO(HospitalLocation mdo)
 {
     if (mdo == null)
     {
         return;
     }
     this.id         = mdo.Id;
     this.name       = mdo.Name;
     this.department = new TaggedText(mdo.Department);
     this.service    = new TaggedText(mdo.Service);
     this.specialty  = new TaggedText(mdo.Specialty);
     if (mdo.Facility != null)
     {
         this.facility = new SiteTO(mdo.Facility);
     }
     this.building             = mdo.Building;
     this.floor                = mdo.Floor;
     this.room                 = mdo.Room;
     this.bed                  = mdo.Bed;
     this.status               = mdo.Status;
     this.phone                = mdo.Phone;
     this.appointmentTimestamp = mdo.AppointmentTimestamp;
     this.type                 = mdo.Type;
     this.physicalLocation     = mdo.PhysicalLocation;
 }
        public JsonResult LabReportHeader(HospitalLocation model)
        {
            string path5 = "";
            //PatientMRD_Model Model
            // PatientMRD_Model obj = new PatientMRD_Model();
            var file5 = model.ImageFile5;

            if (file5 != null)
            {
                //var path = "";
                var filename  = Path.GetFileName(file5.FileName);
                var extention = Path.GetExtension(file5.FileName);
                var filenamethoutextenction = Path.GetFileNameWithoutExtension(file5.FileName);
                //  file.SaveAs(Server.MapPath("~/MRDFiles/" + file.FileName));
                //  Session["Paper"] = "/MRDFiles/" + file.FileName;

                path5 = Server.MapPath("~/") + "MRDFiles/" + file5.FileName;

                file5.SaveAs(path5);

                // Session["Paper"] = path;
                path5 = "/MRDFiles/" + file5.FileName;
                //ViewData["ImagePath"] = "/MRDFiles/" + file5.FileName;
                TempData["LabReportHeader"] = "/MRDFiles/" + file5.FileName;
            }
            return(new JsonResult {
                Data = path5, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public JsonResult PrivilegeCardBack(HospitalLocation model)
        {
            string path10 = "";
            //PatientMRD_Model Model
            // PatientMRD_Model obj = new PatientMRD_Model();
            var file10 = model.ImageFile10;

            if (file10 != null)
            {
                //var path = "";
                var filename  = Path.GetFileName(file10.FileName);
                var extention = Path.GetExtension(file10.FileName);
                var filenamethoutextenction = Path.GetFileNameWithoutExtension(file10.FileName);
                //  file.SaveAs(Server.MapPath("~/MRDFiles/" + file.FileName));
                //  Session["Paper"] = "/MRDFiles/" + file.FileName;

                path10 = Server.MapPath("~/") + "MRDFiles/" + file10.FileName;

                file10.SaveAs(path10);

                // Session["Paper"] = path;
                path10 = "/MRDFiles/" + file10.FileName;
                ////ViewData["ImagePath"] = "/MRDFiles/" + file10.FileName;
                TempData["PrivilegeCardBack"] = "/MRDFiles/" + file10.FileName;
            }
            return(new JsonResult {
                Data = path10, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #6
0
        public TaggedTextArray getSitesForStation()
        {
            TaggedTextArray result = new TaggedTextArray();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                List <SiteId> lst = HospitalLocation.getSitesForStation(mySession.ConnectionSet.BaseConnection);
                if (lst == null || lst.Count == 0)
                {
                    return(null);
                }
                result.results = new TaggedText[lst.Count];
                for (int i = 0; i < lst.Count; i++)
                {
                    result.results[i] = new TaggedText(lst[i].Id, lst[i].Name);
                }
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Beispiel #7
0
        public SiteArray getAllInstitutions()
        {
            SiteArray siteResults = new SiteArray();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                siteResults.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            if (siteResults.fault != null)
            {
                return(siteResults);
            }

            try
            {
                List <Site> sites = HospitalLocation.getAllInstitutions(mySession.ConnectionSet.BaseConnection);
                siteResults = new SiteArray(sites);
            }
            catch (Exception e)
            {
                siteResults.fault = new FaultTO(e);
            }

            return(siteResults);
        }
Beispiel #8
0
        public TaggedTextArray getClinicsByName(string name)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (!mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(name))
            {
                result.fault = new FaultTO("Empty clinic name");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                OrderedDictionary d = HospitalLocation.getClinicsByName(mySession.ConnectionSet.BaseConnection, name);
                result = new TaggedTextArray(d);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
        public void testGetClinicSchedulingDetails()
        {
            HospitalLocation result = _dao.getClinicSchedulingDetails("195");

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Availability.Count, 2232, "Should be 2232 TimeSlot objects");
            Assert.AreEqual("7", result.ClinicDisplayStartTime);
            Assert.AreEqual("4", result.DisplayIncrements);
            Assert.AreEqual("30", result.AppointmentLength);
            Assert.IsTrue(result.AskForCheckIn);
            Assert.IsNull(result.Id);
            Assert.AreEqual("CARDIOLOGY", result.Name);
            Assert.AreEqual("CARDIO", result.Abbr);
            Assert.AreEqual("C", result.Type);
            Assert.AreEqual("C", result.TypeExtension.Key);
            Assert.AreEqual("CLINIC", result.TypeExtension.Value);
            Assert.IsNull(result.Institution.Key);
            Assert.IsNull(result.Institution.Value);
            Assert.IsNull(result.Division.Key);
            Assert.IsNull(result.Division.Value);
            Assert.IsNull(result.Module.Key);
            Assert.IsNull(result.Module.Value);
            Assert.IsNull(result.DispositionAction);
            Assert.AreEqual("", result.VisitLocation);
            Assert.IsNull(result.StopCode.Key);
            Assert.IsNull(result.StopCode.Value);
            Assert.IsNull(result.Department.Key);
            Assert.IsNull(result.Department.Value);
            Assert.AreEqual("M", result.Service.Key);
            Assert.AreEqual("MEDICINE", result.Service.Value);
        }
Beispiel #10
0
        public HospitalLocation getClinicSchedulingDetails(string clinicId)
        {
            DdrGetsEntry request = buildGetClinicSchedulingDetailsQuery(clinicId);

            string[]         response = request.execute();
            HospitalLocation result   = toClinicSchedulingDetails(response);

            result.Availability = getClinicAvailability(clinicId, Convert.ToInt32(result.ClinicDisplayStartTime), Convert.ToInt32(result.AppointmentLength)); // supplement availability

            return(result);
        }
 public TaggedHospitalLocationArray(string tag, HospitalLocation location)
 {
     this.tag = tag;
     if (location == null)
     {
         this.count = 0;
         return;
     }
     this.locations    = new HospitalLocationTO[1];
     this.locations[0] = new HospitalLocationTO(location);
     this.count        = 1;
 }
Beispiel #12
0
        // GET: Hospitals
        public ActionResult Index(int cityname = 1)
        {
            HospitalLocation HL = new HospitalLocation()
            {
                Hospitals = db.hospital.Where(m => m.c_id == cityname).ToList(),
                Cities    = db.city.ToList(),
                Districts = db.district.ToList()
            };

            ViewBag.cityname   = db.city.Where(m => m.c_id == cityname).FirstOrDefault().city_name;
            ViewBag.citynameID = cityname;

            return(View(HL));
        }
        public ActionResult HospitalLocation(HospitalLocation obj)
        {
            obj.LocationName  = Request.Form["LocationName"];
            obj.HospitalName  = Request.Form["HospitalName"];
            obj.GroupName     = Request.Form["GroupName"];
            obj.Logo          = Request.Form["Logo"];
            obj.ManagingBody  = Request.Form["ManagingBody"];
            obj.Adminstrator  = Request.Form["Adminstrator"];
            obj.Address       = Request.Form["Address"];
            obj.CityID        = Request.Form["CityID"];
            obj.Pincode       = Request.Form["Pincode"];
            obj.StateID       = Request.Form["StateID"];
            obj.CountryID     = Request.Form["CountryID"];
            obj.PhoneNumber   = Request.Form["PhoneNumber"];
            obj.PhoneNumber1  = Request.Form["PhoneNumber1"];
            obj.Fax           = Request.Form["Fax"];
            obj.MobileNo      = Request.Form["MobileNo"];
            obj.EmailID       = Request.Form["EmailID"];
            obj.EmailPassword = Request.Form["EmailPassword"];
            obj.URL           = Request.Form["URL"];


            obj.RegistrationNo            = Request.Form["RegistrationNo"];
            obj.ServiceTaxNo              = Request.Form["ServiceTaxNo"];
            obj.PANNo                     = Request.Form["PANNo"];
            obj.TANo                      = Request.Form["TANo"];
            obj.TDSCircle                 = Request.Form["TDSCircle"];
            obj.RegistrationCharge        = Request.Form["RegistrationCharge"];
            obj.RegistrationRenwalCharges = Request.Form["RegistrationRenwalCharges"];
            obj.TDSProfessional           = Request.Form["TDSProfessional"];
            obj.TDSContrator              = Request.Form["TDSContrator"];



            try
            {
                BL_HospitalLocation Bl_Dept = new BL_HospitalLocation();
                if (Bl_Dept.Save(obj))
                {
                    ModelState.Clear();
                    TempData["Msg"] = " HospitalLocation Save successfully";
                }

                return(RedirectToAction("HospitalLocation", "HospitalLocation"));
            }
            catch (Exception)
            {
                return(View());
            }
        }
        // GET: Hospitals
        public ActionResult Index(int?cityId, int?districtId, int page = 1)
        {
            HospitalLocation HL;
            int currentPage = page < 1 ? 1 : page;

            if (cityId == null & districtId == null)
            {
                HL = new HospitalLocation()
                {
                    //Hospitals = db.hospital.ToList(),
                    Cities        = db.city.ToList(),
                    Districts     = db.district.ToList(),
                    HospitalPages = db.hospital.ToList().ToPagedList(currentPage, pageSize)
                };

                ViewBag.cityname = "全部縣市";
                ViewBag.cityID   = "null";
                //ViewBag.d_id = new SelectList(db.district, "d_id", "district_name");
            }
            else if (cityId != null & districtId == null)
            {
                HL = new HospitalLocation()
                {
                    HospitalPages = db.hospital.Where(m => m.c_id == cityId).ToList().ToPagedList(currentPage, pageSize),
                    Cities        = db.city.ToList(),
                    Districts     = db.district.Where(m => m.c_id == cityId).ToList()
                };

                ViewBag.cityname = db.city.Where(m => m.c_id == cityId).FirstOrDefault().city_name;
                ViewBag.cityID   = cityId;
                //ViewBag.d_id = new SelectList(db.district.Where(m => m.c_id == cityId), "d_id", "district_name");
            }
            else
            {
                HL = new HospitalLocation()
                {
                    HospitalPages = db.hospital.Where(m => m.c_id == cityId & m.d_id == districtId).ToList().ToPagedList(currentPage, pageSize),
                    Cities        = db.city.ToList(),
                    Districts     = db.district.Where(m => m.c_id == cityId).ToList()
                };

                ViewBag.cityname = db.city.Where(m => m.c_id == cityId).FirstOrDefault().city_name;
                ViewBag.cityID   = cityId;
                //ViewBag.d_id = new SelectList(db.district.Where(m => m.c_id == cityId), "d_id", "district_name");
            }

            return(View(HL));
        }
Beispiel #15
0
        internal Appointment[] toAppointmentsFromDataReader(IDataReader reader)
        {
            IList <Appointment> appointments = new List <Appointment>();

            try
            {
                while (reader.Read())
                {
                    string id    = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("AppointmentSID"));
                    string sta3n = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("Sta3n"));
                    string appointmentDateTime = DbReaderUtil.getDateTimeValue(reader, reader.GetOrdinal("AppointmentDateTime"));
                    string purposeOfVisit      = DbReaderUtil.getValue(reader, reader.GetOrdinal("PurposeOfVisit"));
                    string locationName        = DbReaderUtil.getValue(reader, reader.GetOrdinal("LocationName"));
                    string primaryStopCode     = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("PrimaryStopCode"));
                    string secondaryStopCode   = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("SecondaryStopCode"));
                    string institutionName     = DbReaderUtil.getValue(reader, reader.GetOrdinal("InstitutionName"));
                    string locationType        = DbReaderUtil.getValue(reader, reader.GetOrdinal("LocationType"));
                    string medicalService      = DbReaderUtil.getValue(reader, reader.GetOrdinal("MedicalService"));
                    string visitId             = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("VisitSID"));
                    string providerName        = providerNameIfAvailable(reader);

                    SiteId           facility         = new SiteId(sta3n, institutionName);
                    HospitalLocation hospitalLocation = new HospitalLocation();
                    hospitalLocation.Name     = locationName;
                    hospitalLocation.StopCode = new KeyValuePair <string, string>("Primary", primaryStopCode);
                    hospitalLocation.Type     = medicalService;

                    Appointment appointment = new Appointment()
                    {
                        Id           = id,
                        VisitId      = visitId,
                        Clinic       = hospitalLocation,
                        Timestamp    = appointmentDateTime,
                        Purpose      = purposeOfVisit,
                        Facility     = facility,
                        ProviderName = providerName
                    };

                    appointments.Add(appointment);
                }
            }
            catch (Exception) { }
            finally
            {
                reader.Close();
            }
            return(appointments.ToArray <Appointment>());
        }
Beispiel #16
0
        // TODO - need to finish parsing
        internal IList <HospitalLocation> toAllClinics(string response)
        {
            IList <HospitalLocation> locations = new List <HospitalLocation>();

            if (String.IsNullOrEmpty(response))
            {
                return(locations);
            }

            string[] lines = StringUtils.split(response, StringUtils.CRLF);

            if (lines == null || lines.Length == 0)
            {
                throw new MdoException(MdoExceptionCode.DATA_UNEXPECTED_FORMAT);
            }

            string[] metaLine   = StringUtils.split(lines[0], StringUtils.EQUALS);
            string[] metaPieces = StringUtils.split(metaLine[1], StringUtils.CARET);
            Int32    numResult  = Convert.ToInt32(metaPieces[0]);

            // metaPieces[1] = number of records requested (number argument). asterisk means all were returned
            // metaPieces[2] = ?

            for (int i = 1; i < lines.Length; i++)
            {
                string[] pieces = StringUtils.split(lines[i], StringUtils.EQUALS);

                if (pieces.Length < 2 || String.IsNullOrEmpty(pieces[1])) // at the declaration of a new result - create a new appointment type
                {
                    if (lines.Length >= i + 2)                            // just to be safe - check there are two more lines so we can obtain the ID and name
                    {
                        HospitalLocation current = new HospitalLocation();
                        current.Id   = (StringUtils.split(lines[i + 1], StringUtils.EQUALS))[1];
                        current.Name = (StringUtils.split(lines[i + 2], StringUtils.EQUALS))[1];
                        locations.Add(current);
                    }
                }
            }

            // TBD - should we check the meta info matched the number of results found?
            return(locations);
        }
Beispiel #17
0
        public HospitalLocation getClinicSchedulingDetails(String clinicId, String startDateTime)
        {
            DdrGetsEntry request = buildGetClinicSchedulingDetailsQuery(clinicId);

            string[]         response = request.execute();
            HospitalLocation result   = toClinicSchedulingDetails(response);

            Int32 clinicDisplayStartTimeInt = 0;
            Int32 apptLengthInt             = 0;

            if (String.IsNullOrEmpty(result.ClinicDisplayStartTime) || !Int32.TryParse(result.ClinicDisplayStartTime, out clinicDisplayStartTimeInt) ||
                String.IsNullOrEmpty(result.AppointmentLength) || !Int32.TryParse(result.AppointmentLength, out apptLengthInt))
            {
                throw new mdo.exceptions.DataException("The clinic has not been configured correctly in VistA");
            }

            result.Availability = getClinicAvailability(clinicId, startDateTime, clinicDisplayStartTimeInt, apptLengthInt); // supplement availability

            return(result);
        }
Beispiel #18
0
 public NoteTO(Note mdoNote)
 {
     if (mdoNote == null) // || ((mdoNote.Id == null || mdoNote.Id == "") && mdoNote.ApprovedBy == null))
     {
         return;
     }
     this.id                 = mdoNote.Id;
     this.timestamp          = mdoNote.Timestamp;
     this.admitTimestamp     = mdoNote.AdmitTimestamp;
     this.dischargeTimestamp = mdoNote.DischargeTimestamp;
     this.localTitle         = mdoNote.LocalTitle;
     this.standardTitle      = mdoNote.StandardTitle;
     this.serviceCategory    = mdoNote.ServiceCategory;
     if (mdoNote.Author != null)
     {
         this.author = new AuthorTO(mdoNote.Author);
     }
     if (mdoNote.Location != null)
     {
         this.location = new HospitalLocationTO(mdoNote.Location);
     }
     else if (!String.IsNullOrEmpty(mdoNote.SiteId.Id) || !String.IsNullOrEmpty(mdoNote.SiteId.Name))
     {
         HospitalLocation hl = new HospitalLocation(mdoNote.SiteId.Id, mdoNote.SiteId.Name);
         this.location = new HospitalLocationTO(hl);
     }
     this.text           = mdoNote.Text;
     this.hasAddendum    = mdoNote.HasAddendum;
     this.isAddendum     = mdoNote.IsAddendum;
     this.originalNoteID = mdoNote.OriginalNoteId;
     this.hasImages      = mdoNote.HasImages;
     if (mdoNote.ApprovedBy != null)
     {
         this.approvedBy = new AuthorTO(mdoNote.ApprovedBy);
     }
     this.status = mdoNote.Status;
 }
Beispiel #19
0
        // TODO - need to finish parsing
        internal HospitalLocation toLocation(string response)
        {
            HospitalLocation location = new HospitalLocation();

            if (String.IsNullOrEmpty(response))
            {
                return(location);
            }

            string[] lines = StringUtils.split(response, StringUtils.CRLF);

            foreach (string line in lines)
            {
                if (String.IsNullOrEmpty(line))
                {
                    continue;
                }

                string[] pieces = StringUtils.split(line, StringUtils.EQUALS);

                if (pieces.Length < 2)
                {
                    continue;
                }

                pieces[0] = pieces[0].Replace("RESULT(\"", "");
                pieces[0] = pieces[0].Replace("\")", "");

                switch (pieces[0])
                {
                case "ABBREVIATION":
                    location.Abbr = StringUtils.split(pieces[1], StringUtils.CARET)[0];
                    break;

                case "DIVISION":
                    location.Division = new KeyValuePair <string, string>(
                        StringUtils.split(pieces[1], StringUtils.CARET)[0], StringUtils.split(pieces[1], StringUtils.CARET)[1]);
                    break;

                case "NAME":
                    location.Name = StringUtils.split(pieces[1], StringUtils.CARET)[0];
                    break;

                case "TREATING SPECIALTY":
                    location.Specialty = new KeyValuePair <string, string>(
                        StringUtils.split(pieces[1], StringUtils.CARET)[0], StringUtils.split(pieces[1], StringUtils.CARET)[1]);
                    break;

                case "TYPE":
                    location.Type = StringUtils.split(pieces[1], StringUtils.CARET)[1];
                    break;

                case "TYPE EXTENSION":
                    location.TypeExtension = new KeyValuePair <string, string>(
                        StringUtils.split(pieces[1], StringUtils.CARET)[0], StringUtils.split(pieces[1], StringUtils.CARET)[1]);
                    break;

                default:
                    break;
                }
            }

            return(location);
        }
Beispiel #20
0
        internal HospitalLocation toClinicSchedulingDetails(string[] response)
        {
            HospitalLocation result = new HospitalLocation();

            if (response == null || response.Length <= 0 || String.IsNullOrEmpty(response[0]) || response[0].Contains("ERROR"))
            {
                throw new MdoException("Invalid response for building clinic scheduling details");
            }

            foreach (string line in response)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                if (!(line.StartsWith("44")))
                {
                    continue;
                }

                string[] pieces = StringUtils.split(line, StringUtils.CARET);

                if (pieces == null || pieces.Length != 5)
                {
                    continue;
                }

                switch (pieces[2])
                {
                    //query.Fields = ".01;1;2;7;9;24;1912;1914;1917";
                    case ".01":
                        result.Name = pieces[3];
                        break;
                    case "1":
                        result.Abbr = pieces[3];
                        break;
                    case "2":
                        result.Type = pieces[3];
                        result.TypeExtension = new KeyValuePair<string, string>(result.Type, pieces[4]);
                        break;
                    case "7":
                        result.VisitLocation = pieces[3];
                        break;
                    case "9":
                        result.Service = new KeyValuePair<string, string>(pieces[3], pieces[4]);
                        break;
                    case "24":
                        result.AskForCheckIn = String.Equals(pieces[3], "1") | String.Equals(pieces[3], "Y", StringComparison.CurrentCultureIgnoreCase);
                        break;
                    case "1912":
                        result.AppointmentLength = pieces[3];
                        break;
                    case "1914":
                        result.ClinicDisplayStartTime = pieces[3];
                        break;
                    case "1917":
                        result.DisplayIncrements = pieces[3];
                        break;
                }
            }

            return result;
        }
Beispiel #21
0
        public bool Save(HospitalLocation obj)
        {
            Connect();

            try
            {
                SqlCommand cmd = new SqlCommand("IUHospitalLocation", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@HospitalID", HospitalID);

                if (obj.ReferenceCode == null)
                {
                    cmd.Parameters.AddWithValue("@ReferenceCode", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ReferenceCode", obj.ReferenceCode);
                }

                if (obj.LocationID == 0 || obj.LocationID == null)
                {
                    cmd.Parameters.AddWithValue("@LocationID", 0);
                    cmd.Parameters["@LocationID"].Direction = ParameterDirection.Output;
                    cmd.Parameters.AddWithValue("@Mode", "Add");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@LocationID", obj.LocationID);
                    cmd.Parameters.AddWithValue("@Mode", "Edit");
                }
                if (obj.LocationName == null || obj.LocationName == "")
                {
                    cmd.Parameters.AddWithValue("@LocationName", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@LocationName", obj.LocationName);
                }
                if (obj.HospitalName == null || obj.HospitalName == "")
                {
                    cmd.Parameters.AddWithValue("@HospitalName", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@HospitalName", obj.HospitalName);
                }

                if (obj.GroupName == null || obj.GroupName == "")
                {
                    cmd.Parameters.AddWithValue("@GroupName", obj.GroupName);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@GroupName", obj.GroupName);
                }

                if (obj.Logo == null || obj.Logo == "")
                {
                    cmd.Parameters.AddWithValue("@Logo", DBNull.Value);
                }


                else
                {
                    //FileStream file1 = new FileStream(obj.Logo, FileMode.OpenOrCreate, FileAccess.Read);
                    //byte[] stphoto1 = new byte[file1.Length];
                    //file1.Read(stphoto1, 0, System.Convert.ToInt32(file1.Length));
                    //file1.Close();

                    cmd.Parameters.AddWithValue("@Logo", obj.Logo);
                }

                if (obj.ManagingBody == null || obj.ManagingBody == "")
                {
                    cmd.Parameters.AddWithValue("@ManagingBody", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ManagingBody", obj.ManagingBody);
                }

                if (obj.Adminstrator == null || obj.Adminstrator == "")
                {
                    cmd.Parameters.AddWithValue("@Adminstrator", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@Adminstrator", obj.Adminstrator);
                }

                if (obj.Address == null || obj.Address == "")
                {
                    cmd.Parameters.AddWithValue("@Address", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@Address", obj.Address);
                }
                if (obj.CityID == null || obj.CityID == "")
                {
                    cmd.Parameters.AddWithValue("@CityID", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@CityID", obj.CityID);
                }
                if (obj.Pincode == null || obj.Pincode == "")
                {
                    cmd.Parameters.AddWithValue("@PinCode", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@PinCode", obj.Pincode);
                }

                if (obj.StateID == null || obj.StateID == "")
                {
                    cmd.Parameters.AddWithValue("@StateID", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@StateID", obj.StateID);
                }
                if (obj.CountryID == null || obj.CountryID == "")
                {
                    cmd.Parameters.AddWithValue("@CountryID", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@CountryID", obj.CountryID);
                }
                if (obj.PhoneNumber == null || obj.PhoneNumber == "")
                {
                    cmd.Parameters.AddWithValue("@PhoneNo", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@PhoneNo", obj.PhoneNumber);
                }
                if (obj.Fax == null || obj.Fax == "")
                {
                    cmd.Parameters.AddWithValue("@FaxNo", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@FaxNo", obj.Fax);
                }
                if (obj.PhoneNumber1 == null || obj.PhoneNumber1 == "")
                {
                    cmd.Parameters.AddWithValue("@PhoneNo1", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@PhoneNo1", obj.PhoneNumber1);
                }
                if (obj.MobileNo == null || obj.MobileNo == "")
                {
                    cmd.Parameters.AddWithValue("@MobileNo", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@MobileNo", obj.MobileNo);
                }

                if (obj.EmailPassword == null || obj.EmailPassword == "")
                {
                    cmd.Parameters.AddWithValue("@EmailPassword", 0);
                }

                else
                {
                    cmd.Parameters.AddWithValue("@EmailPassword", obj.EmailPassword);
                }

                if (obj.EmailID == null || obj.EmailID == "")
                {
                    cmd.Parameters.AddWithValue("@EmailID", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@EmailID", obj.EmailID);
                }

                if (obj.URL == null || obj.URL == "")
                {
                    cmd.Parameters.AddWithValue("@URL", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@URL", obj.URL);
                }
                if (obj.RegistrationNo == null || obj.RegistrationNo == "")
                {
                    cmd.Parameters.AddWithValue("@RegistrationNo", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@RegistrationNo", obj.RegistrationNo);
                }

                if (obj.ServiceTaxNo == null || obj.ServiceTaxNo == "")
                {
                    cmd.Parameters.AddWithValue("@ServiceTaxNo", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ServiceTaxNo", obj.ServiceTaxNo);
                }

                if (obj.PANNo == null || obj.PANNo == "")
                {
                    cmd.Parameters.AddWithValue("@PANNo", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@PANNo", obj.PANNo);
                }

                if (obj.TANo == null || obj.TANo == "")
                {
                    cmd.Parameters.AddWithValue("@TANo", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@TANo", obj.TANo);
                }

                if (obj.TDSCircle == null || obj.TDSCircle == "")
                {
                    cmd.Parameters.AddWithValue("@TDSCircle", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@TDSCircle", obj.TDSCircle);
                }

                if (obj.RegistrationCharge == null || obj.RegistrationCharge == "")
                {
                    cmd.Parameters.AddWithValue("@RegistrationCharge", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@RegistrationCharge", obj.RegistrationCharge);
                }

                if (obj.RegistrationRenwalCharges == null | obj.RegistrationRenwalCharges == "")
                {
                    cmd.Parameters.AddWithValue("@RegistrationRenwalCharges", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@RegistrationRenwalCharges", obj.RegistrationRenwalCharges);
                }

                if (obj.TDSProfessional == null || obj.TDSProfessional == "")
                {
                    cmd.Parameters.AddWithValue("@TDSProfessional", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@TDSProfessional", obj.TDSProfessional);
                }
                if (obj.TDSContrator == null || obj.TDSContrator == "")
                {
                    cmd.Parameters.AddWithValue("@TDSContrator", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@TDSContrator", obj.TDSContrator);
                }
                if (obj.ServiceCharge == null || obj.ServiceCharge == "")
                {
                    cmd.Parameters.AddWithValue("@ServiceCharge", 0);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ServiceCharge", obj.ServiceCharge);
                }


                if (obj.ReportSignature12 == "" || obj.ReportSignature12 == null)
                {
                    cmd.Parameters.AddWithValue("@ReportsSignatureImg", null);
                }

                else
                {
                    //FileStream file2 = new FileStream(obj.ReportSignature12, FileMode.OpenOrCreate, FileAccess.Read);
                    //byte[] stphoto2 = new byte[file2.Length];
                    //file2.Read(stphoto2, 0, System.Convert.ToInt32(file2.Length));
                    //file2.Close();
                    // E:\Govind\MVCProject23092020live\KeystoneProject\KeystoneProject\MRDFiles/images (7).jpg
                    string path     = System.Web.HttpContext.Current.Server.MapPath("~") + obj.ReportSignature12;
                    byte[] byteData = System.IO.File.ReadAllBytes(path);
                    cmd.Parameters.AddWithValue("@ReportsSignatureImg", byteData);
                }

                if (obj.ReportSignature12 == null || obj.ReportSignature12 == "")
                {
                    cmd.Parameters.AddWithValue("@ReportSignature", null);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ReportSignature", obj.ReportSignature12);
                }

                if (obj.ReportSignature1 == "" || obj.ReportSignature1 == null)
                {
                    cmd.Parameters.AddWithValue("@ReportSignature1Img", null);
                }
                else
                {
                    FileStream file3    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.ReportSignature1, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto3 = new byte[file3.Length];
                    file3.Read(stphoto3, 0, System.Convert.ToInt32(file3.Length));
                    file3.Close();
                    cmd.Parameters.AddWithValue("@ReportSignature1Img", stphoto3);
                }


                if (obj.ReportSignature1 == null || obj.ReportSignature1 == "")
                {
                    cmd.Parameters.AddWithValue("@ReportSignature1", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ReportSignature1", obj.ReportSignature1);
                }

                if (obj.OtherSignature == null || obj.OtherSignature == "")
                {
                    cmd.Parameters.AddWithValue("@OtherHeaderImg", null);
                }

                else
                {
                    FileStream file4    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.OtherSignature, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto4 = new byte[file4.Length];
                    file4.Read(stphoto4, 0, System.Convert.ToInt32(file4.Length));
                    file4.Close();

                    cmd.Parameters.AddWithValue("@OtherHeaderImg", stphoto4);
                }

                if (obj.OtherSignature == null || obj.OtherSignature == "")
                {
                    cmd.Parameters.AddWithValue("@OtherHeader", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@OtherHeader", obj.OtherSignature);
                }

                if (obj.BillHeader == null || obj.BillHeader == "")
                {
                    cmd.Parameters.AddWithValue("@BillsHeaderImg", null);
                }
                else
                {
                    FileStream file5    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.BillHeader, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto5 = new byte[file5.Length];
                    file5.Read(stphoto5, 0, System.Convert.ToInt32(file5.Length));
                    file5.Close();
                    cmd.Parameters.AddWithValue("@BillsHeaderImg", stphoto5);
                }


                if (obj.BillHeader == null || obj.BillHeader == "")
                {
                    cmd.Parameters.AddWithValue("@BillsHeader", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@BillsHeader", obj.BillHeader);
                }

                if (obj.LabReportHeader == null || obj.LabReportHeader == "")
                {
                    cmd.Parameters.AddWithValue("@LabReportsHeaderImg", null);
                }

                else
                {
                    FileStream file6    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.LabReportHeader, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto6 = new byte[file6.Length];
                    file6.Read(stphoto6, 0, System.Convert.ToInt32(file6.Length));
                    file6.Close();

                    cmd.Parameters.AddWithValue("@LabReportsHeaderImg", stphoto6);
                }

                if (obj.LabReportHeader == null || obj.LabReportHeader == "")
                {
                    cmd.Parameters.AddWithValue("@LabReportsHeader", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@LabReportsHeader", obj.LabReportHeader);
                }

                if (obj.ReportHeader == null || obj.ReportHeader == "")
                {
                    cmd.Parameters.AddWithValue("@ReportsHeaderImg", null);
                }
                else
                {
                    FileStream file7    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.ReportHeader, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto7 = new byte[file7.Length];
                    file7.Read(stphoto7, 0, System.Convert.ToInt32(file7.Length));
                    file7.Close();

                    cmd.Parameters.AddWithValue("@ReportsHeaderImg", stphoto7);
                }
                if (obj.ReportHeader == null || obj.ReportHeader == "")
                {
                    cmd.Parameters.AddWithValue("@ReportsHeader", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ReportsHeader", obj.ReportHeader);
                }

                if (obj.AdmissionCardFront == null || obj.AdmissionCardFront == "")
                {
                    cmd.Parameters.AddWithValue("@CardFrontendImg", null);
                }
                else
                {
                    FileStream file8    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.AdmissionCardFront, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto8 = new byte[file8.Length];
                    file8.Read(stphoto8, 0, System.Convert.ToInt32(file8.Length));
                    file8.Close();

                    cmd.Parameters.AddWithValue("@CardFrontendImg", stphoto8);
                }
                if (obj.AdmissionCardFront == null || obj.AdmissionCardFront == "")
                {
                    cmd.Parameters.AddWithValue("@CardFrontend", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@CardFrontend", obj.AdmissionCardFront);
                }

                if (obj.AdmissionCardBack == null || obj.AdmissionCardBack == "")
                {
                    cmd.Parameters.AddWithValue("@CardBackendImg", null);
                }
                else
                {
                    FileStream file9    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.AdmissionCardBack, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto9 = new byte[file9.Length];
                    file9.Read(stphoto9, 0, System.Convert.ToInt32(file9.Length));
                    file9.Close();

                    cmd.Parameters.AddWithValue("@CardBackendImg", stphoto9);
                }
                if (obj.AdmissionCardBack == null || obj.AdmissionCardBack == "")
                {
                    cmd.Parameters.AddWithValue("@CardBackend", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@CardBackend", obj.AdmissionCardBack);
                }
                if (obj.PrivilegeCardBack == null || obj.PrivilegeCardBack == "")
                {
                    cmd.Parameters.AddWithValue("@PriCardBackendImg", null);
                }


                else
                {
                    FileStream file10    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.PrivilegeCardBack, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto10 = new byte[file10.Length];
                    file10.Read(stphoto10, 0, System.Convert.ToInt32(file10.Length));
                    file10.Close();
                    cmd.Parameters.AddWithValue("@PriCardBackendImg", stphoto10);
                }

                if (obj.PrivilegeCardBack == null || obj.PrivilegeCardBack == "")
                {
                    cmd.Parameters.AddWithValue("@PriCardBackend", null);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@PriCardBackend", obj.PrivilegeCardBack);
                }

                if (obj.PrivilegeCardFront == null || obj.PrivilegeCardFront == "")
                {
                    cmd.Parameters.AddWithValue("@PriCardFrontendImg", null);
                }

                else
                {
                    FileStream file11    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.PrivilegeCardFront, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto11 = new byte[file11.Length];
                    file11.Read(stphoto11, 0, System.Convert.ToInt32(file11.Length));
                    file11.Close();

                    cmd.Parameters.AddWithValue("@PriCardFrontendImg", stphoto11);
                }

                if (obj.PrivilegeCardFront == null || obj.PrivilegeCardFront == "")
                {
                    cmd.Parameters.AddWithValue("@PriCardFrontend", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@PriCardFrontend", obj.PrivilegeCardFront);
                }


                if (obj.Pharmacy == null || obj.Pharmacy == "")
                {
                    cmd.Parameters.AddWithValue("@PharmacyImg", null);
                }

                else
                {
                    FileStream file15    = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~") + obj.PrivilegeCardFront, FileMode.OpenOrCreate, FileAccess.Read);
                    byte[]     stphoto15 = new byte[file15.Length];
                    file15.Read(stphoto15, 0, System.Convert.ToInt32(file15.Length));
                    file15.Close();

                    cmd.Parameters.AddWithValue("@PharmacyImg", stphoto15);
                }

                if (obj.Pharmacy == null || obj.Pharmacy == "")
                {
                    cmd.Parameters.AddWithValue("@Pharmacy", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@Pharmacy", obj.Pharmacy);
                }


                cmd.Parameters.AddWithValue("@CreationID", UserID);
                con.Open();
                int i = cmd.ExecuteNonQuery();
                con.Close();
                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #22
0
        internal Dictionary<string, HospitalLocation> toHospitalLocationDictionary(string[] response)
        {
            StringDictionary locationTypes = cxn.SystemFileHandler.getLookupTable(VistaConstants.LOCATION_TYPES);
            StringDictionary divisions = cxn.SystemFileHandler.getLookupTable(VistaConstants.MEDICAL_CENTER_DIVISION);
            StringDictionary stops = cxn.SystemFileHandler.getLookupTable(VistaConstants.CLINIC_STOPS);
            Dictionary<string, object> specialties = cxn.SystemFileHandler.getFile(VistaConstants.TREATING_SPECIALTY);
            StringDictionary wardLocations = cxn.SystemFileHandler.getLookupTable(VistaConstants.WARD_LOCATIONS);

            Dictionary<string, HospitalLocation> result = new Dictionary<string, HospitalLocation>(response.Length);
            for (int i = 0; i < response.Length; i++)
            {
                string[] flds = StringUtils.split(response[i], StringUtils.CARET);
                HospitalLocation hl = new HospitalLocation(flds[0], flds[1]);
                hl.Abbr = flds[2];
                hl.Type = decodeHospitalLocationType(flds[3]);
                if (locationTypes.ContainsKey(flds[4]))
                {
                    hl.TypeExtension = new KeyValuePair<string, string>(flds[4], locationTypes[flds[4]]);
                }
                hl.Facility = new Site(flds[5], flds[6]);
                if (divisions.ContainsKey(flds[7]))
                {
                    hl.Division = new KeyValuePair<string, string>(flds[7], divisions[flds[7]]);
                }
                hl.Module = new KeyValuePair<string, string>(flds[8], "");
                hl.DispositionAction = decodeHospitalLocationDispositionAction(flds[9]);
                hl.VisitLocation = flds[10];
                if (stops.ContainsKey(flds[11]))
                {
                    hl.StopCode = new KeyValuePair<string, string>(flds[11], stops[flds[11]]);
                }
                hl.Service = new KeyValuePair<string, string>(flds[12], decodeHospitalLocationService(flds[12]));
                if (specialties.ContainsKey(flds[13]))
                {
                    TreatingSpecialty ts = (TreatingSpecialty)specialties[flds[13]];
                    hl.Specialty = new KeyValuePair<string, string>(flds[13], ts.Name);
                }
                hl.PhysicalLocation = flds[14];
                if (wardLocations.ContainsKey(flds[15]))
                {
                    hl.WardLocation = new KeyValuePair<string, string>(flds[15], wardLocations[flds[15]]);
                }
                hl.Phone = flds[16];
                hl.PrincipalClinic = new KeyValuePair<string, string>(flds[17], "");
                result.Add(flds[0], hl);
            }
            Dictionary<string, HospitalLocation>.Enumerator enm = result.GetEnumerator();
            while (enm.MoveNext())
            {
                HospitalLocation hl = enm.Current.Value;
                if (result.ContainsKey(hl.Module.Key))
                {
                    hl.Module = new KeyValuePair<string, string>(hl.Module.Key, result[hl.Module.Key].Name);
                }
                if (result.ContainsKey(hl.PrincipalClinic.Key))
                {
                    hl.PrincipalClinic = new KeyValuePair<string, string>(hl.PrincipalClinic.Key, result[hl.PrincipalClinic.Key].Name);
                }
            }
            return result;
        }
Beispiel #23
0
        internal HospitalLocation toHospitalLocation(string response)
        {
            if (response == "")
            {
                return null;
            }
            StringDictionary locationTypes = cxn.SystemFileHandler.getLookupTable(VistaConstants.LOCATION_TYPES);
            StringDictionary divisions = cxn.SystemFileHandler.getLookupTable(VistaConstants.MEDICAL_CENTER_DIVISION);
            StringDictionary stops = cxn.SystemFileHandler.getLookupTable(VistaConstants.CLINIC_STOPS);
            Dictionary<string, object> specialties = cxn.SystemFileHandler.getFile(VistaConstants.TREATING_SPECIALTY);
            StringDictionary wardLocations = cxn.SystemFileHandler.getLookupTable(VistaConstants.WARD_LOCATIONS);

            string[] flds = StringUtils.split(response, StringUtils.CARET);
            HospitalLocation result = new HospitalLocation(flds[0], flds[1]);
            result.Abbr = flds[2];
            result.Type = decodeHospitalLocationType(flds[3]);
            if (locationTypes.ContainsKey(flds[4]))
            {
                result.TypeExtension = new KeyValuePair<string,string>(flds[4], locationTypes[flds[4]]);
            }
            result.Facility = new Site(flds[5], flds[6]);
            if (divisions.ContainsKey(flds[7]))
            {
                result.Division = new KeyValuePair<string, string>(flds[7], divisions[flds[7]]);
            }
            result.Module = new KeyValuePair<string, string>(flds[8], "");
            result.DispositionAction = decodeHospitalLocationDispositionAction(flds[9]);
            result.VisitLocation = flds[10];
            if (stops.ContainsKey(flds[11]))
            {
                result.StopCode = new KeyValuePair<string, string>(flds[11], stops[flds[11]]);
            }
            result.Service = new KeyValuePair<string, string>(flds[12], decodeHospitalLocationService(flds[12]));
            if (specialties.ContainsKey(flds[13]))
            {
                TreatingSpecialty ts = (TreatingSpecialty)specialties[flds[13]];
                result.Specialty = new KeyValuePair<string, string>(flds[13], ts.Name);
            }
            result.PhysicalLocation = flds[14];
            if (wardLocations.ContainsKey(flds[15]))
            {
                result.WardLocation = new KeyValuePair<string, string>(flds[15], wardLocations[flds[15]]);
            }
            result.Phone = flds[16];
            result.PrincipalClinic = new KeyValuePair<string, string>(flds[17], "");
            return result;
        }
Beispiel #24
0
 internal HospitalLocation[] toHospitalLocations(string response)
 {
     if (response == "")
     {
         return null;
     }
     string[] rex = StringUtils.split(response, StringUtils.CRLF);
     rex = StringUtils.trimArray(rex);
     HospitalLocation[] result = new HospitalLocation[rex.Length];
     for (int i = 0; i < rex.Length; i++)
     {
         if (rex[i] == "")
         {
             continue;
         }
         string[] flds = StringUtils.split(rex[i], StringUtils.CARET);
         result[i] = new HospitalLocation(flds[0],flds[1]);
     }
     return result;
 }
Beispiel #25
0
 internal HospitalLocation[] toHospitalLocationsFromClinics(string response)
 {
     if (response == "")
     {
         return null;
     }
     string[] lines = StringUtils.split(response, StringUtils.CRLF);
     lines = StringUtils.trimArray(lines);
     HospitalLocation[] result = new HospitalLocation[lines.Length];
     for (int i = 0; i < lines.Length; i++)
     {
         string[] flds = StringUtils.split(lines[i], StringUtils.CARET);
         result[i] = new HospitalLocation(flds[0], flds[1]);
         result[i].PhysicalLocation = getPhysicalLocationString(flds[0]);
     }
     return result;
 }
Beispiel #26
0
        internal HospitalLocation toClinicSchedulingDetails(string[] response)
        {
            HospitalLocation result = new HospitalLocation();

            if (response == null || response.Length <= 0 || String.IsNullOrEmpty(response[0]) || response[0].Contains("ERROR"))
            {
                throw new MdoException("Invalid response for building clinic scheduling details");
            }

            foreach (string line in response)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                if (!(line.StartsWith("44")))
                {
                    continue;
                }

                string[] pieces = StringUtils.split(line, StringUtils.CARET);

                if (pieces == null || pieces.Length != 5)
                {
                    continue;
                }

                switch (pieces[2])
                {
                //query.Fields = ".01;1;2;7;9;24;1912;1914;1917";
                case ".01":
                    result.Name = pieces[3];
                    break;

                case "1":
                    result.Abbr = pieces[3];
                    break;

                case "2":
                    result.Type          = pieces[3];
                    result.TypeExtension = new KeyValuePair <string, string>(result.Type, pieces[4]);
                    break;

                case "7":
                    result.VisitLocation = pieces[3];
                    break;

                case "9":
                    result.Service = new KeyValuePair <string, string>(pieces[3], pieces[4]);
                    break;

                case "24":
                    result.AskForCheckIn = String.Equals(pieces[3], "1") | String.Equals(pieces[3], "Y", StringComparison.CurrentCultureIgnoreCase);
                    break;

                case "1912":
                    result.AppointmentLength = pieces[3];
                    break;

                case "1914":
                    result.ClinicDisplayStartTime = pieces[3];
                    break;

                case "1917":
                    result.DisplayIncrements = pieces[3];
                    break;
                }
            }

            return(result);
        }
Beispiel #27
0
        internal Visit[] toVisitsFromDataReader(IDataReader reader)
        {
            IList <Visit> visits = new List <Visit>();

            try
            {
                while (reader.Read())
                {
                    string providerSid = DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("ProviderSID"));
                    //ignore record if we don't have valid provider
                    if (!String.IsNullOrEmpty(providerSid))
                    {
                        string id                = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("VisitSID"));
                        string sta3n             = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("Sta3n"));
                        string visitDateTime     = DbReaderUtil.getDateTimeValue(reader, reader.GetOrdinal("VisitDateTime"));
                        string locationName      = DbReaderUtil.getValue(reader, reader.GetOrdinal("LocationName"));
                        string primaryStopCode   = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("PrimaryStopCode"));
                        string secondaryStopCode = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("SecondaryStopCode"));
                        string institutionName   = DbReaderUtil.getValue(reader, reader.GetOrdinal("InstitutionName"));
                        string locationType      = DbReaderUtil.getValue(reader, reader.GetOrdinal("LocationType"));
                        string medicalService    = DbReaderUtil.getValue(reader, reader.GetOrdinal("MedicalService"));
                        string firstName         = getStringValue(reader, "FirstName");
                        string lastName          = getStringValue(reader, "LastName");
                        string prefix            = getStringValue(reader, "StaffNamePrefix");
                        string suffix            = getStringValue(reader, "StaffNameSuffix");
                        string providerClass     = getStringValue(reader, "ProviderClass");

                        SiteId facility = new SiteId(sta3n, institutionName);

                        HospitalLocation hospitalLocation = new HospitalLocation()
                        {
                            Name     = locationName,
                            StopCode = new KeyValuePair <string, string>("Primary", primaryStopCode),
                            Type     = locationType
                        };

                        PersonName name = new PersonName()
                        {
                            Firstname = firstName,
                            Lastname  = lastName,
                            Prefix    = prefix,
                            Suffix    = suffix
                        };

                        User provider = new User()
                        {
                            Name          = name,
                            ProviderClass = providerClass,
                            UserClass     = providerClass
                        };

                        Visit visit = new Visit()
                        {
                            Id        = id,
                            Location  = hospitalLocation,
                            Timestamp = visitDateTime,
                            Facility  = facility,
                            Provider  = provider,
                            Service   = medicalService
                        };

                        visits.Add(visit);
                    }
                }
            }
            catch (Exception) { }
            finally
            {
                reader.Close();
            }
            return(visits.ToArray <Visit>());
        }
 public void testGetClinicSchedulingDetailsNonExistentClinicId()
 {
     HospitalLocation result = _dao.getClinicSchedulingDetails("FAKE");
 }
Beispiel #29
0
 internal Patient toPatientSelectedByRpc(string response, string dfn)
 {
     if (String.IsNullOrEmpty(response))
     {
         throw new MdoException(MdoExceptionCode.VISTA_NON_SPECIFIC_ERROR, "No such patient");
     }
     string[] fields = StringUtils.split(response, StringUtils.CARET);
     if (fields[0] == "-1")
     {
         throw new MdoException(MdoExceptionCode.VISTA_NON_SPECIFIC_ERROR, fields[5]);
     }
     Patient patient = new Patient();
     patient.Name = new PersonName(fields[0]);
     patient.Gender = fields[1];
     patient.DOB = DateUtils.trimTime(VistaTimestamp.toUtcString(fields[2]));
     patient.SSN = new SocSecNum(fields[3]);
     patient.LocalPid = dfn;
     patient.MpiPid = fields[13];
     if (!StringUtils.isEmpty(fields[14]))
     {
         patient.Age = Convert.ToInt16(fields[14]);
     }
     if (fields[4] != "" && fields[5] != "")
     {
         HospitalLocation hl = new HospitalLocation(fields[4], fields[5]);
         hl.Room = fields[6];
         if (fields[15] != "")
         {
             hl.Specialty = new KeyValuePair<string, string>(fields[15], "");
         }
         patient.Location = hl;
         patient.IsInpatient = true;
     }
     patient.Cwad = fields[7];
     patient.IsRestricted = (fields[8] == "1");
     if (fields[9] != "")
     {
         patient.AdmitTimestamp = VistaTimestamp.toUtcString(fields[9]);
     }
     patient.IsServiceConnected = (fields[11] == "1");
     if (fields[12] != "")
     {
         patient.ScPercent = Convert.ToInt16(fields[12]);
     }
     cxn.Pid = dfn;
     return patient;
 }