Sfoglia il codice sorgente

환자 신규 등록, 수정 임신 필수 입력값 제거

junekeunsong 4 anni fa
parent
commit
efefe7e1dd

+ 18 - 7
src/main/webapp/WEB-INF/jsp/patient/edit.jsp

@@ -49,6 +49,17 @@ function setEventHandler(){
             $( "td.basalDisease input[type='text']" ).val( "" );
         }
     });
+
+    $( "input[name='pregnancyStatus']" ).on( "click", function(){
+        var $this = $( this );
+        console.log("!@#!@# -- > " + $this.val());
+        if ($this.val() == "Y") {
+            $("#pregnancyWeek").prop("disabled", false);
+        } else {
+            $("#pregnancyWeek").prop("disabled", true);
+            $("#pregnancyWeek").val("");
+        }
+    });
     
     //입소일시
     $( ".hospitalizationDate" ).on( "change", function(){
@@ -338,32 +349,32 @@ $( function(){
                                                     </td>
                                                 </tr>
                                                 <tr>
-                                                    <th><span class="fix">*</span>최근약복용<br />(최근 24시간 이내)</th>
+                                                    <th>최근약복용<br />(최근 24시간 이내)</th>
                                                     <td>
                                                         <label class="form-check form-check-inline">
-                                                            <input class="form-check-input" type="radio" value="N" name="drugYn" <c:if test="${patientData.drugYn eq 'N'}">checked="checked"</c:if> onclick="$('#drugContent').attr('readonly', true);" required>
+                                                            <input class="form-check-input" type="radio" value="N" name="drugYn" <c:if test="${patientData.drugYn eq 'N'}">checked="checked"</c:if> onclick="$('#drugContent').attr('readonly', true).val('');">
                                                             <span class="form-check-label">미복용</span>
                                                         </label>
                                                         <label class="form-check form-check-inline">
-                                                            <input class="form-check-input" type="radio" value="Y" name="drugYn" <c:if test="${patientData.drugYn eq 'Y'}">checked="checked"</c:if> onclick="$('#drugContent').removeAttr('readonly');" required>
+                                                            <input class="form-check-input" type="radio" value="Y" name="drugYn" <c:if test="${patientData.drugYn eq 'Y'}">checked="checked"</c:if> onclick="$('#drugContent').removeAttr('readonly');">
                                                             <span class="form-check-label">복용</span>
                                                         </label>
                                                         <label class="form-check form-check-inline">
                                                             <input type="text" id="drugContent" class="form-control" name="drugContent" placeholder="약명을 입력하세요." value="${patientData.drugContent}" <c:if test="${patientData.drugYn eq 'N'}">readonly</c:if>>
                                                         </label>
                                                     </td>
-                                                    <th><span class="fix">*</span>임신</th>
+                                                    <th>임신</th>
                                                     <td>
                                                         <label class="form-check form-check-inline">
-                                                            <input class="form-check-input" type="radio" name="pregnancyStatus" value="N" <c:if test="${patientData.pregnancyStatus eq 'N'}">checked="checked"</c:if> required>
+                                                            <input class="form-check-input" type="radio" name="pregnancyStatus" value="N" <c:if test="${patientData.pregnancyStatus eq 'N'}">checked="checked"</c:if>>
                                                             <span class="form-check-label">무</span>
                                                         </label>
                                                         <label class="form-check form-check-inline">
-                                                            <input class="form-check-input" type="radio" name="pregnancyStatus" value="Y" <c:if test="${patientData.pregnancyStatus eq 'Y'}">checked="checked"</c:if> required>
+                                                            <input class="form-check-input" type="radio" name="pregnancyStatus" value="Y" <c:if test="${patientData.pregnancyStatus eq 'Y'}">checked="checked"</c:if>>
                                                             <span class="form-check-label">유</span>
                                                         </label>
                                                         <label class="form-check form-check-inline">
-                                                                <select class="custom-select" name="pregnancyWeek" id="pregnancyWeek">
+                                                                <select class="custom-select" name="pregnancyWeek" id="pregnancyWeek" disabled>
                                                                       <option value="" selected="">임신 주차</option>
                                                                       <c:forEach var="p" begin="1" end="40" step="1">
                                                                           <option value="${p}" <c:if test="${patientData.pregnancyWeek eq p}">selected="selected"</c:if>>${p} 주</option>

+ 15 - 4
src/main/webapp/WEB-INF/jsp/patient/new.jsp

@@ -48,6 +48,17 @@ function setEventHandler(){
             $( "td.basalDisease input[type='text']" ).val( "" );
         }
     });
+
+    $( "input[name='pregnancyStatus']" ).on( "click", function(){
+        var $this = $( this );
+        console.log("!@#!@# -- > " + $this.val());
+        if ($this.val() == "Y") {
+            $("#pregnancyWeek").prop("disabled", false);
+        } else {
+            $("#pregnancyWeek").prop("disabled", true);
+            $("#pregnancyWeek").val("");
+        }
+    });
     
     //입소일시
     $( ".hospitalizationDate" ).on( "change", function(){
@@ -335,18 +346,18 @@ $( function(){
                                                             <input type="text" id="drugContent" class="form-control" name="drugContent" placeholder="약명을 입력하세요." readonly>
                                                         </label>
                                                     </td>
-                                                    <th><span class="fix">*</span>임신</th>
+                                                    <th>임신</th>
                                                     <td>
                                                         <label class="form-check form-check-inline">
-                                                            <input class="form-check-input" type="radio" name="pregnancyStatus" value="N" required>
+                                                            <input class="form-check-input" type="radio" name="pregnancyStatus" value="N">
                                                             <span class="form-check-label">무</span>
                                                         </label>
                                                         <label class="form-check form-check-inline">
-                                                            <input class="form-check-input" type="radio" name="pregnancyStatus" value="Y" required>
+                                                            <input class="form-check-input" type="radio" name="pregnancyStatus" value="Y">
                                                             <span class="form-check-label">유</span>
                                                         </label>
                                                         <label class="form-check form-check-inline">
-                                                                <select class="custom-select" name="pregnancyWeek" id="pregnancyWeek">
+                                                                <select class="custom-select" name="pregnancyWeek" id="pregnancyWeek" disabled>
                                                                       <option value="" selected="">임신 주차</option>
                                                                       <c:forEach var="p" begin="1" end="40" step="1">
                                                                           <option value="${p}">${p} 주</option>