Browse Source

api 쿼리 수정

junekeunsong 4 years ago
parent
commit
c31fba1f8f

+ 7 - 3
src/main/java/com/lemon/lifecenter/controller/RestApiController.java

@@ -116,15 +116,18 @@ public class RestApiController {
                         
                         Date nowDate = new Date();
                         if (nowDate.getTime() < getDate.getTime()) {
-                            
                             if (resourceType.equals("")) {
                                 object.put("error", "emptyResourceType");
                                 message = "emptyResourceType";
                                 result = object.toString();
                             } else {
                                 String phone = dto.getPatientPhone();
-                                phone = LifeCenterFunction.setPhoneFormat(phone);
-                                dto.setPatientPhone2(phone);
+                                if (!phone.equals("")) {
+                                    phone = LifeCenterFunction.setPhoneFormat(phone);
+                                    dto.setPatientPhone2(phone);
+                                }
+                                
+                                logger.error("dto.setPatientPhone2 -- > " + dto.getPatientPhone2());
                                 
                                 if (resourceType.equals("bloodPressure") || resourceType.equals("bloodSugar") || 
                                         resourceType.equals("oxygenSaturation") || resourceType.equals("pulseRate") || resourceType.equals("temperature")) {
@@ -133,6 +136,7 @@ public class RestApiController {
                                 } else if (resourceType.equals("clinicMemo")) {
                                     result = selectClinicMemoList(dto);
                                 } else if (resourceType.equals("patientInfo")) {
+                                    
                                     result = selectHLPatientList(dto);
                                 } else if (resourceType.equals("survey")) {
                                     result = selectMunjinDataList(dto);

+ 2 - 2
src/main/resources/application.properties

@@ -7,8 +7,8 @@ spring.mvc.view.suffix=.jsp
 #spring.datasource.url=jdbc:cubrid:localhost:30000:LIFE_CENTER:::?charset=UTF-8
 spring.datasource.driver-class-name=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
 #spring.datasource.url=jdbc:log4jdbc:cubrid:61.97.184.187:30000:LIFE_CENTER:::?charset=UTF-8
-spring.datasource.url=jdbc:log4jdbc:cubrid:118.67.133.187:30000:LIFE_CENTER:::?charset=UTF-8
-#spring.datasource.url=jdbc:log4jdbc:cubrid:localhost:30000:LIFE_CENTER:::?charset=UTF-8
+#spring.datasource.url=jdbc:log4jdbc:cubrid:118.67.133.187:30000:LIFE_CENTER:::?charset=UTF-8
+spring.datasource.url=jdbc:log4jdbc:cubrid:localhost:30000:LIFE_CENTER:::?charset=UTF-8
 #spring.datasource.driver-class-name=cubrid.jdbc.driver.CUBRIDDriver
 #spring.datasource.url=jdbc:cubrid:10.175.153.104:30000:LIFE_CENTER:::?altHosts=10.175.153.105:30000&charset=UTF-8
 

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

@@ -32,27 +32,27 @@
         ]]>
         
         <choose>
-            <when test='careAgencyCode != null and careAgencyCode == "" and birthDate == null and birthDate == "" and patientName == null and patientName == "" and patientPhone == null and patientPhone == ""'>
+            <when test='patientNumber != null and patientNumber !=""'>
                 <![CDATA[
-                       AND CENTER_CODE    = (SELECT center_code
-                                               FROM api_manager
-                                              WHERE cooperative_code = #{careAgencyCode}
-                                                AND use_yn = 'C')
+                    AND PATIENT_NUMBER = #{patientNumber}
                 ]]>
             </when>
             <otherwise>
                 <choose>
-                    <when test='patientNumber != null and patientNumber !=""'>
+                    <when test='birthDate != null and birthDate != "" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
                         <![CDATA[
-                               AND PATIENT_NUMBER = #{patientNumber}
+                            AND JUMIN          = #{birthDate}
+                            AND PATIENT_NAME   = #{patientName}
+                            AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
                         ]]>
                     </when>
                     <otherwise>
-                        <if test='birthDate != null and birthDate !="" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
+                        <if test='careAgencyCode != null and careAgencyCode != ""'>
                             <![CDATA[
-                                   AND JUMIN          = #{birthDate}
-                                   AND PATIENT_NAME   = #{patientName}
-                                   AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
+                                AND CENTER_CODE    = (SELECT center_code
+                                                        FROM api_manager
+                                                       WHERE cooperative_code = #{careAgencyCode}
+                                                         AND use_yn = 'C')
                             ]]>
                         </if>
                     </otherwise>
@@ -89,27 +89,27 @@
          ]]>
 
         <choose>
-            <when test='careAgencyCode != null and careAgencyCode != "" and birthDate == null and birthDate == "" and patientName == null and patientName == "" and patientPhone == null and patientPhone == ""'>
+            <when test='patientNumber != null and patientNumber !=""'>
                 <![CDATA[
-                       AND PC.CENTER_CODE    = (SELECT center_code
-                                                  FROM api_manager
-                                                 WHERE cooperative_code = #{careAgencyCode}
-                                                   AND use_yn = 'C')
+                    AND PATIENT_NUMBER = #{patientNumber}
                 ]]>
             </when>
             <otherwise>
                 <choose>
-                    <when test='patientNumber != null and patientNumber !=""'>
+                    <when test='birthDate != null and birthDate != "" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
                         <![CDATA[
-                               AND PC.PATIENT_NUMBER = #{patientNumber}
+                            AND JUMIN          = #{birthDate}
+                            AND PATIENT_NAME   = #{patientName}
+                            AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
                         ]]>
                     </when>
                     <otherwise>
-                        <if test='birthDate != null and birthDate !="" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
+                        <if test='careAgencyCode != null and careAgencyCode != ""'>
                             <![CDATA[
-                                   AND PC.JUMIN          = #{birthDate}
-                                   AND PC.PATIENT_NAME   = #{patientName}
-                                   AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
+                                AND CENTER_CODE    = (SELECT center_code
+                                                        FROM api_manager
+                                                       WHERE cooperative_code = #{careAgencyCode}
+                                                         AND use_yn = 'C')
                             ]]>
                         </if>
                     </otherwise>
@@ -134,27 +134,27 @@
              WHERE 1 = 1
         ]]>
         <choose>
-            <when test='careAgencyCode != null and careAgencyCode != "" and birthDate == null and birthDate == "" and patientName == null and patientName == "" and patientPhone == null and patientPhone == ""'>
+            <when test='patientNumber != null and patientNumber !=""'>
                 <![CDATA[
-                       AND PC.CENTER_CODE    = (SELECT center_code
-                                                  FROM api_manager
-                                                 WHERE cooperative_code = #{careAgencyCode}
-                                                   AND use_yn = 'C')
+                    AND PATIENT_NUMBER = #{patientNumber}
                 ]]>
             </when>
             <otherwise>
                 <choose>
-                    <when test='patientNumber != null and patientNumber !=""'>
+                    <when test='birthDate != null and birthDate != "" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
                         <![CDATA[
-                               AND PC.PATIENT_NUMBER = #{patientNumber}
+                            AND JUMIN          = #{birthDate}
+                            AND PATIENT_NAME   = #{patientName}
+                            AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
                         ]]>
                     </when>
                     <otherwise>
-                        <if test='birthDate != null and birthDate !="" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
+                        <if test='careAgencyCode != null and careAgencyCode != ""'>
                             <![CDATA[
-                                   AND PC.JUMIN          = #{birthDate}
-                                   AND PC.PATIENT_NAME   = #{patientName}
-                                   AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
+                                AND CENTER_CODE    = (SELECT center_code
+                                                        FROM api_manager
+                                                       WHERE cooperative_code = #{careAgencyCode}
+                                                         AND use_yn = 'C')
                             ]]>
                         </if>
                     </otherwise>
@@ -198,27 +198,27 @@
              WHERE 1 = 1
         ]]>
         <choose>
-            <when test='careAgencyCode != null and careAgencyCode != "" and birthDate == null and birthDate == "" and patientName == null and patientName == "" and patientPhone == null and patientPhone == ""'>
+            <when test='patientNumber != null and patientNumber !=""'>
                 <![CDATA[
-                       AND PC.CENTER_CODE    = (SELECT center_code
-                                                  FROM api_manager
-                                                 WHERE cooperative_code = #{careAgencyCode}
-                                                   AND use_yn = 'C')
+                    AND PATIENT_NUMBER = #{patientNumber}
                 ]]>
             </when>
             <otherwise>
                 <choose>
-                    <when test='patientNumber != null and patientNumber !=""'>
+                    <when test='birthDate != null and birthDate != "" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
                         <![CDATA[
-                               AND PC.PATIENT_NUMBER = #{patientNumber}
+                            AND JUMIN          = #{birthDate}
+                            AND PATIENT_NAME   = #{patientName}
+                            AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
                         ]]>
                     </when>
                     <otherwise>
-                        <if test='birthDate != null and birthDate !="" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
+                        <if test='careAgencyCode != null and careAgencyCode != ""'>
                             <![CDATA[
-                                   AND PC.JUMIN          = #{birthDate}
-                                   AND PC.PATIENT_NAME   = #{patientName}
-                                   AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
+                                AND CENTER_CODE    = (SELECT center_code
+                                                        FROM api_manager
+                                                       WHERE cooperative_code = #{careAgencyCode}
+                                                         AND use_yn = 'C')
                             ]]>
                         </if>
                     </otherwise>
@@ -260,27 +260,27 @@
               WHERE 1 = 1
         ]]>
         <choose>
-            <when test='careAgencyCode != null and careAgencyCode != "" and birthDate == null and birthDate == "" and patientName == null and patientName == "" and patientPhone == null and patientPhone == ""'>
+            <when test='patientNumber != null and patientNumber !=""'>
                 <![CDATA[
-                       AND PC.CENTER_CODE    = (SELECT center_code
-                                                  FROM api_manager
-                                                 WHERE cooperative_code = #{careAgencyCode}
-                                                   AND use_yn = 'C')
+                    AND PATIENT_NUMBER = #{patientNumber}
                 ]]>
             </when>
             <otherwise>
                 <choose>
-                    <when test='patientNumber != null and patientNumber !=""'>
+                    <when test='birthDate != null and birthDate != "" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
                         <![CDATA[
-                               AND PC.PATIENT_NUMBER = #{patientNumber}
+                            AND JUMIN          = #{birthDate}
+                            AND PATIENT_NAME   = #{patientName}
+                            AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
                         ]]>
                     </when>
                     <otherwise>
-                        <if test='birthDate != null and birthDate !="" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
+                        <if test='careAgencyCode != null and careAgencyCode != ""'>
                             <![CDATA[
-                                   AND PC.JUMIN          = #{birthDate}
-                                   AND PC.PATIENT_NAME   = #{patientName}
-                                   AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
+                                AND CENTER_CODE    = (SELECT center_code
+                                                        FROM api_manager
+                                                       WHERE cooperative_code = #{careAgencyCode}
+                                                         AND use_yn = 'C')
                             ]]>
                         </if>
                     </otherwise>
@@ -301,27 +301,27 @@
               WHERE 1 = 1
          ]]>
         <choose>
-            <when test='centerCode != null and centerCode != "" and birthDate == null and birthDate == "" and patientName == null and patientName == "" and patientPhone == null and patientPhone == ""'>
+            <when test='patientNumber != null and patientNumber !=""'>
                 <![CDATA[
-                       AND CENTER_CODE    = (SELECT center_code
-                                               FROM api_manager
-                                              WHERE cooperative_code = #{careAgencyCode}
-                                                AND use_yn = 'C')
+                    AND PATIENT_NUMBER = #{patientNumber}
                 ]]>
             </when>
             <otherwise>
                 <choose>
-                    <when test='patientNumber != null and patientNumber !=""'>
+                    <when test='birthDate != null and birthDate != "" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
                         <![CDATA[
-                               AND PC.PATIENT_NUMBER = #{patientNumber}
+                            AND JUMIN          = #{birthDate}
+                            AND PATIENT_NAME   = #{patientName}
+                            AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
                         ]]>
                     </when>
                     <otherwise>
-                        <if test='birthDate != null and birthDate !="" and patientName != null and patientName != "" and patientPhone != null and patientPhone != ""'>
+                        <if test='careAgencyCode != null and careAgencyCode != ""'>
                             <![CDATA[
-                                   AND JUMIN          = #{birthDate}
-                                   AND PATIENT_NAME   = #{patientName}
-                                   AND (PATIENT_PHONE  = #{patientPhone} OR PATIENT_PHONE = #{patientPhone2})
+                                AND CENTER_CODE    = (SELECT center_code
+                                                        FROM api_manager
+                                                       WHERE cooperative_code = #{careAgencyCode}
+                                                         AND use_yn = 'C')
                             ]]>
                         </if>
                     </otherwise>