Ejemplo n.º 1
0
 def money_AJ(self, AY_str):
     money = []
     for i in XSAJ.objects(Q(案由=AY_str)):
         for j in i.判决结果.split('、'):
             if '被告人' in j:
                 for k in re.split('[,,;]',j):
                     # print(k)
                     if '罚金' in k and '�' not in k:
                         # print(k)
                         if re.findall(r'罚金(.*?)元',k):
                             # print(str(re.findall(r'罚金(.*?)元',k)[0]).replace('人民币',''))
                             str1 = str(re.findall(r'罚金(.*?)元', k)[0]).replace('人民币', '')
                             str1 = str1.replace('人币', '')
                             money.append(str1.replace('人民', ''))
                         elif bool(re.findall(r'处罚金(.*?)。',k)):
                             # print(str(re.findall(r'处罚金(.*?)。', k)[0]))
                             money.append(str(re.findall(r'处罚金(.*?)。', k)[0]).replace('人民币', ''))
     # print(money)
     money_re = []
     for l in money:
         # print(l)
         if l.isdigit():
             # print()
             money_re.append(int(l))
         elif not re.compile(u'[^\u4e00-\u9fa5]').search(l):
             # print(l)
             p = XsDqaData().chinese_to_arabic(l)
             # print(p)
             money_re.append(p)
     return money_re
Ejemplo n.º 2
0
 def prison_date(self, AY_str):
     prison = []
     for i in XSAJ.objects(Q(案由=AY_str)):
         for j in i.判决结果.split('、'):
             if '被告人' in j:
                 for k in re.split('[,,;]', j):
                     if '判处' in k:
                         # print(k)
                         date = ''
                         if re.findall(r'判处(.*?)月',k):
                             date = re.findall(r'判处(.*?)月',k)[0]
                             date = date+'月'
                         elif re.findall(r'判处(.*?)年',k):
                             date = re.findall(r'判处(.*?)年', k)[0]
                             date = date + '年'
                         elif re.findall(r'判处(.*?)刑', k):
                             date1 = re.findall(r'判处(.*?)刑', k)[0]
                             if '死' in date1:
                                 date = '死刑'
                             elif '无期徒' in date1:
                                 date = '无期徒刑'
                         if len(date)<=10 and date and ('�' not in date) and ('的' not in date) and ('被告人' not in date):
                             # print(date)
                             prison.append(date)
     return prison
Ejemplo n.º 3
0
    def get_defendant_info(self, AY_str):
        d = []
        # print(str)
        for i in XSAJ.objects(Q(案由=AY_str, 文书类型='判决书')):
            a = i.当事人.split('、')
            # print(a)
            for j in a:
                if ('被告人' in j or '罪犯' in j or '被告' in j) and ('男,' in j
                                                               or '女,' in j):
                    c = {
                        'name': '未知',
                        'sex': '未知',
                        'birthdate': '未知',
                        'addr': '未知',
                        'age': '未知',
                        'nation': '未知',
                        'edu': '未知'
                    }
                    # print(j)
                    if ',' in j or ',' in j:
                        e = j.split(',')
                        b = []
                        for i in e:
                            for w in i.split(','):
                                b.append(w)
                        b[0] = b[0].replace('被告人', '')
                        b[0] = b[0].replace('罪犯', '')
                        b[0] = b[0].replace('上诉人(原审)', '')
                        b[0] = b[0].replace('上诉人(原审)', '')
                        b[0] = b[0].replace('被告:', '')
                        b[0] = b[0].replace('被告', '')
                        c['name'] = b[0]
                        # print(b)
                        for k in b:
                            if '男' in k or '女' in k:
                                c['sex'] = k
                                # break
                            elif '出生' in k:
                                k1 = k.split('出生')
                                c['birthdate'] = k1[0]
                                if k1[1]:
                                    c['addr'] = re.sub('于', '', k1[1])
                                if (c['birthdate'][:4].isdigit()):
                                    c['age'] = str(2019 -
                                                   int(c['birthdate'][:4]))
                                # break
                            elif '族' in k and len(k) < 6:
                                c['nation'] = k
                                # break
                            elif '文化' in k and len(k) < 6:
                                c['edu'] = k
                            elif '文盲' in k and len(k) < 6:
                                c['edu'] = k
                                # break

                        d.append(c)
                        break
        return d
Ejemplo n.º 4
0
 def get_court_pre_info(self):
     court = {}
     for i in XSAJ.objects(Q(案由='盗窃罪', 文书类型='判决书')):
         if i.法院 in list(court.keys()):
             court[i.法院] += 1
         else:
             court[i.法院] = 1
     court_pre = sorted(court.items(), key=lambda k: k[1], reverse=True)
     return court_pre
Ejemplo n.º 5
0
 def get_case_date_number(self):
     case_date_number = {'2018': 0, '2017': 0, '2016': 0}
     for i in XSAJ.objects(Q(案由='危险驾驶罪', 文书类型='判决书')):
         for j in i.尾部信息.split('、'):
             if ('年' in j) and ('月' in j) and ('日' in j) and ('二' in j):
                 if ('二○一八' in j) or ('二〇一八' in j):
                     case_date_number['2018'] += 1
                 elif ('二○一七' in j) or ('二〇一七' in j):
                     case_date_number['2017'] += 1
                 elif ('二○一六' in j) or ('二〇一六' in j):
                     case_date_number['2016'] += 1
                 break
     return case_date_number
Ejemplo n.º 6
0
 def get_line_data(self):
     line_data_dict = {}
     for i in XSAJ.objects(Q(案由='盗窃罪', 文书类型='判决书')):
         date = str(i.案号.split(')')[0].replace('(', '')) + '年'
         if (date not in line_data_dict.keys()) and (len(date) < 7):
             line_data_dict[date] = 1
         elif date in line_data_dict.keys():
             line_data_dict[date] += 1
     line_data_tuple = sorted(line_data_dict.items(), key=lambda k: k[0])
     line_data = [[], []]
     for i in line_data_tuple:
         line_data[0].append(i[0])
         line_data[1].append(i[1])
     return line_data
Ejemplo n.º 7
0
 def get_Fchart_data(self):
     DQpnumber = len(self.defendant_info)
     DQcasenum = XSAJ.objects(Q(案由='盗窃罪', 文书类型='判决书')).count()
     court_data = XsDqaData().get_court_info()
     map_data = XsDqaData().get_map_data(court_data)
     his_row_data = XsDqaData().get_his_row_data(map_data)
     line_data = XsDqaData().get_line_data()
     Fchart_data = {
         'DQpnumber': DQpnumber,
         'DQcasenum': DQcasenum,
         'map_data': map_data,
         'his_row_data': his_row_data,
         'line_data': line_data,
     }
     return Fchart_data
Ejemplo n.º 8
0
 def get_Fchart_data(self):
     WXJSpnumber = len(self.defendant_info)
     WXJScasenum = XSAJ.objects(Q(案由='危险驾驶罪', 文书类型='判决书')).count()
     court_data = XsWxjsData().get_court_info()
     map_data = XsWxjsData().get_map_data(court_data)
     his_row_data = XsWxjsData().get_his_row_data(map_data)
     line_data = XsWxjsData().get_line_data()
     Fchart_data = {
         'WXJSpnumber': WXJSpnumber,
         'WXJScasenum': WXJScasenum,
         'map_data': map_data,
         'his_row_data': his_row_data,
         'line_data': line_data,
     }
     return Fchart_data
Ejemplo n.º 9
0
 def get_case_alcohol_amount(self):
     alcohol = []
     count = 0
     for i in XSAJ.objects(Q(案由='危险驾驶罪')):
         k = re.findall(r'(\d{1,4}|[1-9]\d*\.\d*|0\.\d*[1-9]\d*)mg',
                        i.庭审过程,
                        flags=0)
         # k1 = re.findall(r'(\d{1,4}|[1-9]\d*\.\d*|0\.\d*[1-9]\d*)mg/(\d{3})ml', i.庭审过程, flags=0)
         if k:
             # print(k)
             alcohol.append(float(k[-1]))
         else:
             count += 1
     alcohol.sort()
     alcohol_amount = {
         '80mg~100mg': 0,
         '101mg~150mg': 0,
         '151mg~200mg': 0,
         '201mg~250mg': 0,
         '251mg~300mg': 0,
         '301mg及以上': 0,
     }
     for a in alcohol:
         if a <= 100:
             alcohol_amount['80mg~100mg'] = alcohol_amount['80mg~100mg'] + 1
         elif a <= 150:
             alcohol_amount[
                 '101mg~150mg'] = alcohol_amount['101mg~150mg'] + 1
         elif a <= 200:
             alcohol_amount[
                 '151mg~200mg'] = alcohol_amount['151mg~200mg'] + 1
         elif a <= 250:
             alcohol_amount[
                 '201mg~250mg'] = alcohol_amount['201mg~250mg'] + 1
         elif a <= 300:
             alcohol_amount[
                 '251mg~300mg'] = alcohol_amount['251mg~300mg'] + 1
         else:
             alcohol_amount['301mg及以上'] = alcohol_amount['301mg及以上'] + 1
     # print(alcohol_amount)
     ALA = []
     for al in alcohol_amount:
         b = {}
         b['name'] = al
         b['y'] = alcohol_amount[al]
         ALA.append(b)
     return ALA