示例#1
0
 def create_test_fhir_instance(self):
     self.setUp()
     fhir_reqest = EligibilityRequest()
     fhir_reqest.patient = PatientConverter.build_fhir_resource_reference(self._TEST_INSUREE)
     fhir_reqest.benefitCategory = PatientConverter.build_codeable_concept(
         Config.get_fhir_service_code(), system=None, text=self._TEST_SERVICE_CODE)
     fhir_reqest.benefitSubCategory = PatientConverter.build_codeable_concept(
         Config.get_fhir_item_code(), system=None, text=self._TEST_ITEM_CODE)
     return fhir_reqest
class EligibilityRequestViewSet(BaseFHIRView, mixins.CreateModelMixin,
                                GenericViewSet):
    queryset = Insuree.filter_queryset()
    serializer_class = eval(Config.get_serializer())
    permission_classes = (FHIRApiEligibilityRequestPermissions, )

    def get_queryset(self):
        return Insuree.get_queryset(None, self.request.user)
 def verify_fhir_instance(self, fhir_obj):
     self.assertIsNotNone(fhir_obj.insurance[0].benefitBalance)
     for benefit in fhir_obj.insurance[0].benefitBalance:
         if benefit.category.text == Config.get_fhir_total_admissions_code(
         ):
             self.assertEqual(self._TEST_TOTAL_ADMISSIONS,
                              benefit.financial[0].allowedUnsignedInt)
         elif benefit.category.text == Config.get_fhir_total_visits_code():
             self.assertEqual(self._TEST_TOTAL_VISITS,
                              benefit.financial[0].allowedUnsignedInt)
         elif benefit.category.text == Config.get_fhir_total_consultations_code(
         ):
             self.assertEqual(self._TEST_TOTAL_CONSULTATIONS,
                              benefit.financial[0].allowedUnsignedInt)
         elif benefit.category.text == Config.get_fhir_total_surgeries_code(
         ):
             self.assertEqual(self._TEST_TOTAL_SURGERIES,
                              benefit.financial[0].allowedUnsignedInt)
         elif benefit.category.text == Config.get_fhir_total_deliveries_code(
         ):
             self.assertEqual(self._TEST_TOTAL_DELIVERIES,
                              benefit.financial[0].allowedUnsignedInt)
         elif benefit.category.text == Config.get_fhir_total_antenatal_code(
         ):
             self.assertEqual(self._TEST_TOTAL_ANTENATAL,
                              benefit.financial[0].allowedUnsignedInt)
         elif benefit.category.text == Config.get_fhir_consultation_amount_code(
         ):
             self.assertEqual(self._TEST_CONSULTATION_AMOUNT,
                              benefit.financial[0].allowedMoney.value)
         elif benefit.category.text == Config.get_fhir_surgery_amount_code(
         ):
             self.assertEqual(self._TEST_SURGERY_AMOUNT,
                              benefit.financial[0].allowedMoney.value)
         elif benefit.category.text == Config.get_fhir_delivery_amount_code(
         ):
             self.assertEqual(self._TEST_DELIVERY_AMOUNT,
                              benefit.financial[0].allowedMoney.value)
         elif benefit.category.text == Config.get_fhir_hospitalization_amount_code(
         ):
             self.assertEqual(self._TEST_HOSPITALIZATION_AMOUNT,
                              benefit.financial[0].allowedMoney.value)
         elif benefit.category.text == Config.get_fhir_antenatal_amount_code(
         ):
             self.assertEqual(self._TEST_ANTENATAL_AMOUNT,
                              benefit.financial[0].allowedMoney.value)
         elif benefit.category.text == Config.get_fhir_service_left_code():
             self.assertEqual(self._TEST_SERVICE_LEFT,
                              benefit.financial[0].allowedUnsignedInt)
         elif benefit.category.text == Config.get_fhir_item_left_code():
             self.assertEqual(self._TEST_ITEM_LEFT,
                              benefit.financial[0].allowedUnsignedInt)
         elif benefit.category.text == Config.get_fhir_is_service_ok_code():
             self.assertEqual(self._TEST_IS_SERVICE_OK,
                              not benefit.excluded)
         elif benefit.category.text == Config.get_fhir_is_item_ok_code():
             self.assertEqual(self._TEST_IS_ITEM_OK, not benefit.excluded)
示例#4
0
class EligibilityRequestViewSet(BaseFHIRView, mixins.CreateModelMixin,
                                GenericViewSet):
    queryset = Insuree.objects.none()
    serializer_class = eval(Config.get_serializer())
示例#5
0
 def build_fhir_generic_benefit_balance_financial(cls):
     financial = InsuranceBenefitBalanceFinancial()
     financial.type = cls.build_simple_codeable_concept(Config.get_fhir_financial_code())
     return financial
示例#6
0
 def build_fhir_insurance(cls, fhir_response, response):
     result = EligibilityResponseInsurance()
     cls.build_fhir_int_benefit(result, Config.get_fhir_total_admissions_code(), response.total_admissions_left)
     cls.build_fhir_int_benefit(result, Config.get_fhir_total_visits_code(), response.total_visits_left)
     cls.build_fhir_int_benefit(result, Config.get_fhir_total_consultations_code(),
                                response.total_consultations_left)
     cls.build_fhir_int_benefit(result, Config.get_fhir_total_surgeries_code(), response.total_surgeries_left)
     cls.build_fhir_int_benefit(result, Config.get_fhir_total_deliveries_code(), response.total_delivieries_left)
     cls.build_fhir_int_benefit(result, Config.get_fhir_total_antenatal_code(), response.total_antenatal_left)
     cls.build_fhir_money_benefit(result, Config.get_fhir_consultation_amount_code(),
                                  response.consultation_amount_left)
     cls.build_fhir_money_benefit(result, Config.get_fhir_surgery_amount_code(), response.surgery_amount_left)
     cls.build_fhir_money_benefit(result, Config.get_fhir_delivery_amount_code(), response.delivery_amount_left)
     cls.build_fhir_money_benefit(result, Config.get_fhir_hospitalization_amount_code(),
                                  response.hospitalization_amount_left)
     cls.build_fhir_money_benefit(result, Config.get_fhir_antenatal_amount_code(), response.antenatal_amount_left)
     cls.build_fhir_int_benefit(result, Config.get_fhir_service_left_code(), response.service_left)
     cls.build_fhir_int_benefit(result, Config.get_fhir_item_left_code(), response.item_left)
     cls.build_fhir_bool_benefit(result, Config.get_fhir_is_service_ok_code(), response.is_service_ok)
     cls.build_fhir_bool_benefit(result, Config.get_fhir_is_item_ok_code(), response.is_item_ok)
     fhir_response.insurance.append(result)
示例#7
0
 def build_imis_item_code(cls, fhir_eligibility_request):
     return cls.get_text_from_codeable_concept_by_coding_code(fhir_eligibility_request.benefitSubCategory,
                                                              Config.get_fhir_item_code())
 def build_fhir_generic_benefit_balance(cls, code):
     benefit_balance = InsuranceBenefitBalance()
     benefit_balance.category = cls.build_simple_codeable_concept(
         Config.get_fhir_balance_default_category())
     return benefit_balance
 def build_fhir_insurance(cls, fhir_response, response):
     result = EligibilityResponseInsurance()
     cls.build_fhir_insurance_contract(result, response)
     cls.build_fhir_money_benefit(result, Config.get_fhir_balance_code(),
                                  response.ceiling, response.ded)
     fhir_response.insurance.append(result)
 def to_fhir_obj(cls, eligibility_response):
     fhir_response = FHIREligibilityResponse()
     for item in eligibility_response.items:
         if item.status in Config.get_fhir_active_policy_status():
             cls.build_fhir_insurance(fhir_response, item)
     return fhir_response