예제 #1
0
파일: front.py 프로젝트: LichuanLu/redberry
def homepage():

    resultData = {}
    pager = Pagger(1, 6)
    doctors = Doctor.get_doctor_list(0, 0, "", pager)
    doctorsList = dataChangeService.get_doctors_dict(doctors)
    resultData['doctorlist'] = doctorsList
    if len(doctorsList['doctor']) > 0:
        resultData['doctor'] = doctorsList['doctor'][0]
    diagnoseComments = Comment.getRecentComments()
    if diagnoseComments and len(diagnoseComments) > 0:
        diagnoseCommentsDict = object2dict.objects2dicts_2(diagnoseComments)
        dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
        resultData['comments'] = diagnoseCommentsDict
    else:
        resultData['comments'] = None

    resultData['ishomepage'] = True
    if session.has_key('userId'):
        userId = session['userId']
        messageCount = Message.getMessageCountByReceiver(userId)
        resultData['messageCount'] = messageCount
        if UserRole.checkRole(db_session, userId, constant.RoleId.Patient):
            resultData['isPatient'] = True

    return render_template("home.html", data=resultData)
예제 #2
0
파일: front.py 프로젝트: houzx910/blueberry
def doctor_list_json():
    form = DoctorList(request)
    form_result = form.validate()
    if form_result.status == rs.SUCCESS.status:
        pager = Pagger(form.pageNumber, form.pageSize)
        pager.count = Doctor.get_doctor_count(form.hospitalId, form.sectionId, form.doctorname, pager)
        doctors = Doctor.get_doctor_list(form.hospitalId, form.sectionId, form.doctorname, pager)
        if doctors is None or len(doctors) < 1:
            return jsonify(rs.SUCCESS.__dict__, ensure_ascii=False)
        doctorsDict = dataChangeService.get_doctors_dict(doctors, form.pageNumber, pager.count/pager.pageSize+1)
        resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, doctorsDict)
        return jsonify(resultStatus.__dict__, ensure_ascii=False)
    return jsonify(FAILURE)
예제 #3
0
def doctorListByDraft():
    try:
        pageNo=request.args.get('pageNumber')
        pageSize=request.args.get('pageSize')
        pager=Pagger(pageNo,pageSize)
        doctors=Doctor.getUserListByStatus(pager)

        doctorsDict=dataChangeService.get_doctors_dict(doctors)
        result=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,doctorsDict)
        return json.dumps(result.__dict__,ensure_ascii=False)
    except Exception,e:
        LOG.error(e.message)
        return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
예제 #4
0
def doctorListByDraft():
    try:
        pageNo = request.args.get('pageNumber')
        pageSize = request.args.get('pageSize')
        pager = Pagger(pageNo, pageSize)
        doctors = Doctor.getUserListByStatus(pager)
        doctorsDict = dataChangeService.get_doctors_dict(doctors)
        data = {}
        data['amount'] = 0
        if doctorsDict:
            data['amount'] = len(doctorsDict.get('doctor'))
        data['list'] = doctorsDict.get('doctor')
        result = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, data)
        return json.dumps(result.__dict__, ensure_ascii=False)
    except Exception, e:
        LOG.error(e.message)
        return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False)
예제 #5
0
파일: front.py 프로젝트: LichuanLu/redberry
def doctor_list_json():
    form = DoctorList(request)
    form_result = form.validate()
    if form_result.status == rs.SUCCESS.status:
        pager = Pagger(form.pageNumber, form.pageSize)
        pager.count = Doctor.get_doctor_count(form.hospitalId, form.sectionId,
                                              form.doctorname, pager)
        doctors = Doctor.get_doctor_list(form.hospitalId, form.sectionId,
                                         form.doctorname, pager)
        if doctors is None or len(doctors) < 1:
            return jsonify(rs.SUCCESS.__dict__, ensure_ascii=False)
        doctorsDict = dataChangeService.get_doctors_dict(
            doctors, form.pageNumber, pager.count / pager.pageSize + 1)
        resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                       doctorsDict)
        return jsonify(resultStatus.__dict__, ensure_ascii=False)
    return jsonify(FAILURE)
예제 #6
0
파일: front.py 프로젝트: houzx910/blueberry
def homepage():

    resultData={}
    pager = Pagger(1, 6)
    doctors = Doctor.get_doctor_list(0, 0, "", pager)
    doctorsList = dataChangeService.get_doctors_dict(doctors)
    resultData['doctorlist'] = doctorsList
    if len(doctorsList['doctor']) > 0:
        resultData['doctor'] = doctorsList['doctor'][0]
    diagnoseComments=Comment.getRecentComments()
    if diagnoseComments  and  len(diagnoseComments)>0:
        diagnoseCommentsDict=object2dict.objects2dicts_2(diagnoseComments)
        dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
        resultData['comments']=diagnoseCommentsDict
    else:
        resultData['comments']=None
    if session.has_key('userId'):
        userId=session['userId']
        messageCount=Message.getMessageCountByReceiver(userId)
        resultData['messageCount']=messageCount
    return render_template("home.html", result=resultData)