示例#1
0
 def test_get_comprehensive_insurance_feedrate(self):
     item = [
         {'start_age': '60D', 'end_age': '6Y',  'fee': 480}
         ]
     comprehensive_insurance_obj = Insurance.get(1)
     comprehensive_insurance_obj.ins_property.feerate = item
     fee = comprehensive_insurance_obj.ins_property.get(1, birthday='2013-03-01')
     self.assertEqual(fee, 480)
示例#2
0
    def test_insurance_oder_rate_property(self):
        item = [
            {'start_age': '60D', 'end_age': '6Y',  'fee': 480}
            ]
        comprehensive_insurance_obj = Insurance.get(1)
        comprehensive_insurance_obj.ins_property.feerate = item

        insurance_order = Order(1, 2, 3, 1)
        insurance_order.rate(birthday='2013-03-01')
        self.assertEqual(insurance_order.rate(birthday='2013-03-01'), 480)
示例#3
0
 def test_get_critical_insurance_feedrate_20w(self):
     item = [
         {'ill': 1, 'age': '2Y', 'gender': 'M', 'fee': 480},
         {'ill': 1, 'age': '2Y', 'gender': 'F', 'fee': 320},
         {'ill': 0, 'age': '2Y', 'gender': 'M', 'fee': 200},
         {'ill': 0, 'age': '2Y', 'gender': 'F', 'fee': 160},
         ]
     critical_insurance_obj = Insurance.get(8)
     critical_insurance_obj.ins_property.feerate = item
     fee = critical_insurance_obj.ins_property.get(
         2, ill=0, gender='0', birthday='2014-03-01')
     self.assertEqual(fee, 320)
示例#4
0
 def test_get_critical_insurance_feedrate(self):
     item = [
         {'ill': 1, 'age': '0Y', 'gender': 'M', 'fee': 480},
         {'ill': 1, 'age': '0Y', 'gender': 'F', 'fee': 320},
         {'ill': 0, 'age': '0Y', 'gender': 'M', 'fee': 200},
         {'ill': 0, 'age': '0Y', 'gender': 'F', 'fee': 160},
         ]
     critical_insurance_obj = Insurance.get(8)
     critical_insurance_obj.ins_property.feerate = item
     fee = critical_insurance_obj.ins_property.get(
         1, ill=1, gender='1', birthday='2016-03-01', coverage=10)
     self.assertEqual(fee, 480)
示例#5
0
def update_insurance(id_, ins_title, urls):
    """
    更新insurance 的名称 和 链接
    """
    ins = Insurance.get(id_)

    db.execute('update insurance set name=%s where insurance_id=%s', (
        ins_title,
        id_,
    ))
    db.commit()
    Insurance.clear_cache(id_)
    feerate = ins.ins_property.feerate[:]
    rec_reason = ins.ins_property.rec_reason
    buy_url = urls
    ins_title = ins_title
    ins_sub_title = ins.ins_property.ins_sub_title
    ins.add_insurance_props(feerate, rec_reason, buy_url, ins_title,
                            ins_sub_title)

    print '更新insurance %s 的标题...成功' % ins_title
示例#6
0
 def test_get_education_insurance_feedrate_20w(self):
     item = [
         {'age': '2Y', 'coverage': 'low', 'fee': 3393},
         {'age': '2Y', 'coverage': 'medium', 'fee': 9390},
         {'age': '2Y', 'coverage': 'high', 'fee': 21525},
         {'age': '3Y', 'coverage': 'low', 'fee': 6553},
         {'age': '3Y', 'coverage': 'medium', 'fee': 18140},
         {'age': '3Y', 'coverage': 'high', 'fee': '41575'}
         ]
     education_insurance_obj = Insurance.get(10)
     education_insurance_obj.ins_property.feerate = item
     fee = education_insurance_obj.ins_property.get(
         1, birthday='2014-03-01', coverage='a1')
     self.assertEqual(fee, 3393)
示例#7
0
文件: order.py 项目: c1xfr2e/soledad
 def insurance(self):
     return Insurance.get(self.insurance_id)
示例#8
0
def add_insurance(kind, insurance_id, name, status, rec_rank):
    Insurance.add(kind, insurance_id, name, status, rec_rank)
    bcolors.run(u'insurance_id=%s,kind=%s,name=%s' %
                (insurance_id, kind, name),
                key='insurance')
示例#9
0
def add_insurance_props():
    item = [{
        'age': '0Y',
        'coverage': 'low',
        'fee': 3234
    }, {
        'age': '0Y',
        'coverage': 'medium',
        'fee': 8940
    }, {
        'age': '0Y',
        'coverage': 'high',
        'fee': 20490
    }, {
        'age': '1Y',
        'coverage': 'low',
        'fee': 3320
    }, {
        'age': '1Y',
        'coverage': 'medium',
        'fee': 9170
    }, {
        'age': '1Y',
        'coverage': 'high',
        'fee': 21015
    }, {
        'age': '2Y',
        'coverage': 'low',
        'fee': 3393
    }, {
        'age': '2Y',
        'coverage': 'medium',
        'fee': 9390
    }, {
        'age': '2Y',
        'coverage': 'high',
        'fee': 21525
    }, {
        'age': '3Y',
        'coverage': 'low',
        'fee': 6553
    }, {
        'age': '3Y',
        'coverage': 'medium',
        'fee': 18140
    }, {
        'age': '3Y',
        'coverage': 'high',
        'fee': 41575
    }, {
        'age': '4Y',
        'coverage': 'low',
        'fee': 6725
    }, {
        'age': '4Y',
        'coverage': 'medium',
        'fee': 18600
    }, {
        'age': '4Y',
        'coverage': 'high',
        'fee': 41575
    }, {
        'age': '5Y',
        'coverage': 'low',
        'fee': 6889
    }, {
        'age': '5Y',
        'coverage': 'medium',
        'fee': 19060
    }, {
        'age': '5Y',
        'coverage': 'high',
        'fee': 43680
    }, {
        'age': '6Y',
        'coverage': 'low',
        'fee': 7065
    }, {
        'age': '6Y',
        'coverage': 'medium',
        'fee': 19540
    }, {
        'age': '6Y',
        'coverage': 'high',
        'fee': 44780
    }, {
        'age': '7Y',
        'coverage': 'low',
        'fee': 6026
    }, {
        'age': '7Y',
        'coverage': 'medium',
        'fee': 13970
    }, {
        'age': '7Y',
        'coverage': 'high',
        'fee': 30755
    }, {
        'age': '8Y',
        'coverage': 'low',
        'fee': 6183
    }, {
        'age': '8Y',
        'coverage': 'medium',
        'fee': 14340
    }, {
        'age': '8Y',
        'coverage': 'high',
        'fee': 31575
    }, {
        'age': '9Y',
        'coverage': 'low',
        'fee': 6343
    }, {
        'age': '9Y',
        'coverage': 'medium',
        'fee': 14710
    }, {
        'age': '9Y',
        'coverage': 'high',
        'fee': 32390
    }, {
        'age': '10Y',
        'coverage': 'low',
        'fee': 5285
    }, {
        'age': '10Y',
        'coverage': 'medium',
        'fee': 8990
    }, {
        'age': '10Y',
        'coverage': 'high',
        'fee': 17980
    }, {
        'age': '11Y',
        'coverage': 'low',
        'fee': 5420
    }, {
        'age': '11Y',
        'coverage': 'medium',
        'fee': 9220
    }, {
        'age': '11Y',
        'coverage': 'high',
        'fee': 18400
    }, {
        'age': '12Y',
        'coverage': 'low',
        'fee': 5555
    }, {
        'age': '12Y',
        'coverage': 'medium',
        'fee': 9460
    }, {
        'age': '12Y',
        'coverage': 'high',
        'fee': 18900
    }, {
        'age': '13Y',
        'coverage': 'low',
        'fee': 5690
    }, {
        'age': '13Y',
        'coverage': 'medium',
        'fee': 9680
    }, {
        'age': '13Y',
        'coverage': 'high',
        'fee': 19360
    }]
    education_insurance_obj = Insurance.get(10)
    feerate = item
    rec_reason = u'① 保障范围广(意外身故、意'
    buy_url = 'http://www.hzins.com/product/detail-727.html'
    ins_title = 'ins_title'
    ins_sub_title = u'实现直到大学的教育金保障'
    education_insurance_obj.add_insurance_props(feerate, rec_reason, buy_url,
                                                ins_title, ins_sub_title)
    item1 = [
        {
            'start_age': '60D',
            'end_age': '6Y',
            'fee': 480
        },
    ]
    comprehensive_insurance_obj = Insurance.get(1)
    feerate = item1
    #    rec_reason = (u'① 保障范围广(意外身故、意外医疗、住院医疗、重大疾病、',
    #                  u'医疗运送等',
    #                  enter,
    #                  u'② 性价比高,尤其含重疾保额10万元')
    rec_reason = u'① 含保费豁免条款'
    buy_url = 'http://www.hzins.com/product/detail-857.html'
    ins_title = 'ins_title'
    ins_sub_title = u'实现综合、全面的保障'
    comprehensive_insurance_obj.add_insurance_props(feerate, rec_reason,
                                                    buy_url, ins_title,
                                                    ins_sub_title)

    item2 = [{'start_age': '7Y', 'end_age': '17Y', 'fee': 400}]
    comprehensive_insurance_obj = Insurance.get(2)
    feerate = item2
    #    rec_reason = (u'① 保障范围广(意外身故、意外医疗、住院医疗、重大疾病、',
    #                  u'医疗运送等)',
    #                  enter,
    #                  u'② 性价比高,尤其含重疾保额10万元')
    rec_reason = u'① 保障范围广(意外身故、意外医疗、住院医疗、重大疾病、医'
    buy_url = 'http://www.hzins.com/product/detail-858.html'
    ins_title = 'ins_title'
    ins_sub_title = u'实现综合、全面的保障'
    comprehensive_insurance_obj.add_insurance_props(feerate, rec_reason,
                                                    buy_url, ins_title,
                                                    ins_sub_title)

    item3 = [{'start_age': '3Y', 'end_age': '17Y', 'fee': 190}]
    comprehensive_insurance_obj = Insurance.get(3)
    feerate = item3
    rec_reason = u'① 保障侧重医疗和重疾,含住院医疗8万,重疾2万'
    buy_url = 'http://www.hzins.com/product/detail-932.html'
    ins_title = 'ins_title'
    ins_sub_title = u'实现医疗为重的综合保障'
    comprehensive_insurance_obj.add_insurance_props(feerate, rec_reason,
                                                    buy_url, ins_title,
                                                    ins_sub_title)

    item4 = [{'start_age': '30D', 'end_age': '17Y', 'fee': 260}]
    comprehensive_insurance_obj = Insurance.get(4)
    feerate = item4
    rec_reason = u'① 保费低、保障全'
    ins_title = 'ins_title'
    ins_sub_title = u'实现医疗为重的综合保障'
    buy_url = 'http://www.hzins.com/product/detail-933.html'
    ins_sub_title = u'实现综合、全面的保障'
    comprehensive_insurance_obj.add_insurance_props(feerate, rec_reason,
                                                    buy_url, ins_title,
                                                    ins_sub_title)

    item5 = [{'start_age': '30D', 'end_age': '2Y', 'fee': 480}]
    comprehensive_insurance_obj = Insurance.get(5)
    feerate = item5
    rec_reason = u'① 保障较全面,'
    buy_url = 'http://www.hzins.com/product/detail-1107.html'
    ins_title = 'ins_title'
    ins_sub_title = u'实现医疗为重的综合保障'
    comprehensive_insurance_obj.add_insurance_props(feerate, rec_reason,
                                                    buy_url, ins_title,
                                                    ins_sub_title)

    item6 = [{'start_age': '2Y', 'end_age': '6Y', 'fee': 300}]
    comprehensive_insurance_obj = Insurance.get(6)
    feerate = item6
    rec_reason = u'① 住院医疗(10万)'
    buy_url = 'http://www.hzins.com/product/detail-924.html'
    ins_title = 'ins_title'
    ins_sub_title = u'实现医疗为重的综合保障'
    comprehensive_insurance_obj.add_insurance_props(feerate, rec_reason,
                                                    buy_url, ins_title,
                                                    ins_sub_title)

    item7 = [{'start_age': '7Y', 'end_age': '17Y', 'fee': 300}]
    comprehensive_insurance_obj = Insurance.get(7)
    feerate = item7
    rec_reason = u'① 性价比高,含住院医疗10万、重疾8万等'
    buy_url = 'http://www.hzins.com/product/detail-926.html'
    ins_title = 'ins_title'
    ins_sub_title = u'实现医疗为重的综合保障'
    comprehensive_insurance_obj.add_insurance_props(feerate, rec_reason,
                                                    buy_url, ins_title,
                                                    ins_sub_title)

    item8 = [{
        'ill': 0,
        'gender': 'M',
        'age': '0Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '0Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '1Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '1Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '2Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '2Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '3Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '3Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '4Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '4Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '5Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '5Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '6Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '6Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '7Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '7Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '8Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '8Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '9Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '9Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '10Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '10Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '11Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '11Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '12Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '12Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '13Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '13Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '14Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '14Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '15Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '15Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '16Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '16Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'F',
        'age': '17Y',
        'fee': 200
    }, {
        'ill': 0,
        'gender': 'M',
        'age': '17Y',
        'fee': 200
    }]

    critical_insurance_obj = Insurance.get(8)
    feerate = item8
    rec_reason = u'① 针对18种少儿高发重大疾病,剔除成人易患的重疾'
    buy_url = 'http://www.hzins.com/product/detail-725.html'
    ins_title = 'ins_title'
    ins_sub_title = u'实现最高%s万元的重疾保障'
    critical_insurance_obj.add_insurance_props(feerate, rec_reason, buy_url,
                                               ins_title, ins_sub_title)

    item9 = [{
        'ill': 1,
        'gender': 'M',
        'age': '0Y',
        'fee': 160
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '0Y',
        'fee': 130
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '1Y',
        'fee': 150
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '1Y',
        'fee': 130
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '2Y',
        'fee': 150
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '2Y',
        'fee': 130
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '3Y',
        'fee': 150
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '3Y',
        'fee': 130
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '4Y',
        'fee': 160
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '4Y',
        'fee': 130
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '5Y',
        'fee': 160
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '5Y',
        'fee': 130
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '6Y',
        'fee': 170
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '6Y',
        'fee': 130
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '7Y',
        'fee': 170
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '7Y',
        'fee': 130
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '8Y',
        'fee': 180
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '8Y',
        'fee': 140
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '9Y',
        'fee': 180
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '9Y',
        'fee': 140
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '10Y',
        'fee': 190
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '10Y',
        'fee': 140
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '11Y',
        'fee': 200
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '11Y',
        'fee': 150
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '12Y',
        'fee': 200
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '12Y',
        'fee': 160
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '13Y',
        'fee': 210
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '13Y',
        'fee': 160
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '14Y',
        'fee': 220
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '14Y',
        'fee': 170
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '15Y',
        'fee': 230
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '15Y',
        'fee': 180
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '16Y',
        'fee': 250
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '16Y',
        'fee': 190
    }, {
        'ill': 1,
        'gender': 'F',
        'age': '17Y',
        'fee': 260
    }, {
        'ill': 1,
        'gender': 'M',
        'age': '17Y',
        'fee': 200
    }]

    critical_insurance_obj = Insurance.get(9)
    feerate = item9
    rec_reason = u'① 长期消费型保险,适合有家族遗传病史,'
    buy_url = 'http://www.hzins.com/product/health/detal-146.html'
    ins_title = 'ins_title'
    ins_sub_title = u'实现%s万元的长期重疾保障'
    critical_insurance_obj.add_insurance_props(feerate, rec_reason, buy_url,
                                               ins_title, ins_sub_title)

    package_obj_1 = Package.get(1)
    package_obj_1[0].insurance_ability = u'本套餐合理覆盖医疗、重疾、'
    package_obj_1[0].name = u'基础套餐'
    package_obj_1[0].title = u'均衡、全面的保障规划'
    package_obj_1[0].sub_title = u'以超高性价比实现均衡的基础保障'
    package_obj_1[0].quota = u''
    package_obj_1[0].quota_b = u''
    package_obj_1[0].radar = 'radar1.png'

    package_obj_2 = Package.get(2)
    package_obj_2[0].insurance_ability = u'本套餐着重于医疗保障,'
    package_obj_2[0].name = u'医疗套餐'
    package_obj_2[0].title = u'医疗保障为主的规划'
    package_obj_2[0].sub_title = u'充足的医疗保障与合理的整体配置'
    package_obj_2[0].quota = u''
    package_obj_2[0].quota_b = u''
    package_obj_2[0].radar = 'radar2.png'

    package_obj_3 = Package.get(3)
    package_obj_3[0].insurance_ability = u'本套餐着重于重疾保障,兼顾适当的'
    package_obj_3[0].name = u'重疾套餐'
    package_obj_3[0].title = u'医疗保障为主的规划'
    package_obj_3[0].sub_title = u'充足的重疾保障与合理的整体配置'
    package_obj_3[0].quota = u''
    package_obj_3[0].quota_b = u''
    package_obj_3[0].radar = 'radar3.png'

    package_obj_4 = Package.get(4)
    package_obj_4[0].insurance_ability = u'本套餐着重于意外保障,精心组合'
    package_obj_4[0].name = u'意外套餐'
    package_obj_4[0].title = u'重疾保障为主的规划'
    package_obj_4[0].sub_title = u'充足的意外保障与高性价比的整体配置'
    package_obj_4[0].quota = u''
    package_obj_4[0].quota_b = u''
    package_obj_4[0].radar = 'radar4.png'

    package_obj_5 = Package.get(5)
    package_obj_5[0].insurance_ability = u'本套餐均衡应对各种风险,科学组合'
    package_obj_5[0].name = u'升级套餐'
    package_obj_5[0].title = u'意外保障为主的规划'
    package_obj_5[0].sub_title = u'以高性价比实现全面、完善的保障'
    package_obj_5[0].quota = u''
    package_obj_5[0].quota_b = u''
    package_obj_5[0].radar = 'radar5.png'

    program = Program()
    balance_quota = u'理财师根据儿童现状,挑选最高性价比儿童保险,'

    medical_with_socical_insurance = u'由于您的孩子已有医保与补充医疗保险,'
    medical_quota = 'medical_quota'

    disease_quota = u'有家族遗传病史的儿童需要尽早完善重疾保障,适合长期重疾险'
    accident_quota = u'孩子们还没学会保护自己,同时充满好奇心、活泼好动,'

    program.quota = {
        '1': balance_quota,
        '2': medical_with_socical_insurance,
        '3': medical_quota,
        '4': disease_quota,
        '5': accident_quota
    }