Prechádzať zdrojové kódy

환자 의료진 메모 api 추가

junekeunsong 4 rokov pred
rodič
commit
c8b9825554

+ 37 - 2
src/main/java/com/lemon/lifecenter/controller/RestApiController.java

@@ -111,7 +111,7 @@ public class RestApiController {
                             
                             String resourceType = dto.getResourceType();
                             if (resourceType.equals("")) {
-                                object.put("error", "invalidParameters");
+                                object.put("error", "emptyResourceType");
                                 return object.toString();
                             } else {
                                 if (resourceType.equals("bloodPressure") || resourceType.equals("bloodSugar") || 
@@ -119,6 +119,8 @@ public class RestApiController {
                                         
                                         result = selectPhrData(dto);
                                         
+                                    } else if (resourceType.equals("clinicMemo")) {
+                                        result = selectClinicMemoList(dto);
                                     } else if (resourceType.equals("patientInfoList")) {
                                         result = selectHLPatientList(dto);
                                     } else if (resourceType.equals("munjin")) {
@@ -129,7 +131,7 @@ public class RestApiController {
                                         //String[] strAr = {"temperature", "bloodPressure", "bloodSugar", "oxygenSaturation", "pulseRate"};
 //                                        result = selectVitalSign(dto);
                                     } else {
-                                        object.put("error", "invalidParameters");
+                                        object.put("error", "invalidResourceType");
                                         return object.toString();
                                     }
                             }
@@ -262,6 +264,39 @@ public class RestApiController {
         return array.toString();
     }
     
+    private String selectClinicMemoList(HlRequestDTO dto) {
+        List<ApiPhrResponseDTO> list = service.selectClinicMemo(dto);
+        JSONArray array = new JSONArray();
+        
+        String resourceType = dto.getResourceType();
+        for (int i = 0; i < list.size(); i++) {
+            LinkedHashMap<String, Object> object = new LinkedHashMap<>();
+            String patientNumber    = list.get(i).getPatientNumber();
+            String patientName      = list.get(i).getPatientName();
+            String patientPhone     = list.get(i).getPatientPhone();
+            String jumin            = list.get(i).getJumin();
+            String clinicMemo       = list.get(i).getValueType1();
+            String recordedByName   = list.get(i).getRecordedByName();
+            String recordedById     = list.get(i).getRecordedById();
+            String createDate       = list.get(i).getCreateDate();
+            
+            object.put("resourceType", resourceType);
+            object.put("patinetId", patientNumber);
+            object.put("patientName", patientName);
+            object.put("patientPhone", patientPhone);
+            object.put("birthDate", jumin);
+            object.put("clinicMemo", clinicMemo);
+            object.put("recordedByName", recordedByName);
+            object.put("recordedById", recordedById);
+            object.put("createDate", createDate);
+            
+            String jsonText = JSONValue.toJSONString(object);
+            array.put(jsonText);
+        }
+        
+        return array.toString();
+    }
+    
     private String selectMunjinDataList(HlRequestDTO dto) {
         String resourceType = dto.getResourceType();
         List<PatientDTO> list = service.selectMunjinDataList(dto);

+ 1 - 0
src/main/java/com/lemon/lifecenter/mapper/RestApiMapper.java

@@ -19,6 +19,7 @@ public interface RestApiMapper {
     public List<ApiSymptomDTO> selectSymptomDataList(HlRequestDTO dto);
     public List<ApiPhrResponseDTO> selectPatientInfoList(HlRequestDTO dto);
     public List<ApiPhrResponseDTO> selectPatientPhrData(int patientIdx);
+    public List<ApiPhrResponseDTO> selectClinicMemo(HlRequestDTO dto);
     
     public String selectApiKey(HlRequestDTO dto);
 }

+ 4 - 0
src/main/java/com/lemon/lifecenter/service/RestApiService.java

@@ -42,6 +42,10 @@ public class RestApiService {
         return mapper.selectPatientPhrData(patientIdx);
     }
     
+    public List<ApiPhrResponseDTO> selectClinicMemo(HlRequestDTO dto) {
+        return mapper.selectClinicMemo(dto);
+    }
+    
     public String selectApiKey(HlRequestDTO dto) {
         return mapper.selectApiKey(dto);
     }

+ 49 - 0
src/main/resources/mybatis/mapper/api/api.xml

@@ -119,6 +119,55 @@
         </choose>
      </select>
      
+     <select id="selectClinicMemo" parameterType="HlRequestDTO" resultType="ApiPhrResponseDTO">
+        <![CDATA[
+            SELECT IFNULL(PC.PATIENT_NUMBER, '')                             AS patientNumber,
+                   IFNULL(PC.PATIENT_NAME, '')                               AS patientName,
+                   IFNULL(PC.PATIENT_PHONE, '')                              AS patientPhone,
+                   IFNULL(PC.JUMIN, '')                                      AS jumin,
+                   IFNULL(PM.CONTENTS, '')                                   AS valueType1,
+                   IFNULL(PM.RECORDED_BY_NAME, '')                           AS recordedByName,
+                   IFNULL(PM.RECORDED_BY_ID, '')                             AS recordedById,
+                   IFNULL(DATE_FORMAT(PM.CREATE_DATE, '%Y-%m-%d %H:%i'), '') AS createDate
+              FROM PATIENT_MEMO PM
+              LEFT JOIN (SELECT PATIENT_IDX,
+                                PATIENT_NUMBER,
+                                PATIENT_NAME,
+                                PATIENT_PHONE,
+                                JUMIN,
+                                CENTER_CODE
+                           FROM PATIENT_CARE
+                          WHERE CENTER_CODE = 63) PC
+                ON PM.PATIENT_IDX = PC.PATIENT_IDX
+             WHERE 1 = 1
+        ]]>
+        <choose>
+            <when test='careAgencyCode != null and careAgencyCode != ""'>
+                <![CDATA[
+                       AND PC.CENTER_CODE    = #{centerCode}
+                ]]>
+            </when>
+            <otherwise>
+                <choose>
+                    <when test='patientNumber != null and patientNumber !=""'>
+                        <![CDATA[
+                               AND PC.PATIENT_NUMBER = #{patientNumber}
+                        ]]>
+                    </when>
+                    <otherwise>
+                        <if test='birthDate != null and birthDate !="" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
+                            <![CDATA[
+                                   AND PC.JUMIN          = #{birthDate}
+                                   AND PC.PATIENT_NAME   = #{patientName}
+                                   AND PC.PATIENT_PHONE  = #{patientPhone}
+                            ]]>
+                        </if>
+                    </otherwise>
+                </choose>
+            </otherwise>
+        </choose>
+     </select>
+     
      <select id="selectMunjinDataList" parameterType="HlRequestDTO" resultType="PatientDTO">
         <![CDATA[
             SELECT IFNULL(PC.PATIENT_NUMBER, '')       AS patientNumber,