瀏覽代碼

환자정보 수정 진행중

huiwon.seo 4 年之前
父節點
當前提交
ee0c2cebb1

+ 36 - 67
src/main/java/com/lemon/lifecenter/controller/PatientController.java

@@ -1,22 +1,18 @@
 package com.lemon.lifecenter.controller;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.json.JSONObject;
 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.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.lemon.lifecenter.common.LifeCenterConfigVO;
@@ -102,12 +98,9 @@ public class PatientController extends LifeCenterController {
     @RequestMapping("/new")
     public ModelAndView patientNew( HttpServletRequest request,HttpServletResponse response ) {
         ModelAndView mv = setMV("patient/new");
-        System.out.println( "dasdsadasdasd : " + request.getParameter( "deviceType" ) );
         String sesCenterCode  = LifeCenterSessionController.getSession( request, "sesCenterCode" );
         String sesId  = LifeCenterSessionController.getSession( request, "sesId" );
         
-        System.out.println( "sesCenterCode: " + sesCenterCode );
-        
         // 세션의 센터코드 들고와서 치료센터명 조회후 view 전달
         CenterInfoDTO dto = new CenterInfoDTO();
         dto.setCenterCode( Integer.valueOf( sesCenterCode ) );
@@ -121,9 +114,9 @@ public class PatientController extends LifeCenterController {
             centerName = centerService.selectCenterInfoOne( dto ).getCenterName();
         }
         
-        System.out.println("centerCount : " + centerCount );
         mv.addObject( "centerName", centerName );
         mv.addObject( "centerCount", centerCount );
+        mv.addObject( "actionType", "new" );
         
         return mv;
     }
@@ -137,10 +130,10 @@ public class PatientController extends LifeCenterController {
         
         //patientCare Insert
         System.out.println( "dto.getJumin().substring(2) : " + dto.getJumin().replace( "-" , "" ).substring(2) );
-        String jumin = dto.getJumin().replace( "-" , "" ).substring(2);
+        String jumin = dto.getJumin().replace( "-" , "" );
         
         dto.setId( dto.getWardNumber().trim() + dto.getRoomNumber().trim() );
-        dto.setPw( LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, jumin ) );
+        dto.setPw( LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, jumin.substring(2) ) );
         dto.setJumin( jumin );
         dto.setCenterCode( sesCenterCode );
         dto.setState( "H" ); // H : 입소
@@ -196,9 +189,40 @@ public class PatientController extends LifeCenterController {
     }
 
     @RequestMapping("/edit")
-    public ModelAndView patientEdit() {
+    public ModelAndView patientEdit( 
+            @ModelAttribute("dto") PatientDTO patientDTO,
+            HttpServletRequest request,HttpServletResponse response ) {
+        String sesCenterCode  = LifeCenterSessionController.getSession( request, "sesCenterCode" );
+        String sesId  = LifeCenterSessionController.getSession( request, "sesId" );
+        
+        int patientIdx = patientDTO.getPatientIdx();
+        patientDTO = patientService.selectPatientOne( patientDTO );
+        
+        
+        // 세션의 센터코드 들고와서 치료센터명 조회후 view 전달
+        // 센터가 존재하는지 체크
+        CenterInfoDTO dto = new CenterInfoDTO();
+        dto.setCenterCode( Integer.valueOf( sesCenterCode ) );
+        dto.setStaffId( sesId );
+        String centerName = "";
+        int centerCount   = centerService.selectCenterCount( dto );
+        
+        if( centerCount > 0 ) {
+            centerName = centerService.selectCenterInfoOne( dto ).getCenterName();
+        } else {
+            LifeCenterFunction.scriptMessage(response, "alert('삭제되었거나 존재하지않는 치료센터입니다.');" );
+            // return ""; 아직처리안함
+        }
+        
         ModelAndView mv = setMV("patient/edit");
-
+        
+        mv.addObject( "centerName", centerName );
+        mv.addObject( "centerCount", centerCount );
+        
+        mv.addObject( "patientIdx", patientIdx );
+        mv.addObject( "patientData", patientDTO );
+        mv.addObject( "actionType", "edit" );
+        
         return mv;
     }
 
@@ -208,59 +232,4 @@ public class PatientController extends LifeCenterController {
 
         return mv;
     }
-    
-    @RequestMapping( value="/nonFaceStart", method = RequestMethod.POST )
-    @ResponseBody
-    public String nonFaceStart(
-            @RequestParam( value="pId", required = true ) String pId,
-            @RequestParam( value="roomId", required = true ) String roomId,
-            @RequestParam( value="pName", required = true ) String pName,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
-        
-        String salt = LifeCenterFunction.getSalt();
-        String timeStamp = LifeCenterFunction.getTimestamp();
-        String signature = LifeCenterFunction.getSignature(config.nonFaceApiSecret, salt, timeStamp);
-        
-        String userId = LifeCenterSessionController.getSession(request, "sesId");
-        String userNm = LifeCenterSessionController.getSession(request, "sesName");
-        
-        HashMap<String, String> data = new HashMap<String, String>();
-        data.put("api_key", config.nonFaceApiKey);
-        data.put("salt", salt);
-        data.put("timestamp", timeStamp);
-        data.put("signature", signature);
-        data.put("client_id", config.nonFaceClientId);
-        data.put("member_id", userId);
-        
-        String result = LifeCenterFunction.httpUrlConnection(config.nonFaceApiTokenUrl, data);
-        
-        JSONObject object = new JSONObject(result);
-        String message = "";
-        String token = "";
-        for(String key : object.keySet()) {
-            logger.error("key -- > " + key);
-            if (key.equals("errorCode")) {
-                message = object.getString("message");
-            } else if (key.equals("token")){
-                token = object.getString("token");
-            }
-        }
-        
-        if (!message.equals("")) {
-            //error
-        }
-        String hashData = LifeCenterFunction.getSignature(config.nonFaceApiSecret, config.nonFaceApiKey, roomId + userId); //"1011503101"
-        
-        object.put("api_key", config.nonFaceApiKey);
-        object.put("member_id", userId);
-        object.put("token", token);
-        object.put("room_id", roomId);
-        object.put("member_name", userNm);
-        object.put("classify", "d"); // p이면 환자 d이면 의사
-        object.put("hashData", hashData);
-        logger.error("pid -- > " + hashData);
-        
-        return object.toString();
-    }
-    
 }

+ 30 - 2
src/main/java/com/lemon/lifecenter/controller/StaffController.java

@@ -27,6 +27,7 @@ import com.lemon.lifecenter.dto.CenterInfoDTO;
 import com.lemon.lifecenter.dto.GroupListDTO;
 import com.lemon.lifecenter.dto.LoginDTO;
 import com.lemon.lifecenter.dto.StaffDTO;
+import com.lemon.lifecenter.service.CenterService;
 import com.lemon.lifecenter.service.GroupListService;
 import com.lemon.lifecenter.service.LoginService;
 import com.lemon.lifecenter.service.StaffService;
@@ -50,8 +51,15 @@ public class StaffController extends LifeCenterController {
     @Autowired
     private GroupListService groupListService;
     
+    @Autowired
+    private CenterService centerService;
+    
     @RequestMapping("/new")
-    public ModelAndView staffNew() throws Exception {
+    public ModelAndView staffNew( HttpServletRequest request,HttpServletResponse response ) throws Exception {
+        int sesCenterCode  = Integer.valueOf( LifeCenterSessionController.getSession( request, "sesCenterCode" ) ) ;
+        int sesGroupIdx    = Integer.valueOf( LifeCenterSessionController.getSession( request, "sesGroupIdx" ) );
+        String sesId       = LifeCenterSessionController.getSession( request, "sesId" );
+        
         List<CenterInfoDTO> centerList = memberService.selectCenterList();
         
         ModelAndView mv = setMV("staff/new");
@@ -59,13 +67,33 @@ public class StaffController extends LifeCenterController {
         GroupListDTO dto = new GroupListDTO();
         List<GroupListDTO> groupList = groupListService.selectGroupList(dto);
         
+        
+        List<CenterInfoDTO> selectCenter = new ArrayList<CenterInfoDTO>();
+        
+        for( CenterInfoDTO c : centerList ) {
+            if( sesGroupIdx == 1 ) {
+                selectCenter.add( c );
+            } else {
+                if( c.getCenterCode() == sesCenterCode ) {
+                    selectCenter.add( c );
+                }
+            }
+        }
+        
+        CenterInfoDTO centerDTO = new CenterInfoDTO();
+        
+        centerDTO.setStaffId( sesId );
+        centerDTO.setCenterCode( sesCenterCode );
+        
+        centerService.selectCenterInfoOne( centerDTO );
+        
         for( GroupListDTO data : groupList ) {
 //            data.setPermissions( LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, data.getPermissions() ) );
             data.setEncryptIdx( LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, String.valueOf( data.getIdx() ) ) );
         }
         
         
-        mv.addObject( "centerList", centerList );
+        mv.addObject( "centerList", selectCenter );
         mv.addObject( "groupList", groupList );
         
         return mv;

+ 3 - 0
src/main/java/com/lemon/lifecenter/mapper/PatientMapper.java

@@ -16,4 +16,7 @@ public interface PatientMapper {
     public void insertPatientDisease( PatientDTO dto );
     public void insertPatientSymptom( PatientDTO dto );
     public PatientDTO selectPatientOne(PatientDTO dto);
+    public void updatePatientCare( PatientDTO dto );
+    public void updatePatientDisease( PatientDTO dto );
+    public void updatePatientSymptom( PatientDTO dto );
 }

+ 10 - 0
src/main/java/com/lemon/lifecenter/service/PatientService.java

@@ -35,4 +35,14 @@ public class PatientService {
     public PatientDTO selectPatientOne(PatientDTO dto) {
         return mapper.selectPatientOne(dto);
     }
+    
+    public void updatePatientCare( PatientDTO dto ) {
+        mapper.updatePatientCare(dto);
+    }
+    public void updatePatientDisease( PatientDTO dto ) {
+        mapper.updatePatientDisease(dto);
+    }
+    public void updatePatientSymptom( PatientDTO dto ) {
+        mapper.updatePatientSymptom(dto);
+    }
 }

+ 1 - 1
src/main/resources/mybatis/mapper/group/group.xml

@@ -12,7 +12,7 @@
                    PERMISSIONS AS permissions
               FROM GROUP_LIST
              WHERE USE_YN = 'Y'
-               AND PERMISSIONS != 'SYSTEM'
+               AND PERMISSIONS = 'USER'
              ORDER BY `ORDER`
         ]]>
     </select>

+ 97 - 8
src/main/resources/mybatis/mapper/patient/patient.xml

@@ -79,15 +79,15 @@
         <![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,  drug_yn,     drug_content,    pregnancy_status,   pregnancy_week,      id,                   pw, 
-                     create_date,       create_by,       update_by)
+                   ( patient_name,      gender,      ward_number,     room_number,        hospitalization_date, state, 
+                     center_code,       jumin,       patient_phone,   guardian_phone,     symptom_start_date,   confirmation_date,    disisolation_date, 
+                     basal_disease_yn,  drug_yn,     drug_content,    pregnancy_status,   pregnancy_week,       id,                   pw, 
+                     create_date,       create_by,   update_by )
                       
-            VALUES ( #{patientName},    #{gender},   #{wardNumber},   #{roomNumber},      NOW(),               NOW(),               #{state}, 
-                     #{centerCode},     #{jumin},    #{patientPhone}, #{guardianPhone},   #{symptomStartDate}, #{confirmationDate}, #{disisolationDate}, 
-                     #{basalDiseaseYn}, #{drugYn},   #{drugContent},  #{pregnancyStatus}, #{pregnancyWeek},    #{id},               #{pw}, 
-                     NOW(),             #{createBy},      '')
+            VALUES ( #{patientName},    #{gender},   #{wardNumber},   #{roomNumber},      ${hospitalizationDate}, #{state}, 
+                     #{centerCode},     #{jumin},    #{patientPhone}, #{guardianPhone},   #{symptomStartDate},    #{confirmationDate},    #{disisolationDate}, 
+                     #{basalDiseaseYn}, #{drugYn},   #{drugContent},  #{pregnancyStatus}, #{pregnancyWeek},       #{id},                  #{pw}, 
+                     NOW(),             #{createBy}, '' )
         ]]>
     </insert>
     
@@ -211,4 +211,93 @@
                AND PC.PATIENT_IDX = #{patientIdx}
         ]]>
     </select>
+    
+    <update id="updatePatientCare" parameterType="PatientDTO" useGeneratedKeys="true">
+        <![CDATA[
+            UPDATE patient_care
+               SET patient_name = ${patientName},
+                   gender = ${gender},
+                   ward_number = ${wardNumber},
+                   room_number = ${roomNumber},
+                   hospitalization_date = ${hospitalizationDate},
+                   state = ${state},
+                   center_code = ${centerCode},
+                   jumin = ${jumin},
+                   patient_phone = ${patientPhone},
+                   guardian_phone = ${guardianPhone},
+                   symptom_start_date = ${symptomStartDate},
+                   confirmation_date = ${confirmationDate},
+                   disisolation_date = ${disisolationDate},
+                   basal_disease_yn = ${basalDiseaseYn},
+                   drug_yn = ${drugYn},
+                   drug_content = ${drugContent},
+                    pregnancy_status = ${pregnancyStatus},
+                   pregnancy_week = ${pregnancyWeek},
+                   id = ${id},
+                   pw = ${pw},
+                   update_date = NOW(),
+                   update_by = ${updateBy}
+             WHERE patient_idx = ${patientIdx}
+        ]]>
+    </update>
+    
+    <update id="updatePatientDisease" parameterType="PatientDTO" useGeneratedKeys="true">
+        <![CDATA[
+            UPDATE patient_disease
+               SET high_blood_pressure_check = #{highBloodPressureCheck},
+                   low_blood_pressure_check = #{lowBloodPressureCheck}, 
+                   organ_transplant_check = #{organTransplantCheck},  
+                   diabetes_check = , #{diabetesCheck}, 
+                   respiratory_disease_check = #{respiratoryDiseaseCheck}, 
+                   immunological_disease_check = #{immunologicalDiseaseCheck}, 
+                   dyspnea_check = #{dyspneaCheck},
+                   cold_fit_check = #{coldFitCheck},
+                   muscle_pain_check =   #{musclePainCheck},
+                   headache_check = #{headacheCheck},
+                   sore_throat_check = #{soreThroatCheck},
+                   smell_palate_check = #{smellPalateCheck},
+                   fatigue_check = #{fatigueCheck},
+                   heart_disease = #{heartDisea},
+                   liver_disease = #{liverDisease},
+                   `operation` = #{operation},
+                   operation_content = #{operationContent},
+                   allergy_check = #{allergyCheck},
+                   kidney_disease =   #{kidneyDisease},
+                   cancer_check = #{cancerCheck},
+                   cancer_name = #{cancerName},
+                   etc_check =   #{etcCheck},
+                   etc_content=${etcContent}
+             WHERE patient_idx = ${patientIdx}
+        ]]>
+    </update>
+    
+    <update id="updatePatientSymptom" parameterType="PatientDTO" useGeneratedKeys="true">
+        <![CDATA[
+            UPDATE patient_symptom
+               SET fever_check = #{feverCheck},
+                   cough_check = #{coughCheck},
+                   colic = #{colic},
+                   cold_fit_check = #{coldFitCheck},
+                   sputum_check = #{sputumCheck},
+                   ocin_check = #{ocinCheck},
+                   fever_right = #{feverRight},
+                   fever_left = #{feverLeft},
+                   fatigue_check = #{fatigueCheck},
+                   etc_check = #{etcCheck},
+                   etc_content = #{etcContent},
+                   chest_pain = #{chestPain},
+                   nose_check = #{noseCheck},
+                   vomiting_check = #{vomitingCheck},
+                   muscle_pain_check = #{musclePainCheck},
+                   sore_throat_check = #{soreThroatCheck},
+                   diarrhea_check = #{diarrheaCheck},
+                   headache_check = #{headacheCheck},
+                   dyspnea_check = #{dyspneaCheck},
+                   pulse_rate = #{pulseRate},
+                   respiration_rate = #{respirationRate},
+                   blood_pressure_level = #{bloodPressureLevel},
+                   oxygen_saturation = #{oxygenSaturation}
+             WHERE patient_idx = #{patient_idx}
+        ]]>
+    </update>
 </mapper>

File diff suppressed because it is too large
+ 512 - 596
src/main/webapp/WEB-INF/jsp/patient/edit.jsp


+ 6 - 5
src/main/webapp/WEB-INF/jsp/patient/new.jsp

@@ -138,7 +138,7 @@ $( function(){
                     <!-- 환자관리 : 신규환자 등록 START -->
                     <div class="row">
                         <div class="col-12 col-lg-6">
-                            <h1 class="h3 mb-3">환자정보</h1>
+                            <h1 class="h3 mb-3">환자정보등록</h1>
                         </div>
                         <div class="col-12 col-lg-6  text-right">
                             <nav aria-label="breadcrumb">
@@ -165,8 +165,9 @@ $( function(){
                                     
                                     <c:if test="${centerCount > 0}">
                                         <c:set var="now" value="<%=new java.util.Date()%>" />
+                                        <c:set var="action" value="/patient/new/insert" />
                                         
-                                        <form id="patientForm" action="/patient/new/insert">
+                                        <form id="patientForm" action="${action}">
                                             <table class="table mobile-table">
                                                 <colgroup>
                                                     <col style="width:15%">
@@ -200,7 +201,7 @@ $( function(){
                                                             <div class="col-3">
                                                                 <select class="custom-select hospitalizationDate" id="hospitalizationDateMin">
                                                                       <option value="" selected="">분</option>
-                                                                      <c:forEach var="i" begin="0" end="60" step="1">
+                                                                      <c:forEach var="i" begin="0" end="59" step="1">
                                                                           <option value="${i}" <c:if test="${sysMin eq i}">selected="selected"</c:if>>${i} 분</option>
                                                                       </c:forEach>
                                                                 </select>
@@ -534,8 +535,8 @@ $( function(){
                                             <div class="row mt-3">
                                                 <div class="col-12">
                                                     <div class="text-right">
-                                                        <button class="btn btn-outline-primary w100">취소</button>
-                                                        <button type="submit" class="btn btn-primary w100">저장</button>
+                                                        <button class="btn btn-outline-primary w100" onclick="history.back();">취소</button>
+                                                        <button type="submit" class="btn btn-primary w100">등록</button>
                                                     </div>
                                                 </div>
                                             </div>