junekeunsong пре 4 година
родитељ
комит
c649952578

+ 8 - 0
src/main/java/com/lemon/lifecenter/controller/RestApiController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.lemon.lifecenter.dto.AppVersionDTO;
 import com.lemon.lifecenter.dto.DeviceInfoDTO;
+import com.lemon.lifecenter.dto.HlRequestDTO;
 import com.lemon.lifecenter.service.RestApiService;
 
 @RestController
@@ -24,4 +25,11 @@ public class RestApiController {
     
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
     
+    @Autowired
+    private RestApiService service;
+    
+    @RequestMapping(value="/patientList" , method = RequestMethod.POST)
+    public void selectHLPatientList(@RequestBody HlRequestDTO dto) {
+        
+    }
 }

+ 48 - 0
src/main/java/com/lemon/lifecenter/dto/HlRequestDTO.java

@@ -0,0 +1,48 @@
+package com.lemon.lifecenter.dto;
+
+public class HlRequestDTO {
+    private String resourceType   = "";
+    private String careAgencyCode = "";
+    private String patientNumber  = "";
+    private String patientName    = "";
+    private String birthDate      = "";
+    private String patientPhone   = "";
+    
+    public String getResourceType() {
+        return resourceType;
+    }
+    public void setResourceType(String resourceType) {
+        this.resourceType = resourceType;
+    }
+    public String getCareAgencyCode() {
+        return careAgencyCode;
+    }
+    public void setCareAgencyCode(String careAgencyCode) {
+        this.careAgencyCode = careAgencyCode;
+    }
+    public String getPatientNumber() {
+        return patientNumber;
+    }
+    public void setPatientNumber(String patientNumber) {
+        this.patientNumber = patientNumber;
+    }
+    public String getPatientName() {
+        return patientName;
+    }
+    public void setPatientName(String patientName) {
+        this.patientName = patientName;
+    }
+    public String getBirthDate() {
+        return birthDate;
+    }
+    public void setBirthDate(String birthDate) {
+        this.birthDate = birthDate;
+    }
+    public String getPatientPhone() {
+        return patientPhone;
+    }
+    public void setPatientPhone(String patientPhone) {
+        this.patientPhone = patientPhone;
+    }
+    
+}

+ 5 - 2
src/main/java/com/lemon/lifecenter/mapper/RestApiMapper.java

@@ -1,12 +1,15 @@
 package com.lemon.lifecenter.mapper;
 
+import java.util.List;
+
 import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
 
-import com.lemon.lifecenter.dto.AppVersionDTO;
-import com.lemon.lifecenter.dto.DeviceInfoDTO;
+import com.lemon.lifecenter.dto.HlRequestDTO;
+import com.lemon.lifecenter.dto.PatientDTO;
 
 @Repository
 @Mapper
 public interface RestApiMapper {
+    public List<PatientDTO> selectHLPatientList(HlRequestDTO dto);
 }

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

@@ -1,10 +1,14 @@
 package com.lemon.lifecenter.service;
 
+import java.util.List;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.lemon.lifecenter.dto.AppVersionDTO;
 import com.lemon.lifecenter.dto.DeviceInfoDTO;
+import com.lemon.lifecenter.dto.HlRequestDTO;
+import com.lemon.lifecenter.dto.PatientDTO;
 import com.lemon.lifecenter.mapper.RestApiMapper;
 
 @Service
@@ -12,4 +16,7 @@ public class RestApiService {
     @Autowired
     private RestApiMapper mapper;
     
+    public List<PatientDTO> selectHLPatientList(HlRequestDTO dto) {
+        return mapper.selectHLPatientList(dto);
+    }
 }

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

@@ -2,4 +2,66 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
 <mapper namespace="com.lemon.lifecenter.mapper.RestApiMapper">
+    <select id="selectHLPatientList" parameterType="HlRequestDTO" resultType="PatientDTO">
+        <!-- 조건이 맞지 않을 경우에는 데이터를 주면 안됨 -->
+        <![CDATA[
+            SELECT PATIENT_NUMBER          AS patinetNumber,
+                   PATIENT_NAME            AS patientName,
+                   GENDER                  AS gender,
+                   WARD_NUMBER             AS wardNumber,
+                   ROOM_NUMBER             AS roomNumber,
+                   FINAL_CLINIC_DATE       AS finalClinicDate,
+                   HOSPITALIZATION_DATE    AS hospitalizationDate,
+                   STATE                   AS state,
+                   CENTER_CODE             AS centerCode,
+                   JUMIN                   AS jumin,
+                   PATIENT_PHONE           AS patientPhone,
+                   GUARDIAN_PHONE          AS guardianPhone,
+                   SYMPTOM_START_DATE      AS sysmptomStartDate,
+                   CONFIRMATION_DATE       AS confirmationDate,
+                   DISISOLATION_DATE       AS disisolationDate,
+                   BASAL_DISEASE_YN        AS basalDiseaseYn,
+                   DRUG_YN                 AS drugYn,
+                   DRUG_CONTENT            AS drugContent,
+                   PREGNANCY_STATUS        AS pregnancyStatus,
+                   PREGNANCY_WEEK          AS pregnancyWeek,
+                   MANAGER_ID              AS namagerId,
+                   EXPECTED_DISCHARGE_DATE AS expectedDischargeDate
+              FROM PATIENT_CARE
+             WHERE 1 = 1
+        ]]>
+        
+        
+        <choose>
+            <when test='careAgencyCode != null and careAgencyCode != ""'>
+                <![CDATA[
+                       AND CENTER_CODE    = (SELECT CENTER_CODE
+                                              FROM CENTER_INFO
+                                             WHERE 1 = 1
+                                               AND COOPERATIVE_CODE = (SELECT COOPERATIVE_CODE
+                                                                         FROM COOPERATIVE_HOSPITAL
+                                                                        WHERE COOPERATIVE_CODE = #{careAgencyCode}))
+                ]]>
+            </when>
+            <otherwise>
+                <choose>
+                    <when test='patientNumber != null and patientNumber !=""'>
+                        <![CDATA[
+                               AND PATIENT_NUMBER = #{patientNumber}
+                        ]]>
+                    </when>
+                    <otherwise>
+                        <if test='birthDate != null and birthDate !="" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
+                            <![CDATA[
+                                   AND JUMIN          = #{birthDate}
+                                   AND PATIENT_NAME   = #{patientName}
+                                   AND PATIENT_PHONE  = #{patientPhone}
+                            ]]>
+                        </if>
+                    </otherwise>
+                </choose>
+            </otherwise>
+        </choose>
+        
+    </select>
 </mapper>