huiwon.seo преди 4 години
родител
ревизия
2fe7f94ff0

+ 5 - 1
src/main/java/com/lemon/lifecenter/common/LifeCenterPaging.java

@@ -23,9 +23,13 @@ public class LifeCenterPaging {
     public LifeCenterPaging() {}
     
     public LifeCenterPaging( int total, int page, String param ) {
-        
         System.out.println( "3s page : " + page );
+        System.out.println( "3s total : " + total );
+        System.out.println( "param : " + param );
         
+//        System.out.println( "config.pagePrefix : " + config.pagePrefix );
+//        System.out.println( "config.pageDataSize : " + config.pageDataSize );
+//        System.out.println( "config.pageGroupSize : " + config.pageGroupSize );
         
         this.setPreFix( config.pagePrefix );
         this.setPageSize( config.pageDataSize );

+ 5 - 1
src/main/java/com/lemon/lifecenter/controller/PatientController.java

@@ -43,7 +43,7 @@ public class PatientController extends LifeCenterController {
         
         PatientDTO dto = new PatientDTO();
         dto.setPatientName(patientName);
-        dto.setStat(inputState);
+        dto.setState(inputState);
         dto.setStartDate(startDate);
         dto.setEndDate(endDate);
         dto.setLimit( ( Integer.valueOf( page ) - 1 ) * config.pageDataSize );
@@ -58,12 +58,16 @@ public class PatientController extends LifeCenterController {
         
         ModelAndView mv = setMV("patient/list");
         
+        System.out.println( "PatientController config.pageGroupSize : " + config.pageGroupSize );
+        
         String param = "patientName=" + patientName + "&inputState=" + inputState + "&startDate=" + startDate + "&endDate=" + endDate;
+        LifeCenterPaging paging = new LifeCenterPaging( total, page, param );
         
         mv.addObject("inputState", inputState);
         mv.addObject("patientName", patientName);
         mv.addObject("total", total);
         mv.addObject("item", result);
+        mv.addObject( "paging", paging );
         
         return mv;
     }

+ 20 - 5
src/main/java/com/lemon/lifecenter/dto/PatientDTO.java

@@ -13,13 +13,28 @@ public class PatientDTO {
     private String finamClinicDate;
     private String hospitalizationDate;
     private String disisolationDate;
-    private String stat;
+    private String state;
     private String startDate;
     private String endDate;
+    private String jumin;
+    private String pw;
     private int limit;
     private int limitMax;
     
     
+    
+    public String getJumin() {
+        return jumin;
+    }
+    public void setJumin(String jumin) {
+        this.jumin = jumin;
+    }
+    public String getPw() {
+        return pw;
+    }
+    public void setPw(String pw) {
+        this.pw = pw;
+    }
     public int getLimit() {
         return limit;
     }
@@ -86,11 +101,11 @@ public class PatientDTO {
     public void setDisisolationDate(String disisolationDate) {
         this.disisolationDate = disisolationDate;
     }
-    public String getStat() {
-        return stat;
+    public String getState() {
+        return state;
     }
-    public void setStat(String stat) {
-        this.stat = stat;
+    public void setState(String stat) {
+        this.state = stat;
     }
     public String getStartDate() {
         return startDate;

+ 96 - 0
src/main/java/com/lemon/lifecenter/test/TestContorller.java

@@ -0,0 +1,96 @@
+package com.lemon.lifecenter.test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.lemon.lifecenter.common.LifeCenterController;
+import com.lemon.lifecenter.dto.PatientDTO;
+
+@Controller
+
+public class TestContorller extends LifeCenterController {
+    
+    @Autowired
+    TestService s;
+    
+    @RequestMapping("/insert/{start}/{end}")
+    public ModelAndView insert(@PathVariable("start") int start, @PathVariable("end") int end) {
+
+        ModelAndView mv = setMV("test");
+
+        PatientDTO dto = new PatientDTO();
+
+        for (int i = start; i < end; i++) {
+            dto.setPatientName(randomHangulName());
+            dto.setWardNumber(numberGen(4, 1));
+            dto.setRoomNumber(numberGen(3, 1));
+            String a = numberGen(6, 1);
+            dto.setJumin(a);
+            dto.setPw(a);
+            s.insertPatientCare(dto);
+        }
+
+        return mv;
+    }
+
+    
+
+    public static String randomHangulName() {
+        List<String> 성 = Arrays.asList("김", "이", "박", "최", "정", "강", "조", "윤", "장", "임", "한", "오", "서", "신", "권", "황",
+                "안", "송", "류", "전", "홍", "고", "문", "양", "손", "배", "조", "백", "허", "유", "남", "심", "노", "정", "하", "곽", "성",
+                "차", "주", "우", "구", "신", "임", "나", "전", "민", "유", "진", "지", "엄", "채", "원", "천", "방", "공", "강", "현", "함",
+                "변", "염", "양", "변", "여", "추", "노", "도", "소", "신", "석", "선", "설", "마", "길", "주", "연", "방", "위", "표", "명",
+                "기", "반", "왕", "금", "옥", "육", "인", "맹", "제", "모", "장", "남", "탁", "국", "여", "진", "어", "은", "편", "구",
+                "용");
+        List<String> 이름 = Arrays.asList("가", "강", "건", "경", "고", "관", "광", "구", "규", "근", "기", "길", "나", "남", "노", "누",
+                "다", "단", "달", "담", "대", "덕", "도", "동", "두", "라", "래", "로", "루", "리", "마", "만", "명", "무", "문", "미", "민",
+                "바", "박", "백", "범", "별", "병", "보", "빛", "사", "산", "상", "새", "서", "석", "선", "설", "섭", "성", "세", "소", "솔",
+                "수", "숙", "순", "숭", "슬", "승", "시", "신", "아", "안", "애", "엄", "여", "연", "영", "예", "오", "옥", "완", "요", "용",
+                "우", "원", "월", "위", "유", "윤", "율", "으", "은", "의", "이", "익", "인", "일", "잎", "자", "잔", "장", "재", "전", "정",
+                "제", "조", "종", "주", "준", "중", "지", "진", "찬", "창", "채", "천", "철", "초", "춘", "충", "치", "탐", "태", "택", "판",
+                "하", "한", "해", "혁", "현", "형", "혜", "호", "홍", "화", "환", "회", "효", "훈", "휘", "희", "운", "모", "배", "부", "림",
+                "봉", "혼", "황", "량", "린", "을", "비", "솜", "공", "면", "탁", "온", "디", "항", "후", "려", "균", "묵", "송", "욱", "휴",
+                "언", "령", "섬", "들", "견", "추", "걸", "삼", "열", "웅", "분", "변", "양", "출", "타", "흥", "겸", "곤", "번", "식", "란",
+                "더", "손", "술", "훔", "반", "빈", "실", "직", "흠", "흔", "악", "람", "뜸", "권", "복", "심", "헌", "엽", "학", "개", "롱",
+                "평", "늘", "늬", "랑", "얀", "향", "울", "련");
+        Collections.shuffle(성);
+        Collections.shuffle(이름);
+        return 성.get(0) + 이름.get(0) + 이름.get(1);
+    }
+
+    public static String numberGen(int len, int dupCd) {
+
+        Random rand = new Random();
+        String numStr = ""; // 난수가 저장될 변수
+
+        for (int i = 0; i < len; i++) {
+
+            // 0~9 까지 난수 생성
+            String ran = Integer.toString(rand.nextInt(10));
+
+            if (dupCd == 1) {
+                // 중복 허용시 numStr에 append
+                numStr += ran;
+            } else if (dupCd == 2) {
+                // 중복을 허용하지 않을시 중복된 값이 있는지 검사한다
+                if (!numStr.contains(ran)) {
+                    // 중복된 값이 없으면 numStr에 append
+                    numStr += ran;
+                } else {
+                    // 생성된 난수가 중복되면 루틴을 다시 실행한다
+                    i -= 1;
+                }
+            }
+        }
+        return numStr;
+    }
+
+}

+ 12 - 0
src/main/java/com/lemon/lifecenter/test/TestMapper.java

@@ -0,0 +1,12 @@
+package com.lemon.lifecenter.test;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import com.lemon.lifecenter.dto.PatientDTO;
+
+@Repository
+@Mapper
+public interface TestMapper {
+    public void insertPatientCare( PatientDTO dto );
+}

+ 17 - 0
src/main/java/com/lemon/lifecenter/test/TestService.java

@@ -0,0 +1,17 @@
+package com.lemon.lifecenter.test;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.lemon.lifecenter.dto.PatientDTO;
+
+@Service
+public class TestService {
+    @Autowired
+    private TestMapper mapper;
+
+    public void insertPatientCare(PatientDTO dto) {
+        mapper.insertPatientCare(dto);
+    }
+
+}

+ 4 - 4
src/main/resources/mybatis/mapper/patient/patient.xml

@@ -8,9 +8,9 @@
               FROM PATIENT_CARE
              WHERE 1 = 1
         ]]>
-        <if test='stat != "ALL"'>
+        <if test='state != "ALL"'>
             <![CDATA[
-               AND STATE = #{stat}
+               AND STATE = #{state}
             ]]>
         </if>
         <if test='patientName != null and patientName != ""'>
@@ -40,9 +40,9 @@
               FROM PATIENT_CARE
              WHERE 1 = 1
         ]]>
-    <if test='stat != "ALL"'>
+    <if test='state != "ALL"'>
         <![CDATA[
-            AND STATE = #{stat}
+            AND STATE = #{state}
         ]]>
     </if>
     <if test='patientName != null and patientName != ""'>

+ 9 - 10
src/main/resources/mybatis/mapper/test/test.xml

@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="test">
+<mapper namespace="com.lemon.lifecenter.test.TestMapper">
 <!--   <select id="selectData" resultType="com.lemon.lifecenter.TestDTO"> -->
 <!--     <![CDATA[ -->
 <!--       SELECT * -->
@@ -17,12 +16,12 @@
 <!--     ]]> -->
 <!--   </select> -->
   
-<!--   <insert id="insertMember" parameterType="com.lemon.lifecenter.TestSDTO"> -->
-<!--   	<![CDATA[ -->
-<!--       INSERT -->
-<!--         INTO member -->
-<!--              ( id, password, create_date, name, last_login_time, fail_count, use_yn, group_idx, center_code ) -->
-<!--       VALUES ( #{id}, #{password}, NOW(), #{name}, NOW(), #{fail_count}, #{use_yn}, #{group_idx}, #{center_code} ) -->
-<!--     ]]> -->
-<!--   </insert> -->
+  <insert id="insertPatientCare" parameterType="com.lemon.lifecenter.dto.PatientDTO">
+    <![CDATA[ 
+       INSERT 
+         INTO patient_care
+              ( patient_name, gender, ward_number, room_number, final_clinic_date, hospitalization_date, state, center_code, jumin, patient_phone, guardian_phone, symptom_start_date, confirmation_date, disisolation_date, basal_disease_yn, disease_name, pregnancy_status, pregnancy_week, id, pw, create_date, update_date, create_by, update_by) 
+       VALUES ( #{patientName}, 'M', #{wardNumber}, #{roomNumber}, NOW(), NOW(), 'Y', '0000', #{jumin}, '01023232323', '', NOW(), NOW(), NOW(), 'N', '', 'N','', '1504102', #{pw}, NOW(), NOW(), '', '');
+     ]]> 
+   </insert> 
 </mapper>

+ 8 - 8
src/main/webapp/WEB-INF/jsp/include/paging.jsp

@@ -2,20 +2,20 @@
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 
 <c:if test="${param.total > 0 && param.endPageNo > 1}">
-    <div class="p_wrap">
-        <a href="?${param.url}&${param.preFix}=${param.firstPageNo}" class="p_btn" title="${param.firstPageNo}">처음</a>
-        <a href="?${param.url}&${param.preFix}=${param.prevPageNo}" class="p_btn" title="${param.prevPageNo}">이전</a>
+<nav aria-label="Page navigation">
+    <ul class="pagination pagination-mb">
+        <li class="page-item"><a class="page-link" href="?${param.url}&${param.preFix}=${param.prevPageNo}"><i class="fas fa-angle-left"></i></a></li>
         <c:forEach var="i" begin="${param.startPageNo}" end="${param.endPageNo}" step="1">
             <c:choose>
                 <c:when test="${i eq param.pageNo}">
-                  <a href="?${param.url}&${param.preFix}=${i}" class="p_btn on" title="${i}">${i}</a>
+                    <li class="page-item active"><a class="page-link" href="?${param.url}&${param.preFix}=${i}">${i}</a></li>
                 </c:when>
                 <c:otherwise>
-                  <a href="?${param.url}&${param.preFix}=${i}" class="p_btn" title="${i}">${i}</a>
+                    <li class="page-item"><a class="page-link" href="?${param.url}&${param.preFix}=${i}">${i}</a></li>
                 </c:otherwise>
             </c:choose>
         </c:forEach>
-        <a href="?${param.url}&${param.preFix}=${param.nextPageNo}" class="p_btn">다음</a>
-        <a href="?${param.url}&${param.preFix}=${param.finalPageNo}" class="p_btn">마지막</a>
-    </div>
+        <li class="page-item"><a class="page-link" href="?${param.url}&${param.preFix}=${param.nextPageNo}"><i class="fas fa-angle-right"></i></a></li>
+    </ul>
+</nav>
 </c:if>

+ 36 - 75
src/main/webapp/WEB-INF/jsp/patient/list.jsp

@@ -119,26 +119,19 @@
 
                 <div class="navbar-collapse collapse">
                     <ul class="navbar-nav ml-auto">
-                        <li class="nav-item dropdown"><a
-                            class="nav-icon dropdown-toggle d-inline-block d-sm-none"
-                            href="#" data-toggle="dropdown"> <i
-                                class="align-middle"
-                                data-feather="settings"></i>
-                        </a> <a
-                            class="nav-link dropdown-toggle d-none d-sm-inline-block"
-                            href="#" data-toggle="dropdown"> <span
-                                class="text-dark">홍길동 선생님</span>
-                        </a>
-                            <div
-                                class="dropdown-menu dropdown-menu-right">
-                                <a class="dropdown-item"
-                                    href="pages-profile.html"><i
-                                    class="align-middle mr-1"
-                                    data-feather="user"></i> 정보변경</a> <a
-                                    class="dropdown-item" href="#"><i
-                                    class="align-middle mr-1"
-                                    data-feather="pie-chart"></i> 로그아웃</a>
-                            </div></li>
+                        <li class="nav-item dropdown">
+                            <a class="nav-icon dropdown-toggle d-inline-block d-sm-none" href="#" data-toggle="dropdown">
+                                <i class="align-middle" data-feather="settings"></i>
+                            </a>
+
+                            <a class="nav-link dropdown-toggle d-none d-sm-inline-block" href="#" data-toggle="dropdown">
+                                <span class="text-dark">홍길동 선생님</span>
+                            </a>
+                            <div class="dropdown-menu dropdown-menu-right">
+                                <a class="dropdown-item" href="pages-profile.html"><i class="align-middle mr-1" data-feather="user"></i> 정보변경</a>
+                                <a class="dropdown-item" href="#"><i class="align-middle mr-1" data-feather="pie-chart"></i> 로그아웃</a>
+                            </div>
+                        </li>
                     </ul>
                 </div>
             </nav>
@@ -238,27 +231,17 @@
                                         </div>
                                     </div>
                                     <div class="table-responsive">
-                                        <table
-                                            class="table table-striped text-center">
+                                        <table class="table table-striped text-center">
                                             <colgroup>
-                                                <col
-                                                    style="width: 11.1%;">
-                                                <col
-                                                    style="width: 11.1%;">
-                                                <col
-                                                    style="width: 11.1%;">
-                                                <col
-                                                    style="width: 11.1%;">
-                                                <col
-                                                    style="width: 11.1%;">
-                                                <col
-                                                    style="width: 11.1%;">
-                                                <col
-                                                    style="width: 11.1%;">
-                                                <col
-                                                    style="width: 11.1%;">
-                                                <col
-                                                    style="width: 11.1%;">
+                                                <col style=" width: 11.1%; ">
+                                                <col style=" width: 11.1%; ">
+                                                <col style=" width: 11.1%; ">
+                                                <col style=" width: 11.1%; ">
+                                                <col style=" width: 11.1%; ">
+                                                <col style=" width: 11.1%; ">
+                                                <col style=" width: 11.1%; ">
+                                                <col style=" width: 11.1%; ">
+                                                <col style=" width: 11.1%; ">
                                             </colgroup>
                                             <thead>
                                                 <tr>
@@ -295,7 +278,7 @@
                                                                         <c:out value="${l.disisolationDate}" />
                                                                     </c:if>
                                                                 </td>
-                                                                <td><c:out value="${l.stat}" /></td>
+                                                                <td><c:out value="${l.state}" /></td>
                                                             </tr>
                                                         </c:forEach>
                                                     </c:when>
@@ -321,40 +304,18 @@
                                             </select> -->
                                         </div>
                                         <div class="col-12 col-lg-6 mb-2">
-                                            <nav aria-label="Page navigation">
-                                                <ul class="pagination pagination-mb">
-                                                    <li
-                                                        class="page-item"><a
-                                                        class="page-link"
-                                                        href="#"><i
-                                                            class="fas fa-angle-left"></i></a></li>
-                                                    <li
-                                                        class="page-item"><a
-                                                        class="page-link"
-                                                        href="#">1</a></li>
-                                                    <li
-                                                        class="page-item active"><a
-                                                        class="page-link"
-                                                        href="#">2</a></li>
-                                                    <li
-                                                        class="page-item"><a
-                                                        class="page-link"
-                                                        href="#">3</a></li>
-                                                    <li
-                                                        class="page-item"><a
-                                                        class="page-link"
-                                                        href="#">4</a></li>
-                                                    <li
-                                                        class="page-item"><a
-                                                        class="page-link"
-                                                        href="#">5</a></li>
-                                                    <li
-                                                        class="page-item"><a
-                                                        class="page-link"
-                                                        href="#"><i
-                                                            class="fas fa-angle-right"></i></a></li>
-                                                </ul>
-                                            </nav>
+                                            <jsp:include page="${data._INCLUDE}/paging.jsp" flush="true">
+                                                <jsp:param name="firstPageNo" value="${paging.firstPageNo}" />
+                                                <jsp:param name="prevPageNo"  value="${paging.prevPageNo}" />
+                                                <jsp:param name="startPageNo" value="${paging.startPageNo}" />
+                                                <jsp:param name="pageNo"      value="${paging.pageNo}" />
+                                                <jsp:param name="endPageNo"   value="${paging.endPageNo}" />
+                                                <jsp:param name="nextPageNo"  value="${paging.nextPageNo}" />
+                                                <jsp:param name="finalPageNo" value="${paging.finalPageNo}" />
+                                                <jsp:param name="preFix"      value="${paging.preFix}" />
+                                                <jsp:param name="url"         value="${paging.url}" />
+                                                <jsp:param name="total"       value="${paging.totalCount}" />
+                                            </jsp:include>
                                         </div>
                                     </div>
                                 </div>