---
# System prepended metadata

title: Tmp

---


```
$formatted_date = date("Ymd");
$YYY = (int)substr($formatted_date,0,4) - 1911;
$md = substr($formatted_date,4,4);
$mdBeforeFourDay = substr(date("Ymd",strtotime($formatted_date . " -4 day")),4,4);
$Today = $YYY.$md;
$BeforeFourDay = $YYY.$mdBeforeFourDay;
echo $Today;
```

```
    public function dateToROC($date, $format = 'Ymd'){
        // $dateTime = $this->getDateTime();
        // $dateTime->setDate(date('Y', strtotime($date)), date('m', strtotime($date)), date('d', strtotime($date)));
        // $dateTime->setTime(date('H', strtotime($date)), date('i', strtotime($date)), date('s', strtotime($date)));
        // $rocDate = ltrim($dateTime->modify('-1911 years')->format($format), '0');
        // return $rocDate;


        $formatted_date = date("Ymd", strtotime($date));
        $YYY = (int)substr($formatted_date,0,4) - 1911;
        $MMDD = substr($formatted_date,4,4);
        return $YYY.$MMDD; // 输出：20240229
    }
```

```
function GetChineseDate(string $Day='0') : int {
    $parameter1 = $Day." day";
    $day = date(
        "Ymd",
        strtotime($parameter1, strtotime(date("Y-m-d", strtotime("-1911 years"))))
    );
    $day = intval($day);
    return $day;
}
```


```
public function dateToROC($date, $format = 'Ymd') {
    // 檢查日期是否合法
    $dateTime = DateTime::createFromFormat('Y-m-d', $date);
    if (!$dateTime || $dateTime->format('Y-m-d') !== $date) {
        return false; // 日期不合法，返回 false 或其他錯誤處理方式
    }

    // 將日期轉換為民國年
    $rocDate = (int)$dateTime->format('Y') - 1911 . $dateTime->format('md');
    $rocDate = ltrim($rocDate, '0'); // 移除開頭多餘的零

    return $rocDate;
}

// 測試函數
$westernDate = '2024-02-29';
$taiwanDate = dateToROC($westernDate);
echo $taiwanDate; // 輸出: 1130229

```



// 取得目前的網址
var currentURL = window.location.href;

// 檢查是否含有指定的參數
function checkParameter(param) {
    return currentURL.includes(param);
}

// 檢查是否含有 layout=main 參數
var hasLayoutMain = checkParameter("layout=main");

if (hasLayoutMain) {
    console.log("目前的網址含有 layout=main 參數，回傳 true");
} else {
    console.log("目前的網址不含有 layout=main 參數，回傳 false");
}



```
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive Bootstrap Buttons</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    <style>
        /* Custom CSS for button height, width, margin, and hover effect */
        .custom-btn {
            height: 120px !important;
            width: 98% !important;
            margin: 5px auto !important;
            border: 2px solid gray !important;
            /* Black border */
            color: white !important;
            transition: background-color 0.3s ease !important;
            font-size: 1.3em !important;
            /* equivalent to h3 font size */
        }

        .custom-btn:hover {
            background-color: #244197 !important;
            /* Change to desired hover color */
        }

        .custom-btn-lightpink {
            background-color: #e98a98 !important;
        }

        .custom-btn-lightyellow {
            background-color: #caca43 !important;
        }

        .custom-btn-lightgreen {
            background-color: #3cd13c !important;
        }

        .custom-btn-lightblue {
            background-color: #4dbee2 !important;
        }

        .custom-btn-lightseagreen {
            background-color: lightseagreen !important;
        }

        .custom-btn-lightskyblue {
            background-color: lightskyblue !important;
        }

        .custom-btn-lightsalmon {
            background-color: #f39800 !important;
        }

        .btn.btn-primary,
        .sppb-btn.btn-primary,
        .btn.sppb-btn-primary,
        .sppb-btn.sppb-btn-primary,
        .btn.sppb-btn-info,
        .sppb-btn.sppb-btn-info,
        .btn.btn-info,
        .sppb-btn.btn-info {
            -webkit-box-shadow: none;
            /* 重置 -webkit-box-shadow 属性 */
            box-shadow: none;
            /* 重置 box-shadow 属性 */
        }
    </style>
</head>

<body>

    <div class="container">
        <div class="row">
            <div class="col-12">
                <h2>
                    <center>網路掛號</center>
                </h2>
            </div>
        </div>
        <div class="row">
            <div class="col-12">
                <h3>
                    <center>請點選以下方塊進入連結</center>
                </h3>
            </div>
        </div>
        <br>
        <div class="row">
            <div class="col-xs-12 col-sm-4">
                <a href="/component/regist/?component=regist&amp;view=section"><button type="button"
                        class="btn btn-primary custom-btn custom-btn-lightpink">
                        <i class="fa fa-hospital-o" aria-hidden="true"></i>
                        依科別資料掛號</button></a>
            </div>
            <div class="col-xs-12 col-sm-4">
                <a href="/component/regist/?component=regist&amp;view=section&amp;type=doc">
                    <button type="button" class="btn btn-primary custom-btn custom-btn-lightsalmon">
                        <i class="fa fa-user-md" aria-hidden="true"></i>
                        依醫師資料掛號</button></a>
            </div>
            <div class="col-xs-12 col-sm-4">
                <a href="/component/regist/?component=regist&amp;view=realtime">
                    <button type="button" class="btn btn-primary custom-btn custom-btn-lightyellow"
                        style="background-color: lightyellow;">
                        <i class="fa fa-clock-o" aria-hidden="true"></i>
                        看診進度查詢</button></a>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12 col-sm-4">
                <a href="/component/regist/?component=regist&amp;view=search">
                    <button type="button" class="btn btn-primary custom-btn custom-btn-lightgreen"
                        style="background-color: lightgreen;">
                        <i class="fa fa-cog" aria-hidden="true"></i>
                        掛號查詢或取消</button></a>
            </div>
            <div class="col-xs-12 col-sm-4">
                <a
                    href="https://www.hosp.nycu.edu.tw/component/regist/?component=regist&amp;view=page&amp;layout=manual">
                    <button type="button" class="btn btn-primary custom-btn custom-btn-lightblue"
                        style="background-color: lightblue;">
                        <i class="fa fa-file" aria-hidden="true"></i>
                        掛號說明</button></a>
            </div>
            <div class="col-xs-12 col-sm-4">
                <a href="https://appweb.hosp.nycu.edu.tw/BookBS/BS/SelectDateTime.aspx">
                    <button type="button" class="btn btn-primary custom-btn custom-btn-lightseagreen"
                        style="background-color: lightseagreen;">
                        <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
                        預約自費<br>乳房超音波檢查</button></a>
            </div>

        </div>
        <div class="row">
            <div class="col-xs-12 col-sm-4">
                <a href="https://appweb.hosp.nycu.edu.tw/BookBS/HLU/SelectDateTime.aspx">
                    <button type="button" class="btn btn-primary custom-btn custom-btn-lightskyblue">
                        <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
                        預約自費<br>胎兒超音波檢查<br>(高層次/頸部透明帶)</button></a>
            </div>
        </div>
        <br>
        <br>
        <br>
        <br>
    </div>

</body>

</html>

```





```
<!DOCTYPE html>
<html>

<head>
    <title>靜態網頁</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>

<body>
    <div class="container">
        <div class="row">
            <div class="col-12"><h2><center>網路掛號</center></h2></div>
        </div>
        <div class="row">
            <div class="col-12"><h3><center>請點選以下方塊進入連結</center></h3></div>
        </div>
        <br>
        <div class="row">
            <div class="col-xs-12 col-md-4">
                <div class="well btn-default btn-lg" style="background-color:lightblue">依科別資料掛號</div>
            </div>
            <div class="col-xs-12 col-md-4">
                <div class="well btn-default btn-lg" style="background-color:lightyellow">依醫師資料掛號</div>
            </div>
            <div class="col-xs-12 col-md-4">
                <div class="well btn-default btn-lg" style="background-color:lightcoral">看診進度查詢</div>
            </div>
            <div class="col-xs-12 col-md-4">
                <div class="well btn-default btn-lg" style="background-color:lightgreen">掛號查詢或取消</div>
            </div>
            <div class="col-xs-12 col-md-4">
                <div class="well btn-default btn-lg" style="background-color:lightsteelblue">掛號說明</div>
            </div>
            <div class="col-xs-12 col-md-4">
                <div class="well btn-default btn-lg" style="background-color:lightskyblue">預約自費乳房超音波檢查</div>
            </div>
            <div class="col-xs-12 col-md-4">
                <div class="well btn-default btn-lg" style="background-color:lightpink">預約自費胎兒超音波檢查<br>(高層次/頸部透明帶)</div>
            </div>
        </div>
    </div>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>

</html>
```





呼吸道傳染病疫情特別門診-資訊需求

1.	開放「P9-流感科」可以網路掛號(排班系統已設定，但尚不能網路掛號)
2.	兒科門診-限未滿18歲病人掛號(2/10下午、2/11下午及2/12晚上)
3.	科別掛號下方加註「呼吸道傳染病疫情特別門診」(如下圖)

以下

//過年期間小兒科限定年齡掛號

```
<img src="images/dinosaur.jpg" />


        //2024.02.05 過年期間小兒科限定年齡掛號
        if($chRegSecNo == "04" && (($regDate == "1130210" && $regTime == "1") || ($regDate == "1130211" && $regTime == "1") || ($regDate == "1130212" && $regTime == "2")))
        {
            if(floor($age) > 18){
                $this->error = ($this->error == '') ?  '此門診限定18歲以下掛號': $this->error;
            } 
        }
```
```
{# 呼吸道傳染病疫情特別門診 #}
{% if  doc.chSecName in ['流感科']  %}
    <br>* 呼吸道傳染病疫情特別門診
{% endif %}

{% if  doc.chSecName in ['流感科']  and (doc.chDocName == "宋亭璇" or doc.chDocName == "温晨辰" or doc.chDocName == "宋世璽") %}
    <br>* (兒科)
{% endif %}
    
```

   

(兒科)


4.	預約掛號的內容加上診間位置平面圖



















5.	首頁公告提供掛號連結，方便民眾點選進行網路掛號。

