Browse Source

表结构调整

zhoutg 5 years ago
parent
commit
ae0a6a06b2
1 changed files with 11 additions and 8 deletions
  1. 11 8
      src/main/resources/mapper/MedicalRecordMapper.xml

+ 11 - 8
src/main/resources/mapper/MedicalRecordMapper.xml

@@ -19,14 +19,17 @@
     </resultMap>
 
     <select id="getRecordContent"  resultType="com.diagbot.dto.RecordContentDTO">
-        select t.*,c.content_blob, c.content_text from (
-            SELECT a.rec_id, a.rec_title, b.stand_model_name FROM `med_medical_record` a, qc_model_hospital b
-            where a.is_deleted = 'N'  and a.rec_title = b.hospital_model_name
-            and a.hospital_id = #{hospitalId}
-            and b.hospital_id = #{hospitalId}
-            and a.behospital_code = #{behospitalCode}
-            and b.stand_model_name is not null) t, med_medical_record_content c
-        where t.rec_id = c.rec_id and c.is_deleted = 'N'
+        select t1.rec_id, t1.rec_title, t2.name stand_model_name, t3.content_text
+        from med_medical_record t1, qc_mode t2, med_medical_record_content t3
+        where
+             t1.is_deleted = 'N'
+        and t2.is_deleted = 'N'
+        and t3.is_deleted = 'N'
+        and t1.mode_id = t2.id
+        and t1.hospital_id = t3.hospital_id
+        and t1.rec_id = t3.rec_id
+        and t1.hospital_id = #{hospitalId}
+        and t1.behospital_code = #{behospitalCode}
     </select>
 
 </mapper>