public void GET_PATDATA_BY_PATIENT_ID(string PATIENT_ID)
        {
            // 指定編碼
            Context.Response.HeaderEncoding = Encoding.UTF8;
            // 加入BOM
            Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
            WSresponse             rm         = new WSresponse();
            string                 actionName = "GET_PAT_DATA";
            List <MC_PATIENT_INFO> patList    = new List <MC_PATIENT_INFO>();
            List <pat_data>        pList      = new List <pat_data>();

            Dapper.DynamicParameters dp = new Dapper.DynamicParameters();
            string sql = "SELECT * FROM " + DB_TABLE_NAME.DB_MC_PATIENT_INFO + " WHERE PATIENT_ID = @PATIENT_ID AND DATASTATUS = '1'";

            dp.Add("PATIENT_ID", PATIENT_ID);
            patList = this.dblink.DBA.getSqlDataTable <MC_PATIENT_INFO>(sql, dp);
            if (this.dblink.DBA.hasLastError)
            {
                rm.success = false;
                rm.msg     = this.dblink.DBA.lastError;
                Com.Mayaminer.LogTool.SaveLogMessage(this.dblink.DBA.lastError, actionName, this.csName);
            }
            else
            {
                rm.success = true;
                rm.msg     = "查詢成功!";
                rm.data    = patList;
            }
            Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
            // return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
        }
        public void GET_HOSPDATA_BY_HOSP_KEY(string HOSP_KEY)
        {
            Dapper.DynamicParameters dp = new Dapper.DynamicParameters();
            // 指定編碼
            Context.Response.HeaderEncoding = Encoding.UTF8;
            // 加入BOM
            Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
            string                 actionName = "GET_ALL_HOSP_DATA";
            WSresponse             rm         = new WSresponse();
            List <MC_HOSP_INFO>    pList      = new List <MC_HOSP_INFO>();
            List <MC_PATIENT_INFO> tempList   = new List <MC_PATIENT_INFO>();
            string                 sql        = string.Concat("SELECT * FROM ", DB_TABLE_NAME.DB_MC_HOSP_INFO);

            dp = new Dapper.DynamicParameters();
            if (!string.IsNullOrWhiteSpace(HOSP_KEY))
            {
                dp.Add("HOSP_KEY", HOSP_KEY);
                sql += " WHERE HOSP_KEY =@HOSP_KEY";
            }
            pList = this.dblink.DBA.getSqlDataTable <MC_HOSP_INFO>(sql, dp);

            if (this.dblink.DBA.hasLastError)
            {
                rm.success = false;
                rm.msg     = "查詢失敗!";
                Com.Mayaminer.LogTool.SaveLogMessage(this.dblink.DBA.lastError, actionName, this.csName);
            }
            else
            {
                if (pList.Count > 0)
                {
                    sql = string.Concat("SELECT * FROM ", DB_TABLE_NAME.DB_MC_PATIENT_INFO, " WHERE HOSP_KEY in @HOSP_KEY");
                    dp  = new Dapper.DynamicParameters();
                    dp.Add("HOSP_KEY", pList.Select(x => x.HOSP_KEY).Distinct().ToList());
                    tempList = this.dblink.DBA.getSqlDataTable <MC_PATIENT_INFO>(sql, dp);
                    foreach (MC_HOSP_INFO item in pList)
                    {
                        if (tempList.Exists(x => x.HOSP_KEY == item.HOSP_KEY))
                        {
                            item.ALL_PATIENT = tempList.FindAll(x => x.HOSP_KEY == item.HOSP_KEY).ToList().Count;
                            if (tempList.Exists(x => x.HOSP_KEY == item.HOSP_KEY && !string.IsNullOrWhiteSpace(x.EXPECTED_ARRIVAL_DATETIME)))
                            {
                                item.ARRIVAL_PATIENT = tempList.FindAll(x => x.HOSP_KEY == item.HOSP_KEY && !string.IsNullOrWhiteSpace(x.EXPECTED_ARRIVAL_DATETIME)).Select(x => DateTime.Parse(x.EXPECTED_ARRIVAL_DATETIME) <= DateTime.Now).Count();
                            }
                            item.SELECT_PATIENT = item.ALL_PATIENT - item.ARRIVAL_PATIENT;
                        }
                    }
                }
                rm.success = true;
                rm.msg     = "查詢成功!";
                rm.data    = pList;
            }
            Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
        }
        public void GET_HOSPSOURCE_BY_PATIENT_ID(string PATIENT_ID)
        {
            // 指定編碼
            Context.Response.HeaderEncoding = Encoding.UTF8;
            // 加入BOM
            Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
            string     actionName = "GET_HOSPSOURCE_BY_PATIENT_ID";
            WSresponse rm         = new WSresponse();
            DateTime   dateNow    = DateTime.Parse("2020-07-08");

            Dapper.DynamicParameters  dp       = new Dapper.DynamicParameters();
            List <MC_SOURCE_LIST>     pList    = new List <MC_SOURCE_LIST>();
            List <DB_MC_PATIENT_INFO> tempList = new List <DB_MC_PATIENT_INFO>();
            string sql = string.Concat("SELECT * FROM ", DB_TABLE_NAME.DB_MC_PATIENT_INFO, " WHERE PATIENT_ID =@PATIENT_ID");

            dp.Add("PATIENT_ID", PATIENT_ID);
            tempList = this.dblink.DBA.getSqlDataTable <DB_MC_PATIENT_INFO>(sql, dp);
            if (tempList.Count > 0)
            {
                sql = string.Concat("SELECT * FROM ", DB_TABLE_NAME.DB_MC_SOURCE_LIST, " WHERE SITE_ID =@SITE_ID");
                dp.Add("SITE_ID", tempList[0].SITE_ID);
                pList = this.dblink.DBA.getSqlDataTable <MC_SOURCE_LIST>(sql, dp);
            }
            if (this.dblink.DBA.hasLastError)
            {
                rm.success = false;
                rm.msg     = this.dblink.DBA.lastError;
                Com.Mayaminer.LogTool.SaveLogMessage(this.dblink.DBA.lastError, actionName, this.csName);
            }
            else
            {
                rm.success = true;
                rm.msg     = "查詢成功!";
                rm.data    = pList;
            }
            Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
            // return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
        }
Esempio n. 4
0
        public string INSERT_PAT_DATA(
            string PATIENT_NAME,
            string PATIENT_ID,
            string LOCATION,
            string LATITUDE,
            string LONGITUDE,
            string AGE,
            string GENDER,
            string CITY,
            string COUNTRY,
            string TRIAGE,
            string EXPECTED_ARRIVAL_DATETIME,
            string LOGIN_DATETIME,
            string SELECTION_DATETIME,
            string HOSP_KEY,
            string HOSPITAL_SHOW_NAME)
        {
            RCS_Data.SQLProvider dblink = new RCS_Data.SQLProvider("MC_DbConnection");
            string SITE_ID = RCS_Data.Models.Function_Library.getDateNowString(RCS_Data.Models.DATE_FORMAT.yyyyMMddHHmmssfffff);

            #region 民眾版 新增  lcoation
            List <DB_MC_SITE_INFO> sList = new List <DB_MC_SITE_INFO>();
            sList.Add(new DB_MC_SITE_INFO()
            {
                SITE_ID     = SITE_ID,
                CREATE_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                CREATE_ID   = "ws",
                CREATE_NAME = "ws",
                MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                MODIFY_ID   = "ws",
                MODIFY_NAME = "ws",
                DATASTATUS  = "1",
                LATITUDE    = LATITUDE,
                LONGITUDE   = LONGITUDE,
            });
            dblink.DBA.DBExecInsert <DB_MC_SITE_INFO>(sList);
            #endregion
            List <string> msg = new List <string>();
            WSresponse    rm  = new WSresponse();
            if (string.IsNullOrWhiteSpace(PATIENT_NAME))
            {
                msg.Add("請輸入病患姓名!");
            }
            if (msg.Count > 0)
            {
                rm.success = false;
                rm.msg     = string.Join(",", msg);
                return(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
            }
            List <DB_MC_PATIENT_INFO> pList = new List <DB_MC_PATIENT_INFO>();
            pList.Add(new DB_MC_PATIENT_INFO()
            {
                PATIENT_ID                = PATIENT_ID,
                PATIENT_NAME              = PATIENT_NAME,
                SITE_ID                   = SITE_ID,
                LOCATION                  = LOCATION,
                AGE                       = AGE,
                GENDER                    = GENDER,
                CITY                      = CITY,
                COUNTRY                   = COUNTRY,
                TRIAGE                    = TRIAGE,
                TRANSPORTATION            = "",
                AMB_ID                    = "",
                EXPECTED_ARRIVAL_DATETIME = EXPECTED_ARRIVAL_DATETIME,
                LOGIN_DATETIME            = LOGIN_DATETIME,
                SELECTION_DATETIME        = SELECTION_DATETIME,
                HOSP_KEY                  = HOSP_KEY,
                HOSPITAL_SHOW_NAME        = HOSPITAL_SHOW_NAME,
                CREATE_ID                 = "ws",
                CREATE_NAME               = "ws",
                CREATE_DATE               = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                MODIFY_ID                 = "ws",
                MODIFY_NAME               = "ws",
                MODIFY_DATE               = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                DATASTATUS                = "1",
            });
            dblink.DBA.DBExecInsert <DB_MC_PATIENT_INFO>(pList);
            if (dblink.DBA.hasLastError)
            {
                rm.success = false;
                rm.msg     = dblink.DBA.lastError;
                return(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
            }
            if (msg.Count > 0)
            {
                rm.success = false;
                rm.msg     = string.Join(",", msg);
                return(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
            }
            rm.success    = true;
            rm.msg        = "success";
            rm.PATIENT_ID = PATIENT_ID;
            return(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
        }
Esempio n. 5
0
        public string UPDATE_PAT_DATA(string PATIENT_ID,
                                      string PATIENT_NAME,
                                      string AGE,
                                      string GENDER,
                                      string CITY,
                                      string COUNTRY,
                                      string TRIAGE,
                                      string EXPECTED_ARRIVAL_DATETIME,
                                      string LOGIN_DATETIME,
                                      string SELECTION_DATETIME,
                                      string HOSP_KEY,
                                      string HOSPITAL_SHOW_NAME,
                                      string HOSP_TO_PAT_SCORE,
                                      string HOSP_TO_PAT_SCORE_LEVEL)
        {
            List <string> msg = new List <string>();
            WSresponse    rm  = new WSresponse();

            RCS_Data.SQLProvider dblink = new RCS_Data.SQLProvider("MC_DbConnection");
            if (string.IsNullOrWhiteSpace(PATIENT_ID))
            {
                msg.Add("沒有傷患編號!無法修改!");
            }
            if (msg.Count > 0)
            {
                rm.success = false;
                rm.msg     = string.Join(",", msg);
                return(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
            }
            List <DB_MC_PATIENT_INFO> pList = dblink.DBA.getSqlDataTable <DB_MC_PATIENT_INFO>(string.Format("SELECT * FROM MC_PATIENT_INFO WHERE PATIENT_ID = '{0}';", PATIENT_ID));

            if (pList.Count > 0)
            {
                pList[0].PATIENT_ID   = dblink.GetFixedStrSerialNumber();
                pList[0].PATIENT_NAME = PATIENT_NAME;
                pList[0].AGE          = AGE;
                pList[0].GENDER       = GENDER;
                pList[0].CITY         = CITY;
                pList[0].COUNTRY      = COUNTRY;
                pList[0].TRIAGE       = TRIAGE;
                pList[0].EXPECTED_ARRIVAL_DATETIME = EXPECTED_ARRIVAL_DATETIME;
                pList[0].LOGIN_DATETIME            = LOGIN_DATETIME;
                pList[0].SELECTION_DATETIME        = SELECTION_DATETIME;
                pList[0].HOSP_KEY                = HOSP_KEY;
                pList[0].HOSPITAL_SHOW_NAME      = HOSPITAL_SHOW_NAME;
                pList[0].MODIFY_ID               = "SYS";
                pList[0].MODIFY_NAME             = "SYS";
                pList[0].MODIFY_DATE             = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                pList[0].DATASTATUS              = "1";
                pList[0].HOSP_TO_PAT_SCORE       = HOSP_TO_PAT_SCORE;
                pList[0].HOSP_TO_PAT_SCORE_LEVEL = HOSP_TO_PAT_SCORE_LEVEL;
            }

            pList.Add(new DB_MC_PATIENT_INFO()
            {
                PATIENT_ID                = dblink.GetFixedStrSerialNumber(),
                PATIENT_NAME              = PATIENT_NAME,
                SITE_ID                   = "9999",
                AGE                       = AGE,
                GENDER                    = GENDER,
                CITY                      = CITY,
                COUNTRY                   = COUNTRY,
                TRIAGE                    = TRIAGE,
                TRANSPORTATION            = "",
                AMB_ID                    = "",
                EXPECTED_ARRIVAL_DATETIME = EXPECTED_ARRIVAL_DATETIME,
                LOGIN_DATETIME            = LOGIN_DATETIME,
                SELECTION_DATETIME        = SELECTION_DATETIME,
                HOSP_KEY                  = HOSP_KEY,
                HOSPITAL_SHOW_NAME        = HOSPITAL_SHOW_NAME,
                CREATE_ID                 = "SYS",
                CREATE_NAME               = "SYS",
                CREATE_DATE               = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                MODIFY_ID                 = "SYS",
                MODIFY_NAME               = "SYS",
                MODIFY_DATE               = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                DATASTATUS                = "1",
                ARRIVAL_FLAG              = "",
                GUEST_FLAG                = "",
                HOSP_TO_PAT_SCORE         = HOSP_TO_PAT_SCORE,
                HOSP_TO_PAT_SCORE_LEVEL   = HOSP_TO_PAT_SCORE_LEVEL
            });
            dblink.DBA.DBExecInsert <DB_MC_PATIENT_INFO>(pList);
            if (dblink.DBA.hasLastError)
            {
                rm.success = false;
                rm.msg     = dblink.DBA.lastError;
                return(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
            }
            if (msg.Count > 0)
            {
                rm.success = false;
                rm.msg     = string.Join(",", msg);
                return(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
            }
            rm.success    = true;
            rm.msg        = "success";
            rm.PATIENT_ID = PATIENT_ID;
            return(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
        }
        public void SELECT_HOSP_BY_PATIENT_ID(string PATIENT_ID, string HOSP_KEY)
        {
            // 指定編碼
            Context.Response.HeaderEncoding = Encoding.UTF8;
            // 加入BOM
            Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
            string        actionName = "SELECT_HOSP_BY_PATIENT_ID";
            List <string> msg        = new List <string>();
            WSresponse    rm         = new WSresponse();

            RCS_Data.SQLProvider dblink = new RCS_Data.SQLProvider("MC_DbConnection");
            if (string.IsNullOrWhiteSpace(PATIENT_ID))
            {
                msg.Add("沒有傷患編號!無法修改!");
            }
            if (string.IsNullOrWhiteSpace(HOSP_KEY))
            {
                msg.Add("沒有選擇醫院!無法修改!");
            }
            if (msg.Count > 0)
            {
                rm.success = false;
                rm.msg     = string.Join(",", msg);
                Com.Mayaminer.LogTool.SaveLogMessage(this.dblink.DBA.lastError, actionName, this.csName);
                Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                // return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
            }
            else
            {
                List <DB_MC_PATIENT_INFO> pList = dblink.DBA.getSqlDataTable <DB_MC_PATIENT_INFO>(string.Format("SELECT * FROM MC_PATIENT_INFO WHERE PATIENT_ID = '{0}';", PATIENT_ID));
                if (pList.Count > 0)
                {
                    pList[0].HOSP_KEY    = HOSP_KEY;
                    pList[0].MODIFY_ID   = "SYS";
                    pList[0].MODIFY_NAME = "SYS";
                    pList[0].MODIFY_DATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    pList[0].DATASTATUS  = "1";
                }
                dblink.DBA.DBExecUpdate <DB_MC_PATIENT_INFO>(pList);
                if (dblink.DBA.hasLastError)
                {
                    rm.success = false;
                    rm.msg     = dblink.DBA.lastError;
                    Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                    // return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
                }
                else
                {
                    if (msg.Count > 0)
                    {
                        rm.success = false;
                        rm.msg     = string.Join(",", msg);
                        Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                        // return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
                    }
                    else
                    {
                        rm.success    = true;
                        rm.msg        = "修改醫院成功!";
                        rm.PATIENT_ID = PATIENT_ID;
                        Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                        // return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
                    }
                }
            }
        }
        public void UPDATE_PATDATA(string PATIENT_ID,
                                   string PATIENT_NAME,
                                   string AGE,
                                   string GENDER,
                                   string CITY,
                                   string COUNTRY,
                                   string TRIAGE,
                                   string EXPECTED_ARRIVAL_DATETIME,
                                   string SELECTION_DATETIME,
                                   string HOSP_KEY,
                                   string SCORE)
        {
            // 指定編碼
            Context.Response.HeaderEncoding = Encoding.UTF8;
            // 加入BOM
            Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
            string        actionName = "UPDATE_PAT_DATA";
            List <string> msg        = new List <string>();
            WSresponse    rm         = new WSresponse();

            RCS_Data.SQLProvider dblink = new RCS_Data.SQLProvider("MC_DbConnection");
            if (string.IsNullOrWhiteSpace(PATIENT_ID))
            {
                msg.Add("沒有傷患編號!無法修改!");
            }
            if (msg.Count > 0)
            {
                rm.success = false;
                rm.msg     = string.Join(",", msg);
                Com.Mayaminer.LogTool.SaveLogMessage(this.dblink.DBA.lastError, actionName, this.csName);
                // return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
            }
            else
            {
                List <DB_MC_PATIENT_INFO> pList = dblink.DBA.getSqlDataTable <DB_MC_PATIENT_INFO>(string.Format("SELECT * FROM MC_PATIENT_INFO WHERE PATIENT_ID = '{0}';", PATIENT_ID));
                if (pList.Count > 0)
                {
                    if (!string.IsNullOrWhiteSpace(PATIENT_NAME))
                    {
                        pList[0].PATIENT_NAME = PATIENT_NAME;
                    }
                    if (!string.IsNullOrWhiteSpace(AGE))
                    {
                        pList[0].AGE = AGE;
                    }
                    if (!string.IsNullOrWhiteSpace(GENDER))
                    {
                        pList[0].GENDER = GENDER;
                    }
                    if (!string.IsNullOrWhiteSpace(CITY))
                    {
                        pList[0].CITY = CITY;
                    }
                    if (!string.IsNullOrWhiteSpace(COUNTRY))
                    {
                        pList[0].COUNTRY = COUNTRY;
                    }
                    if (!string.IsNullOrWhiteSpace(TRIAGE))
                    {
                        pList[0].TRIAGE = TRIAGE;
                    }
                    if (!string.IsNullOrWhiteSpace(EXPECTED_ARRIVAL_DATETIME))
                    {
                        pList[0].EXPECTED_ARRIVAL_DATETIME = EXPECTED_ARRIVAL_DATETIME;
                    }
                    if (!string.IsNullOrWhiteSpace(SELECTION_DATETIME))
                    {
                        pList[0].SELECTION_DATETIME = SELECTION_DATETIME;
                    }
                    if (!string.IsNullOrWhiteSpace(HOSP_KEY))
                    {
                        pList[0].HOSP_KEY = HOSP_KEY;
                    }
                    if (!string.IsNullOrWhiteSpace(SCORE))
                    {
                        pList[0].SCORE = SCORE;
                    }
                    pList[0].MODIFY_ID   = "SYS";
                    pList[0].MODIFY_NAME = "SYS";
                    pList[0].MODIFY_DATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    pList[0].DATASTATUS  = "1";
                }
                dblink.DBA.DBExecUpdate <DB_MC_PATIENT_INFO>(pList);
                if (dblink.DBA.hasLastError)
                {
                    rm.success = false;
                    rm.msg     = dblink.DBA.lastError;
                    Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                    //  return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
                }
                else
                {
                    if (msg.Count > 0)
                    {
                        rm.success = false;
                        rm.msg     = string.Join(",", msg);
                        Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                        // return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
                    }
                    else
                    {
                        rm.success    = true;
                        rm.msg        = "success";
                        rm.PATIENT_ID = PATIENT_ID;
                        Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                        // return Newtonsoft.Json.JsonConvert.SerializeObject(rm);
                    }
                }
            }
        }
        public void INSERT_PATDATA(
            string PATIENT_NAME,
            string PATIENT_ID,
            string LATITUDE,
            string LONGITUDE,
            string AGE,
            string GENDER,
            string CITY,
            string COUNTRY,
            string TRIAGE,
            string EXPECTED_ARRIVAL_DATETIME,
            string SELECTION_DATETIME,
            string HOSP_KEY,
            string SCORE)
        {
            // 指定編碼
            Context.Response.HeaderEncoding = Encoding.UTF8;
            // 加入BOM
            Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
            string        actionName = "INSERT_PAT_DATA";
            WSresponse    rm         = new WSresponse();
            List <string> msg        = new List <string>();

            if (string.IsNullOrWhiteSpace(PATIENT_ID))
            {
                msg.Add("請輸入傷患ID!");
            }
            if (string.IsNullOrWhiteSpace(PATIENT_NAME))
            {
                msg.Add("請輸入傷患姓名!");
            }
            if (msg.Count > 0)
            {
                rm.success = false;
                rm.msg     = string.Join(",", msg);
                Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
            }
            else
            {
                string SITE_ID = RCS_Data.Models.Function_Library.getDateNowString(RCS_Data.Models.DATE_FORMAT.yyyyMMddHHmmssfffff);
                #region 民眾版 新增  lcoation
                List <DB_MC_SITE_INFO> sList = new List <DB_MC_SITE_INFO>();
                sList.Add(new DB_MC_SITE_INFO()
                {
                    SITE_ID     = SITE_ID,
                    CREATE_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                    CREATE_ID   = "ws",
                    CREATE_NAME = "ws",
                    MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                    MODIFY_ID   = "ws",
                    MODIFY_NAME = "ws",
                    DATASTATUS  = "1",
                    LATITUDE    = string.IsNullOrWhiteSpace(LATITUDE) ? "25.0169826" : LATITUDE,
                    LONGITUDE   = string.IsNullOrWhiteSpace(LONGITUDE) ? "121.46278679" : LONGITUDE,
                });
                #endregion
                this.dblink.DBA.DBExecInsert <DB_MC_SITE_INFO>(sList);

                List <DB_MC_PATIENT_INFO> pList = new List <DB_MC_PATIENT_INFO>();
                #region 新增傷患資料
                pList.Add(new DB_MC_PATIENT_INFO()
                {
                    PATIENT_ID                = PATIENT_ID,
                    PATIENT_NAME              = PATIENT_NAME,
                    SITE_ID                   = SITE_ID,
                    AGE                       = AGE,
                    GENDER                    = GENDER,
                    CITY                      = CITY,
                    COUNTRY                   = COUNTRY,
                    TRIAGE                    = string.IsNullOrWhiteSpace(TRIAGE) ? "Moderate" : TRIAGE,
                    TRANSPORTATION            = "",
                    AMB_ID                    = "",
                    EXPECTED_ARRIVAL_DATETIME = EXPECTED_ARRIVAL_DATETIME,
                    SELECTION_DATETIME        = string.IsNullOrWhiteSpace(SELECTION_DATETIME) ? Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss) : SELECTION_DATETIME,
                    HOSP_KEY                  = HOSP_KEY,
                    SCORE                     = SCORE,
                    CREATE_ID                 = "ws",
                    CREATE_NAME               = "ws",
                    CREATE_DATE               = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    MODIFY_ID                 = "ws",
                    MODIFY_NAME               = "ws",
                    MODIFY_DATE               = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    DATASTATUS                = "1",
                });
                #endregion
                this.dblink.DBA.DBExecInsert <DB_MC_PATIENT_INFO>(pList);
                if (this.dblink.DBA.hasLastError)
                {
                    rm.success = false;
                    rm.msg     = this.dblink.DBA.lastError;
                    Com.Mayaminer.LogTool.SaveLogMessage(this.dblink.DBA.lastError, actionName, this.csName);
                    Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                }
                else
                {
                    if (msg.Count > 0)
                    {
                        rm.success = false;
                        rm.msg     = string.Join(",", msg);
                        Com.Mayaminer.LogTool.SaveLogMessage(rm.msg, actionName, this.csName);
                        Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                    }
                    else
                    {
                        rm.success    = true;
                        rm.msg        = "新增成功";
                        rm.PATIENT_ID = PATIENT_ID;
                        Context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rm));
                    }
                }
            }
        }