Explorar el Código

插入诊断和手术前先删除旧数据

lighter hace 2 años
padre
commit
a082c6f78e

+ 9 - 0
src/main/java/thyyxxk/webserver/service/casefrontsheet/CaseFrontSheetMainService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
@@ -512,6 +513,10 @@ public class CaseFrontSheetMainService {
         //在t_case_frontsheet_main表中插入 主体的内容
         dao.insert(sheet);
         //循环插主要的诊断
+        QueryWrapper<CaseFrontsheetDisdiag> diagWrapper = new QueryWrapper<>();
+        diagWrapper.eq("bah", sheet.getBah());
+        diagWrapper.eq("times", sheet.getAdmissTimes());
+        createdDao.delete(diagWrapper);
         for (CaseFrontsheetDisdiag caseFrontsheetDisdiag : sheet.getDisdiagList()) {
             caseFrontsheetDisdiag.setBah(sheet.getBah());
             caseFrontsheetDisdiag.setTimes(sheet.getAdmissTimes());
@@ -520,6 +525,10 @@ public class CaseFrontSheetMainService {
             }
         }
         //循环插入做过的手术
+        QueryWrapper<CaseFrontsheetSurgery> surgeryWrapper = new QueryWrapper<>();
+        surgeryWrapper.eq("bah", sheet.getBah());
+        surgeryWrapper.eq("times", sheet.getAdmissTimes());
+        basDao.delete(surgeryWrapper);
         for (CaseFrontsheetSurgery caseFrontsheetSurgery : sheet.getSurgeryList()) {
             caseFrontsheetSurgery.setBah(sheet.getBah());
             caseFrontsheetSurgery.setTimes(sheet.getAdmissTimes());