Переглянути джерело

증상 날짜도 필터 적용

maengje 4 роки тому
батько
коміт
b3df548d74

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

@@ -33,6 +33,7 @@ public class PatientPHRLatestDTO {
 	private Date bloodSugarCreateDate;
 	private String bloodSugarAlarmYN;
 	private String symptomYN;
+	private Date symptomCreateDate;
 	
 	private int memoCount;
 	private Date symptomLastDate;
@@ -224,6 +225,12 @@ public class PatientPHRLatestDTO {
 	public void setSymptomYN(String symptomYN) {
 		this.symptomYN = symptomYN;
 	}
+	public Date getSymptomCreateDate() {
+		return symptomCreateDate;
+	}	
+	public void setSymptomCreateDate(Date symptomCreateDate) {
+		this.symptomCreateDate = symptomCreateDate;
+	}
 	public String getSearchText() {
 		return searchText;
 	}

+ 15 - 0
src/main/java/com/lemon/lifecenter/service/PHRService.java

@@ -163,6 +163,21 @@ public class PHRService {
     	PatientPHRLatestDTO phrLatestDTO = new PatientPHRLatestDTO();
 		phrLatestDTO.setPatientIdx(dto.getPatientIdx());
 		phrLatestDTO.setSymptomYN("Y");
+		
+		SimpleDateFormat format = new SimpleDateFormat ("yyyy-MM-dd HH:mm");
+	    Date time = new Date();
+	    try {
+			time = format.parse(dto.getRecordedDate());
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		
+	    if (dto.getRecordedDate() == null || dto.getRecordedDate().equals("")) {
+	    	phrLatestDTO.setSymptomCreateDate(time);
+	    } else {
+	    	phrLatestDTO.setSymptomCreateDate(time);
+	    }
+		
 		PatientPHRLatestDTO patient = mapperPHRLatest.selectPHRLatest(phrLatestDTO);
 		if (patient == null) {
 			mapperPHRLatest.insertPHRLatest(phrLatestDTO);		

+ 7 - 2
src/main/resources/mybatis/mapper/patient/patientPHRLatest.xml

@@ -89,7 +89,7 @@
 	    </if>
 	    <if test='symptomYN != null and symptomYN != ""'>
 	    <![CDATA[
-   			, NOW()
+   			, #{symptomCreateDate}
 	    ]]>
 	    </if>
     <![CDATA[
@@ -139,7 +139,7 @@
 		</if>
 		<if test='symptomYN != null and symptomYN != ""'>
 		<![CDATA[ 
-		, symptom_create_date = NOW() ]]>
+		, symptom_create_date = #{symptomCreateDate} ]]>
 		</if>
 	 	<![CDATA[
 	 	WHERE patient_idx = #{patientIdx}
@@ -179,6 +179,11 @@
 	   		AND (systolic_blood_pressure_create_date IS NULL OR systolic_blood_pressure_create_date <= #{systolicBloodPressureCreateDate} OR diastolic_blood_pressure_create_date IS NULL OR diastolic_blood_pressure_create_date < #{diastolicBloodPressureCreateDate})
 		    ]]>
 		    </if>
+		    <if test='symptomYN != null and symptomYN != ""'>
+		    <![CDATA[
+	   		AND (symptom_create_date IS NULL OR symptom_create_date <= #{symptomCreateDate})
+		    ]]>
+		    </if>
 	</update>	
 	 <select id="selectPHRLatest" parameterType="PatientPHRLatestDTO" resultType="PatientPHRLatestDTO">
     <![CDATA[