Angel #8
|
@ -3,20 +3,7 @@
|
|||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State>
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="ZX1D9224Q7" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2024-05-08T23:05:47.315686700Z" />
|
||||
</State>
|
||||
<State />
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
|
|
|
@ -51,6 +51,7 @@ dependencies {
|
|||
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.1")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
|
||||
implementation("androidx.navigation:navigation-fragment-ktx:2.6.0")
|
||||
implementation("com.dmitryborodin:pdfview-android:1.1.0")
|
||||
implementation("androidx.navigation:navigation-ui-ktx:2.6.0")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
|
|
|
@ -15,6 +15,15 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MedicalHealth"
|
||||
tools:targetApi="31" >
|
||||
<activity
|
||||
android:name=".PacienteActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ModificarRecetaActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".PacientePrincipalActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".EliminarRecetaActivity"
|
||||
android:exported="false" />
|
||||
|
@ -29,7 +38,7 @@
|
|||
android:name=".RegistrarDActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name="Reports.ConsultarPacientesActivity"
|
||||
android:name=".reports.ConsultarPacientesActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".EliminarActivity"
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
package Data
|
||||
|
||||
data class Receta(val NombrePaciente : String, val edadPaciente : Int, val pesoPaciente: Double, val nombreMedicamento : String, val fecha : String, val dosis : String, val duracion :String)
|
|
@ -1,7 +1,7 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import Adapters.DoctorDataBaseHelper
|
||||
import Data.Paciente
|
||||
import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.data.Paciente
|
||||
import android.R
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
|
@ -30,8 +30,7 @@ class AgregarActivity : AppCompatActivity() {
|
|||
binding.btnConfirmar.setOnClickListener {
|
||||
//db.crearTablaPacientes()
|
||||
agregarPaciente()
|
||||
val intent = Intent(this@AgregarActivity, EliminarActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
private fun agregarPaciente() {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import Adapters.DoctorDataBaseHelper
|
||||
import Adapters.PacienteAdapter
|
||||
import Data.Paciente
|
||||
import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.adapters.PacienteAdapter
|
||||
import com.terratenientes.medicalhealth.data.Paciente
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -38,6 +39,12 @@ class EliminarActivity : AppCompatActivity() {
|
|||
Toast.makeText(this, "Por favor, selecciona un paciente para eliminar.", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
binding.btnCancelar.setOnClickListener {
|
||||
val intent = Intent(this@EliminarActivity, PrincipalActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private fun cargarListaPacientes() {
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import Adapters.RecetaAdapter
|
||||
import Adapters.RecetaDataBaseHelper
|
||||
import Data.Receta
|
||||
import com.terratenientes.medicalhealth.adapters.RecetaAdapter
|
||||
import com.terratenientes.medicalhealth.adapters.RecetaDataBaseHelper
|
||||
import android.content.Intent
|
||||
import com.terratenientes.medicalhealth.data.Receta
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.terratenientes.medicalhealth.databinding.ActivityEliminarPacienteBinding
|
||||
import com.terratenientes.medicalhealth.databinding.ActivityEliminarRecetaBinding
|
||||
import android.widget.ListView
|
||||
|
||||
|
||||
class EliminarRecetaActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var binding: ActivityEliminarRecetaBinding
|
||||
private lateinit var dbReceta: RecetaDataBaseHelper
|
||||
private lateinit var recetaAdapter: RecetaAdapter
|
||||
private var recetaSeleccionada: Receta? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -28,30 +25,41 @@ class EliminarRecetaActivity : AppCompatActivity() {
|
|||
|
||||
dbReceta = RecetaDataBaseHelper(this)
|
||||
|
||||
// Configurar el ListView y el adaptador
|
||||
val recetas = obtenerListaRecetas()
|
||||
recetaAdapter = RecetaAdapter(this, recetas)
|
||||
binding.listaRecetas.adapter = recetaAdapter
|
||||
cargarListaRecetas()
|
||||
|
||||
binding.listaRecetas.setOnItemClickListener { _, _, position, _ ->
|
||||
recetaSeleccionada = recetaAdapter.getItem(position)
|
||||
}
|
||||
|
||||
// Manejar el evento de clic en el botón para eliminar receta
|
||||
binding.btnEliminarReceta.setOnClickListener {
|
||||
val posicionSeleccionada = binding.listaRecetas.selectedItemPosition
|
||||
if (posicionSeleccionada != ListView.INVALID_POSITION) {
|
||||
val recetaSeleccionada = recetas[posicionSeleccionada]
|
||||
eliminarReceta(recetaSeleccionada)
|
||||
recetaAdapter.remove(recetaSeleccionada)
|
||||
if (recetaSeleccionada != null) {
|
||||
eliminarReceta(recetaSeleccionada!!)
|
||||
cargarListaRecetas()
|
||||
Toast.makeText(this, "Receta eliminada correctamente", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
Toast.makeText(this, "Por favor, seleccione una receta para eliminar", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
binding.btnCancelarr.setOnClickListener {
|
||||
val intent = Intent(this@EliminarRecetaActivity, PrincipalActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun cargarListaRecetas() {
|
||||
val recetas = obtenerListaRecetas()
|
||||
recetaAdapter = RecetaAdapter(this, recetas)
|
||||
binding.listaRecetas.adapter = recetaAdapter
|
||||
}
|
||||
|
||||
private fun obtenerListaRecetas(): List<Receta> {
|
||||
return dbReceta.obtenerTodasRecetas() // Implementa este método en tu RecetaDataBaseHelper para obtener todas las recetas
|
||||
return dbReceta.obtenerTodasRecetas()
|
||||
}
|
||||
|
||||
private fun eliminarReceta(receta: Receta) {
|
||||
dbReceta.eliminarReceta(receta) // Implementa este método en tu RecetaDataBaseHelper para eliminar una receta
|
||||
dbReceta.eliminarReceta(receta)
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import Adapters.DoctorDataBaseHelper
|
||||
import Data.Doctor
|
||||
import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.data.Doctor
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -19,11 +19,20 @@ class MainActivity : AppCompatActivity() {
|
|||
setContentView(view)
|
||||
|
||||
db = DoctorDataBaseHelper(this@MainActivity)
|
||||
//db.createTable()
|
||||
binding.btnIniciarSesion.setOnClickListener {
|
||||
var res=db.validarDatos(binding.tvUsuario.text.toString(),binding.tvContrasena.text.toString())
|
||||
var resPaciente = db.validarDatosPaciente(binding.tvUsuario.text.toString(), binding.tvContrasena.text.toString())
|
||||
if(res==true){
|
||||
Toast.makeText(this@MainActivity,"VALIDADO",Toast.LENGTH_LONG).show()
|
||||
val intent = Intent(this@MainActivity, PrincipalActivity::class.java)
|
||||
//intent.putExtra("IDPaciente",binding.tvUsuario.text.toString())
|
||||
intent.putExtra("Cedula", binding.tvUsuario.text.toString())
|
||||
startActivity(intent)
|
||||
}else if(resPaciente==true){
|
||||
Toast.makeText(this@MainActivity,"VALIDADO",Toast.LENGTH_LONG).show()
|
||||
val intent = Intent(this@MainActivity, PacientePrincipalActivity::class.java)
|
||||
intent.putExtra("IDPaciente",binding.tvContrasena.text.toString())
|
||||
startActivity(intent)
|
||||
}else{
|
||||
Toast.makeText(this@MainActivity," NO VALIDADO",Toast.LENGTH_LONG).show()
|
||||
|
@ -33,6 +42,8 @@ class MainActivity : AppCompatActivity() {
|
|||
val intent = Intent(this@MainActivity, RegistrarDActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@SuppressLint("SuspiciousIndentation")
|
||||
private fun cargarDatos(){
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import Adapters.DoctorDataBaseHelper
|
||||
import Data.Paciente
|
||||
import Reports.ConsultarPacientesActivity
|
||||
import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.data.Paciente
|
||||
import com.terratenientes.medicalhealth.reports.ConsultarPacientesActivity
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
|
@ -35,8 +35,6 @@ class ModificarActivity : AppCompatActivity() {
|
|||
paciente.domicilio = binding.etDomicilio.text.toString()
|
||||
db.modificarPaciente(paciente)
|
||||
finish()
|
||||
intent = Intent(this@ModificarActivity, ConsultarPacientesActivity::class.java)
|
||||
startActivity(intent)
|
||||
Toast.makeText(this@ModificarActivity, "Información Actualizada UwU", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import com.terratenientes.medicalhealth.adapters.RecetaDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.data.Receta
|
||||
import com.terratenientes.medicalhealth.databinding.ActivityModificarRecetaBinding
|
||||
|
||||
class ModificarRecetaActivity : AppCompatActivity() {
|
||||
lateinit var binding : ActivityModificarRecetaBinding
|
||||
lateinit var receta : Receta
|
||||
lateinit var db : RecetaDataBaseHelper
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityModificarRecetaBinding.inflate(layoutInflater)
|
||||
val view = binding.root
|
||||
setContentView(view)
|
||||
db = RecetaDataBaseHelper(this@ModificarRecetaActivity)
|
||||
receta = Receta(intent.getStringExtra("NombrePaciente").toString(),intent.getStringExtra("EdadPaciente").toString().toInt(),intent.getStringExtra("PesoPaciente").toString().toDouble(),intent.getStringExtra("NombreMedicamento").toString(),intent.getStringExtra("Fecha").toString(),intent.getStringExtra("Dosis").toString(), intent.getStringExtra("Duracion").toString())
|
||||
llenarCampos(receta)
|
||||
binding.btnModificarReceta.setOnClickListener {
|
||||
modificarReceta(receta)
|
||||
}
|
||||
}
|
||||
|
||||
private fun modificarReceta(receta : Receta) : Unit {
|
||||
Log.i("Info Recibida", receta.toString())
|
||||
receta.edadPaciente = binding.etEdadPaciente.text.toString().toInt()
|
||||
receta.pesoPaciente = binding.etPesoPaciente.text.toString().toDouble()
|
||||
receta.nombreMedicamento = binding.etRecetaMedicamento.text.toString()
|
||||
receta.fecha = binding.etFecha.text.toString()
|
||||
receta.dosis = binding.etDosisMedicamento.text.toString()
|
||||
receta.duracion = binding.etDuracion.text.toString()
|
||||
db.modificarReceta(receta)
|
||||
Log.i("Info Actualizada", receta.toString())
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun llenarCampos(receta : Receta) : Unit {
|
||||
binding.tvNombrePaciente.setText(receta.NombrePaciente)
|
||||
binding.etEdadPaciente.setText(receta.edadPaciente.toString())
|
||||
binding.etPesoPaciente.setText(receta.pesoPaciente.toString())
|
||||
binding.etRecetaMedicamento.setText(receta.nombreMedicamento)
|
||||
binding.etFecha.setText(receta.fecha)
|
||||
binding.etDosisMedicamento.setText(receta.dosis)
|
||||
binding.etDuracion.setText(receta.duracion)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.terratenientes.medicalhealth.adapters.CellClickListener
|
||||
import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.adapters.PacienteViewAdapter
|
||||
import com.terratenientes.medicalhealth.adapters.RecetaDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.adapters.RecetaViewAdapter
|
||||
import com.terratenientes.medicalhealth.data.Paciente
|
||||
import com.terratenientes.medicalhealth.data.Receta
|
||||
import com.terratenientes.medicalhealth.databinding.ActivityPacienteBinding
|
||||
|
||||
class PacienteActivity : AppCompatActivity(), CellClickListener {
|
||||
lateinit var binding : ActivityPacienteBinding
|
||||
private var idPaciente : String =""
|
||||
private lateinit var db: DoctorDataBaseHelper
|
||||
private lateinit var recycleAdapter : PacienteViewAdapter
|
||||
private lateinit var pacientes : List<Paciente>
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityPacienteBinding.inflate(layoutInflater)
|
||||
val view = binding.root
|
||||
setContentView(view)
|
||||
db = DoctorDataBaseHelper(this@PacienteActivity)
|
||||
pacientes = db.obtenerPacientes()
|
||||
recycleAdapter = PacienteViewAdapter(pacientes, this@PacienteActivity, this@PacienteActivity)
|
||||
binding.rvPacientes.layoutManager = LinearLayoutManager(this)
|
||||
binding.rvPacientes.adapter = recycleAdapter
|
||||
Log.i("Pacientes", pacientes.toString())
|
||||
binding.ivAgregarPaciente.setOnClickListener {
|
||||
val intent = Intent(this@PacienteActivity, AgregarActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
recycleAdapter.refreshData(db.obtenerPacientes())
|
||||
}
|
||||
|
||||
override fun onCellClickListener(position: Int) {
|
||||
}
|
||||
|
||||
override fun onEliminarClickListener(position: Int) {
|
||||
val paciente = pacientes[position]
|
||||
Log.i("Paciente Elim", paciente.toString())
|
||||
db.eliminarPaciente(paciente.id)
|
||||
recycleAdapter.refreshData(db.obtenerPacientes())
|
||||
}
|
||||
|
||||
override fun onModifyClickListener(position: Int) {
|
||||
val paciente = pacientes[position]
|
||||
val intent = Intent(this@PacienteActivity, ModificarActivity::class.java)
|
||||
intent.putExtra("Id", paciente.id)
|
||||
intent.putExtra("Nombre Paciente", paciente.nombre)
|
||||
intent.putExtra("Apellido Paterno", paciente.apellidoPaterno)
|
||||
intent.putExtra("Apellido Materno", paciente.apellidoMaterno)
|
||||
intent.putExtra("Domicilio", paciente.domicilio)
|
||||
intent.putExtra("Edad", paciente.edad)
|
||||
intent.putExtra("Sexo", paciente.sexo)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import com.terratenientes.medicalhealth.adapters.CellClickListener
|
||||
import com.terratenientes.medicalhealth.adapters.RecetaDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.adapters.RecetaViewAdapter
|
||||
import com.terratenientes.medicalhealth.data.Receta
|
||||
import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.pdf.PdfDocument
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.text.TextPaint
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.terratenientes.medicalhealth.databinding.ActivityPacientePrincipalBinding
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
|
||||
class PacientePrincipalActivity : AppCompatActivity(), CellClickListener {
|
||||
private lateinit var binding: ActivityPacientePrincipalBinding
|
||||
private var idPaciente : String =""
|
||||
private lateinit var db: RecetaDataBaseHelper
|
||||
private lateinit var recycleAdapter : RecetaViewAdapter
|
||||
private lateinit var recetas : List<Receta>
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityPacientePrincipalBinding.inflate(layoutInflater)
|
||||
val view = binding.root
|
||||
setContentView(view)
|
||||
idPaciente= intent.getStringExtra("IDPaciente")!!
|
||||
db= RecetaDataBaseHelper(this)
|
||||
recetas=db.obtenerRecetasPaciente(idPaciente)
|
||||
|
||||
recycleAdapter = RecetaViewAdapter(db.obtenerRecetasPaciente(idPaciente), this, this@PacientePrincipalActivity)
|
||||
|
||||
binding.rvRecetasPaciente.layoutManager=LinearLayoutManager(this)
|
||||
binding.rvRecetasPaciente.adapter= recycleAdapter
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
recycleAdapter.refreshData(db.obtenerRecetasPaciente(idPaciente))
|
||||
}
|
||||
|
||||
override fun onCellClickListener(position: Int) {
|
||||
val datosPaciente = db.obtenerRecetasPaciente(idPaciente)//ARREGLO DE TODAS LAS RECETAS DEL PACIENTE
|
||||
//Toast.makeText(this, "Peso : ${datosPaciente[position].pesoPaciente}+ edad: ${datosPaciente[position].edadPaciente} ", Toast.LENGTH_LONG).show()
|
||||
val receta = recetas[position]
|
||||
val nombrePaciente = recetas[position].NombrePaciente
|
||||
val nombreMeciamento=recetas[position].nombreMedicamento
|
||||
val dosisMedicamento = recetas[position].dosis
|
||||
val duracionMedicamento = recetas[position].duracion
|
||||
val fechaReceta = recetas[position].fecha
|
||||
val pesoPaciente= recetas[position].pesoPaciente
|
||||
val edadPaciente = recetas[position].edadPaciente
|
||||
val descripcionReceta ="Fecha de Consulta: ${fechaReceta}\n" +
|
||||
"Datos Generales del Paciente : \n " +
|
||||
"Peso del Paciente : ${pesoPaciente}\n" +
|
||||
"Edad del Paciente : ${edadPaciente}" +
|
||||
"Medicamento a Recetar: ${nombreMeciamento}\n Dosis del Medicamento : ${dosisMedicamento}\n" +
|
||||
"Duración del Tratamiento ${duracionMedicamento} \n"
|
||||
|
||||
|
||||
if(permisosPDF()){
|
||||
// Toast.makeText(this, "Peso : ${datosPaciente[position].pesoPaciente}+ edad: ${datosPaciente[position].edadPaciente} ", Toast.LENGTH_LONG).show()
|
||||
//Toast.makeText(this@PacientePrincipalActivity, "PERMISOS CONCEDIDOS", Toast.LENGTH_SHORT).show()
|
||||
generarPDF(nombrePaciente, descripcionReceta, nombreMeciamento)
|
||||
}else{
|
||||
pedirPermisosPDF()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEliminarClickListener(position: Int) {
|
||||
val receta = recetas[position]
|
||||
db.eliminarReceta(receta)
|
||||
recycleAdapter.refreshData(db.obtenerRecetasPaciente(idPaciente))
|
||||
Toast.makeText(this, "Receta eliminada correctamente", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
override fun onModifyClickListener(position: Int) {
|
||||
val receta = recetas[position]
|
||||
Log.i("Prueba Modificar", receta.toString())
|
||||
val intent = Intent(this@PacientePrincipalActivity, ModificarRecetaActivity::class.java)
|
||||
intent.putExtra("NombrePaciente", receta.NombrePaciente)
|
||||
intent.putExtra("EdadPaciente", receta.edadPaciente.toString())
|
||||
intent.putExtra("PesoPaciente", receta.pesoPaciente.toString())
|
||||
intent.putExtra("NombreMedicamento", receta.nombreMedicamento)
|
||||
intent.putExtra("Fecha", receta.fecha)
|
||||
intent.putExtra("Dosis", receta.dosis)
|
||||
intent.putExtra("Duracion", receta.duracion)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
// función que valida si los permisos ya estan garantizados por parte del usuario
|
||||
fun permisosPDF() : Boolean{
|
||||
val permission1= ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
val permission2= ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
|
||||
return permission1 == PackageManager.PERMISSION_GRANTED && permission2 == PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
fun pedirPermisosPDF(){
|
||||
ActivityCompat.requestPermissions(this,
|
||||
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
),200)
|
||||
}
|
||||
|
||||
fun generarPDF(tituloReceta : String, contenidoReceta : String, medicamento : String){
|
||||
if (!permisosPDF()) {
|
||||
pedirPermisosPDF()
|
||||
return
|
||||
}
|
||||
val pdfDoducment = PdfDocument()
|
||||
val tituloPDF = TextPaint()
|
||||
val contenido = TextPaint()
|
||||
val paginaInfo = PdfDocument.PageInfo.Builder(816,1054,1).create()
|
||||
val paginaReceta = pdfDoducment.startPage(paginaInfo)
|
||||
|
||||
val canvas = paginaReceta.canvas
|
||||
tituloPDF.typeface = Typeface.create(Typeface.DEFAULT, Typeface.BOLD)
|
||||
tituloPDF.textSize=30f
|
||||
canvas.drawText(tituloReceta,10f,150f,tituloPDF)
|
||||
|
||||
contenido.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
tituloPDF.textSize=20f
|
||||
val arrayContenido = contenidoReceta.split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||
var y=200
|
||||
for(i in arrayContenido.indices){
|
||||
canvas.drawText(arrayContenido[i],20f,y.toFloat(),contenido)
|
||||
y=y+15
|
||||
}
|
||||
pdfDoducment.finishPage(paginaReceta)
|
||||
val directory = getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS)
|
||||
val file=File(directory,"Receta${medicamento}.pdf")
|
||||
try {
|
||||
pdfDoducment.writeTo(FileOutputStream(file))
|
||||
Toast.makeText(this,"PDF CREADO CORRECTAMENTE",Toast.LENGTH_LONG).show()
|
||||
}catch (e: Exception){
|
||||
Toast.makeText(this,"ERROR CREAR PDF ${e.toString()}",Toast.LENGTH_LONG).show()
|
||||
|
||||
}
|
||||
pdfDoducment.close()
|
||||
}
|
||||
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<out String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if(requestCode==200){
|
||||
if(grantResults.isNotEmpty() && grantResults.all { it == PackageManager.PERMISSION_GRANTED }){
|
||||
val writeStorage = grantResults[0]==PackageManager.PERMISSION_GRANTED
|
||||
val readStorage = grantResults[1]==PackageManager.PERMISSION_GRANTED
|
||||
//generarPDF("Título", "Contenido")
|
||||
if(writeStorage && readStorage){
|
||||
Toast.makeText(this@PacientePrincipalActivity, "PERMISOS CONCEDIDOS", Toast.LENGTH_SHORT).show()
|
||||
}else{
|
||||
Toast.makeText(this@PacientePrincipalActivity, "PERMISOS DENEGADOS", Toast.LENGTH_SHORT).show()
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,30 +3,42 @@ package com.terratenientes.medicalhealth
|
|||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.data.Doctor
|
||||
import com.terratenientes.medicalhealth.databinding.ActivityPrincipalBinding
|
||||
import com.terratenientes.medicalhealth.reports.ConsultarPacientesActivity
|
||||
|
||||
class PrincipalActivity : AppCompatActivity() {
|
||||
lateinit var binding : ActivityPrincipalBinding
|
||||
lateinit var db : DoctorDataBaseHelper
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityPrincipalBinding.inflate(layoutInflater)
|
||||
val view = binding.root
|
||||
setContentView(view)
|
||||
|
||||
binding.btnAgregarPaciente.setOnClickListener {
|
||||
val intent = Intent(this@PrincipalActivity, AgregarActivity::class.java)
|
||||
db = DoctorDataBaseHelper(this@PrincipalActivity)
|
||||
Log.i("Datos Doctor", intent.getStringExtra("Cedula").toString())
|
||||
datosDoctor(intent.getStringExtra("Cedula").toString())
|
||||
binding.ivPacientes.setOnClickListener {
|
||||
val intent = Intent(this@PrincipalActivity, PacienteActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
binding.btnEliminarPaciente.setOnClickListener {
|
||||
val intent = Intent(this@PrincipalActivity, EliminarActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
binding.btnAgregarReceta.setOnClickListener {
|
||||
binding.ivRecetas.setOnClickListener {
|
||||
val intent = Intent(this@PrincipalActivity, RecetaActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun datosDoctor(cedula : String){
|
||||
val doctores : List<Doctor> = db.obtenerDoctor(cedula)
|
||||
val doctor : Doctor = doctores.get(0)
|
||||
Log.i("Datos Doctor", doctor.toString())
|
||||
binding.tvNombreDoctor.setText("Nombre: ${doctor.Nombre}")
|
||||
binding.tvTelefonoDoctor.setText("Telefono: ${doctor.Telefono}")
|
||||
binding.tvCedulaDoctor.setText("Cédula: ${doctor.Cedula}")
|
||||
binding.tvConsultorioDoctor.setText("Consultorio: ${doctor.Consultorio}")
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import Adapters.DoctorDataBaseHelper
|
||||
import Adapters.RecetaDataBaseHelper
|
||||
import Data.Receta
|
||||
import com.terratenientes.medicalhealth.adapters.RecetaDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.data.Receta
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
|
@ -27,6 +27,7 @@ class RecetaActivity : AppCompatActivity(), OnItemSelectedListener {
|
|||
db= RecetaDataBaseHelper(this@RecetaActivity)
|
||||
dbPaciente = DoctorDataBaseHelper(this@RecetaActivity)
|
||||
setContentView(view)
|
||||
//db.crearTablaReceta()
|
||||
cargarSpinnerPacientes()
|
||||
binding.spNombrePaciente.onItemSelectedListener=this
|
||||
binding.btnAgregarReceta.setOnClickListener {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.terratenientes.medicalhealth
|
||||
|
||||
import Adapters.DoctorDataBaseHelper
|
||||
import Data.Doctor
|
||||
import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.data.Doctor
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.terratenientes.medicalhealth.adapters
|
||||
|
||||
interface CellClickListener {
|
||||
fun onCellClickListener(position : Int)
|
||||
fun onEliminarClickListener(position: Int)
|
||||
fun onModifyClickListener(position: Int)
|
||||
}
|
|
@ -1,12 +1,13 @@
|
|||
package Adapters
|
||||
package com.terratenientes.medicalhealth.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import android.database.sqlite.SQLiteDatabase
|
||||
import android.database.sqlite.SQLiteOpenHelper
|
||||
import Data.Doctor
|
||||
import Data.Paciente
|
||||
import com.terratenientes.medicalhealth.data.Doctor
|
||||
import com.terratenientes.medicalhealth.data.Paciente
|
||||
import com.terratenientes.medicalhealth.data.Receta
|
||||
|
||||
class DoctorDataBaseHelper (context: Context) : SQLiteOpenHelper(context, DATABASE_NAME,null,
|
||||
DATABASE_VERSION
|
||||
|
@ -51,6 +52,7 @@ class DoctorDataBaseHelper (context: Context) : SQLiteOpenHelper(context, DATABA
|
|||
val dropTablePacientes = "DROP TABLE IF EXISTS $TABLE_PACIENTES"
|
||||
db?.execSQL(dropTablePacientes)
|
||||
}
|
||||
|
||||
fun crearTablaPacientes(){
|
||||
val db=writableDatabase
|
||||
val crearTablaPacientes =
|
||||
|
@ -73,6 +75,25 @@ class DoctorDataBaseHelper (context: Context) : SQLiteOpenHelper(context, DATABA
|
|||
db.insert(TABLE_NAME,null, values)
|
||||
db.close()
|
||||
}
|
||||
|
||||
@SuppressLint("Range")
|
||||
fun obtenerDoctor(cedula : String): List<Doctor>{
|
||||
val doctores = mutableListOf<Doctor>()
|
||||
val db = readableDatabase
|
||||
var cursor = db.rawQuery("SELECT * FROM $TABLE_NAME WHERE $COLUMN_CEDULA = '${cedula}'", null)
|
||||
while (cursor.moveToNext()) {
|
||||
val cedula = cursor.getString(cursor.getColumnIndex(COLUMN_CEDULA))
|
||||
val nombreDoctor = cursor.getString(cursor.getColumnIndex(COLUMN_NOMBRE))
|
||||
val apellidoDoctor = cursor.getString(cursor.getColumnIndex(COLUMN_APELLIDO))
|
||||
val telefonoDoctor = cursor.getString(cursor.getColumnIndex(COLUMN_TELEFONO))
|
||||
val consultorioDoctor = cursor.getInt(cursor.getColumnIndex(COLUMN_CONSULTORIO))
|
||||
val doctor = Doctor(cedula,nombreDoctor,apellidoDoctor,telefonoDoctor,consultorioDoctor)
|
||||
doctores.add(doctor)
|
||||
}
|
||||
cursor.close()
|
||||
return doctores
|
||||
}
|
||||
|
||||
fun agregarPaciente(paciente: Paciente) {
|
||||
val db = writableDatabase
|
||||
val values = ContentValues().apply {
|
||||
|
@ -84,9 +105,17 @@ class DoctorDataBaseHelper (context: Context) : SQLiteOpenHelper(context, DATABA
|
|||
put(COLUMN_DOMICILIO, paciente.domicilio)
|
||||
}
|
||||
db.insert(TABLE_PACIENTES, null, values)
|
||||
print("ID DEL PACIENTE AGREGADO: "+ COLUMN_ID_PACIENTE)
|
||||
db.close()
|
||||
}
|
||||
|
||||
fun eliminarPaciente(id : Int) : Int{
|
||||
val db = writableDatabase
|
||||
val resultadoEliminacion = db.delete(TABLE_PACIENTES, "$COLUMN_ID_PACIENTE = ?", arrayOf(id.toString()))
|
||||
db.close()
|
||||
return resultadoEliminacion
|
||||
}
|
||||
|
||||
fun modificarPaciente(paciente: Paciente){
|
||||
val db = writableDatabase
|
||||
val values = ContentValues().apply {
|
||||
|
@ -114,15 +143,42 @@ class DoctorDataBaseHelper (context: Context) : SQLiteOpenHelper(context, DATABA
|
|||
val dropQuery="DROP TABLE IF EXISTS $TABLE_NAME"
|
||||
db?.execSQL(dropQuery)
|
||||
}
|
||||
fun validarDatos(cedula :String , contrasena : String): Boolean{
|
||||
|
||||
fun validarDatos(usuario :String , contrasena : String): Boolean{
|
||||
val db = readableDatabase
|
||||
val validarQuery = "SELECT * FROM $TABLE_NAME WHERE $COLUMN_CEDULA = '$cedula' AND $COLUMN_CONTRASENA = '$contrasena'"
|
||||
val validarQuery = "SELECT $COLUMN_CEDULA,$COLUMN_CONTRASENA FROM $TABLE_NAME WHERE $COLUMN_CEDULA = '$usuario' AND $COLUMN_CONTRASENA = '$contrasena' "
|
||||
val cursor = db.rawQuery(validarQuery, null)
|
||||
val isValid = cursor.count > 0
|
||||
cursor.close()
|
||||
return isValid
|
||||
}
|
||||
@SuppressLint("Range")
|
||||
fun seleccionarDoctores(): List<Doctor>{
|
||||
val doctores= mutableListOf<Doctor>()
|
||||
val db= readableDatabase
|
||||
val query="SELECT * FROM $TABLE_NAME "
|
||||
val cursor=db.query(TABLE_NAME,null,null,null,null,null,null)
|
||||
while (cursor.moveToNext()){
|
||||
val cedula=cursor.getString(cursor.getColumnIndex(COLUMN_CEDULA))
|
||||
val nombre=cursor.getString(cursor.getColumnIndex(COLUMN_NOMBRE))
|
||||
val apellido=cursor.getString(cursor.getColumnIndex(COLUMN_APELLIDO))
|
||||
val telefono = cursor.getString(cursor.getColumnIndex(COLUMN_TELEFONO))
|
||||
val consultorio=cursor.getInt(cursor.getColumnIndex(COLUMN_CONSULTORIO))
|
||||
val contrasena=cursor.getString(cursor.getColumnIndex(COLUMN_CONTRASENA))
|
||||
val doctor = Doctor(cedula,nombre,apellido,telefono,consultorio)
|
||||
doctores.add(doctor)
|
||||
}
|
||||
return doctores
|
||||
}
|
||||
|
||||
fun validarDatosPaciente(usuario : String, contrasena: String): Boolean{
|
||||
val db = readableDatabase
|
||||
val validarQuery = "SELECT $COLUMN_ID_PACIENTE,$COLUMN_NOMBRE_PACIENTE FROM $TABLE_PACIENTES WHERE $COLUMN_ID_PACIENTE = '$usuario' AND $COLUMN_NOMBRE_PACIENTE = '$contrasena' "
|
||||
val cursor = db.rawQuery(validarQuery, null)
|
||||
val isValid = cursor.count > 0
|
||||
cursor.close()
|
||||
return isValid
|
||||
}
|
||||
fun edadPaciente(nombrePaciente : String) : Int{
|
||||
val db=readableDatabase
|
||||
var edadPaciente =0
|
||||
|
@ -137,5 +193,24 @@ class DoctorDataBaseHelper (context: Context) : SQLiteOpenHelper(context, DATABA
|
|||
return edadPaciente
|
||||
}
|
||||
|
||||
@SuppressLint("Range")
|
||||
fun obtenerPacientes(): List<Paciente>{
|
||||
val pacientes = mutableListOf<Paciente>()
|
||||
val db = readableDatabase
|
||||
val cursor = db.rawQuery("SELECT * FROM ${TABLE_PACIENTES}", null)
|
||||
while (cursor.moveToNext()) {
|
||||
val idPaciente = cursor.getInt(cursor.getColumnIndex(COLUMN_ID_PACIENTE))
|
||||
val nombrePaciente = cursor.getString(cursor.getColumnIndex(COLUMN_NOMBRE_PACIENTE))
|
||||
val apellidoPaterno = cursor.getString(cursor.getColumnIndex(COLUMN_APELLIDO_PATERNO_PACIENTE))
|
||||
val apellidoMaterno = cursor.getString(cursor.getColumnIndex(COLUMN_APELLIDO_MATERNO_PACIENTE))
|
||||
val edadPaciente = cursor.getInt(cursor.getColumnIndex(COLUMN_EDAD))
|
||||
val sexoPaciente = cursor.getString(cursor.getColumnIndex(COLUMN_SEXO))
|
||||
val domicilioPaciente = cursor.getString(cursor.getColumnIndex(COLUMN_DOMICILIO))
|
||||
val paciente = Paciente(idPaciente,nombrePaciente, apellidoPaterno, apellidoMaterno, edadPaciente, sexoPaciente, domicilioPaciente)
|
||||
pacientes.add(paciente)
|
||||
}
|
||||
cursor.close()
|
||||
return pacientes
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package Adapters
|
||||
package com.terratenientes.medicalhealth.adapters
|
||||
|
||||
import Data.Paciente
|
||||
import com.terratenientes.medicalhealth.data.Paciente
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
|
@ -0,0 +1,58 @@
|
|||
package com.terratenientes.medicalhealth.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.terratenientes.medicalhealth.R
|
||||
import com.terratenientes.medicalhealth.data.Paciente
|
||||
|
||||
class PacienteViewAdapter (private var notes : List<Paciente>, context: Context, val cellClickListener: CellClickListener) :
|
||||
RecyclerView.Adapter<PacienteViewAdapter.NoteViewHolder>() {
|
||||
class NoteViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val tvNombre : TextView = itemView.findViewById(R.id.tv_nombre)
|
||||
val tvApellidoPaterno : TextView = itemView.findViewById(R.id.tv_apellido_paterno)
|
||||
val tvApellidoMaterno : TextView = itemView.findViewById(R.id.tv_apellido_materno)
|
||||
val tv_edad : TextView = itemView.findViewById(R.id.tv_edad)
|
||||
val tv_sexo : TextView = itemView.findViewById(R.id.tv_sexo)
|
||||
val tv_domicilio : TextView = itemView.findViewById(R.id.tv_domicilio)
|
||||
val ivModificar : ImageView = itemView.findViewById(R.id.iv_modificar_paciente)
|
||||
val ivEliminar : ImageView = itemView.findViewById(R.id.iv_eliminar_paciente)
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NoteViewHolder {
|
||||
val view =
|
||||
LayoutInflater.from(parent.context).inflate(R.layout.rc_paciente_item, parent, false)
|
||||
return NoteViewHolder(view)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return notes.size
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: NoteViewHolder, position: Int) {
|
||||
val note = notes[position]
|
||||
holder.tvNombre.text = note.nombre
|
||||
holder.tvApellidoPaterno.text = note.apellidoPaterno
|
||||
holder.tvApellidoMaterno.text = note.apellidoMaterno
|
||||
holder.tv_edad.text = note.edad.toString()
|
||||
holder.tv_sexo.text = note.sexo
|
||||
holder.tv_domicilio.text = note.domicilio
|
||||
|
||||
holder.ivEliminar.setOnClickListener {
|
||||
cellClickListener.onEliminarClickListener(position)
|
||||
}
|
||||
holder.ivModificar.setOnClickListener {
|
||||
cellClickListener.onModifyClickListener(position)
|
||||
}
|
||||
}
|
||||
|
||||
fun refreshData(newNotes: List<Paciente>) {
|
||||
this.notes = newNotes
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package Adapters
|
||||
package com.terratenientes.medicalhealth.adapters
|
||||
|
||||
import Data.Receta
|
||||
import com.terratenientes.medicalhealth.data.Receta
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
|
@ -1,11 +1,13 @@
|
|||
package Adapters
|
||||
package com.terratenientes.medicalhealth.adapters
|
||||
|
||||
import Data.Receta
|
||||
import com.terratenientes.medicalhealth.data.Receta
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import android.database.sqlite.SQLiteDatabase
|
||||
import android.database.sqlite.SQLiteOpenHelper
|
||||
import android.util.Log
|
||||
import com.terratenientes.medicalhealth.data.Paciente
|
||||
|
||||
class RecetaDataBaseHelper(context: Context) : SQLiteOpenHelper(context, DATABAENAME, null, DATABASEVERSION){
|
||||
companion object{
|
||||
|
@ -53,6 +55,29 @@ class RecetaDataBaseHelper(context: Context) : SQLiteOpenHelper(context, DATABAE
|
|||
val recetas = mutableListOf<Receta>()
|
||||
val db = readableDatabase
|
||||
val cursor = db.rawQuery("SELECT * FROM $TABLE_NAME", null)
|
||||
//val cursor : Cursor =db.query(TABLE_NAME,null,null,null,null,null,null)
|
||||
if(cursor!=null){
|
||||
while (cursor.moveToNext()) {
|
||||
val nombrePaciente = cursor.getString(cursor.getColumnIndex(COLUMN_NOMBRE_PACIENTE))
|
||||
val edadPaciente = cursor.getInt(cursor.getColumnIndex(COLUMN_EDAD_PACIENTE))
|
||||
val pesoPaciente = cursor.getDouble(cursor.getColumnIndex(COLUMN_PESO_PACIENTE))
|
||||
val medicamento = cursor.getString(cursor.getColumnIndex(COLUMN_MEDICAMENTO))
|
||||
val fecha = cursor.getString(cursor.getColumnIndex(COLUMN_FECHA))
|
||||
val dosis = cursor.getString(cursor.getColumnIndex(COLUMN_DOSIS_PACIENTE))
|
||||
val duracion = cursor.getString(cursor.getColumnIndex(DURACION_MEDICAMENTO))
|
||||
val receta = Receta(nombrePaciente, edadPaciente, pesoPaciente, medicamento, fecha, dosis, duracion)
|
||||
recetas.add(receta)
|
||||
}
|
||||
cursor.close()
|
||||
}
|
||||
db.close()
|
||||
return recetas
|
||||
}
|
||||
@SuppressLint("Range")
|
||||
fun obtenerRecetasPaciente(nombrePaciente : String): List<Receta>{
|
||||
val recetas = mutableListOf<Receta>()
|
||||
val db = readableDatabase
|
||||
val cursor = db.rawQuery("SELECT * FROM $TABLE_NAME WHERE $COLUMN_NOMBRE_PACIENTE = '$nombrePaciente'", null)
|
||||
while (cursor.moveToNext()) {
|
||||
val nombrePaciente = cursor.getString(cursor.getColumnIndex(COLUMN_NOMBRE_PACIENTE))
|
||||
val edadPaciente = cursor.getInt(cursor.getColumnIndex(COLUMN_EDAD_PACIENTE))
|
||||
|
@ -69,8 +94,32 @@ class RecetaDataBaseHelper(context: Context) : SQLiteOpenHelper(context, DATABAE
|
|||
}
|
||||
|
||||
fun eliminarReceta(receta: Receta) {
|
||||
Log.d("RecetaDataBaseHelper", "Eliminando receta: ${receta.NombrePaciente}, ${receta.fecha}")
|
||||
val db = writableDatabase
|
||||
db.delete(TABLE_NAME, "$COLUMN_NOMBRE_PACIENTE = ? AND $COLUMN_FECHA = ?", arrayOf(receta.NombrePaciente, receta.fecha))
|
||||
db.close()
|
||||
}
|
||||
|
||||
fun modificarReceta(receta: Receta){
|
||||
val db = writableDatabase
|
||||
val values = ContentValues().apply {
|
||||
put(COLUMN_EDAD_PACIENTE, receta.edadPaciente)
|
||||
put(COLUMN_PESO_PACIENTE, receta.pesoPaciente)
|
||||
put(COLUMN_MEDICAMENTO, receta.nombreMedicamento)
|
||||
put(COLUMN_FECHA, receta.fecha)
|
||||
put(COLUMN_DOSIS_PACIENTE, receta.dosis)
|
||||
put(DURACION_MEDICAMENTO, receta.duracion)
|
||||
}
|
||||
val whereClause = "$COLUMN_NOMBRE_PACIENTE = ? and $COLUMN_FECHA = ?"
|
||||
val whereArgs = arrayOf(receta.NombrePaciente, receta.fecha)
|
||||
db.update(TABLE_NAME, values, whereClause, whereArgs)
|
||||
db.close()
|
||||
}
|
||||
|
||||
fun crearTablaReceta(){
|
||||
val db=writableDatabase
|
||||
val creatTabla="CREATE TABLE $TABLE_NAME ($COLUMN_NOMBRE_PACIENTE VARCHAR(30), $COLUMN_EDAD_PACIENTE INT, $COLUMN_PESO_PACIENTE INT, $COLUMN_FECHA VARCHAR(30), " +
|
||||
"$COLUMN_MEDICAMENTO VARCHAR(30), $DURACION_MEDICAMENTO VARCHAR(20), $COLUMN_DOSIS_PACIENTE VARCHAR(30))"
|
||||
db?.execSQL(creatTabla)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.terratenientes.medicalhealth.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.terratenientes.medicalhealth.R
|
||||
import com.terratenientes.medicalhealth.data.Receta
|
||||
|
||||
class RecetaViewAdapter(private var notes : List<Receta>, context: Context, val cellClickListener: CellClickListener) :
|
||||
RecyclerView.Adapter<RecetaViewAdapter.NoteViewHolder>() {
|
||||
class NoteViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
|
||||
val tituloReceta : TextView = itemView.findViewById(R.id.tv_titulo_receta)
|
||||
val fechaReceta : TextView = itemView.findViewById(R.id.tv_fecha_receta)
|
||||
val nombreReceta : TextView = itemView.findViewById(R.id.tv_nombre_paciente)
|
||||
val btnDescargar : ImageView = itemView.findViewById(R.id.iv_descargar_receta)
|
||||
val btnEliminar: ImageView = itemView.findViewById(R.id.iv_eliminar_receta)
|
||||
val btnModificar : ImageView = itemView.findViewById(R.id.iv_modificar_receta)
|
||||
val pesoReceta : TextView = itemView.findViewById(R.id.tv_peso_paciente)
|
||||
val edadReceta : TextView = itemView.findViewById(R.id.tv_edad_paciente)
|
||||
val dosisReceta : TextView=itemView.findViewById(R.id.tv_dosis_medicamento)
|
||||
val duracionReceta : TextView= itemView.findViewById(R.id.tv_duracion_receta)
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NoteViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.rc_receta_item, parent, false)
|
||||
return NoteViewHolder(view)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return notes.size
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: NoteViewHolder, position: Int) {
|
||||
val note = notes[position]
|
||||
holder.tituloReceta.text = note.nombreMedicamento
|
||||
holder.fechaReceta.text = note.fecha
|
||||
holder.dosisReceta.text=note.dosis
|
||||
holder.duracionReceta.text=note.duracion
|
||||
holder.nombreReceta.text=note.NombrePaciente
|
||||
holder.pesoReceta.text= note.pesoPaciente.toString()
|
||||
holder.edadReceta.text=note.edadPaciente.toString()
|
||||
holder.btnDescargar.setOnClickListener{
|
||||
cellClickListener.onCellClickListener(position)
|
||||
}
|
||||
holder.btnEliminar.setOnClickListener{
|
||||
cellClickListener.onEliminarClickListener(position)
|
||||
}
|
||||
holder.btnModificar.setOnClickListener {
|
||||
cellClickListener.onModifyClickListener(position)
|
||||
}
|
||||
}
|
||||
|
||||
fun refreshData( newNotes : List<Receta>){
|
||||
this.notes=newNotes
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
package Data
|
||||
package com.terratenientes.medicalhealth.data
|
||||
|
||||
data class Doctor(var Cedula : String ,var Nombre : String, var Apellido : String, var Telefono : String, var Consultorio : Int)
|
|
@ -1,4 +1,4 @@
|
|||
package Data
|
||||
package com.terratenientes.medicalhealth.data
|
||||
|
||||
data class Paciente(
|
||||
var id: Int, // Este campo representa el ID autoincrementable en la base de datos
|
|
@ -0,0 +1,3 @@
|
|||
package com.terratenientes.medicalhealth.data
|
||||
|
||||
data class Receta(var NombrePaciente : String, var edadPaciente : Int, var pesoPaciente: Double, var nombreMedicamento : String, var fecha : String, var dosis : String, var duracion :String)
|
|
@ -1,4 +1,4 @@
|
|||
package Reports
|
||||
package com.terratenientes.medicalhealth.reports
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
|
@ -11,10 +11,10 @@ import android.os.Environment
|
|||
import android.widget.Toast
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import Adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.adapters.DoctorDataBaseHelper
|
||||
import com.terratenientes.medicalhealth.ModificarActivity
|
||||
import Data.Paciente
|
||||
import Adapters.PacienteAdapter
|
||||
import com.terratenientes.medicalhealth.data.Paciente
|
||||
import com.terratenientes.medicalhealth.adapters.PacienteAdapter
|
||||
import com.terratenientes.medicalhealth.R
|
||||
import com.terratenientes.medicalhealth.databinding.ActivityConsultarPacientesBinding
|
||||
import java.io.File
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12,4A4,4 0,0 1,16 8A4,4 0,0 1,12 12A4,4 0,0 1,8 8A4,4 0,0 1,12 4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0,0 0,8 21H16A2,2 0,0 0,18 19V7H6V19Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M14.84,16.26C17.86,16.83 20,18.29 20,20V22H4V20C4,18.29 6.14,16.83 9.16,16.26L12,21L14.84,16.26M8,8H16V10A4,4 0,0 1,12 14A4,4 0,0 1,8 10V8M8,7L8.41,2.9C8.46,2.39 8.89,2 9.41,2H14.6C15.11,2 15.54,2.39 15.59,2.9L16,7H8M12,3H11V4H10V5H11V6H12V5H13V4H12V3Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0,0 1,18 22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M15,18V16H6V18H15M18,14V12H6V14H18Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M13.5,8H12V13L16.28,15.54L17,14.33L13.5,12.25V8M13,3A9,9 0,0 0,4 12H1L4.96,16.03L9,12H6A7,7 0,0 1,13 5A7,7 0,0 1,20 12A7,7 0,0 1,13 19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0,0 0,22 12A9,9 0,0 0,13 3"/>
|
||||
</vector>
|
|
@ -4,6 +4,6 @@
|
|||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
|
||||
</vector>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0,0 0,2 12A10,10 0,0 0,12 22A10,10 0,0 0,22 12A10,10 0,0 0,12 2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M21,10.12H14.22L16.96,7.3C14.23,4.6 9.81,4.5 7.08,7.2C4.35,9.91 4.35,14.28 7.08,17C9.81,19.7 14.23,19.7 16.96,17C18.32,15.65 19,14.08 19,12.1H21C21,14.08 20.12,16.65 18.36,18.39C14.85,21.87 9.15,21.87 5.64,18.39C2.14,14.92 2.11,9.28 5.62,5.81C9.13,2.34 14.76,2.34 18.27,5.81L21,3V10.12M12.5,8V12.25L16,14.33L15.28,15.54L11,13V8H12.5Z"/>
|
||||
</vector>
|
|
@ -18,13 +18,6 @@
|
|||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:src="@drawable/image_area"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -121,17 +114,5 @@
|
|||
android:background="@drawable/radius_btn"
|
||||
android:text="@string/bt_agregar" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancelar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bt_cancelar"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginStart="50dp"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/radius_btn"
|
||||
android:layout_marginEnd="50dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context="Reports.ConsultarPacientesActivity">
|
||||
tools:context=".reports.ConsultarPacientesActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
android:text="@string/bt_eliminar" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancelar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bt_cancelar"
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
android:text="@string/bt_eliminar" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancelarr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bt_cancelar"
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ModificarRecetaActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_marginTop="130dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/receta_activity_title"
|
||||
android:textSize="32sp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_nombre_paciente"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginStart="2dp"
|
||||
android:textSize="20dp"/>
|
||||
<EditText
|
||||
android:id="@+id/et_edad_paciente"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/receta_edad"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/et_peso_paciente"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/receta_peso"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:inputType="number"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/et_receta_medicamento"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/receta_medicamento"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/et_fecha"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:textSize="20dp"
|
||||
android:hint="@string/receta_fecha_paciente"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:inputType="date"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/et_dosis_medicamento"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/receta_dosis"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/et_duracion_"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/receta_duracion"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/btn_modificar_receta"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/btn_modificar_receta"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".PacienteActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/tv_titulo_consultar"
|
||||
android:textSize="30dp"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:gravity="center"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_agregar_paciente"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:src="@drawable/plus_circle_outline"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_pacientes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="550dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="8dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_descargar_csv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/btn_csv"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/radius_btn"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".PacientePrincipalActivity">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_recetas_paciente"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="vertical"
|
||||
tools:listitem="@layout/rc_receta_item"
|
||||
/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
|
@ -7,22 +7,143 @@
|
|||
android:orientation="vertical"
|
||||
tools:context="PrincipalActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_agregar_paciente"
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tv_agregar_paciente_titulo"/>
|
||||
<Button
|
||||
android:id="@+id/btn_eliminar_paciente"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/eliminar_paciente_titulo"/>
|
||||
<Button
|
||||
android:id="@+id/btn_agregar_receta"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/btn_agregar_receta"/>
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textSize="30dp"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_margin="20dp"
|
||||
android:src="@drawable/doctor"/>
|
||||
|
||||
<GridLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="80dp"
|
||||
android:columnCount="1"
|
||||
android:rowCount="4">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nombre_doctor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="0"
|
||||
android:layout_row="0"
|
||||
android:textSize="25dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="Nombre:"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_telefono_doctor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="0"
|
||||
android:layout_row="1"
|
||||
android:textSize="25dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="Telefono:"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_cedula_doctor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="0"
|
||||
android:layout_row="2"
|
||||
android:textSize="25dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="Cédula:"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_consultorio_doctor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="0"
|
||||
android:layout_row="3"
|
||||
android:textSize="25dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="Consultorio:"/>
|
||||
|
||||
</GridLayout>
|
||||
|
||||
<GridLayout
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/radius_tv"
|
||||
android:backgroundTint="@color/primaryColor"
|
||||
android:layout_marginTop="80dp"
|
||||
android:columnCount="3"
|
||||
android:rowCount="2">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pacientes"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/account"
|
||||
android:layout_column="0"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_row="0"/>
|
||||
<ImageView
|
||||
android:id="@+id/iv_recetas"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/file_document"
|
||||
android:layout_column="1"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_row="0"/>
|
||||
<ImageView
|
||||
android:id="@+id/iv_historial"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/history"
|
||||
android:layout_column="2"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_row="0"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Pacientes"
|
||||
android:textColor="@color/white"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="0"
|
||||
android:gravity="center"
|
||||
android:layout_row="1"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Recetas"
|
||||
android:textColor="@color/white"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="1"
|
||||
android:gravity="center"
|
||||
android:layout_row="1"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Historial"
|
||||
android:textColor="@color/white"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="2"
|
||||
android:gravity="center"
|
||||
android:layout_row="1"/>
|
||||
</GridLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_margin="10dp"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="8dp">
|
||||
|
||||
<GridLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:columnCount="3"
|
||||
android:rowCount="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nombre"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="0"
|
||||
android:layout_row="0"
|
||||
android:text="@string/ht_nombre"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_apellido_paterno"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="1"
|
||||
android:layout_row="0"
|
||||
android:text="@string/ht_apellido_paterno"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_apellido_materno"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="2"
|
||||
android:layout_row="0"
|
||||
android:text="@string/ht_apellido_materno"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_edad"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="0"
|
||||
android:layout_row="1"
|
||||
android:text="@string/et_modificar_edad"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_sexo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="1"
|
||||
android:layout_row="1"
|
||||
android:text="@string/et_modificar_sexo"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_domicilio"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_column="2"
|
||||
android:layout_row="1"
|
||||
android:text="@string/ht_domicilio"/>
|
||||
<ImageView
|
||||
android:id="@+id/iv_modificar_paciente"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_column="1"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_row="2"
|
||||
android:src="@drawable/update"/>
|
||||
<ImageView
|
||||
android:id="@+id/iv_eliminar_paciente"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_column="2"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_row="2"
|
||||
android:src="@drawable/delete"/>
|
||||
|
||||
</GridLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,170 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="110dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginVertical="10dp"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="8dp"
|
||||
android:layout_marginStart="12dp"
|
||||
|
||||
>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nombre_paciente"
|
||||
android:layout_width="117dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="256dp"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:hint="Nombre Paciente"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_titulo_receta"
|
||||
android:layout_width="117dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="256dp"
|
||||
android:layout_marginBottom="45dp"
|
||||
android:hint="Titulo de la Receta"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_fecha_receta"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_marginTop="83dp"
|
||||
android:layout_marginEnd="255dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:hint="Fecha de la Receta"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_descargar_receta"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="243dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:src="@drawable/download"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.243" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_modificar_receta"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:src="@drawable/update"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.593" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_eliminar_receta"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="243dp"
|
||||
android:layout_marginTop="75dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:src="@drawable/delete"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.487" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_peso_paciente"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="141dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="196dp"
|
||||
android:layout_marginBottom="71dp"
|
||||
android:hint="Peso"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_duracion_receta"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="199dp"
|
||||
android:layout_marginTop="83dp"
|
||||
android:layout_marginEnd="128dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:hint="Duración"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_edad_paciente"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="141dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="196dp"
|
||||
android:layout_marginBottom="41dp"
|
||||
android:hint="Edad"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dosis_medicamento"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="141dp"
|
||||
android:layout_marginTop="83dp"
|
||||
android:layout_marginEnd="196dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:hint="Dosis"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
|
@ -47,6 +47,7 @@
|
|||
<string name="receta_peso">Peso del paciente KG</string>
|
||||
<string name="btn_agregar_receta">Agregar Receta</string>
|
||||
<string name="btn_ayuda_receta">Ayuda</string>
|
||||
<string name="btn_modificar_receta">Modificar Receta</string>
|
||||
<string name="title_activity_principal">PrincipalActivity</string>
|
||||
<string name="title_home">Home</string>
|
||||
<string name="title_dashboard">Dashboard</string>
|
||||
|
|
Loading…
Reference in New Issue