|
@@ -45,7 +45,8 @@
|
|
<select id="listByPoint" resultMap="wmDaHospitalMap">
|
|
<select id="listByPoint" resultMap="wmDaHospitalMap">
|
|
SELECT
|
|
SELECT
|
|
s.*,
|
|
s.*,
|
|
- (st_distance (point (s.longitude, s.latitude),point(#{query.longitude},#{query.latitude})) / 0.0111) AS distance
|
|
|
|
|
|
+ (st_distance (point (s.longitude, s.latitude),
|
|
|
|
+ point(#{query.longitude},#{query.latitude})) / 0.0111) AS distance
|
|
FROM wm_da_hospital s
|
|
FROM wm_da_hospital s
|
|
where s.longitude is not null and s.latitude is not null and s.del_flag=0 and s.enable_flag=0
|
|
where s.longitude is not null and s.latitude is not null and s.del_flag=0 and s.enable_flag=0
|
|
AND (st_distance (point (s.longitude, s.latitude),point(#{query.longitude},#{query.latitude})) / 0.0111)
|
|
AND (st_distance (point (s.longitude, s.latitude),point(#{query.longitude},#{query.latitude})) / 0.0111)
|
|
@@ -56,13 +57,15 @@
|
|
<select id="listByPointForDM" resultMap="wmDaHospitalMap">
|
|
<select id="listByPointForDM" resultMap="wmDaHospitalMap">
|
|
SELECT * from (
|
|
SELECT * from (
|
|
SELECT s.*,
|
|
SELECT s.*,
|
|
- (dmgeo.st_distance(dmgeo.st_pointfromtext(CONCAT('point(',s.longitude,' ', s.latitude,')'),0),
|
|
|
|
- dmgeo.st_pointfromtext('point(#{query.longitude} #{query.latitude})',0)) / 0.0111) AS distance
|
|
|
|
|
|
+ (dmgeo.st_distance(
|
|
|
|
+ dmgeo.st_pointfromtext(CONCAT('point(',s.longitude,' ', s.latitude,')'),0),
|
|
|
|
+ dmgeo.st_pointfromtext('point('#{query.longitude}' '#{query.latitude}')',0)
|
|
|
|
+ ) / 0.0111) AS distance
|
|
FROM wm_da_hospital s
|
|
FROM wm_da_hospital s
|
|
WHERE (s.longitude IS NOT NULL and TRIM(s.longitude) != '')
|
|
WHERE (s.longitude IS NOT NULL and TRIM(s.longitude) != '')
|
|
- AND (s.latitude IS NOT NULL and TRIM(s.latitude) != '')
|
|
|
|
- AND s.del_flag = 0
|
|
|
|
- AND s.enable_flag = 0) temp
|
|
|
|
|
|
+ AND (s.latitude IS NOT NULL and TRIM(s.latitude) != '')
|
|
|
|
+ AND s.del_flag = 0
|
|
|
|
+ AND s.enable_flag = 0) temp
|
|
WHERE distance <= 1
|
|
WHERE distance <= 1
|
|
ORDER BY distance ASC;
|
|
ORDER BY distance ASC;
|
|
</select>
|
|
</select>
|