瀏覽代碼

对接大数据

lulihong 6 年之前
父節點
當前提交
1f3eac1e29

+ 3 - 0
js/api/bigData-api.js

@ -3,6 +3,9 @@
		getJsonData: function(url,data) {
			return httpRequest.getJson(url, {data: data})
		},
		getTemplateData: function(data) {
            return httpRequest.get("/gov/report/getNoChartTemplateData",{data: data})
        },
		getNoChartTemplateData: "/gov/report/getNoChartTemplateData",
		getTemplateDataByViewCode:"/gov/report/getTemplateDataByViewCode",
		getCityArea: "/gov/report/getCityArea",

+ 119 - 0
js/util.js

@ -65,4 +65,123 @@ function isNull(str) {
	var re = new RegExp(regu);
	var bb = re.test(str);
	return re.test(str);
}
/** 
 * 获取本周、本季度、本月、上月的开端日期、停止日期 
 */
var now = new Date(); //当前日期 
var nowDayOfWeek = now.getDay(); //今天本周的第几天 
var nowDay = now.getDate(); //当前日 
var nowMonth = now.getMonth(); //当前月 
var nowYear = now.getYear(); //当前年 
nowYear += (nowYear < 2000) ? 1900 : 0; //
var lastMonthDate = new Date(); //上月日期 
lastMonthDate.setDate(1);
lastMonthDate.setMonth(lastMonthDate.getMonth() - 1);
var lastYear = lastMonthDate.getYear();
var lastMonth = lastMonthDate.getMonth();
//格局化日期:yyyy-MM-dd 
function formatDate(date) {
	var myyear = date.getFullYear();
	var mymonth = date.getMonth() + 1;
	var myweekday = date.getDate();
	if(mymonth < 10) {
		mymonth = "0" + mymonth;
	}
	if(myweekday < 10) {
		myweekday = "0" + myweekday;
	}
	return(myyear + "-" + mymonth + "-" + myweekday);
}
//获得某月的天数 
function getMonthDays(myMonth) {
	var monthStartDate = new Date(nowYear, myMonth, 1);
	var monthEndDate = new Date(nowYear, myMonth + 1, 1);
	var days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24);
	return days;
}
//获得本季度的开端月份 
function getQuarterStartMonth() {
	var quarterStartMonth = 0;
	if(nowMonth < 3) {
		quarterStartMonth = 0;
	}
	if(2 < nowMonth && nowMonth < 6) {
		quarterStartMonth = 3;
	}
	if(5 < nowMonth && nowMonth < 9) {
		quarterStartMonth = 6;
	}
	if(nowMonth > 8) {
		quarterStartMonth = 9;
	}
	return quarterStartMonth;
}
//获得本周的开端日期 
function getWeekStartDate() {
	var weekStartDate = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek);
	return formatDate(weekStartDate);
}
//获得本周的停止日期 
function getWeekEndDate() {
	var weekEndDate = new Date(nowYear, nowMonth, nowDay + (6 - nowDayOfWeek));
	return formatDate(weekEndDate);
}
//获得本月的开端日期 
function getMonthStartDate() {
	var monthStartDate = new Date(nowYear, nowMonth, 1);
	return formatDate(monthStartDate);
}
//获得本月的停止日期 
function getMonthEndDate() {
	var monthEndDate = new Date(nowYear, nowMonth, getMonthDays(nowMonth));
	return formatDate(monthEndDate);
}
//获得上月开端时候 
function getLastMonthStartDate() {
	var lastMonthStartDate = new Date(nowYear, lastMonth, 1);
	return formatDate(lastMonthStartDate);
}
//获得上月停止时候 
function getLastMonthEndDate() {
	var lastMonthEndDate = new Date(nowYear, lastMonth, getMonthDays(lastMonth));
	return formatDate(lastMonthEndDate);
}
//获得本季度的开端日期 
function getQuarterStartDate() {
	var quarterStartDate = new Date(nowYear, getQuarterStartMonth(), 1);
	return formatDate(quarterStartDate);
}
//或的本季度的停止日期 
function getQuarterEndDate() {
	var quarterEndMonth = getQuarterStartMonth() + 2;
	var quarterStartDate = new Date(nowYear, quarterEndMonth, getMonthDays(quarterEndMonth));
	return formatDate(quarterStartDate);
}
//获得本年的开始日期
function getYearStartDate() {
    //获得当前年份4位年
    var currentYear=new Date().getFullYear();
    //本年第一天
    var currentYearFirstDate=new Date(currentYear,0,1);
    return formatDate(currentYearFirstDate);
}
//获得本年的结束日期
function getYearEndDate() {
    //获得当前年份4位年
    var currentYear=new Date().getFullYear();
    //本年最后
    var currentYearLastDate=new Date(currentYear,11,31);
    return formatDate(currentYearLastDate);
}

+ 13 - 0
page/bigData/component/high-incidence-disease.js

@ -35,6 +35,9 @@
				gaoBingFaData:null,
				isInit:true,
				fontSize: 0.007 * window.screen.width,
				linkageFilter:"",
				firstDay:"",//本月第一天
				lastDay:"",//本月最后一天
			}
		},
		mounted: function() {
@ -48,6 +51,16 @@
			}
		},
		methods: {
			getData:function(){
				if(this.index2==0){//本月
					this.linkageFilter = "quotaDate >= '" + getMonthStartDate() + "' and quotaDate <= '" + getMonthEndDate() + "';";
				}else if(this.index2==1){//本季
					this.linkageFilter = "quotaDate >= '" + getQuarterStartDate() + "' and quotaDate <= '" + getQuarterEndDate() + "';";
				}else if(this.index2==2){//本年
					this.linkageFilter = "quotaDate >= '" + getYearStartDate() + "' and quotaDate <= '" + getYearEndDate() + "';";
				}
				bigDataAPI.getTemplateData({viewCodeStr: "VIEW_13_0007",linkageFilter:this.linkageFilter})
			},
			btnClick1:function(idx){
				this.index1 = idx;
				this.refreshData();

+ 1 - 0
page/bigData/html/home.html

@ -104,6 +104,7 @@
		<script src="../../../js/bootstrap.min.js"></script>
		<script src="../../../js/es6-promise.js"></script>
		<script src="../../../js/underscore.js"></script>
		<script src="../../../js/util.js"></script>
		<script src="../../../js/plugins/layer/layer.min.js"></script>
		<script src="../../../js/api/http-request.js"></script>
		<script src="../../../js/api/bigData-api.js"></script>

+ 16 - 16
page/bigData/html/medical.html

@ -202,19 +202,19 @@
									<td>
										<div>
											<span class="mr10">{{item.HC_05_1001}}元</span>
											<span class="mr20">环比</span>
											<img v-if="item['门急诊总费用环比'] >1" src="../images/zengzhang.png">
											<img v-else src="../images/xiajiang.png">
											<span>{{item['门急诊总费用环比']}}%</span>
											<span v-show="item.HC_14_1025!='--'" class="mr20">环比</span>
											<img v-show="item.HC_14_1025!='--' && item.HC_14_1025>1" src="../images/zengzhang.png">
											<img v-show="item.HC_14_1025!='--' && item.HC_14_1025<1" src="../images/xiajiang.png">
											<span v-show="item.HC_14_1025!='--'">{{item.HC_14_1025}}%</span>
										</div>
									</td>
									<td>
										<div>
											<span class="mr10">{{item.HC_05_1003}}元</span>
											<span class="mr20">环比</span>
											<img v-if="item['门急诊次均费用环比'] >1" src="../images/zengzhang.png">
											<img v-else src="../images/xiajiang.png">
											<span>{{item['门急诊次均费用环比']}}%</span>
											<span v-show="item.HC_14_1026!='--'" class="mr20">环比</span>
											<img v-show="item.HC_14_1026!='--' && item.HC_14_1026>1" src="../images/zengzhang.png">
											<img v-show="item.HC_14_1026!='--' && item.HC_14_1026<1" src="../images/xiajiang.png">
											<span v-show="item.HC_14_1026!='--'">{{item.HC_14_1026}}%</span>
										</div>
									</td>
								</tr>
@ -248,19 +248,19 @@
									<td>
										<div>
											<span class="mr10">{{parseInt(item.HC_06_1014)}}元</span>
											<span class="mr20">环比</span>
											<img v-if="item['住院总费用环比'] >1" src="../images/zengzhang.png">
											<img v-else src="../images/xiajiang.png">
											<span>{{item['住院总费用环比']}}%</span>
											<span v-show="item.HC_14_1027!='--'" class="mr20">环比</span>
											<img v-show="item.HC_14_1027!='--' && item.HC_14_1027>1" src="../images/zengzhang.png">
											<img v-show="item.HC_14_1027!='--' && item.HC_14_1027<1" src="../images/xiajiang.png">
											<span v-show="item.HC_14_1027!='--'">{{item.HC_14_1027}}%</span>
										</div>
									</td>
									<td>
										<div>
											<span class="mr10">{{item.HC_06_1022}}元</span>
											<span class="mr20">环比</span>
											<img v-if="item['住院次均费用环比'] >1" src="../images/zengzhang.png">
											<img v-else src="../images/xiajiang.png">
											<span>{{item['住院次均费用环比']}}%</span>
											<span v-show="item.HC_14_1028!='--'" class="mr20">环比</span>
											<img v-show="item.HC_14_1028!='--' && item.HC_14_1028>1" src="../images/zengzhang.png">
											<img v-show="item.HC_14_1028!='--' && item.HC_14_1028<1" src="../images/xiajiang.png">
											<span v-show="item.HC_14_1028!='--'">{{item.HC_14_1028}}%</span>
										</div>
									</td>
								</tr>

+ 5 - 3
page/bigData/js/home.js

@ -27,9 +27,11 @@ new Vue({
    		$(".div-mask-layer").hide();
    		var reqUrl = [{url: bigDataAPI.getCityArea,reqType: 'get',data: {}},
    		{url:bigDataAPI.getMapJingWeiDuInfo,reqType: 'get',data:{}},//上饶地图经纬度数据
    		{url: bigDataAPI.getNoChartTemplateData,reqType: 'get',data: {viewCodeStr: "VIEW_14_0012"}},//地图数据
    		{url: bigDataAPI.getNoChartTemplateData,reqType: 'get',data: {viewCodeStr: "VIEW_13_0026"}},//地图数据
    		{url: bigDataAPI.getNoChartTemplateData,reqType: 'get',data: {viewCodeStr: "VIEW_13_0027"}},//按月环比糖尿病患者人数
    		];
    		httpRequest.getReqPromises(reqUrl).then(function(datas) {
    			debugger
    			vm.town = [{
					"name": "上饶市",
					"id": "0"
@ -40,11 +42,11 @@ new Vue({
    	},
    	setMapData: function(data) {
			var optionData = [];
			_.map(data.obj.VIEW_14_0012, function(item) {
			_.map(data.obj.VIEW_13_0026, function(item) {
				if(item.firstColumn != "合计") {
					optionData.push({
						name: item.townName,
						value: parseInt(item.HC_14_1019)
						value: parseInt(item.HC_13_0017)
					})
				}
			})

+ 2 - 2
page/bigData/js/medical.js

@ -28,13 +28,13 @@ new Vue({
		yesterdayDate:""//昨天
	},
	mounted: function() {
		this.formatDate2017(); //格式化时间
		this.initData();
	},
	methods: {
		initData: function() {
			$(".div-mask-layer").show();
			var vm = this,data1, data2, data3, data4, data5, data6, data7, data8;
			this.formatDate2017(); //格式化时间
			this.town.map(function(v, i) {
				if(v.name == vm.city) {
					vm.cityVal = v.id;
@ -188,6 +188,7 @@ new Vue({
					resData.push(item)
				}
			})
			debugger
			this.tableData1 = resData
		},
		setTable2: function(data5) {
@ -262,7 +263,6 @@ new Vue({
		    return oYear + str + oMoth + str + oDay;
		},
		formatDate2017: function() {
			debugger
			//获取上个月第一天
			var firstdate = new Date(new Date().getFullYear()-1, new Date().getMonth() - 1, 1);
			//获取上个月最后一天