示例#1
0
def pxs2person(row, person):

    kw = {}
    store(kw,
          card_number=row['CARDNUMBER'],
          card_issuer=row.get('CARDISSUER', ''),      # 20110110
          noble_condition=row.get('NOBLEECOND', ''),      # 20110110
          birth_place=row.get('BIRTHPLACE', ''),
          remarks2=row.get('MEMO', ''),
          gender=convert_sex(row['SEXE'])
          )
    for k, v in kw.items():
        setattr(person, k, v)

    par2person(row, person)

    if row.has_key('CARDTYPE'):
        #~ row.card_type = BeIdCardTypes.items_dict.get(row['CARDTYPE'].strip(),'')
        from lino_welfare.modlib.pcsw import models as pcsw
        if row['CARDTYPE'] == 0:
            person.card_type = BeIdCardTypes.blank_item
        else:
            person.card_type = BeIdCardTypes.get_by_value(str(row['CARDTYPE']))
    if row['IDMUT']:
        try:
            person.health_insurance = Company.objects.get(
                pk=ADR_id(row['IDMUT']))
        except ValueError, e:
            dblogger.warning(u"%s : invalid health_insurance %r",
                             obj2str(person), row['IDMUT'])
        except Company.DoesNotExist, e:
            dblogger.warning(u"%s : health_insurance %s not found",
                             obj2str(person), row['IDMUT'])
示例#2
0
def pxs2client(row, person):

    kw = {}
    store(
        kw,
        card_number=row["CARDNUMBER"],
        card_issuer=row.get("CARDISSUER", ""),  # 20110110
        noble_condition=row.get("NOBLEECOND", ""),  # 20110110
        birth_place=row.get("BIRTHPLACE", ""),
        remarks2=row.get("MEMO", ""),
        gender=convert_sex(row["SEXE"]),
    )
    for k, v in kw.items():
        setattr(person, k, v)

    par2client(row, person)

    if row.has_key("CARDTYPE"):
        if row["CARDTYPE"] == 0:
            # ~ person.card_type = BeIdCardTypes.blank_item
            person.card_type = ""
        else:
            person.card_type = BeIdCardTypes.get_by_value(str(row["CARDTYPE"]))

    if row["IDMUT"]:
        checkcc(person, ADR_id(row["IDMUT"]), CCTYPE_HEALTH_INSURANCE)
    if row["APOTHEKE"]:
        checkcc(person, row["APOTHEKE"], CCTYPE_PHARMACY)

        # ~ try:
        # ~ person.pharmacy = Company.objects.get(pk=int(row['APOTHEKE']))
        # ~ except ValueError,e:
        # ~ dblogger.warning(u"%s : invalid pharmacy %r",dd.obj2str(person),row['APOTHEKE'])
        # ~ except Company.DoesNotExist,e:
        # ~ dblogger.warning(u"%s : pharmacy %s not found",dd.obj2str(person),row['APOTHEKE'])

    nat = row["NATIONALIT"]
    if nat:
        try:
            country = Country.objects.get(short_code__exact=nat)
        except Country.DoesNotExist:
            country = Country(isocode=nat, name=nat, short_code=nat)
            country.save()
        person.nationality = country

    store_date(row, person, "GEBDAT", "birth_date")
    store_date(row, person, "VALID1", "card_valid_from")
    store_date(row, person, "VALID2", "card_valid_until")