Restructuración del Proyecto

This commit is contained in:
AngelSuarez03 2024-05-02 09:38:17 -06:00
parent e83dc3fabe
commit 6ee43fc790
16 changed files with 52 additions and 32 deletions

View File

@ -3,7 +3,20 @@
<component name="deploymentTargetDropDown">
<value>
<entry key="app">
<State />
<State>
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\USER\.android\avd\Pixel_3a_API_34_extension_level_7_x86_64.avd" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-05-02T15:23:11.192908200Z" />
</State>
</entry>
</value>
</component>

View File

@ -22,7 +22,7 @@
android:name=".RegistrarDActivity"
android:exported="false" />
<activity
android:name=".ConsultarPacientesActivity"
android:name="Reports.ConsultarPacientesActivity"
android:exported="false" />
<activity
android:name=".EliminarActivity"

View File

@ -1,14 +1,16 @@
package com.terratenientes.medicalhealth
package Adapters
import android.annotation.SuppressLint
import android.content.ContentValues
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import android.widget.Toast
import Data.Doctor
import Data.Paciente
class DoctorDataBaseHelper (context: Context) : SQLiteOpenHelper(context, DATABASE_NAME,null,
DATABASE_VERSION){
DATABASE_VERSION
){
companion object{
private const val DATABASE_NAME ="MedicalHealth"
private const val DATABASE_VERSION=1
@ -124,7 +126,7 @@ class DoctorDataBaseHelper (context: Context) : SQLiteOpenHelper(context, DATABA
fun edadPaciente(nombrePaciente : String) : Int{
val db=readableDatabase
var edadPaciente =0
val queryEdad= "SELECT ${COLUMN_EDAD} FROM ${TABLE_PACIENTES} WHERE ${COLUMN_NOMBRE_PACIENTE}='${nombrePaciente}'"
val queryEdad= "SELECT $COLUMN_EDAD FROM $TABLE_PACIENTES WHERE $COLUMN_NOMBRE_PACIENTE='${nombrePaciente}'"
val cursor = db.rawQuery(queryEdad,null)
if(cursor.moveToFirst()){
val columnEdad = cursor.getColumnIndex(COLUMN_EDAD)

View File

@ -1,5 +1,6 @@
package com.terratenientes.medicalhealth
package Adapters
import Data.Paciente
import android.content.Context
import android.view.LayoutInflater
import android.view.View

View File

@ -1,5 +1,6 @@
package com.terratenientes.medicalhealth
package Adapters
import Data.Receta
import android.content.ContentValues
import android.content.Context
import android.database.sqlite.SQLiteDatabase

View File

@ -1,3 +1,3 @@
package com.terratenientes.medicalhealth
package Data
data class Doctor(var Cedula : String ,var Nombre : String, var Apellido : String, var Telefono : String, var Consultorio : Int)

View File

@ -1,4 +1,4 @@
package com.terratenientes.medicalhealth
package Data
data class Paciente(
var id: Int, // Este campo representa el ID autoincrementable en la base de datos

View File

@ -1,3 +1,3 @@
package com.terratenientes.medicalhealth
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)

View File

@ -1,4 +1,4 @@
package com.terratenientes.medicalhealth
package Reports
import android.Manifest
import android.annotation.SuppressLint
@ -11,6 +11,11 @@ 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.ModificarActivity
import Data.Paciente
import Adapters.PacienteAdapter
import com.terratenientes.medicalhealth.R
import com.terratenientes.medicalhealth.databinding.ActivityConsultarPacientesBinding
import java.io.File
import java.io.FileWriter

View File

@ -1,16 +1,14 @@
package com.terratenientes.medicalhealth
import Adapters.DoctorDataBaseHelper
import Data.Paciente
import android.R
import android.content.Intent
import android.os.Bundle
import android.widget.ArrayAdapter
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.ActivityAgregarPacienteBinding
import com.terratenientes.medicalhealth.databinding.ActivityMainBinding
class AgregarActivity : AppCompatActivity() {

View File

@ -1,16 +1,12 @@
package com.terratenientes.medicalhealth
import android.R
import Adapters.DoctorDataBaseHelper
import Adapters.PacienteAdapter
import Data.Paciente
import android.annotation.SuppressLint
import android.os.Bundle
import android.util.Log
import android.widget.ArrayAdapter
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.ActivityAgregarPacienteBinding
import com.terratenientes.medicalhealth.databinding.ActivityEliminarPacienteBinding
class EliminarActivity : AppCompatActivity() {

View File

@ -1,5 +1,7 @@
package com.terratenientes.medicalhealth
import Adapters.DoctorDataBaseHelper
import Data.Doctor
import android.annotation.SuppressLint
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
@ -16,7 +18,7 @@ class MainActivity : AppCompatActivity() {
val view=binding.root
setContentView(view)
db =DoctorDataBaseHelper(this@MainActivity)
db = DoctorDataBaseHelper(this@MainActivity)
binding.btnIniciarSesion.setOnClickListener {
var res=db.validarDatos(binding.tvUsuario.text.toString(),binding.tvContrasena.text.toString())
if(res==true){

View File

@ -1,5 +1,8 @@
package com.terratenientes.medicalhealth
import Adapters.DoctorDataBaseHelper
import Data.Paciente
import Reports.ConsultarPacientesActivity
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

View File

@ -1,7 +1,9 @@
package com.terratenientes.medicalhealth
import Adapters.DoctorDataBaseHelper
import Adapters.RecetaDataBaseHelper
import Data.Receta
import android.annotation.SuppressLint
import android.database.sqlite.SQLiteOpenHelper
import android.os.Bundle
import android.view.View
import android.widget.AdapterView
@ -10,8 +12,6 @@ import android.widget.ArrayAdapter
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.ActivityRecetaBinding
class RecetaActivity : AppCompatActivity(), OnItemSelectedListener {

View File

@ -1,11 +1,10 @@
package com.terratenientes.medicalhealth
import Adapters.DoctorDataBaseHelper
import Data.Doctor
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.ActivityRegistrarDactivityBinding
class RegistrarDActivity : AppCompatActivity() {
@ -28,7 +27,7 @@ class RegistrarDActivity : AppCompatActivity() {
val telefono=binding.etTelefonoRegisto.text.toString()
val domicilio = binding.etDomicilio.text.toString()
val contrasena= binding.etContrasenaRegistro.text.toString()
val usuario=Doctor(cedula,nombre,apellido,telefono,domicilio.toInt())
val usuario= Doctor(cedula,nombre,apellido,telefono,domicilio.toInt())
db.agregarDoctores(usuario,contrasena)
Toast.makeText(this@RegistrarDActivity,"USUARIO AGREGADO",Toast.LENGTH_LONG).show()
}

View File

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ConsultarPacientesActivity">
tools:context="Reports.ConsultarPacientesActivity">
<TextView
android:layout_width="match_parent"