Example #1
0
def exp_to_excel_form3(doc, iperiod, iregion, mode, stat = None):    # mode = 0 по региону или группе больниц  mode = 1 - по конкретной больнице
    res =  calc_sum_form3(doc)
    speriod = get_period_namef(iperiod)
    sregion = get_region_name(mode,doc,iregion)
    if mode == 1:
        name_file = get_name("/static/Form/Form3.xlsx")
    else:
        name_file = get_name("/static/Form/Form3_All.xlsx")

    wb = openpyxl.load_workbook(name_file)
    sheet = wb.active
    sheet['B2'] = speriod
    sheet['B1'] = sregion
    if mode==0:
        sheet['B310'] = "Статистика по отчету"  
        sheet['B311'] = "Организаций предоставляющих, Всего"
        sheet['C311'] = stat.rec_all
        sheet['B312'] = "Отобрано в отчет, Всего"
        sheet['C312'] = stat.rec_fltr
        sheet['B313'] = "Завершено"
        sheet['C313'] = stat.rec_complete
        sheet['B314'] = "Согласование"
        sheet['C314'] = stat.rec_soglas
        sheet['B315'] = "Корректировка"
        sheet['C315'] = stat.rec_correct
        sheet['B316'] = "Редактирование"
        sheet['C316'] = stat.rec_edit


    startrow = 7 
    for i in range(0,296):
        srA = "B" + str(startrow + i)
        srB = "C" + str(startrow + i)
        sheet[srA] = res[i][0]
        sheet[srB] = res[i][1]
# вывод только для конкретной МО для все  не выводится        
    if mode == 1:
#        res = calc_valf3_form2(doc)
        startrow = 307 
        for i in range(0,38):
            srA = "B" + str(startrow + i)
            srB = "C" + str(startrow + i)
            sheet[srA] = res[i][0]
            sheet[srB] = res[i][1]
                
        sheet['A346'] = "Выведено в системе Мед+ " + str(datetime.now()) 
        sheet['A346'].font = Font(size=5)
    else:
        sheet['A318'] = "Выведено в системе Мед+ " + str(datetime.now()) 
        sheet['A318'].font = Font(size=5)
 
 #   name_file =  get_name("\\medicament\\Form\\rep" + str(int(random()*100000000)) + ".xlsx") 
    name_file =  get_name("/medicament/Form/rep" + str(int(random()*100000000)) + ".xlsx") 
    wb.save(name_file)
    
    return name_file
Example #2
0
def exp_to_excel_form4(doc, iperiod, iregion, mode, stat = None):    # mode = 0 по региону или группе больниц  mode = 1 - по конкретной больнице
    print("mode=", mode)
    print("doc=", doc)
    res =  calc_sum_form4(doc)
    speriod = get_period_namef(iperiod)
    sregion = get_region_name(mode,doc,iregion)
    if mode == 1:
        name_file = get_name("/static/Form/Form4.xlsx")
    else:
        name_file = get_name("/static/Form/Form4_All.xlsx")

    wb = openpyxl.load_workbook(name_file)
    print(wb.get_sheet_names())

    tab = 'Doc'
    sheet = wb[tab]
#    sheet = wb.active
    sheet['B2'] = speriod
    sheet['B1'] = sregion
    if mode==0:
        sheet['B310'] = "Статистика по отчету"  
        sheet['B311'] = "Организаций предоставляющих, Всего"
        sheet['C311'] = stat.rec_all
        sheet['B312'] = "Отобрано в отчет, Всего"
        sheet['C312'] = stat.rec_fltr
        sheet['B313'] = "Завершено"
        sheet['C313'] = stat.rec_complete
        sheet['B314'] = "Согласование"
        sheet['C314'] = stat.rec_soglas
        sheet['B315'] = "Корректировка"
        sheet['C315'] = stat.rec_correct
        sheet['B316'] = "Редактирование"
        sheet['C316'] = stat.rec_edit

# Обшая часть
    startrow = 7 
    i = 0
    d = res['doc']
    for elem in d:
        srA = "B" + str(startrow + i)
        srB = "C" + str(startrow + i)
        sheet[srA] = elem[0]
        sheet[srB] = elem[1]
        i += 1
# Таблицы
    tab = 'tab1000'
    sheet1 = wb[tab]
    startrow = 12
    i = 0
    t = res[tab]
#    assert False
    for line in t:
        srA = "B" + str(startrow + i)
        srB = "C" + str(startrow + i)
        srC = "D" + str(startrow + i)
        sheet1[srA] = line[0].name
        sheet1[srB] = line[1]
        sheet1[srC] = line[2]
        i += 1
    
    
    sheet['A50'] = "Выведено в системе Мед+ " + str(datetime.now()) 
    sheet['A50'].font = Font(size=5)
 
#   name_file =  get_name("\\medicament\\Form\\rep" + str(int(random()*100000000)) + ".xlsx") 
    name_file =  get_name("/medicament/Form/rep" + str(int(random()*100000000)) + ".xlsx") 
    wb.save(name_file)
    
    return name_file
Example #3
0
def exp_to_excel_form1(doc, iperiod, iregion, mode, stat = None):    # mode = 0 по региону или группе больниц  mode = 1 - по конкретной больнице
    res =  calc_sum_form1(doc)
    speriod = get_period_namef(iperiod)
    sregion = get_region_name(mode,doc,iregion)
    name_file = get_name("/static/Form/Form1.xlsx")

    wb = openpyxl.load_workbook(name_file)
    sheet = wb.active
    sheet['B2'] = speriod
    sheet['A1'] = sregion
    if mode==0:
        sheet['A20'] = "Статистика по отчету"  
        sheet['A21'] = "Организаций предоставляющих, Всего"
        sheet['B21'] = stat.rec_all
        sheet['A22'] = "Отобрано в отчет, Всего"
        sheet['B22'] = stat.rec_fltr
        sheet['A23'] = "Завершено"
        sheet['B23'] = stat.rec_complete
        sheet['A24'] = "Согласование"
        sheet['B24'] = stat.rec_soglas
        sheet['A25'] = "Корректировка"
        sheet['B25'] = stat.rec_correct
        sheet['A26'] = "Редактирование"
        sheet['B26'] = stat.rec_edit

    sheet['A28'] = "Выведено в системе Мед+ " + str(datetime.now()) 
    sheet['A28'].font = Font(size=5)

    
    sheet['B8'] = res[0][1]
    sheet['C8'] = res[0][2]
    sheet['D8'] = res[0][3]
    sheet['E8'] = res[0][4]
    sheet['F8'] = res[0][5]

    sheet['G10'] = res[1][6]
    sheet['H10'] = res[1][7]
    sheet['I10'] = res[1][8]

    sheet['B11'] = res[2][1]
    sheet['C11'] = res[2][2]
    sheet['D11'] = res[2][3]
    sheet['E11'] = res[2][4]
    sheet['F11'] = res[2][5]
    sheet['G11'] = res[2][6]
    sheet['H11'] = res[2][7]
    sheet['I11'] = res[2][8]

    sheet['B13'] = res[3][1]
    sheet['C13'] = res[3][2]
    sheet['D13'] = res[3][3]
    sheet['E13'] = res[3][4]
    sheet['F13'] = res[3][5]
    sheet['G13'] = res[3][6]
    sheet['H13'] = res[3][7]
    sheet['I13'] = res[3][8]


 #   name_file =  get_name("\\medicament\\Form\\rep" + str(int(random()*100000000)) + ".xlsx") 
    name_file =  get_name("/medicament/Form/rep" + str(int(random()*100000000)) + ".xlsx") 
    wb.save(name_file)
    
    return name_file
Example #4
0
def exp_to_excel_form3(doc, iperiod, iregion, mode, stat = None):    # mode = 0 по региону или группе больниц  mode = 1 - по конкретной больнице
    res =  calc_sum_form3(doc)
    speriod = get_period_namef(iperiod)
    sregion = get_region_name(mode,doc,iregion)
    name_file = get_name("/static/Form/Form3.xlsx")

    wb = openpyxl.load_workbook(name_file)
    
#    print(wb.get_sheet_names())
    
    sheet = wb['stat']
    sheet1 = wb['1000']
    sheet2 = wb['2000']
    sheet3 = wb['3000']
    sheet4 = wb['4000']
    sheet5 = wb['5000']
    sheet6 = wb['5001']
    sheet7 = wb['6000']
    sheet8 = wb['7000']
#    sheet = wb.active
    
    sheet['B1'] = "Период:"
    sheet['C1'] = speriod
    sheet['B2'] = "Учереждение"
    sheet['C2'] = sregion
    if mode==0:
        sheet['B3'] = "Статистика по отчету"  
        sheet['B4'] = "Организаций предоставляющих, Всего"
        sheet['C4'] = stat.rec_all
        sheet['B5'] = "Отобрано в отчет, Всего"
        sheet['C5'] = stat.rec_fltr
        sheet['B6'] = "Завершено"
        sheet['C6'] = stat.rec_complete
        sheet['B7'] = "Согласование"
        sheet['C7'] = stat.rec_soglas
        sheet['B8'] = "Корректировка"
        sheet['C8'] = stat.rec_correct
        sheet['B9'] = "Редактирование"
        sheet['C9'] = stat.rec_edit
       
# Вне табличные данные
    d = res['doc']
    
# ТаблицыS
#   1000
    startrow = 7
    i = 0
    t = res['tab1000']
    for line in t:
        sheet1["C" + str(startrow + i)] = line[5] + line[9]
        sheet1["D" + str(startrow + i)] = line[6] + line[10]
        sheet1["E" + str(startrow + i)] = line[7] + line[11]
        sheet1["F" + str(startrow + i)] = line[8] + line[12]
        sheet1["G" + str(startrow + i)] = line[5]
        sheet1["H" + str(startrow + i)] = line[6]
        sheet1["I" + str(startrow + i)] = line[7]
        sheet1["J" + str(startrow + i)] = line[8]
        sheet1["K" + str(startrow + i)] = line[9]
        sheet1["L" + str(startrow + i)] = line[10]
        sheet1["M" + str(startrow + i)] = line[11]
        sheet1["N" + str(startrow + i)] = line[12]
        i += 1

#   2000
    startrow = 6
    i = 0
    t = res['tab2000']
    for line in t:
        sheet2["C" + str(startrow + i)] = line[1]
        if i != 0 and i != 19:
            sheet2["D" + str(startrow + i)] = line[2]
            sheet2["E" + str(startrow + i)] = line[3]
        sheet2["F" + str(startrow + i)] = line[4]
        i += 1

#   3000
    startrow = 6
    i = 0
    t = res['tab3000']
    for line in t:
        sheet3["C" + str(startrow + i)] = line[1]
        sheet3["D" + str(startrow + i)] = line[2]
        sheet3["E" + str(startrow + i)] = line[3]
        sheet3["F" + str(startrow + i)] = line[4]
        if i != 13 and i != 14:
            sheet3["G" + str(startrow + i)] = line[5]
        i += 1
    sheet3['F25'] = d[0]

#   4000
    startrow = 6
    i = 0
    t = res['tab4000']
    for line in t:
        sheet4["D" + str(startrow + i)] = line[1]
        sheet4["E" + str(startrow + i)] = line[2]
        sheet4["F" + str(startrow + i)] = line[3]
        sheet4["H" + str(startrow + i)] = line[4]
        sheet4["I" + str(startrow + i)] = line[5]
        sheet4["J" + str(startrow + i)] = line[6]
        i += 1
    sheet4['H19'] = d[1]
    sheet4['H20'] = d[2]
    sheet4['K21'] = d[3]
    sheet4['K22'] = d[4]

#   5000
    startrow = 6
    i = 0
    t = res['tab5000']
    for line in t:
        sheet5["D" + str(startrow + i)] = line[1]
        sheet5["E" + str(startrow + i)] = line[2]
        sheet5["F" + str(startrow + i)] = line[3]
        sheet5["H" + str(startrow + i)] = line[4]
        sheet5["I" + str(startrow + i)] = line[5]
        sheet5["J" + str(startrow + i)] = line[6]
        sheet5["P" + str(startrow + i)] = line[7]
        i += 1   

#   5001
    startrow = 6
    i = 0
    t = res['tab5001']
    for line in t:
        sheet6["D" + str(startrow + i)] = line[1]
        sheet6["E" + str(startrow + i)] = line[2]
        sheet6["F" + str(startrow + i)] = line[3]
        sheet6["H" + str(startrow + i)] = line[4]
        sheet6["I" + str(startrow + i)] = line[5]
        sheet6["J" + str(startrow + i)] = line[6]
        sheet6["P" + str(startrow + i)] = line[7]
        i += 1   

#   6000
    startrow = 6
    i = 0
    t = res['tab6000']
    for line in t:
        sheet7["D" + str(startrow + i)] = line[1]
        sheet7["E" + str(startrow + i)] = line[2]
        sheet7["F" + str(startrow + i)] = line[3]
        sheet7["H" + str(startrow + i)] = line[4]
        sheet7["I" + str(startrow + i)] = line[5]
        sheet7["J" + str(startrow + i)] = line[6]
        sheet7["P" + str(startrow + i)] = line[7]
        i += 1    
    
#   7000
    startrow = 6
    i = 0
    t = res['tab7000']
    for line in t:
        sheet8["C" + str(startrow + i)] = line[1]
        sheet8["D" + str(startrow + i)] = line[2]
        sheet8["E" + str(startrow + i)] = line[3]
        sheet8["F" + str(startrow + i)] = line[4]
        sheet8["G" + str(startrow + i)] = line[5]
        sheet8["H" + str(startrow + i)] = line[6]
        i += 1
    startrow = 15
    i = 0
    for i in range(21):
        sheet8["G" + str(startrow + i)] = d[i + 5]

    sheet['B12'] = "Выведено в системе ЯрВебМед " + str(datetime.now()) 
    sheet['B12'].font = Font(size=5)
 
#   name_file =  get_name("\\medicament\\Form\\rep" + str(int(random()*100000000)) + ".xlsx") 
    name_file =  get_name("/medicament/Form/rep" + str(int(random()*100000000)) + ".xlsx") 
    wb.save(name_file)
    
    return name_file
Example #5
0
def exp_to_excel_form3(
    doc, iperiod, iregion, mode, stat=None
):  # mode = 0 по региону или группе больниц  mode = 1 - по конкретной больнице
    res = calc_sum_form3(doc)
    speriod = get_period_namef(iperiod)
    sregion = get_region_name(mode, doc, iregion)
    name_file = get_name("/static/Form/Form3.xlsx")

    wb = openpyxl.load_workbook(name_file)

    #    print(wb.get_sheet_names())

    sheet = wb["stat"]
    sheet1 = wb["1000"]
    sheet2 = wb["2000"]
    sheet3 = wb["3000"]
    sheet4 = wb["4000"]
    sheet5 = wb["5000"]
    sheet6 = wb["5001"]
    sheet7 = wb["6000"]
    sheet8 = wb["7000"]
    #    sheet = wb.active

    sheet["B1"] = "Период:"
    sheet["C1"] = speriod
    sheet["B2"] = "Учереждение"
    sheet["C2"] = sregion
    if mode == 0:
        sheet["B3"] = "Статистика по отчету"
        sheet["B4"] = "Организаций предоставляющих, Всего"
        sheet["C4"] = stat.rec_all
        sheet["B5"] = "Отобрано в отчет, Всего"
        sheet["C5"] = stat.rec_fltr
        sheet["B6"] = "Завершено"
        sheet["C6"] = stat.rec_complete
        sheet["B7"] = "Согласование"
        sheet["C7"] = stat.rec_soglas
        sheet["B8"] = "Корректировка"
        sheet["C8"] = stat.rec_correct
        sheet["B9"] = "Редактирование"
        sheet["C9"] = stat.rec_edit

    # Вне табличные данные
    d = res["doc"]

    # ТаблицыS
    #   1000
    startrow = 7
    i = 0
    t = res["tab1000"]
    for line in t:
        sheet1["C" + str(startrow + i)] = line[5] + line[9]
        sheet1["D" + str(startrow + i)] = line[6] + line[10]
        sheet1["E" + str(startrow + i)] = line[7] + line[11]
        sheet1["F" + str(startrow + i)] = line[8] + line[12]
        sheet1["G" + str(startrow + i)] = line[5]
        sheet1["H" + str(startrow + i)] = line[6]
        sheet1["I" + str(startrow + i)] = line[7]
        sheet1["J" + str(startrow + i)] = line[8]
        sheet1["K" + str(startrow + i)] = line[9]
        sheet1["L" + str(startrow + i)] = line[10]
        sheet1["M" + str(startrow + i)] = line[11]
        sheet1["N" + str(startrow + i)] = line[12]
        i += 1

    #   2000
    startrow = 6
    i = 0
    t = res["tab2000"]
    for line in t:
        sheet2["C" + str(startrow + i)] = line[1]
        if i != 0 and i != 19:
            sheet2["D" + str(startrow + i)] = line[2]
            sheet2["E" + str(startrow + i)] = line[3]
        sheet2["F" + str(startrow + i)] = line[4]
        i += 1

    #   3000
    startrow = 6
    i = 0
    t = res["tab3000"]
    for line in t:
        sheet3["C" + str(startrow + i)] = line[1]
        sheet3["D" + str(startrow + i)] = line[2]
        sheet3["E" + str(startrow + i)] = line[3]
        sheet3["F" + str(startrow + i)] = line[4]
        if i != 13 and i != 14:
            sheet3["G" + str(startrow + i)] = line[5]
        i += 1
    sheet3["F25"] = d[0]

    #   4000
    startrow = 6
    i = 0
    t = res["tab4000"]
    for line in t:
        sheet4["D" + str(startrow + i)] = line[1]
        sheet4["E" + str(startrow + i)] = line[2]
        sheet4["F" + str(startrow + i)] = line[3]
        sheet4["H" + str(startrow + i)] = line[4]
        sheet4["I" + str(startrow + i)] = line[5]
        sheet4["J" + str(startrow + i)] = line[6]
        i += 1
    sheet4["H19"] = d[1]
    sheet4["H20"] = d[2]
    sheet4["K21"] = d[3]
    sheet4["K22"] = d[4]

    #   5000
    startrow = 6
    i = 0
    t = res["tab5000"]
    for line in t:
        sheet5["D" + str(startrow + i)] = line[1]
        sheet5["E" + str(startrow + i)] = line[2]
        sheet5["F" + str(startrow + i)] = line[3]
        sheet5["H" + str(startrow + i)] = line[4]
        sheet5["I" + str(startrow + i)] = line[5]
        sheet5["J" + str(startrow + i)] = line[6]
        sheet5["P" + str(startrow + i)] = line[7]
        i += 1

    #   5001
    startrow = 6
    i = 0
    t = res["tab5001"]
    for line in t:
        sheet6["D" + str(startrow + i)] = line[1]
        sheet6["E" + str(startrow + i)] = line[2]
        sheet6["F" + str(startrow + i)] = line[3]
        sheet6["H" + str(startrow + i)] = line[4]
        sheet6["I" + str(startrow + i)] = line[5]
        sheet6["J" + str(startrow + i)] = line[6]
        sheet6["P" + str(startrow + i)] = line[7]
        i += 1

    #   6000
    startrow = 6
    i = 0
    t = res["tab6000"]
    for line in t:
        sheet7["D" + str(startrow + i)] = line[1]
        sheet7["E" + str(startrow + i)] = line[2]
        sheet7["F" + str(startrow + i)] = line[3]
        sheet7["H" + str(startrow + i)] = line[4]
        sheet7["I" + str(startrow + i)] = line[5]
        sheet7["J" + str(startrow + i)] = line[6]
        sheet7["P" + str(startrow + i)] = line[7]
        i += 1

    #   7000
    startrow = 6
    i = 0
    t = res["tab7000"]
    for line in t:
        sheet8["C" + str(startrow + i)] = line[1]
        sheet8["D" + str(startrow + i)] = line[2]
        sheet8["E" + str(startrow + i)] = line[3]
        sheet8["F" + str(startrow + i)] = line[4]
        sheet8["G" + str(startrow + i)] = line[5]
        sheet8["H" + str(startrow + i)] = line[6]
        i += 1
    startrow = 15
    i = 0
    for i in range(21):
        sheet8["G" + str(startrow + i)] = d[i + 5]

    sheet["B12"] = "Выведено в системе ЯрВебМед " + str(datetime.now())
    sheet["B12"].font = Font(size=5)

    #   name_file =  get_name("\\medicament\\Form\\rep" + str(int(random()*100000000)) + ".xlsx")
    name_file = get_name("/medicament/Form/rep" + str(int(random() * 100000000)) + ".xlsx")
    wb.save(name_file)

    return name_file
Example #6
0
def exp_to_excel_form1(doc, iperiod, iregion, mode, stat = None):    # mode = 0 по региону или группе больниц  mode = 1 - по конкретной больнице
    res =  calc_sum_form1(doc)
    speriod = get_period_namef(iperiod)
    sregion = get_region_name(mode,doc,iregion)
    name_file = get_name("/static/Form/Form1.xlsx")

    wb = openpyxl.load_workbook(name_file)
    sheet = wb.active
    
    sheet['B2'] = speriod
    sheet['A1'] = sregion
    if mode==0:
        sheet['A20'] = "Статистика по отчету"  
        sheet['A21'] = "Организаций предоставляющих, Всего"
        sheet['B21'] = stat.rec_all
        sheet['A22'] = "Отобрано в отчет, Всего"
        sheet['B22'] = stat.rec_fltr
        sheet['A23'] = "Завершено"
        sheet['B23'] = stat.rec_complete
        sheet['A24'] = "Согласование"
        sheet['B24'] = stat.rec_soglas
        sheet['A25'] = "Корректировка"
        sheet['B25'] = stat.rec_correct
        sheet['A26'] = "Редактирование"
        sheet['B26'] = stat.rec_edit

    sheet['A28'] = "Выведено в системе Мед+ " + str(datetime.now()) 
    sheet['A28'].font = Font(size=5)

    
    sheet['C8'] = res[0][1]
    sheet['D8'] = res[0][2]
    sheet['E8'] = res[0][3]
    sheet['F8'] = res[0][4]
    sheet['G8'] = res[0][5]

    sheet['H10'] = res[1][6]
    sheet['I10'] = res[1][7]
    sheet['J10'] = res[1][8]

    sheet['C11'] = res[2][1]
    sheet['D11'] = res[2][2]
    sheet['E11'] = res[2][3]
    sheet['F11'] = res[2][4]
    sheet['G11'] = res[2][5]
    sheet['H11'] = res[2][6]
    sheet['I11'] = res[2][7]
    sheet['J11'] = res[2][8]

    sheet['C13'] = res[3][1]
    sheet['D13'] = res[3][2]
    sheet['E13'] = res[3][3]
    sheet['F13'] = res[3][4]
    sheet['G13'] = res[3][5]
    sheet['H13'] = res[3][6]
    sheet['I13'] = res[3][7]
    sheet['J13'] = res[3][8]


    name_file =  get_name("/medicament/Form/rep" + str(int(random()*100000000)) + ".xlsx") 
    wb.save(name_file)
    
    return name_file