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

    if session.has_key('userId'):
        userId = session['userId']
    if userId is None:
        return redirect('/loginPage')

    data = {}
    hospitals = Hospital.getAllHospitals(db_session)
    hospitalsDict = object2dict.objects2dicts(hospitals)
    data['hospitals'] = hospitalsDict

    positions = Position.getPositions()
    positionsDict = object2dict.objects2dicts(positions)
    data['positions'] = positionsDict

    locations = Location.getAllLocations(db_session)
    locationsDict = object2dict.objects2dicts(locations)
    data['locations'] = locationsDict

    #hospital user
    if 'type' in request.args.keys():
        data['type'] = int(request.args.get('type'))
    if 'edit' in request.args.keys() and 'diagnoseid' in request.args.keys():
        new_diagnose = Diagnose.getDiagnoseById(request.args['diagnoseid'])
        data['edit'] = 1
    else:
        new_diagnose = Diagnose.getNewDiagnoseByStatus(ModelStatus.Draft,
                                                       session['userId'])

    if new_diagnose is not None:
        data['doctor'] = new_diagnose.doctor
        data['patient'] = new_diagnose.patient
        data['pathology'] = new_diagnose.pathology

        new_file = File.getFiles(new_diagnose.pathologyId,
                                 constant.FileType.Dicom)
        data['dicomfile'] = new_file
        new_files = File.getFiles(new_diagnose.pathologyId,
                                  constant.FileType.FileAboutDiagnose)
        data['fileAboutDiagnose'] = new_files

        pathologyPositions = []
        if hasattr(new_diagnose, 'pathology') and hasattr(
                new_diagnose.pathology, 'pathologyPostions'):
            pathologyPositions = object2dict.objects2dicts(
                new_diagnose.pathology.pathologyPostions)
        data['pathologyPositions'] = pathologyPositions

    patients = Patient.get_patient_by_user(session['userId'])
    if patients is None or len(patients) < 1:
        patientdict = []
    else:
        patientdict = object2dict.objects2dicts(patients)

    data['patientdict'] = patientdict

    return render_template("applyDiagnose.html", result=data)
예제 #2
0
파일: front.py 프로젝트: houzx910/blueberry
def doctor_list():
    result = {}
    hospitals = Hospital.getAllHospitals(db_session)
    hospitalsDict = object2dict.objects2dicts(hospitals)
    result['hospitals'] = hospitalsDict

    skills = Skill.getSkills()
    skillsDict = object2dict.objects2dicts(skills)
    result['skills'] = skillsDict
    return render_template("doctorList.html", result=result)
예제 #3
0
파일: front.py 프로젝트: LichuanLu/redberry
def doctor_list():
    result = {}
    hospitals = Hospital.getAllHospitals(db_session)
    hospitalsDict = object2dict.objects2dicts(hospitals)
    result['hospitals'] = hospitalsDict

    skills = Skill.getSkills()
    skillsDict = object2dict.objects2dicts(skills)
    result['skills'] = skillsDict
    result['isdoctorlist'] = True
    return render_template("doctorList.html", data=result)
예제 #4
0
파일: front.py 프로젝트: houzx910/blueberry
def applyDiagnose():

    if session.has_key('userId'):
        userId=session['userId']
    if userId is None:
        return redirect('/loginPage')

    data = {}
    hospitals = Hospital.getAllHospitals(db_session)
    hospitalsDict = object2dict.objects2dicts(hospitals)
    data['hospitals'] = hospitalsDict

    positions = Position.getPositions()
    positionsDict = object2dict.objects2dicts(positions)
    data['positions'] = positionsDict

    locations = Location.getAllLocations(db_session)
    locationsDict = object2dict.objects2dicts(locations)
    data['locations'] = locationsDict


    if 'edit' in request.args.keys() and 'diagnoseid' in request.args.keys():
        new_diagnose = Diagnose.getDiagnoseById(request.args['diagnoseid'])
        data['edit'] = 1
    else:
        new_diagnose = Diagnose.getNewDiagnoseByStatus(ModelStatus.Draft, session['userId'])

    if new_diagnose is not None:
        data['doctor'] = new_diagnose.doctor
        data['patient'] = new_diagnose.patient
        data['pathology'] = new_diagnose.pathology

        new_file = File.getFiles(new_diagnose.pathologyId, constant.FileType.Dicom)
        data['dicomfile'] = new_file
        new_files = File.getFiles(new_diagnose.pathologyId, constant.FileType.FileAboutDiagnose)
        data['fileAboutDiagnose'] = new_files

        pathologyPositions = []
        if hasattr(new_diagnose, 'pathology') and hasattr(new_diagnose.pathology, 'pathologyPostions'):
            pathologyPositions = object2dict.objects2dicts(new_diagnose.pathology.pathologyPostions)
        data['pathologyPositions'] = pathologyPositions


    patients = Patient.get_patient_by_user(session['userId'])
    if patients is None or len(patients) < 1:
        patientdict = []
    else:
        patientdict = object2dict.objects2dicts(patients)

    data['patientdict'] = patientdict

    return render_template("applyDiagnose.html", result=data)
예제 #5
0
def getConsultsByDoctor(doctorId):
    sourceId = request.args.get('source_id')
    status = request.args.get('status')
    if status is None:
        status = -1
    else:
        status = string.atoi(status)
    if doctorId:
        consuts = None
        if sourceId:
            consuts = Consult.getConsultsByDoctorId(doctorId,
                                                    string.atoi(sourceId),
                                                    status)
        else:
            consuts = Consult.getConsultsByDoctorId(doctorId, status=status)

        consutsDict = object2dict.objects2dicts(consuts)
        dataChangeService.setConsultsResult(consutsDict,
                                            long(session["userId"]))

        resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                       consutsDict)
        resultDict = resultStatus.__dict__
        return json.dumps(resultDict, ensure_ascii=False)
    return json.dumps(rs.PARAM_ERROR, ensure_ascii=False)
예제 #6
0
def getPatients(doctorId):
    patients = Diagnose.getPatientListByDoctorId(doctorId)
    patientsDict = object2dict.objects2dicts(patients)
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   patientsDict)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
예제 #7
0
def getConsultsByUser(userId):
    if userId:
        consuts = Consult.getConsultsByUserId(userId)
        consutsDict = object2dict.objects2dicts(consuts)
        resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, consutsDict)
        resultDict = resultStatus.__dict__
        return json.dumps(resultDict, ensure_ascii=False)
    return json.dumps(rs.PARAM_ERROR, ensure_ascii=False)
예제 #8
0
def getList(user, list):
    if user is None:
        result = rs.ResultStatus(rs.FAILURE.status, rs.FAILURE.msg)
        return json.dumps(result.__dict__, ensure_ascii=False)
    if (list and len(list) > 0):
        resultLogs = object2dict.objects2dicts(list)
        result = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, resultLogs)
        return json.dumps(result.__dict__, ensure_ascii=False)
    return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
예제 #9
0
def diagnoseCommentsByDiagnose(diagnoseId):

    diagnoseComments=Comment.getCommentBydiagnose(diagnoseId)
    if diagnoseComments is None or len(diagnoseComments)<1:
        return jsonify(rs.SUCCESS.__dict__)
    diagnoseCommentsDict=object2dict.objects2dicts(diagnoseComments)
    resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,diagnoseCommentsDict)
    resultDict=resultStatus.__dict__
    return jsonify(resultDict)
예제 #10
0
def getList(user, list):
    if user is None:
        result=rs.ResultStatus(rs.FAILURE.status,rs.FAILURE.msg)
        return  json.dumps(result.__dict__,ensure_ascii=False)
    if (list and len(list)>0):
        resultLogs=object2dict.objects2dicts(list)
        result=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,resultLogs)
        return  json.dumps(result.__dict__,ensure_ascii=False)
    return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
예제 #11
0
def diagnoseCommentsByObserver(userId):

    diagnoseComments=Comment.getCommentByUser(userId,type=constant.CommentType)
    if diagnoseComments is None or len(diagnoseComments)<1:
        return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
    diagnoseCommentsDict=object2dict.objects2dicts(diagnoseComments)
    resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,diagnoseCommentsDict)
    resultDict=resultStatus.__dict__
    return json.dumps(resultDict,ensure_ascii=False)
예제 #12
0
def diagnoseCommentsByDiagnose(diagnoseId):

    diagnoseComments = Comment.getCommentBydiagnose(diagnoseId)
    if diagnoseComments is None or len(diagnoseComments) < 1:
        return jsonify(rs.SUCCESS.__dict__)
    diagnoseCommentsDict = object2dict.objects2dicts(diagnoseComments)
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   diagnoseCommentsDict)
    resultDict = resultStatus.__dict__
    return jsonify(resultDict)
예제 #13
0
def diagnoseCommentsByObserver(userId):

    diagnoseComments = Comment.getCommentByUser(userId,
                                                type=constant.CommentType)
    if diagnoseComments is None or len(diagnoseComments) < 1:
        return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
    diagnoseCommentsDict = object2dict.objects2dicts(diagnoseComments)
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   diagnoseCommentsDict)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
예제 #14
0
def getDiagnoseLog():
    if session.has_key('userId'):
        userId=session['userId']
    if userId is None:
        return redirect(LOGIN_URL)

    diagnoseLogs=AlipayLog.getAlipayLogsByUserId(userId)
    if diagnoseLogs and len(diagnoseLogs)>0:
        resultLogs=object2dict.objects2dicts(diagnoseLogs)
        result=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,resultLogs)
        return  json.dumps(result.__dict__,ensure_ascii=False)
    return  json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
예제 #15
0
def getDiagnoseLog():
    if session.has_key('userId'):
        userId = session['userId']
    if userId is None:
        return redirect(LOGIN_URL)

    diagnoseLogs = AlipayLog.getAlipayLogsByUserId(userId)
    if diagnoseLogs and len(diagnoseLogs) > 0:
        resultLogs = object2dict.objects2dicts(diagnoseLogs)
        result = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, resultLogs)
        return json.dumps(result.__dict__, ensure_ascii=False)
    return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
예제 #16
0
def getDiagnoseLogBydiagnoseId(diagnoseId):
    if session.has_key('userId'):
        userId=session['userId']
    if userId is None:
        return redirect(LOGIN_URL)
    diagnose=Diagnose.getDiagnoseById(diagnoseId)
    if diagnose and hasattr(diagnose,'patient') and diagnose.patient.userID==string.atoi(userId):
        diagnoseLogs=AlipayLog.getAlipayLogsByDiagnoseId(diagnoseId)
        if diagnoseLogs and len(diagnoseLogs)>0:
            resultLogs=object2dict.objects2dicts(diagnoseLogs)
            result=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,resultLogs)
            return  json.dumps(result.__dict__,ensure_ascii=False)
        return  json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
    return  json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
예제 #17
0
def messagesBySender(senderId):
    status=request.args.get('status')

    messages=None
    if status:
        messages=Message.getMessageByReceiver(senderId,status)
    else:
        messages=Message.getMessageByReceiver(senderId)
    if messages is None or len(messages)<1:
        return jsonify(rs.SUCCESS.__dict__)
    messagesDict=object2dict.objects2dicts(messages)
    resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,messagesDict)
    resultDict=resultStatus.__dict__
    return jsonify(resultDict)
예제 #18
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)
예제 #19
0
def diagnoseCommentsByReceiver(receiverId):

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

    diagnoseComments=Comment.getCommentByReceiver(receiverId,constant.ModelStatus.Normal,constant.CommentType.DiagnoseComment,pager)
    if diagnoseComments is None or len(diagnoseComments)<1:
        return jsonify(rs.SUCCESS.__dict__)

    diagnoseCommentsDict=object2dict.objects2dicts(diagnoseComments)
    dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
    resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,diagnoseCommentsDict)
    resultDict=resultStatus.__dict__
    return jsonify(resultDict)
예제 #20
0
def getConsultsByUser(userId):
    sourceId=request.args.get('source_id')
    if userId:
        consuts=None
        if sourceId:
            consuts=Consult.getConsultsByUserId(userId,string.atoi(sourceId))
        else:
            consuts=Consult.getConsultsByUserId(userId)
        consutsDict=object2dict.objects2dicts(consuts)
        dataChangeService.setConsultsResult(consutsDict)

        resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,consutsDict)
        resultDict=resultStatus.__dict__
        return json.dumps(resultDict,ensure_ascii=False)
    return json.dumps(rs.PARAM_ERROR,ensure_ascii=False)
예제 #21
0
def messagesBySender(senderId):
    status = request.args.get('status')

    messages = None
    if status:
        messages = Message.getMessageByReceiver(senderId, status)
    else:
        messages = Message.getMessageByReceiver(senderId)
    if messages is None or len(messages) < 1:
        return jsonify(rs.SUCCESS.__dict__)
    messagesDict = object2dict.objects2dicts(messages)
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   messagesDict)
    resultDict = resultStatus.__dict__
    return jsonify(resultDict)
예제 #22
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)
예제 #23
0
def getDiagnoseLogBydiagnoseId(diagnoseId):
    if session.has_key('userId'):
        userId = session['userId']
    if userId is None:
        return redirect(LOGIN_URL)
    diagnose = Diagnose.getDiagnoseById(diagnoseId)
    if diagnose and hasattr(
            diagnose,
            'patient') and diagnose.patient.userID == string.atoi(userId):
        diagnoseLogs = AlipayLog.getAlipayLogsByDiagnoseId(diagnoseId)
        if diagnoseLogs and len(diagnoseLogs) > 0:
            resultLogs = object2dict.objects2dicts(diagnoseLogs)
            result = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                     resultLogs)
            return json.dumps(result.__dict__, ensure_ascii=False)
        return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
    return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False)
예제 #24
0
def diagnoseCommentsByReceiver(receiverId):

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

    diagnoseComments = Comment.getCommentByReceiver(
        receiverId, constant.ModelStatus.Normal,
        constant.CommentType.DiagnoseComment, pager)
    if diagnoseComments is None or len(diagnoseComments) < 1:
        return jsonify(rs.SUCCESS.__dict__)

    diagnoseCommentsDict = object2dict.objects2dicts(diagnoseComments)
    dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   diagnoseCommentsDict)
    resultDict = resultStatus.__dict__
    return jsonify(resultDict)
예제 #25
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)
예제 #26
0
def diagnoseCommentsByDraft():

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

    diagnoseComments=Comment.getCommentsByDraft(pager)
    if diagnoseComments is None or len(diagnoseComments)<1:
        return jsonify(rs.SUCCESS.__dict__)

    diagnoseCommentsDict=object2dict.objects2dicts(diagnoseComments)
    dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
    data={}
    data['amount']=0
    if diagnoseCommentsDict:
        data['amount']=len(diagnoseCommentsDict)
    data['list']=diagnoseCommentsDict
    resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,data)
    resultDict=resultStatus.__dict__
    return jsonify(resultDict)
예제 #27
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)
예제 #28
0
def diagnoseCommentsByDraft():

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

    diagnoseComments = Comment.getCommentsByDraft(pager)
    if diagnoseComments is None or len(diagnoseComments) < 1:
        return jsonify(rs.SUCCESS.__dict__)

    diagnoseCommentsDict = object2dict.objects2dicts(diagnoseComments)
    dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
    data = {}
    data['amount'] = 0
    if diagnoseCommentsDict:
        data['amount'] = len(diagnoseCommentsDict)
    data['list'] = diagnoseCommentsDict
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, data)
    resultDict = resultStatus.__dict__
    return jsonify(resultDict)
예제 #29
0
def getConsultsByDoctor(doctorId):
    sourceId=request.args.get('source_id')
    status=request.args.get('status')
    if status is None:
        status=-1
    else:
        status=string.atoi(status)
    if doctorId:
        consuts=None
        if sourceId:
            consuts=Consult.getConsultsByDoctorId(doctorId,string.atoi(sourceId),status)
        else:
            consuts=Consult.getConsultsByDoctorId(doctorId,status=status)


        consutsDict=object2dict.objects2dicts(consuts)
        dataChangeService.setConsultsResult(consutsDict, long(session["userId"]))

        resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,consutsDict)
        resultDict=resultStatus.__dict__
        return json.dumps(resultDict,ensure_ascii=False)
    return json.dumps(rs.PARAM_ERROR,ensure_ascii=False)
예제 #30
0
def getDiagnosePage():
    hospitals = Hospital.getAllHospitals(db_session)
    hospitalsDict = object2dict.objects2dicts(hospitals)

    return render_template("adminFenzhen.html", datas=hospitalsDict)
예제 #31
0
def getDiagnosePage():
    hospitals=Hospital.getAllHospitals(db_session)
    hospitalsDict=object2dict.objects2dicts(hospitals)

    return render_template("adminFenzhen.html", datas=hospitalsDict)
예제 #32
0
def endterDoctorSite(userId):

    #user=User.getById(userId)
    doctor=Doctor.getByUserId(userId)

    if  doctor is None:
        return redirect(ERROR_URL)

    if  hasattr(doctor,'user') !=True:
        return redirect(ERROR_URL)

    resultDate={}
    userFavortiesCount=UserFavorites.getFavortiesCountByDoctorId(doctor.id)
    resultDate['userFavortiesCount']=userFavortiesCount

    diagnoseCount=Diagnose.getDiagnoseCountByDoctorId(db_session,doctor.id)
    resultDate['diagnoseCount']=diagnoseCount

    goodDiagnoseCount=Diagnose.getDiagnoseCountByDoctorId(db_session,doctor.id,1)#good
    goodDiagnoseCount+=Diagnose.getDiagnoseCountByDoctorId(db_session,doctor.id,2)
    resultDate['goodDiagnoseCount']=goodDiagnoseCount

    resultDate['doctor']=dataChangeService.get_doctor(doctor)

    thanksNoteCount=ThanksNote.getThanksNoteCountByReceiver(db_session,userId)
    resultDate['thanksNoteCount']=thanksNoteCount

    diagnoseCommentCount=Comment.getCountByReceiver(userId)
    resultDate['diagnoseCommentCount']=diagnoseCommentCount

    if session.has_key('userId'):
        loginUserId=session.get('userId')
        if loginUserId:
            loginUserId=string.atoi(loginUserId)
            userfavor=UserFavorites.getUerFavortiesByNormalStatus(db_session,loginUserId,constant.UserFavoritesType.Doctor,doctor.id)
            if userfavor:
                resultDate['userFavortiesId']=userfavor.id





    pager=constant.Pagger(1,10)

    diagnoseComments=Comment.getCommentByReceiver(userId,constant.ModelStatus.Normal,constant.CommentType.DiagnoseComment,pager)
    if diagnoseComments  and  len(diagnoseComments)>0:
        diagnoseCommentsDict=object2dict.objects2dicts(diagnoseComments)
        dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
        resultDate['comments']=diagnoseCommentsDict
    else:
        resultDate['comments']=None


    thanksNotes=ThanksNote.getThanksNoteByReceiver(db_session,userId)
    if thanksNotes  and  len(thanksNotes)>0:
        thanksNotesDict=object2dict.objects2dicts(thanksNotes)
        dataChangeService.setThanksNoteDetail(thanksNotesDict)
        resultDate['thanksNotes']=thanksNotesDict

    intros=DoctorProfile.getDoctorProfiles(userId,constant.DoctorProfileType.Intro)
    resultDate['intros']=object2dict.objects2dicts(intros)

    resumes=DoctorProfile.getDoctorProfiles(userId,constant.DoctorProfileType.Resume)
    resultDate['resumes']=object2dict.objects2dicts(resumes)

    awards=DoctorProfile.getDoctorProfiles(userId,constant.DoctorProfileType.Award)
    resultDate['awards']=object2dict.objects2dicts(awards)

    others=DoctorProfile.getDoctorProfiles(userId,constant.DoctorProfileType.Other)
    resultDate['others']=object2dict.objects2dicts(others)

    return render_template("doctorSite.html",data=resultDate)
예제 #33
0
def getPatients(doctorId):
     patients=Diagnose.getPatientListByDoctorId(doctorId)
     patientsDict=object2dict.objects2dicts(patients)
     resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,patientsDict)
     resultDict=resultStatus.__dict__
     return json.dumps(resultDict,ensure_ascii=False)
예제 #34
0
def endterDoctorSite(userId):

    #user=User.getById(userId)
    doctor = Doctor.getByUserId(userId)

    if doctor is None:
        return redirect(ERROR_URL)

    if hasattr(doctor, 'user') != True:
        return redirect(ERROR_URL)

    resultDate = {}
    userFavortiesCount = UserFavorites.getFavortiesCountByDoctorId(doctor.id)
    resultDate['userFavortiesCount'] = userFavortiesCount

    diagnoseCount = Diagnose.getDiagnoseCountByDoctorId(db_session, doctor.id)
    resultDate['diagnoseCount'] = diagnoseCount

    goodDiagnoseCount = Diagnose.getDiagnoseCountByDoctorId(
        db_session, doctor.id, 1)  #good
    goodDiagnoseCount += Diagnose.getDiagnoseCountByDoctorId(
        db_session, doctor.id, 2)
    resultDate['goodDiagnoseCount'] = goodDiagnoseCount

    resultDate['doctor'] = dataChangeService.get_doctor(doctor)

    thanksNoteCount = ThanksNote.getThanksNoteCountByReceiver(
        db_session, userId)
    resultDate['thanksNoteCount'] = thanksNoteCount

    diagnoseCommentCount = Comment.getCountByReceiver(userId)
    resultDate['diagnoseCommentCount'] = diagnoseCommentCount

    if session.has_key('userId'):
        loginUserId = session.get('userId')
        if loginUserId:
            loginUserId = string.atoi(loginUserId)
            userfavor = UserFavorites.getUerFavortiesByNormalStatus(
                db_session, loginUserId, constant.UserFavoritesType.Doctor,
                doctor.id)
            if userfavor:
                resultDate['userFavortiesId'] = userfavor.id

    pager = constant.Pagger(1, 10)

    diagnoseComments = Comment.getCommentByReceiver(
        userId, constant.ModelStatus.Normal,
        constant.CommentType.DiagnoseComment, pager)
    if diagnoseComments and len(diagnoseComments) > 0:
        diagnoseCommentsDict = object2dict.objects2dicts(diagnoseComments)
        dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
        resultDate['comments'] = diagnoseCommentsDict
    else:
        resultDate['comments'] = None

    thanksNotes = ThanksNote.getThanksNoteByReceiver(db_session, userId)
    if thanksNotes and len(thanksNotes) > 0:
        thanksNotesDict = object2dict.objects2dicts(thanksNotes)
        dataChangeService.setThanksNoteDetail(thanksNotesDict)
        resultDate['thanksNotes'] = thanksNotesDict

    intros = DoctorProfile.getDoctorProfiles(userId,
                                             constant.DoctorProfileType.Intro)
    resultDate['intros'] = object2dict.objects2dicts(intros)

    resumes = DoctorProfile.getDoctorProfiles(
        userId, constant.DoctorProfileType.Resume)
    resultDate['resumes'] = object2dict.objects2dicts(resumes)

    awards = DoctorProfile.getDoctorProfiles(userId,
                                             constant.DoctorProfileType.Award)
    resultDate['awards'] = object2dict.objects2dicts(awards)

    others = DoctorProfile.getDoctorProfiles(userId,
                                             constant.DoctorProfileType.Other)
    resultDate['others'] = object2dict.objects2dicts(others)

    return render_template("doctorSite.html", data=resultDate)