|
@@ -153,4 +153,37 @@ def count_emergency_management(location_list: list, db):
|
|
|
|
|
|
sql = text(f"""SELECT DISTINCT management_unit FROM `rescue_materia` WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', latitude, ' ', longitude, ')'), 4326))""")
|
|
|
|
|
|
- return len(db.execute(sql).all())
|
|
|
+ return len(db.execute(sql).all())
|
|
|
+
|
|
|
+
|
|
|
+def get_hospital_list(location_list:list,db):
|
|
|
+ resutl = []
|
|
|
+ for location in location_list:
|
|
|
+ location = convert_to_polygon(location)
|
|
|
+ sql = text(f"""SELECT hospital_name as `name`,longitude,latitude,6 AS `dataType` FROM mid_hospital WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', latitude, ' ', longitude, ')'), 4326))""")
|
|
|
+
|
|
|
+ resutl+=db.execute(sql).all()
|
|
|
+ return resutl
|
|
|
+
|
|
|
+def get_emergency_shelter_list(location_list:list,db):
|
|
|
+
|
|
|
+ resutl = []
|
|
|
+ for location in location_list:
|
|
|
+ location = convert_to_polygon(location)
|
|
|
+
|
|
|
+ sql = text(f"""SELECT shelter_name as `name`,lng as longitude,lat as latitude,3 AS `dataType` FROM mid_emergency_shelter WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', lat, ' ', lng, ')'), 4326))""")
|
|
|
+
|
|
|
+ resutl+=db.execute(sql).all()
|
|
|
+ return resutl
|
|
|
+
|
|
|
+
|
|
|
+def get_waterlogged_roads_list(location_list:list,db):
|
|
|
+
|
|
|
+ resutl = []
|
|
|
+ for location in location_list:
|
|
|
+ location = convert_to_polygon(location)
|
|
|
+
|
|
|
+ sql = text(f"""SELECT flood_name as `name`,lng as longitude,lat as latitude,4 AS `dataType` FROM mid_waterlogged_roads WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', lat, ' ', lng, ')'), 4326))""")
|
|
|
+
|
|
|
+ resutl+=db.execute(sql).all()
|
|
|
+ return resutl
|