libushang 7 mēneši atpakaļ
vecāks
revīzija
c203bac40d
2 mainītis faili ar 22 papildinājumiem un 1 dzēšanām
  1. 1 1
      common/db/db_emergency_plan.py
  2. 21 0
      routers/api/eventManagement/event.py

+ 1 - 1
common/db/db_emergency_plan.py

@@ -13,4 +13,4 @@ def get_plan_name_by_id(db: Session, plan_id: int) -> str:
     if row is not None:
         return row.plan_name
     
-    return None
+    return ''

+ 21 - 0
routers/api/eventManagement/event.py

@@ -253,6 +253,7 @@ async def get_event_detail(
                     "latitude": row.latitude,
                     "longitude": row.longitude,
                     "address": row.address,
+                    "plan_id": row.plan_id,
                     "plan_name": db_emergency_plan.get_plan_name_by_id(db, row.plan_id),
                     "del_flag": row.del_flag,
                     "summary_file": db_event_management.get_summary_file_list(db, row.id),
@@ -814,3 +815,23 @@ def get_sent_status_text(sent_status) -> str:
         return str(sent_status)
     
 
+# 上报伤亡情况
+@router.post("/upload_casualties")
+async def upload_casualties(
+    request: Request,  
+    body = Depends(remove_xss_json), 
+    db: Session = Depends(get_db)
+):
+    eventId = body['event_id']
+    
+    del body['event_id']
+
+    # 标记已上传
+    body['casualties'] = '1'
+    db.query(EventBase).filter(EventBase.event_code == eventId).update(body)
+    db.commit()
+
+    return {
+        "code": 200,
+        "msg": "保存事件伤亡情况成功"
+    }