<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>

<script type="text/javascript">
function nonFaceStart() {
    getAjax("/patient/nonFaceStart", $("#hiddenForm").serialize(), function ( result ) {
        
        $("#nonface").append('<input type="hidden" name="member_name" value="'+result.member_name+'" />');
        $("#nonface").append('<input type="hidden" name="member_id" value="'+result.member_id+'" />');
        $("#nonface").append('<input type="hidden" name="room_id" value="'+result.room_id+'" />');
        $("#nonface").append('<input type="hidden" name="hashData" value="'+result.hashData+'">');
        $("#nonface").append('<input type="hidden" name="token" value="'+result.token+'">');
        $("#nonface").append('<input type="hidden" name="api_key" value="'+result.api_key+'">');

        $("#nonface").append('<input type="hidden" name="classify" value="d">');

        var gsWin = window.open('about:blank','nonface');
        var frm =document.nonface;
        frm.target ="nonface";
        frm.method ="post";
        frm.submit();

    }, function(){
    }, function(){
        
    });
}
</script>

</head>
<body>
    <form id="nonface" name="nonface" action="https://lemon.medihere.com/app/vc">
    </form>
    <div class="wrapper">
        <jsp:include page="${data._INCLUDE}/sidebar.jsp"></jsp:include>

        <div class="main">
            <jsp:include page="${data._INCLUDE}/top.jsp"></jsp:include>

            <main class="content">
                <form id="hiddenForm">
                    <input type="hidden" id="pId" name="pId" value="<c:out value="${info.id}" />">
                    <input type="hidden" id="pName" name="pName" value="<c:out value="${info.patientName}" />">
                    <input type="hidden" id="roomId" name="roomId" value="<c:out value="${info.roomNumber}" />">
                </form>
                <div class="container-fluid p-0">
                    <!-- 환자관리 : 신규환자 등록 START -->
                    <div class="row">
                        <div class="col-12 col-lg-6">
                            <h1 class="h3 mb-3">
                                환자정보
                            </h1>
                        </div>
                        <div class="col-12 col-lg-6  text-right">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="javscript:;">Home</a></li>
                                    <li class="breadcrumb-item">환자관리</li>
                                    <li class="breadcrumb-item active">환자정보 조회</li>
                                </ol>
                            </nav>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12">
                            <div class="card">
                                <div class="card-body">
                                    <table class="table mobile-table">
                                        <colgroup>
                                            <col style="width:15%">
                                            <col style="width:35%">
                                            <col style="width:15%">
                                            <col style="width:35%">
                                        </colgroup>
                                        <tr>
                                            <th>치료센터</th>
                                            <td><c:out value="${info.centerName}" /></td>
                                            <th>입소일시</th>
                                            <td colspan="2">
                                                <c:out value="${info.hospitalizationDate}" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>병동 번호</th>
                                            <td>
                                                <c:out value="${info.wardNumber}동 ${info.roomNumber}호" />
                                            </td>
                                            <th>이름</th>
                                            <td>
                                                <c:out value="${info.patientName}" /><button class="btn btn-primary ml-2" onclick="nonFaceStart();">진료시작</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>성별</th>
                                            <td>
                                                <c:if test="${info.gender eq 'M'}">
                                                    남
                                                </c:if>
                                                <c:if test="${info.gender ne 'M'}">
                                                    여
                                                </c:if>
                                            </td>
                                            <th>생년월일</th>
                                            <td>
                                                <c:out value="${info.jumin}" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>연락처</th>
                                            <td>
                                                <c:out value="${info.patientPhone}" />
                                            </td>
                                            <th>보호자 연락처</th>
                                            <td>
                                                <c:out value="${info.guardianPhone}" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>증상시작일</th>
                                            <td>
                                                <c:out value="${info.symptomStartDate}" />
                                            </td>
                                            <th>확진일</th>
                                            <td>
                                                <c:out value="${info.confirmationDate}" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>격리해제 예정일</th>
                                            <td>
                                                <c:out value="${info.disisolationDate}" />
                                            </td>
                                            <th>상태</th>
                                            <td>
                                                <c:if test="${info.state eq 'H'}">
                                                    입소
                                                </c:if>
                                                <c:if test="${info.state eq 'D'}">
                                                    퇴소
                                                </c:if>
                                                <c:if test="${info.state eq 'T'}">
                                                    지정병원 이송
                                                </c:if>
                                                <c:if test="${info.state eq 'E'}">
                                                    기타
                                                </c:if>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>최근 약복용<br />(최근 24시간 이내)</th>
                                            <td>
                                                <c:choose>
                                                    <c:when test="${info.drugYn eq 'Y'}">
                                                        복용 (<c:out value="${info.drugContent}" />)
                                                    </c:when>
                                                    <c:otherwise>
                                                        미복용
                                                    </c:otherwise>
                                                </c:choose>
                                            </td>
                                            <th>임신</th>
                                            <td>
                                                <c:choose>
                                                    <c:when test="${info.pregnancyStatus eq 'N'}">
                                                        무
                                                    </c:when>
                                                    <c:otherwise>
                                                        유 (<c:out value="${info.pregnancyWeek}주차" />)
                                                    </c:otherwise>
                                                </c:choose>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th rowspan="2">기저질환 여부</th>
                                            <td colspan="3">
                                                <c:choose>
                                                    <c:when test="${info.basalDiseaseYn eq 'Y'}">
                                                        유
                                                    </c:when>
                                                    <c:otherwise>
                                                        무
                                                    </c:otherwise>
                                                </c:choose>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3">
<%--                                                 <c:if test="${info.highBloodPressureCheck eq 'Y'}">, 고혈압</c:if> --%>
<%--                                                 <c:if test="${info.lowBloodPressureCheck eq 'Y'}">, 저혈압</c:if> --%>
<%--                                                 <c:if test="${info.organTransplantCheck eq 'Y'}">, 장기이식(신장, 간 등)</c:if> --%>
<%--                                                 <c:if test="${info.diabetesCheck eq 'Y'}">, 당뇨</c:if> --%>
<%--                                                 <c:if test="${info.respiratoryDiseaseCheck eq 'Y'}">, 호흡기질환</c:if> --%>
<%--                                                 <c:if test="${info.immunologicalDiseaseCheck eq 'Y'}">, 면역질환(류마티스 등)</c:if> --%>
<%--                                                 <c:if test="${info.heartDisease eq 'Y'}">, 심장질환</c:if> --%>
<%--                                                 <c:if test="${info.liverDisease eq 'Y'}">, 간질환</c:if> --%>
<%--                                                 <c:if test="${info.operation eq 'Y'}">, 수술(<c:out value="${info.operationContent}" />)</c:if> --%>
<%--                                                 <c:if test="${info.allergyCheck eq 'Y'}">, 알레르기</c:if> --%>
<%--                                                 <c:if test="${info.kidneyDisease eq 'Y'}">, 신장질환</c:if> --%>
<%--                                                 <c:if test="${info.cancerCheck eq 'Y'}">, 암(<c:out value="${info.cancerName}" />)</c:if> --%>
<%--                                                 <c:if test="${info.ectCheckDisease eq 'Y'}">, 기타(<c:out value="${info.etcContentDisease}" />)</c:if> --%>
                                                <c:out value="${disease}" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>현재 증상<br />(입소 당시)</th>
                                            <td colspan="3">
<%--                                                 <c:if test="${info.feverCheck eq 'Y'}">, 열감(열나는느낌)</c:if> --%>
<%--                                                 <c:if test="${info.coughCheck eq 'Y'}">, 기침</c:if> --%>
<%--                                                 <c:if test="${info.colic eq 'Y'}">, 복통(배아픔)</c:if> --%>
<%--                                                 <c:if test="${info.coldFitCheck eq 'Y'}">, 오한(추운 느낌)</c:if> --%>
<%--                                                 <c:if test="${info.sputumCheck eq 'Y'}">, 가래</c:if> --%>
<%--                                                 <c:if test="${info.ocinCheck eq 'Y'}">, 오심(구역질)</c:if> --%>
<%--                                                 <c:if test="${info.chestPain eq 'Y'}">, 흉통</c:if> --%>
<%--                                                 <c:if test="${info.noseCheck eq 'Y'}">, 콧물 또는 코 막힘</c:if> --%>
<%--                                                 <c:if test="${info.vomitingCheck eq 'Y'}">, 구토</c:if> --%>
<%--                                                 <c:if test="${info.musclePainCheck eq 'Y'}">, 근육통(몸살)</c:if> --%>
<%--                                                 <c:if test="${info.soreThroatCheck eq 'Y'}">, 인후통(목 아픔)</c:if> --%>
<%--                                                 <c:if test="${info.diarrheaCheck eq 'Y'}">, 설사</c:if> --%>
<%--                                                 <c:if test="${info.headacheCheck eq 'Y'}">, 두통(머리아픔)</c:if> --%>
<%--                                                 <c:if test="${info.dyspneaCheck eq 'Y'}">, 호흡곤란(숨가쁨)</c:if> --%>
<%--                                                 <c:if test="${info.fatigueCheck eq 'Y'}">, 권태감(피곤함)</c:if> --%>
<%--                                                 <c:if test="${info.ectCheckSymptom eq 'Y'}">, 기타(<c:out value="${info.etcContentSymptom}" />)</c:if> --%>
                                                <c:out value="${symptom}" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>
                                                체온
                                            </th>
                                            <td>
                                                <c:out value="우측 ${info.feverRight}℃ /  좌측  ${info.feverRight}℃" />
                                            </td>
                                            <th>
                                                맥박수
                                            </th>
                                            <td>
                                                <c:out value="${info.pulseRate} 회/분" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>
                                                호흡수
                                            </th>
                                            <td>
                                                <c:out value="${info.respirationRate} 회/분" />
                                            </td>
                                            <th>
                                                혈압
                                            </th>
                                            <td>
                                            <c:out value="수축기 ${info.bloodPressureLevelCon} mmHg  /  이완기 ${info.bloodPressureLevelRel} mmHg" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>
                                                산소포화도
                                            </th>
                                            <td colspan="3">
                                                <c:out value="${info.oxygenSaturation} %" />
                                            </td>
                                        </tr>
                                    </table>
                                    <div class="row mt-3">
                                        <div class="col-12">
                                            <div class="text-right">
                                                <button type="button" class="btn btn-primary w100" onclick="location.href='./edit?patientIdx=${patientIdx}';">수정</button>
                                                <button type="button" class="btn btn-primary w100" onclick="location.href='./list';">확인</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- 환자관리 : 신규환자 등록 END -->
                </div>
            </main>

            <jsp:include page="${data._INCLUDE}/footer.jsp"></jsp:include>
        </div>
    </div>
</body>
</html>