Ver Fonte

환자용 푸시메시지함 추가, 문진 정보 입력 수정

junekeunsong há 4 anos atrás
pai
commit
7b7b352301

+ 22 - 0
src/main/java/com/lemon/lifecenter/common/LifeCenterFunction.java

@@ -163,6 +163,28 @@ public class LifeCenterFunction {
         return dateFormat.format(date);
     }
     
+    public static String getPrevMonth( String ym ) throws ParseException {
+        DateFormat df = new SimpleDateFormat( "yyyy-MM" );
+        Date date = df.parse( ym );
+        
+        Calendar cal = Calendar.getInstance();
+        cal.setTime( date );
+        cal.add( Calendar.MONTH, -1 );
+        
+        return df.format( cal.getTime() );
+    }
+    
+    public static String getNextMonth( String ym ) throws ParseException {
+        DateFormat df = new SimpleDateFormat( "yyyy-MM" );
+        Date date = df.parse( ym );
+        
+        Calendar cal = Calendar.getInstance();
+        cal.setTime( date );
+        cal.add( Calendar.MONTH, +1 );
+        
+        return df.format( cal.getTime() );
+    }
+    
     public static String getPrevDate( String ymd ) throws ParseException {
         DateFormat df = new SimpleDateFormat( "yyyy-MM-dd" );
         Date date = df.parse( ymd );

+ 51 - 3
src/main/java/com/lemon/lifecenter/controller/MobilePushController.java

@@ -1,26 +1,74 @@
 package com.lemon.lifecenter.controller;
 
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.lemon.lifecenter.common.LifeCenterConfigVO;
 import com.lemon.lifecenter.common.LifeCenterController;
+import com.lemon.lifecenter.common.LifeCenterFunction;
+import com.lemon.lifecenter.common.LifeCenterSessionController;
+import com.lemon.lifecenter.dto.PushDTO;
+import com.lemon.lifecenter.service.PushService;
 
 @Controller
 @RequestMapping("/mobile")
 public class MobilePushController extends LifeCenterController {
+    
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+    
     @Autowired
     private LifeCenterConfigVO config;
     
-    @RequestMapping( "/push/list" )
-    public ModelAndView pushList() {
+    @Autowired
+    private PushService pushService;
+    
+    @RequestMapping("/push/list")
+    public ModelAndView pushList(@RequestParam(value="ym", required=false, defaultValue="") String ym,
+            HttpServletRequest request, HttpServletResponse response) throws ParseException {
+        
+        String sesMpIdx  = LifeCenterSessionController.getSession(request, "sesMpIdx");
+        
+        if(ym.equals("")){
+            ym = LifeCenterFunction.getNow("yyyy-MM");
+        }
         
+        PushDTO dto = new PushDTO();
+        logger.error("date -- > " + ym);
+        logger.error("prevMonth -- > " + LifeCenterFunction.getPrevMonth(ym));
+        logger.error("nextMonth -- > " + LifeCenterFunction.getNextMonth(ym));
         
+        String ym2 = ym.replace("-", "");
+        dto.setYm(ym2);
+        dto.setPatientIdx(Integer.parseInt(sesMpIdx));
+        int total = pushService.selectPushResultTableCount(dto);
         
-        ModelAndView mv = setMobileMV( "push/list" );
+        int listCount = 0;
+        List<PushDTO> pushList = new ArrayList<PushDTO>();
+        if (total > 0) {
+            listCount = pushService.mobilePushMessageBoxCount(dto);
+            pushList = pushService.mobilePushMessageBox(dto);
+        }
         
+        ModelAndView mv = setMobileMV("push/list");
+        mv.addObject("total", total);
+        mv.addObject("date", ym);
+        mv.addObject("prevMonth", LifeCenterFunction.getPrevMonth( ym ));
+        mv.addObject("nextMonth", LifeCenterFunction.getNextMonth( ym ));
+        mv.addObject("nowMonth", LifeCenterFunction.getNow( "yyyy-MM" ));
+        mv.addObject("listCount", listCount);
+        mv.addObject("pushList", pushList);
         return mv;
     }
 }

+ 2 - 0
src/main/java/com/lemon/lifecenter/mapper/PushMapper.java

@@ -32,4 +32,6 @@ public interface PushMapper {
     
     public int selectPushScheduleOneCount( PushDTO dto );
     public PushDTO selectPushScheduleOneData( PushDTO dto );
+    public int mobilePushMessageBoxCount(PushDTO dto);
+    public List<PushDTO> mobilePushMessageBox(PushDTO dto);
 }

+ 6 - 0
src/main/java/com/lemon/lifecenter/service/PushService.java

@@ -63,4 +63,10 @@ public class PushService {
     public PushDTO selectPushScheduleOneData( PushDTO dto ) {
         return mapper.selectPushScheduleOneData(dto);
     }
+    public int mobilePushMessageBoxCount(PushDTO dto) {
+        return mapper.mobilePushMessageBoxCount(dto);
+    }
+    public List<PushDTO> mobilePushMessageBox(PushDTO dto) {
+        return mapper.mobilePushMessageBox(dto);
+    }
 }

+ 35 - 0
src/main/resources/mybatis/mapper/push/push.xml

@@ -415,4 +415,39 @@
              WHERE PS.push_idx = #{pushIdx}
         ]]>
     </select>
+    
+    <select id="mobilePushMessageBoxCount" parameterType="PushDTO" resultType="int">
+        <![CDATA[
+            SELECT COUNT(*) AS cnt
+              FROM PUSH_RESULT_${ym} PR
+              LEFT JOIN (SELECT PUSH_IDX,
+                                PUSH_TITLE,
+                                PUSH_CONTENT
+                           FROM PUSH_LOG) PL
+                ON PR.PUSH_IDX = PL.PUSH_IDX
+             WHERE 1 = 1
+               AND PR.PATIENT_IDX = #{patientIdx}
+               AND PR.SUCCESS_YN = 'Y'
+               AND PR.STATE = 'C'
+        ]]>
+    </select>
+    
+    <select id="mobilePushMessageBox" parameterType="PushDTO" resultType="PushDTO">
+        <![CDATA[
+            SELECT PL.PUSH_TITLE                                 AS pushTitle,
+                   PL.PUSH_CONTENT                               AS pushContent,
+                   DATE_FORMAT(PR.UPDATE_DATE, '%Y-%m-%d %H:%i') AS updateDate
+              FROM PUSH_RESULT_${ym} PR
+              LEFT JOIN (SELECT PUSH_IDX,
+                                PUSH_TITLE,
+                                PUSH_CONTENT
+                           FROM PUSH_LOG) PL
+                ON PR.PUSH_IDX = PL.PUSH_IDX
+             WHERE 1 = 1
+               AND PR.PATIENT_IDX = #{patientIdx}
+               AND PR.SUCCESS_YN = 'Y'
+               AND PR.STATE = 'C'
+             ORDER BY PR.UPDATE_DATE DESC
+        ]]>
+    </select>
 </mapper>

+ 31 - 9
src/main/webapp/WEB-INF/jsp/mobile/push/list.jsp

@@ -17,16 +17,20 @@ span.push-date{float:right;font-size:14px;color:#999;}
     <div class="container">
         <div class="header">
             <div class="previous">
-                <a href="javascript:;" onclick="loadApp();">이전</a>
+                <!-- <a href="javascript:;" onclick="loadApp();">이전</a> -->
+                <a href="/mobile/menu">이전</a>
             </div>
             <div class="title">메시지 수신함</div>
         </div>
         
         <div class="examination">
             <div class="daily" style="margin-top:20px;">
-                <a href="?ym=" class="previous active">이전</a>
-                2021년 1월
-                <a href="?ym=" class="next active">다음</a>
+                <a href="?ym=${prevMonth}" class="previous active">이전</a>
+                    <c:out value="${date}" />
+                <c:if test="${nextMonth <= nowMonth}">
+                    <a href="?ym=${nextMonth}" class="next active">다음</a>
+                </c:if>
+                
             </div>
         </div>
         
@@ -34,15 +38,33 @@ span.push-date{float:right;font-size:14px;color:#999;}
         
         <div class="faq">
             <ul class="list">
-                <c:forEach var="i" begin="1" end="10">
+                <c:if test="${total eq 0}">
                     <li>
                         <a href="javascript:;" class="">
-                            <span class="push-title">푸시 제목 입니다 ${i}</span>
-                            <span class="push-date" style="float:right;">8일 15:32</span>
+                            <span class="push-title">받은 푸시 메시지가 없습니다</span>
                         </a>
-                        <div class="answer push-content">생활치료센터 앱의 좌측 상단 목록 아이콘을 클릭합니다. 펼쳐진 메뉴의 아래에서 세번째에 있는 “문의하기”를 선택하시면 담당 의료진에게 궁금한 사항을 문의 하실 수 있습니다.</div>
                     </li>
-                </c:forEach>
+                </c:if>
+                <c:if test="${total ne 0}">
+                    <c:if test="${listCount eq 0}">
+                        <li>
+                            <a href="javascript:;" class="">
+                                <span class="push-title">받은 푸시 메시지가 없습니다</span>
+                            </a>
+                        </li>
+                    </c:if>
+                    <c:if test="${listcount ne 0}">
+                        <c:forEach var="i" items="${pushList}">
+                            <li>
+                                <a href="javascript:;" class="">
+                                    <span class="push-title"><c:out value="${i.pushTitle}" /></span>
+                                    <span class="push-date" style="float:right;"><c:out value="${i.updateDate}" /></span>
+                                </a>
+                                <div class="answer push-content"><c:out value="${i.pushContent}" /></div>
+                            </li>
+                        </c:forEach>
+                    </c:if>
+                </c:if>
             </ul>
         </div>
     </div>

+ 20 - 5
src/main/webapp/WEB-INF/jsp/mobile/servey/servey.jsp

@@ -41,6 +41,21 @@ $( function(){
     
     $( "#patientForm" ).validate({
         rules: {
+            bloodPressureLevelCon : {
+                number : true
+            },
+            bloodPressureLevelRel : {
+                number : true
+            },
+            pulseRate : {
+                number : true
+            },
+            respirationRate : {
+                number : true
+            },
+            oxygenSaturation : {
+                number : true
+            }
 //             hospitalizationDate : {
 //                 date : true
 //             },
@@ -427,7 +442,7 @@ function setEventHandler() {
                         </div>
                         <div class="data">
                             <label class="inline">
-                                ( <input type="text" name="pulseRate"> ) 회/분
+                                ( <input type="text" name="pulseRate" onkeypress="onlyNumber();"> ) 회/분
                             </label>
                         </div>
                     </div>
@@ -437,7 +452,7 @@ function setEventHandler() {
                         </div>
                         <div class="data">
                             <label class="inline">
-                                ( <input type="text" name="respirationRate"> ) 회/분
+                                ( <input type="text" name="respirationRate" onkeypress="onlyNumber();"> ) 회/분
                             </label>
                         </div>
                     </div>
@@ -447,10 +462,10 @@ function setEventHandler() {
                         </div>
                         <div class="data">
                             <label class="inline">
-                                수축기( <input type="text" name="bloodPressureLevelCon"> )mmHg
+                                수축기( <input type="text" name="bloodPressureLevelCon" onkeypress="onlyNumber();"> )mmHg
                             </label>
                             <label class="inline">
-                                이완기( <input type="text" name="bloodPressureLevelRel"> )mmHg
+                                이완기( <input type="text" name="bloodPressureLevelRel" onkeypress="onlyNumber();"> )mmHg
                             </label>
                         </div>
                     </div>
@@ -460,7 +475,7 @@ function setEventHandler() {
                         </div>
                         <div class="data">
                             <label class="inline">
-                                ( <input type="text" name="oxygenSaturation"> )%
+                                ( <input type="text" name="oxygenSaturation" onkeypress="onlyNumber();"> )%
                             </label>
                         </div>
                     </div>