Last active
June 26, 2016 17:27
-
-
Save laocanio/93675ddf96a1bac4a1a0bd000b0af117 to your computer and use it in GitHub Desktop.
PLACE2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ionic Starter App | |
// angular.module is a global place for creating, registering and retrieving Angular modules | |
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html) | |
// the 2nd parameter is an array of 'requires' | |
// 'starter.services' is found in services.js | |
// 'starter.controllers' is found in controllers.js | |
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services','jett.ionic.filter.bar']) | |
.run(function($ionicPlatform) { | |
$ionicPlatform.ready(function() { | |
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard | |
// for form inputs) | |
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) { | |
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); | |
cordova.plugins.Keyboard.disableScroll(true); | |
} | |
if (window.StatusBar) { | |
// org.apache.cordova.statusbar required | |
StatusBar.styleDefault(); | |
} | |
}); | |
}) | |
.config(function($stateProvider, $urlRouterProvider) { | |
// Ionic uses AngularUI Router which uses the concept of states | |
// Learn more here: https://github.com/angular-ui/ui-router | |
// Set up the various states which the app can be in. | |
// Each state's controller can be found in controllers.js | |
$stateProvider | |
// setup an abstract state for the tabs directive | |
.state('tab', { | |
url: '/tab', | |
abstract: true, | |
templateUrl: 'templates/tabs.html' | |
}) | |
// Each tab has its own nav history stack: | |
.state('tab.guardarpaciente', { | |
url: '/guardarpaciente', | |
views: { | |
'tab-dash': { | |
templateUrl: 'templates/tab-guardarpaciente.html', | |
controller: 'GuardarPacienteCtrl' | |
} | |
} | |
}) | |
.state('tab.listarpaciente', { | |
url: '/listarpaciente', | |
views: { | |
'tab-chats': { | |
templateUrl: 'templates/tab-listarpaciente.html', | |
controller: 'ListarPacienteCtrl' | |
} | |
} | |
}) | |
.state('tab.paciente-detalles', { | |
url: '/listarpaciente/:paciente', | |
views: { | |
'tab-chats': { | |
templateUrl: 'templates/paciente-detalles.html', | |
controller: 'PacientesDetaCtrl' | |
} | |
} | |
}) | |
; | |
// if none of the above states are matched, use this as the fallback | |
$urlRouterProvider.otherwise('/tab/listarpaciente'); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('starter.controllers', []) | |
.controller ('GuardarPacienteCtrl', function($scope,$state, Paciente){ | |
$scope.paciente= | |
{ | |
nombre : '', | |
apellidos:'', | |
edad:'', | |
peso:'', | |
estatura:'' | |
}; | |
//button guardarpaciente | |
$scope.guardarPaciente= function(){ | |
Paciente.save($scope.paciente) | |
console.log($scope.paciente.nombre); | |
//$state.go("tab.paciente-detalles", {'paciente': $scope.paciente.nombre}) | |
$scope.paciente = {} | |
} | |
}) | |
.controller ('ListarPacienteCtrl', function($scope,$ionicListDelegate,$ionicFilterBar, Paciente){ | |
$scope.pacientes = Paciente.all() | |
$scope.listCanSwipe = true; | |
$scope.data = { | |
showDelete: false | |
}; | |
$scope.onpacienteDelete = function(paciente) { | |
console.log(paciente.nombre) | |
Paciente.remove(paciente) | |
}; | |
$scope.showFilterBar = function () { | |
$ionicFilterBar.show({ | |
items: $scope.pacientes, | |
update: function (filteredItems) { | |
$scope.pacientes = filteredItems; | |
}, | |
}); | |
}; | |
}) | |
.controller('PacientesDetaCtrl', function($scope,$ionicModal, $state, $stateParams, Paciente, Diagnostico) { | |
$scope.paciente = Paciente.get($stateParams.paciente); | |
$scope.problema = Diagnostico.get($stateParams.problema); | |
$scope.problema = Diagnostico.get($stateParams.problemaId); | |
$scope.item = null | |
$scope.problema = Diagnostico.all() | |
$ionicModal.fromTemplateUrl('ventana-modificar.html',{ | |
scope:$scope, | |
animation:'slide-in-up', | |
}).then(function(modal){ | |
$scope.modal=modal; | |
}); | |
$scope.modificarPaciente=function(){ | |
$scope.modal.show(); | |
}; | |
$scope.cerrarModificacion=function(){ | |
$scope.modal.hide(); | |
Paciente.update($scope.paciente) | |
}; | |
$ionicModal.fromTemplateUrl('ventana-diagnostico.html', { | |
scope: $scope, | |
animation: 'slide-in-up' | |
}).then(function (modal) { | |
$scope.modal_2= modal; | |
}); | |
$scope.diagnosticoPaciente=function(){ | |
$scope.modal_2.show(); | |
}; | |
$scope.cerrarDiagnostico=function(){ | |
$scope.modal_2.hide(); | |
}; | |
$ionicModal.fromTemplateUrl('ventana-estado.html', { | |
scope: $scope, | |
animation: 'slide-in-up' | |
}).then(function (modal) { | |
$scope.modal_3= modal; | |
}); | |
$scope.estadoPaciente=function(){ | |
$scope.modal_3.show(); | |
}; | |
$scope.selectAction= function() { | |
console.log($scope.item); | |
}; | |
$scope.selectActionn= function(item) { | |
if($scope.item.id==1){ | |
return itemm.subgroup['1']; | |
} | |
}; | |
$scope.cerrarEstado=function(){ | |
$scope.modal_3.hide(); | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> | |
<title></title> | |
<link href="lib/ionic/css/ionic.css" rel="stylesheet"> | |
<link href="css/style.css" rel="stylesheet"> | |
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above | |
<link href="css/ionic.app.css" rel="stylesheet"> | |
--> | |
<!-- ionic/angularjs js --> | |
<script src="lib/ionic/js/ionic.bundle.js"></script> | |
<!-- cordova script (this will be a 404 during development) --> | |
<script src="cordova.js"></script> | |
<!-- your app's js --> | |
<script src="js/app.js"></script> | |
<script src="js/controllers.js"></script> | |
<script src="js/services.js"></script> | |
<script src="lib/ngstorage/ngStorage.min.js"></script> | |
<link href="lib/ionic-filter-bar/dist/ionic.filter.bar.min.css" rel="stylesheet"> | |
<script src="lib/ionic-filter-bar/dist/ionic.filter.bar.min.js"></script> | |
</head> | |
<body ng-app="starter"> | |
<!-- | |
The nav bar that will be updated as we navigate between views. | |
--> | |
<ion-nav-bar class="bar-stable"> | |
<ion-nav-back-button> | |
</ion-nav-back-button> | |
</ion-nav-bar> | |
<!-- | |
The views will be rendered in the <ion-nav-view> directive below | |
Templates are in the /templates folder (but you could also | |
have templates inline in this html file if you'd like). | |
--> | |
<ion-nav-view></ion-nav-view> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view view-title="{{paciente.nombre}}"> | |
<ion-content class="padding"> | |
<ion-list> | |
<p> | |
Nombre: {{paciente.nombre}}</p> | |
<p> | |
Apellidos: {{paciente.apellidos}}</p> | |
<p> | |
Edad: {{paciente.edad}}</p> | |
<p> | |
Estatura: {{paciente.estatura}}</p> | |
<p> | |
Peso: {{paciente.peso}}</p> | |
<p> | |
Servicio: {{paciente.servicios}} | |
</p> | |
</ion-list> | |
<label class="item item-input" > | |
<button class="button ion-network" ng-click="modificarPaciente()"> Modificar Paciente </button> | |
</label> | |
<br> | |
<label class="item item-input" > | |
<button class="button ion-network" ng-click="diagnosticoPaciente()"> Diagnóstico </button> | |
</label> | |
<br> | |
<label class="item item-input" > | |
<button class="button ion-network" ng-click="estadoPaciente()"> Estado </button> | |
</label> | |
<br> | |
<br> | |
</ion-content> | |
</ion-view> | |
<script id="ventana-modificar.html" type="text/ng-template"> | |
<div class="modal"> | |
<ion-header-bar> | |
<h1 class="title">Editar paciente</h1> | |
</ion-header-bar> | |
<ion-content class="padding"> | |
<div class="list"> | |
<label class="item item-input"> | |
<input type="text" placeholder="Nombre" ng-model="paciente.nombre"> | |
</label> <br> | |
<label class="item item-input"> | |
<input type="text" placeholder="Apellidos" ng-model="paciente.apellidos"> | |
</label> <br> | |
<label class="item item-input"> | |
<input type="number" placeholder="Edad" ng-model="paciente.edad"> | |
</label> <br> | |
<label class="item item-input"> | |
<input type="number" placeholder="Peso" ng-model="paciente.peso"> | |
</label><br> | |
<label class="item item-input"> | |
<input type="number" placeholder="Estatura" ng-model="paciente.estatura"> | |
</label><br> | |
<label class="item item-input" placeholder="Servicio"> | |
<input type="text" placeholder="Servicio"> | |
<select class="ion-input-select--large" ng-model="paciente.servicios"> | |
<option> Ginecología</option> | |
<option> Pediatría Obst.</option> | |
<option>Cirugia y Traumatología</option> | |
<option>Medicina Interna</option> | |
<option>UCIN</option> | |
<option>UCIA</option> | |
<option>Terapia Intermedia</option> | |
<option>Urgencias Adultos</option> | |
<option>Urgencias Pediátricas</option> | |
<option>Oncología</option> | |
<option>Diálisis</option> | |
<option>Hemodiálisis</option> | |
<option>Recuperación</option> | |
</select> | |
</label><br> | |
<label class="item item-input" > | |
<button class="button ion-person-add" ng-click="cerrarModificacion()"> Modificar </button> | |
</div> | |
</ion-content> | |
</ion-content> | |
</div> | |
</script> | |
<script id="ventana-diagnostico.html" type="text/ng-template"> | |
<div class="modal" > | |
<ion-header-bar> | |
<h1 class="title">Diagnostico del paciente</h1> | |
</ion-header-bar> | |
<ion-content class="padding"> | |
<div class="list" > | |
<label class="item item-input" placeholder="Problema"> | |
<input type="text" placeholder="Problema"> | |
<select class="ion-input-select--large" ng-model="item" ng-change="selectAction()" | |
ng-options="values as values.nombrep group by value.groupp for values in problema"> | |
</select> | |
</label> | |
<br> | |
<label class="item item-input"> | |
<input type="text" placeholder="Factores relacionados" > | |
</label> | |
<br> | |
{{item.nombrep}} | |
<br> | |
<br> | |
<br> | |
<label class="item item-input" placeholder="Causas"> | |
<select class="ion-input-select--large" ng-change="selectActionn()" ng-model="itemm" | |
ng-options="value.id as value.nombrec group by value.subgroup for value in causas"> | |
> | |
</select> | |
</label> | |
<br> | |
<label class="item item-input"> | |
<input type="text" placeholder="Caracteristicas definitorias" ng-model="paciente.caracteristicas"> | |
</label> <br> | |
<label class="item item-input" > | |
<input type="text" placeholder="Indicador" value=Indicador > | |
</label> | |
<br> | |
<input type="range" name="volume" min="1" max="5" ng-model="paciente.indicador"> | |
<br> | |
valor: {{paciente.indicador}} | |
<br> | |
<label class="item item-input" > | |
<button class="button ion-person-add" ng-click="cerrarDiagnostico()"> Aplicar </button> | |
</label> | |
</ion-content> | |
</div> | |
</script> | |
<script id="ventana-estado.html" type="text/ng-template"> | |
<div class="modal"> | |
<ion-header-bar> | |
<h1 class="title" >Estado del paciente</h1> | |
</ion-header-bar> | |
<ion-content class="padding"> | |
<div class="list" > | |
{{data}} | |
{{item.nombrep}} | |
<br> | |
{{problemas.name}} | |
<br> | |
Factores Relacionados: | |
<br> | |
<br> | |
Caracteristicass definitorias: {{paciente.caracteristicas}} | |
<br> | |
<br> | |
Indicador: {{paciente.indicador}} | |
<br> | |
<label class="item item-input" > | |
<button class="button ion-person-add" ng-click="cerrarEstado()"> Cerrar Estado </button> | |
</label> | |
</ion-content> | |
</div> | |
</script> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('starter.services', ['ngStorage']) | |
.factory('Paciente', function($localStorage) { | |
// Might use a resource here that returns a JSON array | |
// Some fake testing data | |
return { | |
all: function() { | |
return $localStorage.pacientes; | |
}, | |
save: function(paciente) { | |
if(!$localStorage.pacientes){ | |
$localStorage.pacientes = [] | |
} | |
$localStorage.pacientes.push(paciente); | |
}, | |
newProject: function(pacientes) { | |
// Add a new project | |
return { | |
name: '' | |
}; | |
}, | |
get: function(nombrePaciente) { | |
for (var i = 0; i < $localStorage.pacientes.length; i++) { | |
if ($localStorage.pacientes[i].nombre === nombrePaciente) { | |
return $localStorage.pacientes[i]; | |
} | |
} | |
return null; | |
}, update: function(paciente) { | |
var id_paciente = $localStorage.pacientes.indexOf(paciente) | |
$localStorage.pacientes[id_paciente] = paciente | |
}, | |
search: function(nombrePaciente) { | |
for (var i = 0; i < $localStorage.pacientes.length; i++) { | |
if ($localStorage.pacientes[i].nombre === nombrePaciente) { | |
return $localStorage.pacientes[i]; | |
} | |
} | |
}, | |
remove: function(paciente) { | |
$localStorage.pacientes.splice($localStorage.pacientes.indexOf(paciente), 1) | |
} | |
} | |
}) | |
.factory('Diagnostico', function() { | |
// Might use a resource here that returns a JSON array | |
// Some fake testing data | |
var problema = [ | |
{ | |
id: 1, | |
nombrep: "Proteccion ineficaz", | |
groupp: '1' | |
}, { | |
id: 2, | |
nombrep: "Deficit de autocuidado", | |
groupp:'1' | |
}, | |
]; | |
var item={} | |
return { | |
all: function() { | |
return problema; | |
},setItem : function(data){ | |
this.problema=item; | |
item = data; | |
},getItem: function(){ return item;} | |
,get: function(problemaId) { | |
for (var i = 0; i < problema.length; i++) { | |
if (problema[i].id === parseInt(problemaId)) { | |
return problema[i]; | |
} | |
} | |
return null; | |
} | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view view-title="Agregar Paciente"> | |
<ion-content class="padding"> | |
<div class="list"> | |
<label class="item item-input"> | |
<input type="text" placeholder="Nombre" ng-model="paciente.nombre"> | |
</label> <br> | |
<label class="item item-input"> | |
<input type="text" placeholder="Apellidos" ng-model="paciente.apellidos"> | |
</label> <br> | |
<label class="item item-input"> | |
<input type="number" placeholder="Edad" ng-model="paciente.edad"> | |
</label> <br> | |
<label class="item item-input"> | |
<input type="number" placeholder="Peso" ng-model="paciente.peso"> | |
</label><br> | |
<label class="item item-input" placeholder="Servicio"> | |
<input type="text" placeholder="Servicio"> | |
<select class="ion-input-select--large" ng-model="paciente.servicios"> | |
<option> Ginecología</option> | |
<option> Pediatría Obst.</option> | |
<option>Cirugia y Traumatología</option> | |
<option>Medicina Interna</option> | |
<option>UCIN</option> | |
<option>UCIA</option> | |
<option>Terapia Intermedia</option> | |
<option>Urgencias Adultos</option> | |
<option>Urgencias Pediátricas</option> | |
<option>Oncología</option> | |
<option>Diálisis</option> | |
<option>Hemodiálisis</option> | |
<option>Recuperación</option> | |
</select> | |
</label><br> | |
<label class="item item-input"> | |
<input type="number" placeholder="Estatura" ng-model="paciente.estatura"> | |
</label><br> | |
<label class="item item-input" > | |
<button class="button ion-person-add" ng-click="guardarPaciente()"> Agregar </button> | |
</label> | |
</div> | |
</ion-content> | |
</ion-view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view view-title="Lista de pacientes"> | |
<ion-nav-buttons side="right"> | |
<div class="buttons"> | |
<button class="button button-icon icon ion-ios-minus-outline" | |
ng-click="data.showDelete = !data.showDelete"> </button> | |
<button class="button button-icon ion-android-search" placeholder="Buscar" ng-click="showFilterBar()"></button> | |
</div> | |
</ion-nav-buttons> | |
<ion-content > | |
<ion-list show-delete="data.showDelete" type="item-text-wrap" can-swipe="listCanSwipe"> | |
<ion-item ng-repeat="paciente in pacientes" | |
href="#/tab/listarpaciente/{{paciente.nombre}}"> | |
<p> {{paciente.nombre}}</p> | |
<p>{{paciente.apellidos}}</p> | |
<ion-delete-button class="ion-minus-circled" | |
ng-click="onpacienteDelete(paciente)"> | |
</ion-delete-button> | |
</ion-item> | |
</ion-content> | |
</ion-view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Create tabs with an icon and label, using the tabs-positive style. | |
Each tab's child <ion-nav-view> directive will have its own | |
navigation history that also transitions its views in and out. | |
--> | |
<ion-tabs class="tabs-icon-top tabs-color-active-positive"> | |
<!-- Dashboard Tab --> | |
<ion-tab title="" icon-off="ion-person-add" | |
icon-on="ion-person-add" | |
href="#/tab/guardarpaciente" | |
> | |
<ion-nav-view name="tab-dash"> </ion-nav-view name="tab-dash"> | |
</ion-tab> | |
<!-- Buscar paciente--> | |
<ion-tab title="" | |
icon-off="ion-search" | |
icon-on="ion-search" | |
href="#/tab/listarpaciente"> | |
<ion-nav-view name="tab-chats"> </ion-nav-view name="tab-chats"> | |
</ion-tab> | |
</ion-tabs> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment