Ejemplo n.º 1
0
        ///<summary>Gets the data necessary to load the Family Module.</summary>
        public static LoadData GetLoadData(long patNum, bool doCreateSecLog)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <LoadData>(MethodBase.GetCurrentMethod(), patNum, doCreateSecLog));
            }
            LoadData data = new LoadData();

            data.Fam          = Patients.GetFamily(patNum);
            data.Pat          = data.Fam.GetPatient(patNum);
            data.ListPatPlans = PatPlans.Refresh(patNum);
            if (!PatPlans.IsPatPlanListValid(data.ListPatPlans))             //PatPlans had invalid references and need to be refreshed.
            {
                data.ListPatPlans = PatPlans.Refresh(patNum);
            }
            data.PatNote               = PatientNotes.Refresh(patNum, data.Pat.Guarantor);
            data.ListInsSubs           = InsSubs.RefreshForFam(data.Fam);
            data.ListInsPlans          = InsPlans.RefreshForSubList(data.ListInsSubs);
            data.ListBenefits          = Benefits.Refresh(data.ListPatPlans, data.ListInsSubs);
            data.ListRecalls           = Recalls.GetList(data.Fam.ListPats.Select(x => x.PatNum).ToList());
            data.ArrPatFields          = PatFields.Refresh(patNum);
            data.SuperFamilyMembers    = Patients.GetBySuperFamily(data.Pat.SuperFamily);
            data.SuperFamilyGuarantors = Patients.GetSuperFamilyGuarantors(data.Pat.SuperFamily);
            data.DictCloneSpecialities = Patients.GetClonesAndSpecialties(patNum);
            data.PatPict               = Documents.GetPatPictFromDb(patNum);
            data.HasPatPict            = (data.PatPict == null ? YN.No : YN.Yes);
            List <DisplayField> listDisplayFields = DisplayFields.GetForCategory(DisplayFieldCategory.PatientInformation);

            foreach (DisplayField field in listDisplayFields)
            {
                switch (field.InternalName)
                {
                case "Guardians":
                    data.ListGuardians = Guardians.Refresh(patNum);
                    break;

                case "Pat Restrictions":
                    data.ListPatRestricts = PatRestrictions.GetAllForPat(patNum);
                    break;

                case "Payor Types":
                    data.PayorTypeDesc = PayorTypes.GetCurrentDescription(patNum);
                    break;

                case "PatFields":
                    data.ListPatFieldDefLinks = FieldDefLinks.GetForLocation(FieldLocations.Family);
                    break;

                case "References":
                    data.ListCustRefEntries = CustRefEntries.GetEntryListForCustomer(patNum);
                    break;

                case "Referrals":
                    data.ListRefAttaches = RefAttaches.Refresh(patNum);
                    break;

                case "ResponsParty":
                    if (data.Pat.ResponsParty != 0)
                    {
                        data.ResponsibleParty = Patients.GetLim(data.Pat.ResponsParty);
                    }
                    break;
                }
            }
            if (data.Pat.DiscountPlanNum != 0)
            {
                data.DiscountPlan = DiscountPlans.GetPlan(data.Pat.DiscountPlanNum);
            }
            data.ListMergeLinks = PatientLinks.GetLinks(data.Fam.ListPats.Select(x => x.PatNum).ToList(), PatientLinkType.Merge);
            if (doCreateSecLog)
            {
                SecurityLogs.MakeLogEntry(Permissions.FamilyModule, patNum, "");
            }
            return(data);
        }
Ejemplo n.º 2
0
        /*
         * public static Document Import(Bitmap image,long docCategory,Patient pat) {
         *      string patFolder="";
         *      if(PrefC.UsingAtoZfolder) {
         *              patFolder=GetPatientFolder(pat,GetPreferredAtoZpath());
         *      }
         *      Document doc=new Document();
         *      doc.FileName=".jpg";
         *      doc.DateCreated=DateTime.Today;
         *      doc.DocCategory=docCategory;
         *      doc.PatNum=pat.PatNum;
         *      doc.ImgType=ImageType.Photo;
         *      //doc.RawBase64 handled further down.
         *      //doc.Thumbnail="";//no thumbnail yet
         *      Documents.Insert(doc,pat);//this assigns a filename and saves to db
         *      doc=Documents.GetByNum(doc.DocNum);
         *      try {
         *              SaveDocument(doc,image,ImageFormat.Jpeg,patFolder);
         *              if(PrefC.UsingAtoZfolder) {
         *                      Documents.Update(doc);
         *              }
         *      }
         *      catch {
         *              Documents.Delete(doc);
         *              throw;
         *      }
         *      return doc;
         * }*/

        /// <summary>Saves to either AtoZ folder or to db.  Saves image as a jpg.  Compression will differ depending on imageType.</summary>
        public static Document Import(Bitmap image, long docCategory, ImageType imageType, Patient pat)
        {
            string patFolder = "";

            if (PrefC.UsingAtoZfolder)
            {
                patFolder = GetPatientFolder(pat, GetPreferredAtoZpath());
            }
            Document doc = new Document();

            doc.ImgType     = imageType;
            doc.FileName    = ".jpg";
            doc.DateCreated = DateTime.Today;
            doc.PatNum      = pat.PatNum;
            doc.DocCategory = docCategory;
            Documents.Insert(doc, pat);           //creates filename and saves to db
            doc = Documents.GetByNum(doc.DocNum);
            long qualityL = 0;

            if (imageType == ImageType.Radiograph)
            {
                qualityL = 100;
            }
            else if (imageType == ImageType.Photo)
            {
                qualityL = 100;
            }
            else              //Assume document
                              //Possible values 0-100?
            {
                qualityL = PrefC.GetLong(PrefName.ScannerCompression);
            }
            ImageCodecInfo myImageCodecInfo;

            ImageCodecInfo[] encoders;
            encoders         = ImageCodecInfo.GetImageEncoders();
            myImageCodecInfo = null;
            for (int j = 0; j < encoders.Length; j++)
            {
                if (encoders[j].MimeType == "image/jpeg")
                {
                    myImageCodecInfo = encoders[j];
                }
            }
            EncoderParameters myEncoderParameters = new EncoderParameters(1);
            EncoderParameter  myEncoderParameter  = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, qualityL);

            myEncoderParameters.Param[0] = myEncoderParameter;
            //AutoCrop()?
            try {
                SaveDocument(doc, image, myImageCodecInfo, myEncoderParameters, patFolder);
                if (!PrefC.UsingAtoZfolder)
                {
                    Documents.Update(doc);                    //because SaveDocument stuck the image in doc.RawBase64.
                    //no thumbnail yet
                }
            }
            catch {
                Documents.Delete(doc);
                throw;
            }
            return(doc);
        }