def insert_prueba(self): query = "INSERT INTO Prueba (idPrueba, Observaciones, idPrueba_externo, Tipo, idInforme, Nombre)" \ " VALUES('" + str(self.idPrueba) + "', '" + self.Observaciones + "', '" + str( self.idPrueba_Externo) + "', '" + self.Tipo + "', '" + self.idInforme + "', '" + self.Nombre + "' );" print(query) connection = conn.get_connection() conn.update_query(query, connection) conn.close_connection(connection)
def insert_informe(self): query = "INSERT INTO Informe (idInforme, Estado_paciente, Diagnostico, idHistorial, Fecha_consulta, idConsulta, Licencia_medico)" \ " VALUES('" + str(self.idInforme) + "', '" + self.Estado_paciente + "', '" + str( self.Diagnostico) + "', '" + self.idHistorial + "', '" + self.Fecha_consulta + "', '" + self.idConsulta \ + "', '" + self.Licencia_medico + "' );" print(query) connection = conn.get_connection() conn.update_query(query, connection) conn.close_connection(connection)
def insert_icd10(self, codes): query = list() print("Aquiiiii" + str(len(codes))) for code in codes: if code not in self.ICD10s: query.append("INSERT INTO INFORME_ICD_10 (IdInforme, Codigo) VALUES ('" + self.idInforme + "', '" \ + code + "');") print(query) connection = conn.get_connection() conn.update_query(query, connection) conn.close_connection(connection)
def update_paciente(self, Localidad, Domicilio, Telefono, Correo_electronico, Embarazada, FPP): self.Localidad = Localidad is None and self.Localidad or Localidad self.Domicilio = Domicilio is None and self.Domicilio or Domicilio self.Telefono = Telefono is None and self.Telefono or Telefono self.Correo_electronico = Correo_electronico is None and self.Correo_electronico or Correo_electronico self.Embarazada = Embarazada is None and self.Embarazada or Embarazada self.FPP = FPP is None and self.FPP or FPP query = list() query.append("UPDATE Paciente SET "\ + "Localidad='" + self.Localidad + "', "\ + "Domicilio='" + self.Domicilio + "', "\ + "Telefono='" + self.Telefono + "', "\ + "Correo_electronico='" + str(self.Correo_electronico) + "', "\ + "Embarazada=" + str(self.Embarazada) + ", "\ #+ "FPP='" + self.FPP.strftime('%Y-%m-%d') + "' "\ + "FPP='" + str(self.FPP) + "' "\ + "WHERE idPaciente = " + str(self.idPaciente) + ";") connection = conn.get_connection() conn.update_query(query, connection) conn.close_connection(connection)
def create_ICD10(Codigo, Nombre): icd10s = lista_ICD10() is_include = False icd10_result = ICD10() print("createICD10") print(Codigo) for icd10 in icd10s: if Codigo == icd10.Codigo: is_include = True icd10_result = icd10 if not is_include: print("leggoooooo") query = "INSERT INTO ICD_10 (Codigo, Nombre) VALUES (\"" + str( Codigo) + "\", \"" + str(Nombre) + "\");" connection = conn.get_connection() conn.update_query(query, connection) conn.close_connection(connection) print(query) icd10_result.new_ICD10(Codigo, Nombre) else: icd10_result return icd10_result
def delete_informe(self): query = list() query.append("DELETE FROM Informe WHERE idInforme = '" + str(self.idInforme) + "';") print("DELETE FROM Informe WHERE idInforme = '" + str(self.idInforme) + "';") query.append("DELETE FROM Prueba WHERE idInforme = '" + str(self.idInforme) + "';") query.append("DELETE FROM INFORME_ICD_10 WHERE idInforme = '" + str(self.idInforme) + "';") connection = conn.get_connection() conn.update_query(query, connection) conn.close_connection(connection) self.idInforme = None self.Estado_paciente = None self.Diagnostico = None self.idHistorial = None self.idConsulta = None self.Fecha_consulta = None self.Licencia_medico = None self.Pruebas = None self.ICD10s = None