consulta.py 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class ClinicMedicvisit(models.Model):
  4. _inherit = 'clinic.history'
  5. @api.model
  6. def getClinicMedicvisit(self,domain):
  7. ClinicMedicvisit = self.env['clinic.history'].search(domain)
  8. values = []
  9. for clinichistory in ClinicMedicvisit:
  10. try:
  11. street = clinichistory.partner_id.street
  12. except Exception as e:
  13. street = ''
  14. values.append({
  15. # ID
  16. 'id': clinichistory.id,
  17. # WORKORDER INFO
  18. 'name': clinichistory.name or "",
  19. 'user_name': clinichistory.user_id.name or "",
  20. 'paramedico_name': clinichistory.paramedico_id.name or "",
  21. 'order_date': clinichistory.order_date or "",
  22. 'name_movil': clinichistory.name_movil or "",
  23. 'at_base': clinichistory.at_base or "",
  24. 'nro_salida': clinichistory.nro_salida or "",
  25. 'planned_start_date': clinichistory.planned_start_date or "",
  26. 'programado': clinichistory.programado or "",
  27. 'edad_paciente': clinichistory.edad_paciente or "",
  28. 'antig_trabajo': clinichistory.antig_trabajo or "",
  29. 'planned_end_date': clinichistory.planned_end_date or "",
  30. 'lugar_visita': clinichistory.lugar_visita or "",
  31. 'tipo_paciente': clinichistory.tipo_paciente or "",
  32. 'uso_gel': clinichistory.uso_gel or "",
  33. 'seguro': clinichistory.seguro or "",
  34. 'nro_socio': clinichistory.nro_socio or "",
  35. 'nro_socio1': clinichistory.nro_socio1 or "",
  36. 'alergico': clinichistory.alergico or "",
  37. 'tipo_alergico': clinichistory.tipo_alergico or "",
  38. 'embarazada': clinichistory.embarazada or "",
  39. 'respuesta_tratamiento': clinichistory.respuesta_tratamiento or "",
  40. 'pa': clinichistory.pa or "",
  41. 'fc': clinichistory.fc or "",
  42. 'fr': clinichistory.fr or "",
  43. 'temp': clinichistory.temp or "",
  44. 'so': clinichistory.so or "",
  45. 'hgt': clinichistory.hgt or "",
  46. 'ost': clinichistory.ost or "",
  47. 'asm': clinichistory.asm or "",
  48. 'card': clinichistory.card or "",
  49. 'acv': clinichistory.acv or "",
  50. 'conv': clinichistory.conv or "",
  51. 'hta': clinichistory.hta or "",
  52. 'epoc': clinichistory.epoc or "",
  53. 'otro': clinichistory.otro or "",
  54. 'motivo': clinichistory.motivo or "",
  55. 'diagnostic': clinichistory.diagnostic or "",
  56. 'indicacion': clinichistory.indicacion or "",
  57. 'recommendations': clinichistory.recommendations or "",
  58. 'epicrisis': clinichistory.epicrisis or "",
  59. 'presuntivo': clinichistory.presuntivo or "",
  60. 'clasificacion': clinichistory.clasificacion or "",
  61. 'informado': clinichistory.informado or "",
  62. 'entregado': clinichistory.entregado or "",
  63. 'signature_image_paramedico': clinichistory.signature_image_paramedico or "",
  64. 'signature_image_medico': clinichistory.signature_image_medico or "",
  65. 'signature_image_paciente': clinichistory.signature_image_paciente or "",
  66. # PARTNER INFO
  67. 'partner_id': clinichistory.partner_id.id or "",
  68. 'partner_name': clinichistory.partner_id.name or "",
  69. 'paciente_id': clinichistory.paciente_id.id or "",
  70. 'paciente_name': clinichistory.paciente_id.name or "",
  71. 'partner_ruc': clinichistory.partner_id.ruc or "",
  72. 'partner_address': street or "",
  73. 'partner_phone': clinichistory.partner_id.phone or "",
  74. 'partner_mobile': clinichistory.partner_id.mobile or "",
  75. 'partner_fecha_nac ': clinichistory.partner_id.fecha_nac or "",
  76. 'partner_sexo': clinichistory.paciente_id.sexo or "",
  77. # COMPANY INFO
  78. 'company_id': clinichistory.user_id.company_id.id or "",
  79. 'company_name': clinichistory.user_id.company_id.name or "",
  80. 'company_logo': clinichistory.user_id.company_id.logo or "",
  81. 'company_address': clinichistory.user_id.company_id.street2 or "",
  82. 'company_phone': clinichistory.user_id.company_id.phone or "",
  83. 'vat': clinichistory.user_id.company_id.vat or "",
  84. # USER INFO
  85. 'user_id': clinichistory.user_id.id or "",
  86. 'user_image': clinichistory.user_id.image or "",
  87. # PARAMEDICO INFO
  88. 'paramedico_id': clinichistory.paramedico_id.id or "",
  89. 'paramedico_image': clinichistory.paramedico_id.image or "",
  90. })
  91. return values
  92. class ClinicMedicvisitLine(models.Model):
  93. _inherit = 'clinic.history.line'
  94. @api.model
  95. def getClinicMedicvisitLine(self,domain):
  96. ClinicMedicvisitLine = self.env['clinic.history.line'].search(domain)
  97. values = []
  98. for line in ClinicMedicvisitLine:
  99. values.append({
  100. # ID
  101. 'id': line.id,
  102. # LINE INFO
  103. 'clinichistory_id': line.clinichistory_id.id,
  104. 'product_id':[
  105. line.product_id.id,
  106. line.product_id.name,
  107. ],
  108. 'quantity': line.quantity or "",
  109. 'brand': line.brand or "",
  110. 'number': line.number or "",
  111. })
  112. return values
  113. class ClinicInsumosvisitLine(models.Model):
  114. _inherit = 'clinic.insumos.line'
  115. @api.model
  116. def getClinicInsumosvisitLine(self,domain):
  117. ClinicInsumosvisitLine = self.env['clinic.insumos.line'].search(domain)
  118. values = []
  119. for line in ClinicInsumosvisitLine:
  120. values.append({
  121. # ID
  122. 'id': line.id,
  123. # LINE INFO
  124. 'clinicinsumos_id': line.clinichistory_id.id,
  125. 'product_id':[
  126. line.product_id.id,
  127. line.product_id.name,
  128. ],
  129. 'quantity': line.quantity or "",
  130. 'brand': line.brand or "",
  131. 'number': line.number or "",
  132. })
  133. return values