Browse Source

쿼리 use_yn 처리 수정 / 환자삭제시 메모 추가

huiwonseo 4 years ago
parent
commit
64325e41dc

+ 3 - 0
src/main/java/com/lemon/lifecenter/controller/PatientController.java

@@ -363,6 +363,7 @@ public class PatientController extends LifeCenterController {
     @RequestMapping("/delete")
     @Transactional(propagation=Propagation.REQUIRED)
     public String patientDelete( @RequestParam( value="enIdx", required = true ) String enIdx,
+            @RequestParam( value="deleteReason", required = false, defaultValue = "" ) String deleteReason,
             HttpServletRequest request,HttpServletResponse response ) throws Exception {
         String deIdx   = LifeCenterFunction.aesDecrypt( config.aesKey, config.IV, enIdx );
         int patientIdx = Integer.valueOf( deIdx );
@@ -380,7 +381,9 @@ public class PatientController extends LifeCenterController {
             // patientService.deletePatientCare(dto);
             // 환자데이터를 삭제하지않고 flag 값을 변경 (21.04.12 수정)
             dto.setUseYn( "N" );
+            dto.setDeleteReason( deleteReason );
             patientService.updatePatientCareUseYn(dto);
+            
         }
         
         LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '환자정보가 삭제되었습니다. ', callBack : function(){ location.href='./list'; } });" );

+ 7 - 0
src/main/java/com/lemon/lifecenter/dto/PatientDTO.java

@@ -150,7 +150,14 @@ public class PatientDTO {
     private String jurisdictionName="";
     
     private String useYn;
+    private String deleteReason="";
     
+    public String getDeleteReason() {
+        return deleteReason;
+    }
+    public void setDeleteReason(String deleteReason) {
+        this.deleteReason = deleteReason;
+    }
     public String getUseYn() {
         return useYn;
     }

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

@@ -85,8 +85,8 @@
               FROM PATIENT_PHR_HISTORY PPH
               LEFT JOIN PATIENT_CARE PC
                 ON PC.PATIENT_IDX = PPH.PATIENT_IDX
-               AND PC.USE_YN = 'Y'
              WHERE 1 = 1
+               AND PC.USE_YN = 'Y'
                AND PPH.PHR_TYPE      = #{resourceType}
          ]]>
 
@@ -133,8 +133,8 @@
               FROM PATIENT_MEMO PM
               LEFT JOIN PATIENT_CARE PC
                 ON PM.PATIENT_IDX = PC.PATIENT_IDX
-               AND PC.USE_YN = 'Y'
              WHERE 1 = 1
+               AND PC.USE_YN = 'Y'
         ]]>
         <choose>
             <when test='patientNumber != null and patientNumber !=""'>
@@ -198,8 +198,8 @@
               FROM PATIENT_SYMPTOM PS
               LEFT JOIN PATIENT_CARE PC
                 ON PS.PATIENT_IDX = PC.PATIENT_IDX
-               AND PC.USE_YN = 'Y'
              WHERE 1 = 1
+               AND PC.USE_YN = 'Y'
         ]]>
         <choose>
             <when test='patientNumber != null and patientNumber !=""'>
@@ -261,8 +261,8 @@
                FROM PATIENT_SYMPTOM_SIM PSS
                LEFT JOIN PATIENT_CARE PC
                  ON PC.PATIENT_IDX = PSS.PATIENT_IDX
-                AND PC.USE_YN = 'Y'
               WHERE 1 = 1
+                AND PC.USE_YN = 'Y'
         ]]>
         <choose>
             <when test='patientNumber != null and patientNumber !=""'>

+ 1 - 1
src/main/resources/mybatis/mapper/mobile/login.xml

@@ -8,8 +8,8 @@
               FROM PATIENT_CARE PC
               LEFT JOIN CENTER_INFO CI
                 ON PC.CENTER_CODE = CI.CENTER_CODE
-               AND PC.USE_YN = 'Y'
              WHERE 1 = 1
+               AND PC.USE_YN = 'Y'
                AND PC.ID = #{id}
                AND PC.PW = #{pw}
                AND PC.CENTER_CODE = #{centerCode}

+ 1 - 1
src/main/resources/mybatis/mapper/mobile/munjin.xml

@@ -7,8 +7,8 @@
         <![CDATA[
             SELECT COUNT(*) AS CNT
               FROM patient_care
-               AND USE_YN = 'Y'
              WHERE patient_idx = #{patientIdx}
+               AND USE_YN = 'Y'
                AND update_date IS NOT null;
         ]]>
     </select>

+ 3 - 1
src/main/resources/mybatis/mapper/patient/patient.xml

@@ -708,7 +708,9 @@
     <update id="updatePatientCareUseYn" parameterType="PatientDTO">
         <![CDATA[
             UPDATE patient_care
-               SET use_yn = #{useYn}
+               SET use_yn = #{useYn},
+                   delete_reason = #{deleteReason},
+                   update_date = NOW()
              WHERE patient_idx = #{patientIdx}
         ]]>
     </update>

+ 2 - 2
src/main/resources/mybatis/mapper/push/push.xml

@@ -247,8 +247,8 @@
               FROM push_result_${ym} PR
               LEFT JOIN patient_care PC
                 ON PR.patient_idx = PC.patient_idx
-               AND PC.USE_YN = 'Y'
              WHERE 1=1
+               AND PC.USE_YN = 'Y'
                AND PR.push_idx = #{pushIdx}
                AND PR.log_idx = #{logIdx}
         ]]>
@@ -347,8 +347,8 @@
               FROM push_target_temp PT
               LEFT JOIN patient_care PC
                 ON PC.patient_idx = PT.patient_idx
-               AND PC.USE_YN = 'Y'
              WHERE push_idx = #{pushIdx}
+               AND PC.USE_YN = 'Y'
         ]]>
     </select>
     

+ 41 - 1
src/main/webapp/WEB-INF/jsp/patient/info.jsp

@@ -6,16 +6,26 @@
 <jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
 <script>
 function deleteConfirm(){
+	if( $.trim( $( "#deleteReason" ).val() ) == "" ){
+        alertBox({ txt : "사유를 입력해주세요" });
+        $( ".modal-header>.modal-title h3" ).remove();
+        return false;
+    }
+	
     alertBox({ type : "confirm", 
                txt : "정말로 삭제할까요? (기록된 환자의 모든정보가 삭제되며 복구가 불가능합니다)", 
                callBack : function( result ){
                    console.log( result );
                    if( result ){
                        $( "#pForm" ).attr( "action", "./delete" );
+                       $( "#pForm" ).append( $("#deleteReason").clone() );
                        $( "#pForm" ).submit();
                    }
                }
     });
+    
+    $( "#deletePatientMemo h3" ).remove();
+    
     return false;
 }
 
@@ -58,6 +68,36 @@ function goListPage(){
 </script>
 </head>
 <body>
+    <div class="modal fade" id="deletePatientMemo" tabindex="-1" role="dialog" aria-hidden="true" data-memoid="">
+        <div class="modal-dialog modal-sm" role="document">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h5 class="modal-title">환자삭제 사유 입력</h5>
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
+                            aria-hidden="true">&times;</span> </button>
+                </div>
+                <div class="modal-body m-3">
+                    <table class="table mobile-table">
+                        <colgroup>
+                            <col style="width: 80%">
+                        </colgroup>
+                        <tr>
+                            <td>
+                                <div class="form-row">
+                                    <textarea id="deleteReason" name="deleteReason" class="form-control" rows="3" placeholder="삭제사유를 50자 이내로 입력하세요" maxlength="50"></textarea>
+                                </div>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+                <div class="addMemoTools modal-footer">
+                    <button type="button" class="btn btn-outline-primary" data-dismiss="modal">취소</button>
+                    <button type="button" class="btn btn-primary" onclick="deleteConfirm();">제출 후 환자삭제</button>
+                </div>
+            </div>
+        </div>
+    </div>
+    
     <div class="wrapper">
         <jsp:include page="${data._INCLUDE}/sidebar.jsp"></jsp:include>
 
@@ -99,7 +139,7 @@ function goListPage(){
                                                     <button type="button" class="btn btn-warning w100" onclick="location.href='/clinic/info?patientIdx=${patientIdx}';">건강정보</button>
                                                     
                                                     <c:if test="${role._DELETE eq 'Y'}">
-                                                        <button type="button" class="btn btn-danger w100" onclick="deleteConfirm();">삭제</button>
+                                                        <button type="button" class="btn btn-danger w100" data-toggle="modal" data-target="#deletePatientMemo">삭제</button>
                                                     </c:if>
                                                     
                                                     <c:if test="${role._UPDATE eq 'Y'}">