Ejemplo n.º 1
0
        protected override void Operation(WordDocument doc)
        {
            int careSvrId = (int)ParamId;

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            IResidentManageService     residentManageService     = IOCContainer.Instance.Resolve <IResidentManageService>();
            ISocialWorkerManageService socialWorkerManageService = IOCContainer.Instance.Resolve <ISocialWorkerManageService>();
            IOrganizationManageService organizationManageService = IOCContainer.Instance.Resolve <IOrganizationManageService>();
            IDictManageService         dictManageService         = IOCContainer.Instance.Resolve <IDictManageService>();
            ICarePlansManageService    carePlansManageService    = IOCContainer.Instance.Resolve <ICarePlansManageService>();
            var careSvr = socialWorkerManageService.GetCareSvrById(careSvrId);

            if (careSvr.Data == null || !careSvr.Data.FeeNo.HasValue)
            {
                InitData(typeof(CaresvrRecModel), doc);
                doc.ReplaceText("Name", "");
                doc.ReplaceText("Area", "");
                doc.ReplaceText("RoomNo", "");
                doc.ReplaceText("Age", "");
                doc.ReplaceText("H02", "");
                doc.ReplaceText("EvalShour", "");
                return;
            }
            doc.ReplaceText("EvalShour", careSvr.Data.EvalMinutes.HasValue ? ((decimal)careSvr.Data.EvalMinutes.Value / 60).ToString("F2") : "");
            CodeFilter request = new CodeFilter {
                ItemTypes = new string[] { "K00.017", "E00.215", "E00.216", "E00.217" }
            };
            var dict = (List <CodeValue>)dictManageService.QueryCode(request).Data;

            if (careSvr.Data.SvrAddress != null)
            {
                careSvr.Data.SvrAddress = dict.Find(it => it.ItemType == "K00.017" && it.ItemCode == careSvr.Data.SvrAddress).ItemName;
            }
            if (careSvr.Data.SvrType != null)
            {
                careSvr.Data.SvrType = dict.Find(it => it.ItemType == "E00.215" && it.ItemCode == careSvr.Data.SvrType).ItemName;
            }
            if (careSvr.Data.RelationType != null)
            {
                careSvr.Data.RelationType = dict.Find(it => it.ItemType == "E00.216" && it.ItemCode == careSvr.Data.RelationType).ItemName;
            }
            if (careSvr.Data.EvalStatus != null)
            {
                careSvr.Data.EvalStatus = dict.Find(it => it.ItemType == "E00.217" && it.ItemCode == careSvr.Data.EvalStatus).ItemName;
            }
            if (careSvr.Data.QuestionFocus != null)
            {
                if (careSvr.Data.QuestionLevel != null)
                {
                    var diaPr = carePlansManageService.GetDiaPR("001", careSvr.Data.QuestionLevel);
                    if (diaPr != null && diaPr.Data != null)
                    {
                        careSvr.Data.QuestionFocus = diaPr.Data.Find(it => it.ItemCode == careSvr.Data.QuestionFocus).ItemName;
                    }
                }
            }
            if (careSvr.Data.Carer != null)
            {
                var emp = organizationManageService.GetEmployee(careSvr.Data.Carer);
                if (emp != null)
                {
                    careSvr.Data.Carer = emp.Data.EmpName;
                }
            }
            BindData(careSvr.Data, doc);
            var resident = residentManageService.GetResident(careSvr.Data.FeeNo.Value);

            if (resident != null && resident.Data != null)
            {
                doc.ReplaceText("RoomNo", resident.Data.RoomNo);
                doc.ReplaceText("Area", resident.Data.Floor);
            }
            else
            {
                doc.ReplaceText("RoomNo", "");
                doc.ReplaceText("Area", "");
            }

            var person = residentManageService.GetPerson(careSvr.Data.RegNo ?? 0);

            if (person != null && person.Data != null)
            {
                doc.ReplaceText("Name", person.Data.Name);
                doc.ReplaceText("Age", person.Data.Age.ToString());
            }
            else
            {
                doc.ReplaceText("Name", "");
                doc.ReplaceText("Age", "");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// P13社工定期處遇評估表
        /// </summary>
        /// <param name="doc"></param>
        private void P13Operation(WordDocument doc)
        {
            int recordId = 4;
            ISocialWorkerManageService reportManageService   = IOCContainer.Instance.Resolve <ISocialWorkerManageService>();
            IResidentManageService     residentManageService = IOCContainer.Instance.Resolve <IResidentManageService>();
            //ISocialWorkerManageService socialWorkerManageService = IOCContainer.Instance.Resolve<ISocialWorkerManageService>();
            IOrganizationManageService organizationManageService = IOCContainer.Instance.Resolve <IOrganizationManageService>();
            IDictManageService         dictManageService         = IOCContainer.Instance.Resolve <IDictManageService>();
            var question = reportManageService.GetRegEvaluateById(recordId).Data;

            if (question == null)
            {
                return;
            }
            if (!question.FeeNo.HasValue)
            {
                return;
            }
            var resident = residentManageService.GetResident(question.FeeNo.Value);
            var person   = residentManageService.GetPerson(resident.Data.RegNo ?? 0);

            var        emp     = organizationManageService.GetEmployee(question.EvaluateBy);
            CodeFilter request = new CodeFilter
            {
                ItemTypes = new string[]
                {
                    "E00.014", "E00.005", "E00.008", "E00.009", "E00.015", "E00.016", "E00.017", "E00.018",
                    "E00.019", "E00.206", "E00.207", "E00.208", "E00.209", "E00.210", "E00.211"
                }
            };
            var org  = organizationManageService.GetOrg(resident.Data.OrgId);
            var dict = (List <CodeValue>)dictManageService.QueryCode(request).Data;

            doc.ReplaceText("MindState", dict.Find(it => it.ItemType == "E00.005" && it.ItemCode == question.MindState).ItemName);
            doc.ReplaceText("ExpressionState", dict.Find(it => it.ItemType == "E00.008" && it.ItemCode == question.ExpressionState).ItemName);
            doc.ReplaceText("LanguageState", dict.Find(it => it.ItemType == "E00.015" && it.ItemCode == question.LanguageState).ItemName);
            doc.ReplaceText("NonexpressionState", dict.Find(it => it.ItemType == "E00.009" && it.ItemCode == question.NonexpressionState).ItemName);
            doc.ReplaceText("EmotionState", dict.Find(it => it.ItemType == "E00.016" && it.ItemCode == question.EmotionState).ItemName);
            doc.ReplaceText("Personality", dict.Find(it => it.ItemType == "E00.017" && it.ItemCode == question.Personality).ItemName);
            doc.ReplaceText("Attention", dict.Find(it => it.ItemType == "E00.018" && it.ItemCode == question.Attention).ItemName);
            doc.ReplaceText("Realisticsense", dict.Find(it => it.ItemType == "E00.019" && it.ItemCode == question.Realisticsense).ItemName);
            doc.ReplaceText("SocialParticipation", dict.Find(it => it.ItemType == "E00.206" && it.ItemCode == question.SocialParticipation).ItemName);
            doc.ReplaceText("SocialAttitude", dict.Find(it => it.ItemType == "E00.207" && it.ItemCode == question.SocialAttitude).ItemName);
            doc.ReplaceText("SocialSkills", dict.Find(it => it.ItemType == "E00.208" && it.ItemCode == question.SocialSkills).ItemName);
            doc.ReplaceText("CommSkills", dict.Find(it => it.ItemType == "E00.209" && it.ItemCode == question.CommSkills).ItemName);
            doc.ReplaceText("ResponseSkills", dict.Find(it => it.ItemType == "E00.210" && it.ItemCode == question.ResponseSkills).ItemName);
            doc.ReplaceText("FixissueSkills", dict.Find(it => it.ItemType == "E00.211" && it.ItemCode == question.FixissueSkills).ItemName);
            doc.ReplaceText("BookDegree", dict.Find(it => it.ItemType == "E00.014" && it.ItemCode == question.BookDegree).ItemName);
            doc.ReplaceText("EmpName", emp == null ? "" : emp.Data.EmpName);
            doc.ReplaceText("Org", org == null ? "" : org.Data.OrgName);
            doc.ReplaceText("Name", person == null ? "" : person.Data.Name);
            if (person != null && person.Data.Age != null)
            {
                doc.ReplaceText("Age", person.Data.Age.ToString());
            }
            else
            {
                doc.ReplaceText("Age", "");
            }
            doc.ReplaceText("BedNo", resident.Data.BedNo);
            doc.ReplaceText("Floor", resident.Data.Floor);
            doc.ReplaceText("IllCard", question.IllCardName);
            doc.ReplaceText("Service", question.ServiceName);
            doc.ReplaceText("NextDate", question.NextEvalDate == null ? "" : ((DateTime)question.NextEvalDate).ToString("yyyy-MM-dd"));
            BindData(question, doc);
        }
Ejemplo n.º 3
0
        protected override void Operation(Infrastructure.Word.WordDocument doc)
        {
            int recordId = (int)ParamId;

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            IResidentManageService ResidentManageService = IOCContainer.Instance.Resolve <IResidentManageService>();
            IDictManageService     dictManageService     = IOCContainer.Instance.Resolve <IDictManageService>();
            var Person = ResidentManageService.GetPersonExtend(recordId);

            if (Person == null)
            {
                return;
            }
            if (Person.Data.ImgUrl != null)
            {
                string mapPath = string.Format("{0}\\{1}", AppDomain.CurrentDomain.BaseDirectory, Person.Data.ImgUrl.Replace("/", @"\"));
                if (File.Exists(mapPath))
                {
                    doc.InsertImage("photo", mapPath, 150, 200);
                }
                else
                {
                    doc.ReplaceText("photo", "");
                }
            }
            else
            {
                doc.ReplaceText("photo", "");
            }
            CodeFilter codeFilter = new CodeFilter();

            codeFilter.ItemTypes = new string[] { "A00.030", "A00.032", "A00.035", "A00.001", "A00.007", "A00.008", "A00.011", "A00.002" };
            var       dict = (List <CodeValue>)dictManageService.QueryCode(codeFilter).Data;
            CodeValue findItem;

            Person.Data.Sex = dict.Find(it => it.ItemType == "A00.001" && it.ItemCode == Person.Data.Sex) != null?
                              dict.Find(it => it.ItemType == "A00.001" && it.ItemCode == Person.Data.Sex).ItemName : "";

            Person.Data.servicetype = dict.Find(it => it.ItemType == "A00.002" && it.ItemCode == Person.Data.servicetype) != null?
                                      dict.Find(it => it.ItemType == "A00.002" && it.ItemCode == Person.Data.servicetype).ItemName : "";

            Person.Data.Education = dict.Find(it => it.ItemType == "A00.007" && it.ItemCode == Person.Data.Education) != null?
                                    dict.Find(it => it.ItemType == "A00.007" && it.ItemCode == Person.Data.Education).ItemName : "";

            Person.Data.ReligionCode = dict.Find(it => it.ItemType == "A00.008" && it.ItemCode == Person.Data.ReligionCode) != null?
                                       dict.Find(it => it.ItemType == "A00.008" && it.ItemCode == Person.Data.ReligionCode).ItemName : "";

            Person.Data.MerryFlag = dict.Find(it => it.ItemType == "A00.011" && it.ItemCode == Person.Data.MerryFlag) != null?
                                    dict.Find(it => it.ItemType == "A00.011" && it.ItemCode == Person.Data.MerryFlag).ItemName : "";

            Person.Data.CAddress1 = Person.Data.City2 + "" + Person.Data.Address2 + "" + Person.Data.Address2dtl;
            Person.Data.CAddress2 = Person.Data.City1 + "" + Person.Data.Address1 + "" + Person.Data.Address1dtl;
            BindData(Person.Data, doc);
            DataTable dt = new DataTable();

            dt.Columns.Add("c1");
            dt.Columns.Add("c2");
            dt.Columns.Add("c3");
            dt.Columns.Add("c4");
            dt.Columns.Add("c5");
            dt.Columns.Add("c6");
            if (Person.Data.RelationDtl != null)
            {
                if (Person.Data.RelationDtl.Count > 0)
                {
                    foreach (var item in Person.Data.RelationDtl)
                    {
                        var dr = dt.NewRow();
                        dr["c1"] = item.Name;
                        findItem = dict.Find(it => it.ItemType == "A00.030" && it.ItemCode == item.Contrel);
                        dr["c2"] = findItem != null ? findItem.ItemName : "";
                        findItem = dict.Find(it => it.ItemType == "A00.032" && it.ItemCode == item.RelationType);
                        dr["c3"] = findItem != null ? findItem.ItemName : "";
                        dr["c4"] = item.Phone;
                        dr["c5"] = item.Address;
                        findItem = dict.Find(it => it.ItemType == "A00.035" && it.ItemCode == item.WorkCode);
                        dr["c6"] = findItem != null ? findItem.ItemName : "";
                        dt.Rows.Add(dr);
                    }
                }
                else
                {
                    var dr = dt.NewRow();
                    dr["c1"] = "";
                    dr["c2"] = "";
                    dr["c3"] = "";
                    dr["c4"] = "";
                    dr["c5"] = "";
                    dr["c6"] = "";
                    dt.Rows.Add(dr);
                }
            }
            else
            {
                var dr = dt.NewRow();
                dr["c1"] = "";
                dr["c2"] = "";
                dr["c3"] = "";
                dr["c4"] = "";
                dr["c5"] = "";
                dr["c6"] = "";
                dt.Rows.Add(dr);
            }
            doc.FillTable(0, dt, "", "", 32);
            dt.Dispose();
        }