Exemple #1
0
        /// <summary>
        /// 获取组织机构
        /// </summary>
        /// <returns></returns>
        public List <OrgEntity> GetOrg()
        {
            string    ProjectId = OperatorProvider.Provider.CurrentUser.ProjectId;
            string    sql1      = @"select case when cp.ParentCompanyCode='1' then '0' else cp.ParentCompanyCode end as pid,cp.CompanyCode as id,cp.CompanyFullName as Name,'Org' as TypeName,cast(cp.OrgType as varchar) as OrgType,pc.ProjectId from TbCompany cp 
            left join TbProjectCompany pc on cp.CompanyCode=pc.CompanyCode  where pc.ProjectId=@ProjectId and cp.OrgType!=1  order by cp.id asc";
            DataTable dt1       = Db.Context.FromSql(sql1).AddInParameter("@ProjectId", DbType.String, ProjectId).ToDataTable();
            string    sql2      = "select CompanyCode as id,CompanyFullName as Name,'Org' as TypeName,OrgType from TbCompany where OrgType=1";
            DataTable dt2       = Db.Context.FromSql(sql2).ToDataTable();

            if (dt2 != null && dt2.Rows.Count > 0)
            {
                DataTable dt3 = dt1.Select("pid='0'").CopyToDataTable();
                for (int i = 0; i < dt2.Rows.Count; i++)
                {
                    DataRow newRow = dt1.NewRow();
                    newRow["pid"]       = dt3.Rows[0]["id"];
                    newRow["id"]        = dt2.Rows[i]["id"];
                    newRow["Name"]      = dt2.Rows[i]["Name"];
                    newRow["TypeName"]  = dt2.Rows[i]["TypeName"];
                    newRow["OrgType"]   = dt2.Rows[i]["OrgType"];
                    newRow["ProjectId"] = dt3.Rows[0]["ProjectId"];
                    dt1.Rows.Add(newRow);
                }
            }
            return(ModelConvertHelper <OrgEntity> .ToList(dt1));
        }
Exemple #2
0
        ///// <summary>
        ///// 新增、修改
        ///// </summary>
        ///// <param name="jdata"></param>
        ///// <returns></returns>
        //[HttpGet]
        //public HttpResponseMessage SaveCompanyData(string jdata)
        //{
        //    try
        //    {
        //        //{"type":"add","model":{"CompanyCode":"001003002","ParentCompanyCode":"001003","CompanyFullName":"二工区","Address":"广州市","IsEnable": 0,"OrgType":3}}
        //        JObject jo = (JObject)JsonConvert.DeserializeObject(jdata);
        //        string modelstr = jo["model"] == null ? "" : jo["model"].ToString();
        //        string type = jo["type"] == null ? "" : jo["type"].ToString();
        //        if (string.IsNullOrWhiteSpace(modelstr) || string.IsNullOrWhiteSpace(type))
        //            return AjaxResult.Error("参数错误").ToJsonApi();
        //        var model = JsonEx.JsonToObj<TbCompany>(modelstr);
        //        if (type == "add")
        //        {
        //            var data = cit.Insert(model, true);
        //            return data.ToJsonApi();
        //        }
        //        else
        //        {
        //            var data = cit.Update(model, true);
        //            return data.ToJsonApi();
        //        }
        //    }
        //    catch (Exception)
        //    {
        //        return AjaxResult.Error("操作失败").ToJsonApi();
        //    }
        //}

        ///// <summary>
        ///// 删除
        ///// </summary>
        ///// <param name="keyValue"></param>
        ///// <returns></returns>
        //[HttpGet]
        //public HttpResponseMessage DeleteCompanyData(string companyCode)
        //{
        //    var data = cit.Delete(companyCode, true);
        //    return data.ToJsonApi();
        //}

        /// <summary>
        /// 获取组织机构地址
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage GetCompanyList(string url)
        {
            try
            {
                var     dataJson = Get(strBMUrl + url);
                JObject jo       = (JObject)JsonConvert.DeserializeObject(dataJson);
                string  modelstr = jo["data"] == null ? "" : jo["data"].ToString();
                if (string.IsNullOrWhiteSpace(modelstr))
                {
                    return(AjaxResult.Error("参数错误").ToJsonApi());
                }
                DataTable dt = ToDataTable(modelstr);
                dt.Columns["OrgId"].ColumnName       = "CompanyCode";
                dt.Columns["OrgName"].ColumnName     = "CompanyFullName";
                dt.Columns["ParentOrgId"].ColumnName = "ParentCompanyCode";
                dt.Columns["Address"].ColumnName     = "Address";
                dt.Columns["OrgType"].ColumnName     = "OrgType";
                DataColumn dc = new DataColumn("IsEnable", typeof(int));
                dc.DefaultValue = 0;
                dt.Columns.Add(dc);
                List <TbCompany> model = ModelConvertHelper <TbCompany> .ToList(dt);

                var data = cit.InsertNew(model, true);
                return(AjaxResult.Success(data).ToJsonApi());
            }
            catch (Exception)
            {
                return(AjaxResult.Error("操作失败").ToJsonApi());
            }
        }
        public List <TbAreaAdministration> GetParentAreaJosn(string AreaCode)
        {
            string sql       = @"select * from TbAreaAdministration where FK_AreaCode is null or FK_AreaCode='" + AreaCode + "'";
            var    model     = Db.Context.FromSql(sql).ToDataTable();
            var    modelList = ModelConvertHelper <TbAreaAdministration> .ToList(model);

            return(modelList);
        }
Exemple #4
0
        /// <summary>
        /// 取得对应条件的五官科资料
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public List <RecordsVisceraFunctionModel> GetModelList(string strWhere, string conn = "")
        {
            // 取得五官资料
            DataTable dt = this.dal.GetList(strWhere, conn).Tables[0];

            // 将DataTable转为List
            List <RecordsVisceraFunctionModel> list = ModelConvertHelper <RecordsVisceraFunctionModel> .ToList(dt);

            return(list);
        }
Exemple #5
0
        /// <summary>
        /// 取得对应条件的外科资料
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public List <RecordsPhysicalExamModel> GetSurgicalList(string strWhere, string conn = "")
        {
            // 取得外科资料
            DataTable dt = this.dal.GetSurgicalList(strWhere, conn).Tables[0];

            // 将DataTable转为List
            List <RecordsPhysicalExamModel> list = ModelConvertHelper <RecordsPhysicalExamModel> .ToList(dt);

            return(list);
        }
Exemple #6
0
        /// <summary>
        /// 取得对应条件的X光资料
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public List <RecordsAssistCheckModel> GetChestXList(string strWhere, string conn = "")
        {
            // 取得X光资料
            DataTable dt = this.dal.GetChestXList(strWhere, conn).Tables[0];

            // 将DataTable转为List
            List <RecordsAssistCheckModel> list = ModelConvertHelper <RecordsAssistCheckModel> .ToList(dt);

            return(list);
        }
Exemple #7
0
        public TbFlowDefineResponse GetFlowDefine(string keyvalue)
        {
            var dt = Db.Context.From <TbFlowDefine>()
                     .Select(
                TbFlowDefine._.All,
                TbSysMenu._.MenuName)
                     .LeftJoin <TbSysMenu>((a, c) => a.FormCode == c.MenuCode).Where(p => p.FlowCode == keyvalue).ToDataTable();
            var list = ModelConvertHelper <TbFlowDefineResponse> .ToList(dt);

            return(list[0]);
        }
Exemple #8
0
        public List <RecordsMedicationModel> GetMaxModelList(string strWhere)
        {
            DataSet ds = this.dal.GetMaxList(strWhere);

            if (ds == null)
            {
                return(null);
            }

            return(ModelConvertHelper <RecordsMedicationModel> .ToList(ds.Tables[0]));
        }
Exemple #9
0
        /// <summary>
        /// 取得对应条件的内科资料
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public IList <InternalMedicineModel> GetInternalMedicine(string startDate, string endDate, int startIndex, int endIndex, string conn)
        {
            DataSet ds = dal.GetInternalMedicine(startDate, endDate, startIndex, endIndex, conn);

            if (ds != null && ds.Tables.Count > 0)
            {
                return(ModelConvertHelper <InternalMedicineModel> .ToList(ds.Tables[0]));
            }

            return(new List <InternalMedicineModel>());
        }
Exemple #10
0
        /// <summary>
        /// 获取体检问询住院、免疫接种史资料内容
        /// </summary>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <returns></returns>
        public IList <History> GetHistory(string startDate, string endDate, string conn)
        {
            DataSet ds = dal.GetHistory(startDate, endDate, conn);

            if (ds != null && ds.Tables.Count > 0)
            {
                return(ModelConvertHelper <History> .ToList(ds.Tables[0]));
            }

            return(new List <History>());
        }
Exemple #11
0
        /// <summary>
        /// 取得对应条件的X光资料
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public IList <RecordsAssistCheckModel> GetRecordsChestX(string startDate, string endDate, int startIndex, int endIndex, string conn)
        {
            DataSet ds = dal.GetRecordsChestX(startDate, endDate, startIndex, endIndex, conn);

            if (ds != null && ds.Tables.Count > 0)
            {
                return(ModelConvertHelper <RecordsAssistCheckModel> .ToList(ds.Tables[0]));
            }

            return(new List <RecordsAssistCheckModel>());
        }
Exemple #12
0
        /// <summary>
        /// 获取资料内容
        /// </summary>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <param name="deviceType">设备类型 20:血压 24:血糖 39:身高体重 33:尿仪 22:体温 40:体重</param>
        /// <param name="startIndex">开始笔数</param>
        /// <param name="endIndex">结束笔数</param>
        /// <returns></returns>
        public IList <DeviceInfoModel> GetDeviceInfo(string startDate, string endDate, string deviceType, int startIndex, int endIndex, string conn)
        {
            DataSet ds = dal.GetDeviceInfo(startDate, endDate, deviceType, startIndex, endIndex, conn);

            if (ds != null && ds.Tables.Count > 0)
            {
                return(ModelConvertHelper <DeviceInfoModel> .ToList(ds.Tables[0]));
            }

            return(new List <DeviceInfoModel>());
        }
        public List <RecordsIllnessHistoryInfoModel> GetModelList(string strWhere)
        {
            DataSet ds = this.dal.GetList(strWhere);

            if (ds == null)
            {
                return(null);
            }

            return(ModelConvertHelper <RecordsIllnessHistoryInfoModel> .ToList(ds.Tables[0]));
        }
Exemple #14
0
        /// <summary>
        /// 获取智力评估资料内容
        /// </summary>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <param name="startIndex">开始笔数</param>
        /// <param name="endIndex">结束笔数</param>
        /// <returns></returns>
        public IList <OldIntelligenceModel> GetIntelligence(string startDate, string endDate, string conn)
        {
            DataSet ds = dal.GetIntelligence(startDate, endDate, conn);

            if (ds != null && ds.Tables.Count > 0)
            {
                return(ModelConvertHelper <OldIntelligenceModel> .ToList(ds.Tables[0]));
            }

            return(new List <OldIntelligenceModel>());
        }
Exemple #15
0
        /// <summary>
        /// 获取体检问询资料内容
        /// </summary>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <param name="startIndex">开始笔数</param>
        /// <param name="endIndex">结束笔数</param>
        /// <returns></returns>
        public IList <DataUploadModel> GetMedicalEnquiry(string startDate, string endDate, int startIndex, int endIndex, string conn)
        {
            DataSet ds = dal.GetMedicalEnquiry(startDate, endDate, startIndex, endIndex, conn);

            if (ds != null && ds.Tables.Count > 0)
            {
                return(ModelConvertHelper <DataUploadModel> .ToList(ds.Tables[0]));
            }

            return(new List <DataUploadModel>());
        }
Exemple #16
0
        /// <summary>
        /// 获取体检问询用药资料内容
        /// </summary>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <returns></returns>
        public IList <RecordsMedicationModel> GetMedication(string startDate, string endDate, string conn)
        {
            DataSet ds = dal.GetMedication(startDate, endDate, conn);

            if (ds != null && ds.Tables.Count > 0)
            {
                return(ModelConvertHelper <RecordsMedicationModel> .ToList(ds.Tables[0]));
            }

            return(new List <RecordsMedicationModel>());
        }
        public List <DeviceInfoModel> GetMaxModelList(string strWhere, string conn = "")
        {
            DataSet ds = this.dal.GetMaxList(strWhere, conn);

            if (ds == null)
            {
                return(null);
            }

            return(ModelConvertHelper <DeviceInfoModel> .ToList(ds.Tables[0]));
        }
Exemple #18
0
        /// <summary>
        /// 根据体检外键取得资料
        /// </summary>
        /// <param name="OutKey"></param>
        /// <returns></returns>
        public RecordsGeneralConditionModel GetModelByOutKey(int OutKey)
        {
            DataSet ds = dal.GetModelByOutKey(OutKey);
            List <RecordsGeneralConditionModel> list = ModelConvertHelper <RecordsGeneralConditionModel> .ToList((ds.Tables[0]));

            if (list.Count > 0)
            {
                return(list[0]);
            }

            return(new RecordsGeneralConditionModel());
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public OtherAssessSetModel GetModel(string where = "")
        {
            DataSet ds = dal.GetList(where);

            if (ds != null && ds.Tables.Count > 0)
            {
                List<OtherAssessSetModel> list = ModelConvertHelper<OtherAssessSetModel>.ToList(ds.Tables[0]);

                if (list.Count > 0) return list[0];
            }

            return null;
        }
Exemple #20
0
        public List <RequireModel> GetModel(string TabName, string Comment, string ChinName)
        {
            DataSet ds = this.dal.GetData(TabName, Comment, ChinName);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                List <RequireModel> list = ModelConvertHelper <RequireModel> .ToList(ds.Tables[0]);

                return(list);
            }

            return(null);
        }
Exemple #21
0
        public List <RecordsMedicationModel> GetModelList(string strWhere, string conn = "")
        {
            DataSet ds = this.dal.GetList(strWhere, conn);

            List <RecordsMedicationModel> list = new List <RecordsMedicationModel>();

            if (ds.Tables[0].Rows.Count > 0)
            {
                // 将DataTable转为List
                list = ModelConvertHelper <RecordsMedicationModel> .ToList(ds.Tables[0]);
            }

            return(list);
        }
Exemple #22
0
        public List <OlderSelfCareabilityModel> GetModelList(string strWhere)
        {
            DataSet ds = this.dal.GetList(strWhere);

            List <OlderSelfCareabilityModel> list = new List <OlderSelfCareabilityModel>();
            int count = ds.Tables[0].Rows.Count;

            if (count > 0)
            {
                // 将DataTable转为List
                list = ModelConvertHelper <OlderSelfCareabilityModel> .ToList(ds.Tables[0]);
            }

            return(list);
        }
Exemple #23
0
        public RecordsSelfcareabilityModel GetModelID(int ID)
        {
            DataSet ds = this.dal.GetModelID(ID);

            if (ds != null && ds.Tables.Count > 0)
            {
                List <RecordsSelfcareabilityModel> list = ModelConvertHelper <RecordsSelfcareabilityModel> .ToList(ds.Tables[0]);

                if (list.Count > 0)
                {
                    return(list[0]);
                }
            }
            return(null);
        }
Exemple #24
0
        /// <summary>
        /// 心电
        /// </summary>
        /// <param name="strWhere"></param>
        /// <param name="conn"></param>
        /// <returns></returns>
        public List <EcgDataModel> GetECGList(string strWhere, string conn = "")
        {
            DataSet ds = this.dal.GetECGList(strWhere, conn);

            List <EcgDataModel> list = new List <EcgDataModel>();
            int count = ds.Tables[0].Rows.Count;

            if (count > 0)
            {
                // 将DataTable转为List
                list = ModelConvertHelper <EcgDataModel> .ToList(ds.Tables[0]);
            }

            return(list);
        }
Exemple #25
0
        /// <summary>
        /// 获取所有附件ID
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public List <TbAttachment> GetUploadList(string ids)
        {
            string FileIDNew = "";

            if (!string.IsNullOrEmpty(ids))
            {
                string   str  = ids;
                string[] strs = str.Split(',');
                for (int i = 0; i < strs.Length; i++)
                {
                    if (FileIDNew == "")
                    {
                        FileIDNew += "'" + strs[i] + "'";
                    }
                    else
                    {
                        FileIDNew += ",'" + strs[i] + "'";
                    }
                }
            }
            try
            {
                string sql;
                if (!string.IsNullOrEmpty(FileIDNew))
                {
                    sql = @"select TbAttachment.*,TbUser.UserName from TbAttachment 
left join TbUser on TbAttachment.UserCode=TbUser.UserCode
where FileID in (" + FileIDNew + ")";
                }
                else
                {
                    sql = @"select TbAttachment.*,TbUser.UserName from TbAttachment 
left join TbUser on TbAttachment.UserCode=TbUser.UserCode
where FileID='" + ids + "'";
                }
                var model = Db.Context.FromSql(sql).ToDataTable();
                var list  = ModelConvertHelper <TbAttachment> .ToList(model);

                return(list);
            }
            catch (Exception)
            {
                throw;
            }
            //var ret = Db.Context.From<TbAttachment>()
            //.Select(TbAttachment._.All).Where(p => p.FileID == ids).ToList();
            //return ret;
        }
Exemple #26
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public BiochemicalAssessSetModel GetModel(string where = "")
        {
            DataSet ds = dal.GetList(where);

            if (ds != null && ds.Tables.Count > 0)
            {
                List <BiochemicalAssessSetModel> list = ModelConvertHelper <BiochemicalAssessSetModel> .ToList(ds.Tables[0]);

                if (list.Count > 0)
                {
                    return(list[0]);
                }
            }

            return(null);
        }
        /// <summary>
        /// 取最后一次随访
        /// </summary>
        /// <param name="IDCardNo"></param>
        /// <param name="VersionNo"></param>
        /// <returns></returns>
        public ChronicHypertensionVisitModel GetMaxModel(string IDCardNo, string Version = "V2.0")
        {
            DataSet ds = dal.GetMaxModel(IDCardNo, Version);

            if (ds != null && ds.Tables.Count > 0)
            {
                List <ChronicHypertensionVisitModel> list = ModelConvertHelper <ChronicHypertensionVisitModel> .ToList(ds.Tables[0]);

                if (list.Count > 0)
                {
                    return(list[0]);
                }
            }

            return(null);
        }
Exemple #28
0
        public List <DeviceInfoModel> GetModelList(string strWhere)
        {
            DataSet ds = this.dal.GetList(strWhere);

            if (ds != null && ds.Tables.Count > 0)
            {
                List <DeviceInfoModel> list = ModelConvertHelper <DeviceInfoModel> .ToList(ds.Tables[0]);

                if (list.Count > 0)
                {
                    return(list);
                }
            }

            return(null);
        }
Exemple #29
0
        public List <HealthGuidanceModel> GetModelList(string where)
        {
            DataSet ds = dal.GetModelList(where);

            if (ds != null && ds.Tables.Count > 0)
            {
                List <HealthGuidanceModel> list = ModelConvertHelper <HealthGuidanceModel> .ToList(ds.Tables[0]);

                if (list.Count > 0)
                {
                    return(list);
                }
            }

            return(null);
        }
Exemple #30
0
        public RecordsAssistCheckModel GetModelByOutKey(int OutKey)
        {
            DataSet ds = this.dal.GetModelByOutKey(OutKey);

            if (ds != null && ds.Tables.Count > 0)
            {
                List <RecordsAssistCheckModel> list = ModelConvertHelper <RecordsAssistCheckModel> .ToList(ds.Tables[0]);

                if (list.Count > 0)
                {
                    return(list[0]);
                }
            }

            return(new RecordsAssistCheckModel());
        }