Esempio n. 1
0
def callcard_hour_view(request, mid, mdate, mhour):
    mis_obj = get_object_or_404(Mis, id=mid)
    if not is_mis_admin(request.user, mid):
        return redirect('/login/')
    context = get_calls_context(request)
    sdate = str(mdate)
    try:
        this_date = date(int(sdate[0:4]), int(sdate[4:6]), int(sdate[6:]))
        this_time = time(int(mhour), 0)
        this_datetime = datetime.combine(this_date, this_time)
        this_datetime_s = this_datetime.strftime('%d/%m/%Y %H:%M')
    except Exception as ex:
        raise Http404
    date_s = this_date.strftime("%d/%m/%Y")
    day_calls = getHourCalls(mid, this_datetime)
    callCardCount = day_calls.pop()

    context["mis"] = mis_obj
    context["mtime"] = this_time
    context["mdatetime"] = this_datetime
    context["mdatetime_s"] = this_datetime_s
    context["date_s"] = date_s
    context["day_calls"] = day_calls
    context["count"] = callCardCount
    context["mdate"] = sdate
    context["info_link"] = f'/sys/mis/{mid}/'
    context["is_mis_admin"] = "True"
    context["refresh"] = True
    return render(request, "callcard_hour.html", context)
Esempio n. 2
0
def ajax_callcard_list(request):
    mid = request.GET.get("mid")
    if not is_mis_admin(request.user, mid):
        return redirect('/login/')
    call_priority = request.GET.get("priority")
    call_result = request.GET.get("result")
    call_date = request.GET.get("date")

    sdate = str(call_date)
    this_date = date(int(sdate[0:4]), int(sdate[4:6]), int(sdate[6:]))

    day_calls = getDayCalls(mid, this_date, call_priority, call_result)
    callCardCount = day_calls.pop()
    context = {
        "day_calls": day_calls,
        "count": callCardCount,
    }
    return render(request, "call_card_list.html", context)
Esempio n. 3
0
def callcard_sys_view(request, cardslug):
    callCard_qs = CallCard.objects.filter(call_card_id=cardslug)
    if callCard_qs.exists():
        callCard = callCard_qs.first()
    else:
        return page_not_found(request, f'Not found Callcard: {cardslug}')
    mis_obj = callCard.mis_id
    mis_id = mis_obj.id
    # print(f'MIS: {mis_id}, CallCard: {cardslug}')
    if not is_mis_admin(request.user, mis_id):
        return page_not_found(request, "Not authoruzed")
    callCard_s = CallCardSerializer(callCard)
    ref_date = callCard.start_datetime.strftime('%Y%m%d')
    ref_hour = callCard.start_datetime.strftime('%H')
    date_s = callCard.start_datetime.strftime('%d/%m/%Y')
    duration = callCard.end_datetime - callCard.start_datetime
    hours, remainder = divmod(duration.seconds, 3600)
    minutes, seconds = divmod(remainder, 60)
    duration_s = '{:02}:{:02}:{:02}'.format(int(hours), int(minutes),
                                            int(seconds))
    context = get_callcard_context(request, mis_obj)
    call_record_l = getCallRecord(callCard)
    med_record_l = getMedRecord(callCard)
    #med_record_l = []
    callStat = getCallStat(callCard, call_record_l)
    if is_true_admin(request.user, mis_id):
        kszi = "True"
    else:
        kszi = "False"
    context["callcard_s"] = callCard_s
    context["callcard"] = callCard
    context["call_record"] = call_record_l
    context["call_stat"] = callStat
    context["med_record"] = med_record_l
    context["ref_date"] = ref_date
    context["ref_hour"] = ref_hour
    context["duration"] = duration_s
    context["is_mis_admin"] = "True"
    context["is_kszi"] = kszi
    context["refresh"] = False
    context["date_s"] = date_s  # "08/02/2019"
    context["mtime"] = callCard.start_datetime
    return render(request, "callcard_sys.html", context)
Esempio n. 4
0
def medrecord_sys_view(request, medrecordslug):
    medRecord_qs = MedRecord.objects.filter(med_record_id=medrecordslug)
    if medRecord_qs.exists():
        medRecord_obj = medRecord_qs.first()
    else:
        return page_not_found(request, f'Not found Callcard: {medrecordslug}')
    mis_obj = medRecord_obj.mis_id
    mis_id = mis_obj.id
    if not is_mis_admin(request.user, mis_id):
        return page_not_found(request, "Not authoruzed")
    medRecord_s = MedRecordSerializer(medRecord_obj)
    ref_date = medRecord_obj.start_datetime.strftime('%Y%m%d')
    ref_hour = medRecord_obj.start_datetime.strftime('%H')
    date_s = medRecord_obj.start_datetime.strftime('%d/%m/%Y')
    noresult_msg = "Виїзд рзультативний"
    is_result = True
    if medRecord_obj.noresult:
        if medRecord_obj.noresult.name != "результативний":
            noresult_msg = f"Виїзд безрезультатний: {medRecord_obj.noresult.name}"
            is_result = False
    hospital_list = list(medRecord_obj.mrhospital_set.order_by('hospital_seq'))
    diagnosis_list = list(
        medRecord_obj.mrdiagnosis_set.order_by('diagnosis_seq'))
    context = get_medrecord_context(request, mis_obj)
    if is_true_admin(request.user, mis_id):
        kszi = "True"
    else:
        kszi = "False"
    context["medrecord_s"] = medRecord_s
    context["medrecord"] = medRecord_obj
    context["ref_date"] = ref_date
    context["ref_hour"] = ref_hour
    context["date_s"] = date_s
    context["noresult_msg"] = noresult_msg
    context["is_result"] = is_result
    context["hospital_list"] = hospital_list
    context["diagnosis_list"] = diagnosis_list
    context["is_mis_admin"] = "True"
    context["is_kszi"] = kszi
    context["refresh"] = False
    context["mtime"] = medRecord_obj.start_datetime
    return render(request, "medrecord_sys.html", context)
Esempio n. 5
0
def callcard_day_view(request, mid, mdate):
    mis_obj = get_object_or_404(Mis, id=mid)
    if not is_mis_admin(request.user, mid):
        return redirect('/login/')
    conext = get_calls_context(request)
    try:
        sdate = str(mdate)
        this_date = date(int(sdate[0:4]), int(sdate[4:6]), int(sdate[6:]))
        date_s = this_date.strftime("%d/%m/%Y")
    except Exception as ex:
        raise Http404
    day_calls = getDayCalls(mid, this_date)
    callCardCount = day_calls.pop()
    context = get_calls_context(request)
    context["mis"] = mis_obj
    context["mdate"] = mdate
    context["date_s"] = date_s
    context["day_calls"] = day_calls
    context["count"] = callCardCount
    context["info_link"] = f'/sys/mis/{mid}/'
    context["is_mis_admin"] = "True"
    context["refresh"] = False
    return render(request, "callcard_day.html", context)