people
.success(function(data){
$scope.peopleList = data;
$scope.inHospitalCount = 0;
$scope.sickRoomCount = 0;
$scope.icuCount = 0;
$scope.seriousInjuredCount = 0;
$scope.mediumInjuredCount = 0;
$scope.slightInjuredCount = 0;
$scope.sum = data.data.length;
$scope.hospitalList = [];
angular.forEach(data.data, function(obj) {
var hospital = {"收治單位": "", "重傷": 0
, "中傷": 0, "輕傷": 0,"加護病房": 0,
"一般病房": 0, "其他": 0, "sum": 0};
var addHospital = true;
for (var i=0;i<$scope.hospitalList.length;i++){
if ($scope.hospitalList[i]["收治單位"] == obj["收治單位"]){
addHospital = false;
break;
}
}
if (addHospital == true) {
hospital["收治單位"] = obj["收治單位"];
$scope.hospitalList.push(hospital);
}
var currentHospital;
for (var i=0;i<$scope.hospitalList.length;i++){
if ($scope.hospitalList[i]["收治單位"] == obj["收治單位"]){
currentHospital = $scope.hospitalList[i];
}
}
switch(obj["即時動向"]){
case '出院':
break;
case '一般病房':
$scope.inHospitalCount++;
$scope.sickRoomCount++;
currentHospital["一般病房"]++;
break;
case '自動出院(AAD)':
break;
case '加護病房':
$scope.inHospitalCount++;
$scope.icuCount++;
currentHospital["加護病房"]++;
break;
case '其他':
$scope.inHospitalCount++;
currentHospital["其他"]++;
break;
case '死亡':
$scope.inHospitalCount++;
break;
case '轉院':
$scope.inHospitalCount++;
break;
}
switch(obj["救護檢傷"]){
case '重傷':
$scope.seriousInjuredCount++;
currentHospital["重傷"]++;
currentHospital["sum"]++;
$scope.count1++;
break;
case '中傷':
$scope.mediumInjuredCount++;
currentHospital["中傷"]++;
currentHospital["sum"]++;
$scope.count2++;
break;
case '輕傷':
$scope.slightInjuredCount++;
currentHospital["輕傷"]++;
currentHospital["sum"]++;
$scope.count3++;
break;
}
});
})
.error(function(err){
console.log('people-error:' + err);
});