예제 #1
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)
예제 #2
0
def getDiagnoseListByHospitalUser2():

    userId = session['userId']

    status = request.args.get('status')
    if status:
        import string
        status = string.atoi(status)

    startDateStr = request.args.get('startDate')
    startDate = None
    if startDateStr:
        startDate = datetime.strptime(startDateStr, "%Y-%m-%d")
    else:
        startDate = constant.SystemTimeLimiter.startTime

    endDateStr = request.args.get('endDate')
    endDate = None
    if endDateStr:
        endDate = datetime.strptime(endDateStr, "%Y-%m-%d")
    else:
        endDate = constant.SystemTimeLimiter.endTime

    patientName = request.args.get('patientName')
    pageNo = request.args.get('pageNumber')
    pageSize = request.args.get('pageSize')
    pager = Pagger(pageNo, pageSize)
    diagnoses = Diagnose.getDealedDiagnoseByHospitalUser(
        db_session, userId, patientName, status, startDate, endDate, pager)
    diagnosesDict = dataChangeService.userCenterDiagnoses(diagnoses)

    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   diagnosesDict)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
예제 #3
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)
예제 #4
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)
예제 #5
0
def needCallBySupportStaff():
    pageNo = request.args.get('pageNumber')
    pageSize = request.args.get('pageSize')
    pager = Pagger(pageNo, pageSize)
    diagnoses = Diagnose.getDiagnosesBySupportStaff(pager)
    diagnosesDict = dataChangeService.getDiagnoseListByKefu(diagnoses)
    data = {}
    data['amount'] = 0
    if diagnosesDict:
        data['amount'] = len(diagnosesDict)
    data['list'] = diagnosesDict
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, data)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
예제 #6
0
def getThanksNotes(userid):
    #status=request.args.get('status')

    pageNo = request.args.get('pageNo')
    pageSize = request.args.get('pageSize')
    pager = Pagger(pageNo, pageSize)

    thanksNotes = ThanksNote.getThanksNoteByReceiver(db_session, userid)
    if thanksNotes is None or len(thanksNotes) < 1:
        return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
    thanksNotesDict = object2dict.objects2dicts(thanksNotes)
    dataChangeService.setThanksNoteDetail(thanksNotesDict)
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   thanksNotesDict)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
예제 #7
0
def getDiagnoseListByHospitaluserReal():
    userId = session['userId']

    if userId:

        pageNo = request.args.get('pageNo')
        pageSize = request.args.get('pageSize')
        pager = Pagger(pageNo, pageSize)
        diagnoses = Diagnose.getDiagnoseByHospitalUserReal(
            db_session, userId, pager)
        diagnosesDict = dataChangeService.userCenterDiagnoses(diagnoses)
        resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                       diagnosesDict)
        resultDict = resultStatus.__dict__
        return json.dumps(resultDict, ensure_ascii=False)
    return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False)
예제 #8
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)
예제 #9
0
def getDiagnoseListByHospitalUser():

    userId = session['userId']

    pageNo = request.args.get('pageNumber')
    pageSize = request.args.get('pageSize')
    pager = Pagger(pageNo, pageSize)
    diagnoses = Diagnose.getNeedDealDiagnoseByHospitalUser(
        db_session, userId, None, pager)
    #type fullFile代表查询文件返回文件全部信息,如果没有只返回FILE URL
    diagnosesDict = dataChangeService.userCenterDiagnoses(
        diagnoses, 'fullFile')

    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   diagnosesDict)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
예제 #10
0
def getDiagnoseListByAdmin2():

    userId = session['userId']

    hostpitalIds = request.args.get('hospitalId')
    hostpitalList = UserCenter.getDiagnoseListByAdmin(hostpitalIds)
    doctorName = request.args.get('doctorName')
    pageNo = request.args.get('pageNo')
    pageSize = request.args.get('pageSize')
    pager = Pagger(pageNo, pageSize)
    diagnoses = Diagnose.getDiagnoseByAdmin2(db_session, hostpitalList,
                                             doctorName, pager)
    diagnosesDict = dataChangeService.userCenterDiagnoses(diagnoses)

    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   diagnosesDict)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
예제 #11
0
def getDiagnoseListByPatient():
    userId = session['userId']
    # user=User.getById(userId)
    # if user is None:
    #     return  json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
    #     #权限查看
    # if UserRole.checkRole(db_session,userId,constant.RoleId.Admin):
    #     return  json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False)

    if userId:

        status = request.args.get('type')
        if status:
            import string
            status = string.atoi(status)
        if status == u'':
            status = None

        startDateStr = request.args.get('startDate')
        startDate = None
        if startDateStr:
            startDate = datetime.strptime(startDateStr, "%Y-%m-%d")
        else:
            startDate = constant.SystemTimeLimiter.startTime

        endDateStr = request.args.get('endDate')
        endDate = None
        if endDateStr:
            endDate = datetime.strptime(endDateStr, "%Y-%m-%d")
        else:
            endDate = constant.SystemTimeLimiter.endTime

        pageNo = request.args.get('pageNo')
        pageSize = request.args.get('pageSize')
        pager = Pagger(pageNo, pageSize)
        diagnoses = Diagnose.getDiagnoseByPatientUser(db_session, userId,
                                                      status, pager)
        diagnosesDict = dataChangeService.userCenterDiagnoses(diagnoses)
        resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                       diagnosesDict)
        resultDict = resultStatus.__dict__
        return json.dumps(resultDict, ensure_ascii=False)
    return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False)
예제 #12
0
def getThanksNotesByDraft():
    #status=request.args.get('status')

    pageNo = request.args.get('pageNo')
    pageSize = request.args.get('pageSize')
    pager = Pagger(pageNo, pageSize)

    thanksNotes = ThanksNote.getThankNoteByDraft(pager)
    if thanksNotes is None or len(thanksNotes) < 1:
        return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
    thanksNotesDict = object2dict.objects2dicts(thanksNotes)
    dataChangeService.setThanksNoteDetail(thanksNotesDict)
    data = {}
    data['amount'] = 0
    if thanksNotesDict:
        data['amount'] = len(thanksNotesDict)
    data['list'] = thanksNotesDict
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, data)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
예제 #13
0
def endterDoctorHome():
    userId = session['userId']
    doctor = Doctor.getByUserId(userId)

    if doctor is None:
        return redirect(ERROR_URL)

    resultDate = {}
    messageCount = Message.getMessageCountByReceiver(userId)
    resultDate['messageCount'] = messageCount

    diagnoseCount = Diagnose.getNewDiagnoseCountByDoctorId(doctor.id)
    resultDate['diagnoseCount'] = diagnoseCount

    resultDate['doctor'] = doctor
    pager = Pagger(1, 20)
    diagnoses = Diagnose.getDiagnosesByDoctorId(db_session, doctor.id, pager)
    diagnoseDict = dataChangeService.userCenterDiagnoses(diagnoses)
    resultDate['diagnoses'] = diagnoseDict
    return render_template("doctorHome.html", data=resultDate)
예제 #14
0
 def test_getDiagnose(self):
     pager = Pagger(1, 20)
     diagnoses = Diagnose.getDiagnosesByDoctorId(1, pager, None)
     print len(diagnoses)