김서연

Merge branch 'integrated#3_ksy' into 'master'

Integrated#3 ksy



See merge request !20
......@@ -2,23 +2,13 @@ var express = require('express');
var bodyParser = require('body-parser');
var request = require('request');
var cheerio = require('cheerio');
var app =express();
const HTTPS = require('https');
const domain = "www.stagefive.tk"
const sslport = 80;
app.set('view engine','ejs');
app.set('views','./views')
app.use(express.urlencoded( {extended : false } ));
app.locals.pretty=true;
// app.set('view engine','pug');
app.use(express.static('public'));
var http = require('http');
var fs = require('fs');
//?page=페이지번호&?perPage=페이지당 데이터수
const $base_url = `https://api.odcloud.kr/api/apnmOrg/v1/list`;
const $key = '4US0H%2BXj%2BmS8IR4YL0%2BUb9H4CcbTr92QxhYULfOEz1DT%2BZaaos4sRfNh6cmAD2Icli862Ysc31%2BaE4pWywDBIA%3D%3D';
......@@ -34,18 +24,14 @@ app.post('/',function(req,res,next){
request($api_url,function(err,response,body){
if(err) throw err;
// console.log(body);
//data부분만 추출
var obj = JSON.parse(body).data;
// console.log(obj);
//검색한 지역 포함한 모든 data 담기
let searchList = obj.filter(searchList => {
return searchList.orgZipaddr.includes(searchWord);
});
// console.log(searchList);
//result라는 변수에 담아 결과 보내기
// var hey = searchList[0].orgZipaddr.split(',');
var timeList=[];
for(var i=0; i<searchList.length; i++){ //시간정보 파싱
var eachtime=[];
......@@ -87,9 +73,7 @@ app.post('/',function(req,res,next){
}
res.render('index', {result:JSON.stringify(searchList),info:searchList ,timeList:timeList});
})
})
app.get('/',function(req,res){
......
......@@ -3,7 +3,6 @@
<head>
<meta charset="utf-8">
<title>코로나 백신 의료기관 조회</title>
<%if(typeof(info)!="undefined"){%>
<script>
try {
......@@ -18,10 +17,8 @@
</head>
<body>
<center>
<h1 style="font-family:verdana;">COVID-19 예방접종 위탁 의료기관 조회</h1> <hr>
<!-- <div style="background: #e8ecff; border-left: 0.5em solid #688FF4;border-right: 0.5em solid #688FF4; padding: 0.5em;"> -->
<h2>COVID-19 예방접종 위탁 의료기관 조회</h2> <hr>
<!-- </div> -->
<form action="/" method="post">
<p>
<div style="float:right; width:40%; margin-bottom:10px; margin-right: 5px;">
......@@ -31,12 +28,10 @@
</p>
</form>
</center>
<div id="map" style="width:1300px;height:750px; margin-left:100px; float:left; border: 3px solid; " ></div>
<script type="text/javascript" src="https://dapi.kakao.com/v2/maps/sdk.js?appkey=35fccf4b4e2a3179187346f26ed3f988&libraries=services"></script>
<% if(typeof(info) != "undefined"){ %>
<div id="map" style="width:65%;height:550px;float:left; margin-left: 2%; border-radius: 2%; border:1px solid black" ></div>
<div style="overflow:scroll; width:25%; height:550px;float:left; margin-left:2%; border:1px solid black;">
<ol id="placelist">
<% for(i=0; i<info.length; i++){%>
......@@ -48,7 +43,6 @@
<%}else { %>
<span style="color:green"> (정상운영) </span>
<%}%>
<br>
<% if(timeList[i][0]!="" && timeList[i][1]!="" && timeList[i][2]!="" && timeList[i][3]!=""){%>
<span>점심시간 : <%=timeList[i][0]%>:<%=timeList[i][1]%>~<%=timeList[i][2]%>:<%=timeList[i][3] %></span><br>
......@@ -64,10 +58,7 @@
<%} %>
</ol>
</div>
<%}else{%>
<div style="overflow:scroll; width:25%; height:550px;float:left; margin-left:2%; border:1px solid black;">
</div>
<% } %>
<%}%>
<% if(typeof(result) != "undefined"){ %>
<script>
......@@ -88,7 +79,6 @@
listData = JSON.parse(listData);
var count = 0;
//입력되는 배열명이 listData로 들어오면 됨.
listData.forEach(function(addr, index) {
var tmpaddr = ((addr.orgZipaddr).split(','))[0];
......@@ -98,7 +88,6 @@
var coords = new kakao.maps.LatLng(result[0].y, result[0].x);
count += 1;
var marker = new kakao.maps.Marker({
position: coords,
clickable: true
......@@ -135,7 +124,6 @@
infowindow.close();
};
}
var infowindows = [];
function displayinfowindow(address,name,flag){
if(flag){
......@@ -143,7 +131,7 @@
geocoder.addressSearch(tmpaddr, function(result, status) {
if (status === kakao.maps.services.Status.OK) {
var coords = new kakao.maps.LatLng(result[0].y, result[0].x);
//map.setCenter(coords);//인포윈도우 생성 마커로 이동
map.setCenter(coords);//인포윈도우 생성 마커로 이동
var marker = new kakao.maps.Marker({
position: coords,
clickable: true
......@@ -164,15 +152,17 @@
}
</script>
<% }else{ %>
<div id="map" style="width:90%;height:550px;float:left; margin-left: 2%; border-radius: 2%; border:1px solid black" ></div>
<script>//입력 값이 없을 때 기본 지도 띄움
var mapContainer = document.getElementById('map'), // 지도를 표시할 div
mapOption = {
center: new kakao.maps.LatLng(37.596672, 127.051950), // 지도의 중심좌표
level: 3 // 지도의 확대 레벨
};
var map = new kakao.maps.Map(mapContainer, mapOption); // 지도를 생성합니다
</script>
<% } %>
</body>
</html>
\ No newline at end of file
......