コード例 #1
0
        /// <summary>
        /// 42、	获取项目的病人列表
        /// </summary>
        /// <param name="hospitalid">医院id[通常不用]</param>
        /// <param name="projectid">项目id</param>
        /// <param name="doctorid">对应的医生id</param>
        /// <param name="username">病人名字(模糊)</param>
        /// <param name="page">分页id</param>
        /// Gerry Ge
        /// 请求方式:GET
        /// <returns></returns>
        public string PatientList(string token, int hospitalid, int projectid, int doctorid, string username, int page = 1)
        {
            string strResponse = string.Empty;
            PatientListResponse apiResponse = new PatientListResponse();

            try
            {
                Dictionary <string, string> sPara = new Dictionary <string, string>();

                sPara.Add("hospitalid", hospitalid.ToString());
                sPara.Add("projectid", projectid.ToString());
                sPara.Add("doctorid", doctorid.ToString());
                sPara.Add("username", username.ToString());
                sPara.Add("page", page.ToString());

                strResponse = F8YLSubmit.BuildGetRequest(sPara, "project/patient/list?token=" + token);
            }
            catch (Exception ex)
            {
                AppLog.Instance.Write("PatientList", AppLog.LogMessageType.Error, ex);
            }
            return(strResponse);
        }
コード例 #2
0
        public PatientListResponse PostPatientList([FromBody] PatientListRequest request)
        {
            PatientListResponse response = new PatientListResponse();

            try
            {
                if (CommonHelpers.ValidateRequest(request.UserToken))
                {
                    DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]);
                    DBAgent.ClearParams();
                    if (!String.IsNullOrEmpty(request.AccountNumber))
                    {
                        DBAgent.AddParameter("@ParamAccountNumber", request.AccountNumber);
                    }
                    string data = DBAgent.ExecuteStoredProcedure("dbo.spGetPatientListByAccount");
                    if (data.Length > 0)
                    {
                        DataSet ds = CommonHelpers.GetDataSetFromXml(data);
                        if (ds.Tables.Count > 0)
                        {
                            DataTable dTable = ds.Tables[0];
                            //response.PatientListDataTable = dTable;

                            ArrayList             PatientList        = new ArrayList();
                            List <PatientDetails> PatientDetailsList = new List <PatientDetails>();
                            foreach (DataRow dr in dTable.Rows)
                            {
                                string PatientNameRow = String.Format("{0}, {1} ({2} - {3})", dr["PatientLastName"], dr["PatientFirstName"], dr["PatientAccountNumber"], dr["PatientDOB"]);
                                PatientList.Add(String.Format("{0}, {1} ({2} - {3})", dr["PatientLastName"], dr["PatientFirstName"], dr["PatientAccountNumber"], dr["PatientDOB"]));
                                PatientDetailsList.Add(new PatientDetails(PatientNameRow, dr["PatientID"].ToString()));
                            }

                            response.PatientList        = PatientList;
                            response.PatientDetailsList = PatientDetailsList;
                        }
                        else
                        {
                            response.ErrorMessage = "No Data";
                        }
                    }
                    else
                    {
                        response.ErrorMessage = "No Data";
                    }
                }
                else
                {
                    response.ErrorMessage = "Invalid Request";

                    DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]);
                    DBAgent.ClearParams();
                    DBAgent.AddParameter("@ParamRefID", request.LoginID);
                    DBAgent.AddParameter("@ParamRefType", "Users");
                    DBAgent.AddParameter("@ParamAction", "IR");
                    DBAgent.AddParameter("@ParamComment", "Invalid Requestv from Mobile App - PatientListController - " + request.UserToken);
                    DBAgent.ExecuteNonQuery("dbo.spAddUserAction");
                }
            }
            catch (Exception ex)
            {
                response.ErrorMessage = ex.Message;
                CommonHelpers.writeLogToFile("API: PostPatientList - PatientListController.cs", ex.Message + Environment.NewLine + ex.StackTrace);
            }
            return(response);
        }