public object Login(Login_Form_Body form)
 {
     if (!string.IsNullOrWhiteSpace(form.site_id) || !string.IsNullOrWhiteSpace(form.hosp_id))
     {
         if (!string.IsNullOrWhiteSpace(form.site_id))
         {
             if (_model.getMC_SITE_INFO(form.site_id).Count == 0)
             {
                 if (!string.IsNullOrWhiteSpace(form.LATITUDE) && !string.IsNullOrWhiteSpace(form.LONGITUDE))
                 {
                     List <DB_MC_SITE_INFO> pList = new List <DB_MC_SITE_INFO>();
                     pList.Add(new DB_MC_SITE_INFO()
                     {
                         SITE_ID     = form.site_id,
                         CREATE_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                         CREATE_ID   = this.userinfo.user_id,
                         CREATE_NAME = this.userinfo.user_name,
                         MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                         MODIFY_ID   = this.userinfo.user_id,
                         MODIFY_NAME = this.userinfo.user_name,
                         DATASTATUS  = "1",
                         LATITUDE    = form.LATITUDE,
                         LONGITUDE   = form.LONGITUDE,
                     });
                     this.DBLink.DBA.DBExecInsert <DB_MC_SITE_INFO>(pList);
                     if (this.DBLink.DBA.hasLastError)
                     {
                         this.throwHttpResponseException("程式發生錯誤,請洽資訊人員!");
                         Com.Mayaminer.LogTool.SaveLogMessage(this.DBLink.DBA.lastError, "Login", this.csName);
                     }
                 }
                 else
                 {
                     this.throwHttpResponseException("查無經緯度資料無法填寫資料!!");
                 }
             }
         }
         return(new
         {
             Result = true,
             token = JwtAuthActionFilterAttribute.EncodeToken(new PAYLOAD()
             {
                 hosp_id = form.hosp_id,
                 site_id = form.site_id,
                 user_name = this.userinfo.user_name,
                 user_id = this.userinfo.user_id,
             })
         });
     }
     else
     {
         this.throwHttpResponseException("請輸入資料!!");
     }
     this.throwHttpResponseException("請輸入資料!!");
     return(false);
 }
示例#2
0
        /// <summary>
        /// 計算CV
        /// </summary>
        /// <param name="pSITE_ID">計算日期</param>
        public void runCV(string pSITE_ID)
        {
            string actionName = "runCV";
            List <DB_MC_HOSP_INFO_DTL> tempList = this.getMC_HOSP_INFO_DTL(pSITE_ID);

            if (tempList.Count > 0)
            {
                List <DB_MC_PATIENT_INFO> patList = this.getMC_PATIENT_INFO();
                foreach (DB_MC_HOSP_INFO_DTL item in tempList)
                {
                    item.CV = MvcApplication.hospList.Find(x => x.HOSP_KEY == item.HOSP_KEY).CV;
                    List <DB_MC_PATIENT_INFO> tempPatList = patList.FindAll(x => x.HOSP_KEY == item.HOSP_KEY).ToList();
                    int    SEVERE_PAT   = tempPatList.FindAll(x => x.TRIAGE == "Severe").Count();
                    int    MODERATE_PAT = tempPatList.FindAll(x => x.TRIAGE == "Moderate").Count();
                    int    MILD_PAT     = tempPatList.FindAll(x => x.TRIAGE == "Mild").Count();
                    double PS           = this.penalty_standadize(int.Parse(item.CV), tempPatList.Count());
                    item.PS = PS.ToString();
                    string v = Math.Round(double.Parse(PS.ToString()), 2).ToString();
                    item.PS           = v;
                    item.SEVERE_PAT   = SEVERE_PAT.ToString();
                    item.MODERATE_PAT = MODERATE_PAT.ToString();
                    item.MILD_PAT     = MILD_PAT.ToString();
                    try
                    {
                        item.SOURCE = (double.Parse((PS * tempPatList.Count).ToString()) / double.Parse(MvcApplication.hospList.Find(x => x.HOSP_KEY == item.HOSP_KEY).EDOBSERVBEDS)).ToString();
                        double tempd = 0;
                        double.TryParse(item.SOURCE, out tempd);
                        item.SOURCE = tempd.ToString();
                        if (item.SOURCE == "非數值")
                        {
                            item.SOURCE = "0";
                        }
                        else
                        {
                            item.SOURCE = Math.Round(double.Parse(item.SOURCE), 2).ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        Com.Mayaminer.LogTool.SaveLogMessage(Newtonsoft.Json.JsonConvert.SerializeObject(item), actionName, this.csName);
                        Com.Mayaminer.LogTool.SaveLogMessage(ex, actionName, this.csName);
                        item.SOURCE = "0";
                    }
                    item.MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss);
                    item.MODIFY_ID   = this.userinfo.user_id;
                    item.MODIFY_NAME = this.userinfo.user_name;
                }
                List <string> disSource = tempList.Select(x => x.SOURCE).Distinct().ToList();
                this.DBLink.DBA.DBExecUpdate <DB_MC_HOSP_INFO_DTL>(tempList);
                if (this.DBLink.DBA.hasLastError)
                {
                    Com.Mayaminer.LogTool.SaveLogMessage(this.DBLink.DBA.lastError, actionName, this.csName);
                }
            }
        }
示例#3
0
        /// <summary>
        /// 設定今天的變動CV
        /// </summary>
        /// <param name="pDate"></param>
        private void setMC_HOSP_INFO_DTL(string pSITE_ID, string pSITE_AREA)
        {
            string      actionName              = "setMC_HOSP_INFO_DTL";
            SQLProvider dba                     = new SQLProvider();
            List <DB_MC_HOSP_INFO_DTL> pList    = new List <DB_MC_HOSP_INFO_DTL>();
            List <DB_MC_HOSP_INFO_DTL> tempList = this.getMC_HOSP_INFO_DTL(pSITE_ID);
            List <DB_MC_HOSP_INFO>     hpList   = new List <DB_MC_HOSP_INFO>();

            if (tempList.Count > 0)
            {
                hpList = MvcApplication.hospList.FindAll(x => !tempList.Exists(y => y.HOSP_KEY == x.HOSP_KEY)).ToList();
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(pSITE_AREA))
                {
                    hpList = MvcApplication.hospList.FindAll(x => x.DIVISION.Trim() == pSITE_AREA).ToList();
                }
            }
            foreach (DB_MC_HOSP_INFO item in hpList)
            {
                pList.Add(new DB_MC_HOSP_INFO_DTL()
                {
                    HOSP_KEY    = item.HOSP_KEY,
                    SITE_ID     = pSITE_ID,
                    CREATE_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                    CREATE_ID   = this.userinfo.user_id,
                    CREATE_NAME = this.userinfo.user_name,
                    MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                    MODIFY_ID   = this.userinfo.user_id,
                    MODIFY_NAME = this.userinfo.user_name,
                    DATASTATUS  = "1",
                });
            }
            if (pList.Count > 0)
            {
                dba.DBA.DBExecInsert <DB_MC_HOSP_INFO_DTL>(pList);
            }
            if (dba.DBA.hasLastError)
            {
                Com.Mayaminer.LogTool.SaveLogMessage(dba.DBA.lastError, actionName, this.csName);
            }
        }
示例#4
0
        public void runDriving(string pSITE_ID)
        {
            List <DB_MC_SITE_DRIVING_TIME_INFO> tempList = new List <DB_MC_SITE_DRIVING_TIME_INFO>();
            List <DB_MC_SITE_INFO> sList = getMC_SITE_INFO(pSITE_ID);
            List <DB_MC_HOSP_INFO> pList = MvcApplication.hospList.ToList();

            if (!string.IsNullOrWhiteSpace(pSITE_ID))
            {
                pList = pList.FindAll(x => x.DIVISION.Trim() == sList.First(y => y.SITE_ID == pSITE_ID).SITE_AREA);
            }
            List <string> dList = this.getDB_DRIVING_SITE(sList.Select(x => x.SITE_ID).ToList());

            foreach (DB_MC_SITE_INFO s in sList)
            {
                if (!dList.Exists(x => x == s.SITE_ID))
                {
                    foreach (DB_MC_HOSP_INFO h in pList)
                    {
                        var Dis = (int)(new GeoCoordinate(double.Parse(h.LATITUDE), double.Parse(h.LONGITUDE))).GetDistanceTo(
                            new GeoCoordinate(double.Parse(s.LATITUDE), double.Parse(s.LONGITUDE))
                            );
                        tempList.Add(new DB_MC_SITE_DRIVING_TIME_INFO()
                        {
                            HOSP_KEY     = h.HOSP_KEY,
                            SITE_ID      = s.SITE_ID,
                            CREATE_DATE  = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                            CREATE_ID    = this.userinfo.user_id,
                            CREATE_NAME  = this.userinfo.user_name,
                            MODIFY_DATE  = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                            MODIFY_ID    = this.userinfo.user_id,
                            MODIFY_NAME  = this.userinfo.user_name,
                            DATASTATUS   = "1",
                            DRIVING_TIME = Math.Round((double.Parse(Dis.ToString()) / 1000) > 60 ? 60 : (double.Parse(Dis.ToString()) / 1000), 0).ToString(),
                        });
                    }
                    this.time_ordinal(ref tempList);
                    this.DBLink.DBA.DBExecInsert <DB_MC_SITE_DRIVING_TIME_INFO>(tempList);
                }
            }
        }
        /// <summary>
        /// 新增病患資料
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string INSERT_PAT_DATA(DB_MC_PATIENT_INFO model)
        {
            string actionName = "INSERT_PAT_DATA";

            model.CREATE_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss);
            model.CREATE_ID   = this.userinfo.user_id;
            model.CREATE_NAME = this.userinfo.user_name;
            model.MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss);
            model.MODIFY_ID   = this.userinfo.user_id;
            model.MODIFY_NAME = this.userinfo.user_name;
            this.DBLink.DBA.DBExecInsert <DB_MC_PATIENT_INFO>(new List <DB_MC_PATIENT_INFO>()
            {
                model
            });
            if (this.DBLink.DBA.hasLastError)
            {
                Com.Mayaminer.LogTool.SaveLogMessage(this.DBLink.DBA.lastError, actionName, this.csName);
            }
            if (!MvcApplication.MCSourceThread.IsAlive)
            {
                MvcApplication.MCSourceThread.Start();
            }
            return("儲存成功!");
        }
示例#6
0
        public void getAllScore(string pSITE_ID)
        {
            string actionName = "getAllScore";
            List <DB_MC_SOURCE_LIST>            insertList = new List <DB_MC_SOURCE_LIST>();
            List <DB_MC_SOURCE_LIST>            updateList = new List <DB_MC_SOURCE_LIST>();
            List <DB_MC_SITE_DRIVING_TIME_INFO> tList      = new List <DB_MC_SITE_DRIVING_TIME_INFO>();
            List <DB_MC_HOSP_INFO_DTL>          dList      = new List <DB_MC_HOSP_INFO_DTL>();
            List <DB_MC_PATIENT_INFO>           pList      = new List <DB_MC_PATIENT_INFO>();
            List <DB_MC_SOURCE_LIST>            saList     = new List <DB_MC_SOURCE_LIST>();

            Dapper.DynamicParameters dp = new Dapper.DynamicParameters();
            string sql = "";

            sql = "SELECT * FROM " + DB_TABLE_NAME.DB_MC_SITE_INFO + " WHERE DATASTATUS = '1';";
            sql = "SELECT * FROM " + DB_TABLE_NAME.DB_MC_PATIENT_INFO + " WHERE DATASTATUS = '1' AND SITE_ID = @SITE_ID;"
                  + " SELECT * FROM " + DB_TABLE_NAME.DB_MC_SITE_DRIVING_TIME_INFO + " WHERE DATASTATUS = '1'  AND SITE_ID = @SITE_ID;"
                  + " SELECT * FROM " + DB_TABLE_NAME.DB_MC_HOSP_INFO_DTL + " WHERE DATASTATUS = '1' AND SITE_ID = @SITE_ID;"
                  + " SELECT * FROM " + DB_TABLE_NAME.DB_MC_SOURCE_LIST + " WHERE DATASTATUS = '1'  AND SITE_ID = @SITE_ID;";
            dp.Add("SITE_ID", pSITE_ID);
            this.DBLink.DBA.Open();
            GridReader gr = this.DBLink.DBA.dbConnection.QueryMultiple(sql, dp);

            pList  = gr.Read <DB_MC_PATIENT_INFO>().ToList();
            tList  = gr.Read <DB_MC_SITE_DRIVING_TIME_INFO>().ToList();
            dList  = gr.Read <DB_MC_HOSP_INFO_DTL>().ToList();
            saList = gr.Read <DB_MC_SOURCE_LIST>().ToList();
            this.DBLink.DBA.Close();
            foreach (DB_MC_SITE_DRIVING_TIME_INFO t in tList)
            {
                bool hasData           = false;
                DB_MC_SOURCE_LIST temp = new DB_MC_SOURCE_LIST();
                DB_MC_HOSP_INFO   hosp = MvcApplication.hospList.Find(x => x.HOSP_KEY == t.HOSP_KEY);
                if (saList.Exists(x => x.SITE_ID == t.SITE_ID && x.HOSP_KEY == t.HOSP_KEY))
                {
                    hasData          = true;
                    temp             = saList.Find(x => x.SITE_ID == t.SITE_ID && x.HOSP_KEY == t.HOSP_KEY);
                    temp.MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss);
                    temp.MODIFY_ID   = this.userinfo.user_id;
                    temp.MODIFY_NAME = this.userinfo.user_name;
                }
                else
                {
                    temp = new DB_MC_SOURCE_LIST()
                    {
                        HOSP_KEY       = t.HOSP_KEY,
                        MILD           = hosp.MILD,
                        SEVERE         = hosp.SEVERE,
                        MODERATE       = hosp.MODERATE,
                        W2             = hosp.W2,
                        CV             = dList.Find(x => x.HOSP_KEY == t.HOSP_KEY && x.SITE_ID == t.SITE_ID).SOURCE,
                        SITE_ID        = t.SITE_ID,
                        DRIVING_SOURCE = t.DRIVING_SOURCE,
                        CREATE_DATE    = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                        CREATE_ID      = this.userinfo.user_id,
                        CREATE_NAME    = this.userinfo.user_name,
                        MODIFY_DATE    = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                        MODIFY_ID      = this.userinfo.user_id,
                        MODIFY_NAME    = this.userinfo.user_name,
                        DATASTATUS     = "1",
                    };
                }
                //  (𝒙_𝒊𝒋) + ( 𝒚_𝒊𝒋 (𝟏−𝒛_𝒊𝒋 )+ 𝒚_𝒊𝒋 𝒘𝟐_𝒊𝒋 )
                double x_ij = double.Parse(temp.DRIVING_SOURCE),
                       y_ij = double.Parse(temp.MILD), z_ij = double.Parse(temp.CV), w2_ij = double.Parse(temp.MILD);

                temp.MILD_SOURCE     = Math.Round(x_ij + (double.Parse(temp.MILD) * (1 - z_ij) + double.Parse(temp.MILD) * w2_ij), 2).ToString();
                temp.MODERATE_SOURCE = Math.Round(x_ij + (double.Parse(temp.MODERATE) * (1 - z_ij) + double.Parse(temp.MODERATE) * w2_ij), 2).ToString();
                temp.SEVERE_SOURCE   = Math.Round(x_ij + (double.Parse(temp.SEVERE) * (1 - z_ij) + double.Parse(temp.SEVERE) * w2_ij), 2).ToString();
                if (hasData)
                {
                    updateList.Add(temp);
                }
                else
                {
                    insertList.Add(temp);
                }
            }
            this.DBLink.DBA.DBExecInsert <DB_MC_SOURCE_LIST>(insertList);
            this.DBLink.DBA.DBExecUpdate <DB_MC_SOURCE_LIST>(updateList);
            if (this.DBLink.DBA.hasLastError)
            {
                Com.Mayaminer.LogTool.SaveLogMessage(this.DBLink.DBA.lastError, actionName, this.csName);
            }
        }
示例#7
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));
        }
        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));
                    }
                }
            }
        }
        public string saveSite(DB_MC_SITE_INFO form)
        {
            List <DB_MC_SITE_INFO> pList = new List <DB_MC_SITE_INFO>();

            if (string.IsNullOrWhiteSpace(form.LATITUDE) || string.IsNullOrWhiteSpace(form.LONGITUDE))
            {
                this.throwHttpResponseException("查無經緯度資料無法填寫資料!!");
            }
            if (string.IsNullOrEmpty(form.SITE_ID))
            {
                this.throwHttpResponseException("請填寫事件代碼!!");
            }
            if (string.IsNullOrEmpty(form.SITE_DESC))
            {
                this.throwHttpResponseException("請填寫事件名稱!!");
            }
            if (string.IsNullOrEmpty(form.SITE_AREA))
            {
                this.throwHttpResponseException("請填寫事件地區!!");
            }
            if (!string.IsNullOrEmpty(form.SITE_ID))
            {
                pList = _model.getMC_SITE_INFO(form.SITE_ID);
                if (pList.Count == 0)
                {
                    pList.Add(new DB_MC_SITE_INFO()
                    {
                        SITE_DESC   = form.SITE_DESC,
                        SITE_ID     = form.SITE_ID,
                        CREATE_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                        CREATE_ID   = this.userinfo.user_id,
                        CREATE_NAME = this.userinfo.user_name,
                        MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss),
                        MODIFY_ID   = this.userinfo.user_id,
                        MODIFY_NAME = this.userinfo.user_name,
                        DATASTATUS  = "1",
                        LATITUDE    = form.LATITUDE,
                        LONGITUDE   = form.LONGITUDE,
                    });
                    this.DBLink.DBA.DBExecInsert <DB_MC_SITE_INFO>(pList);
                    if (this.DBLink.DBA.hasLastError)
                    {
                        this.throwHttpResponseException("程式發生錯誤,請洽資訊人員!");
                        Com.Mayaminer.LogTool.SaveLogMessage(this.DBLink.DBA.lastError, "Login", this.csName);
                    }
                }
                else
                {
                    foreach (DB_MC_SITE_INFO item in pList)
                    {
                        item.SITE_DESC   = form.SITE_DESC;
                        item.SITE_AREA   = form.SITE_AREA;
                        item.LATITUDE    = form.LATITUDE;
                        item.LONGITUDE   = form.LONGITUDE;
                        item.MODIFY_DATE = Function_Library.getDateNowString(DATE_FORMAT.yyyy_MM_dd_HHmmss);
                        item.MODIFY_ID   = this.userinfo.user_id;
                        item.MODIFY_NAME = this.userinfo.user_name;
                    }
                    this.DBLink.DBA.DBExecUpdate <DB_MC_SITE_INFO>(pList);
                    if (this.DBLink.DBA.hasLastError)
                    {
                        this.throwHttpResponseException("程式發生錯誤,請洽資訊人員!");
                        Com.Mayaminer.LogTool.SaveLogMessage(this.DBLink.DBA.lastError, "Login", this.csName);
                    }
                }
            }

            if (this.DBLink.DBA.hasLastError)
            {
                this.throwHttpResponseException("儲存失敗!");
            }
            return("儲存成功");
        }