Ejemplo n.º 1
0
def changeDiagnoseCommentStatus():
    id = request.form.get('id')
    status = request.form.get('status')
    if id and status:
        result = Comment.updateComment(id, status)
        return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
    return json.dumps(rs.PARAM_ERROR.__dict__, ensure_ascii=False)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
def changeDiagnoseCommentStatus():
    id=request.form.get('id')
    status=request.form.get('status')
    if id and status:
        result=Comment.updateComment(id,status)
        return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
    return json.dumps(rs.PARAM_ERROR.__dict__,ensure_ascii=False)
Ejemplo n.º 4
0
def addDiagnoseComment():
    form = CommentsForm(request.form)
    resultForm = form.validate()
    if resultForm.status == rs.SUCCESS.status:
        #session['remember_me'] = form.remember_me.data
        # login and validate the user...
        diagnoseComment = Comment(form.userId, form.receiverId,
                                  form.diagnoseId, form.content)
        db_session.add(diagnoseComment)
        db_session.commit()
        db_session.flush()
        score = constant.DiagnoseScore[form.score]
        diagnose = Diagnose.getDiagnoseById(form.diagnoseId)
        diagnose.score = form.score
        Diagnose.save(diagnose)
        #为医生添加一些冗余字段
        if hasattr(diagnose, 'doctor'):
            doctor = diagnose.doctor
            if score != 0:
                if doctor.goodFeedbackCount:
                    doctor.goodFeedbackCount += 1
                else:
                    doctor.goodFeedbackCount = 1
            if doctor.feedbackCount:
                doctor.feedbackCount += 1
            else:
                doctor.feedbackCount = 1
            Doctor.save(doctor)
        #flash('成功添加诊断评论')
        return jsonify(rs.SUCCESS.__dict__)
    return jsonify(rs.FAILURE.__dict__)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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)
Ejemplo n.º 8
0
def userCenterDiagnoses(diagnoses):
    if diagnoses is None or len(diagnoses)<1:
        return
    result=[]
    for diagnose in diagnoses:
        diagDict={}

        if hasattr(diagnose,"patient") and diagnose.patient and diagnose.patient.realname:
            diagDict['patientName']=diagnose.patient.realname
        if hasattr(diagnose,"doctor") and diagnose.doctor and diagnose.doctor.username:
            diagDict['doctorName']=diagnose.doctor.username
            if hasattr(diagnose.doctor,'hospital') and diagnose.doctor.hospital and diagnose.doctor.hospital.name:
                diagDict['doctorHispital']= diagnose.doctor.hospital.name

        if hasattr(diagnose,"hospital") and diagnose.hospital and diagnose.hospital.name:
            diagDict['hispital']=diagnose.hospital.name


        if diagnose.createDate:
            diagDict["date"]=diagnose.createDate.strftime('%Y-%m-%d')
        if diagnose.id:
            diagDict['id']=diagnose.id
        if diagnose.diagnoseSeriesNumber:
            diagDict['diagnosenumber']=diagnose.diagnoseSeriesNumber
        if diagnose.status or diagnose.status==0:
            diagDict['statusId']=diagnose.status
            diagDict['status']=constant.DiagnoseStatus.getStatusName(diagnose.status)
        if diagnose.pathologyId:
            dicomUrl=File.getDicomFileUrl(diagnose.pathologyId)
            if dicomUrl:
                diagDict['dicomUrl'] = dicomUrl
        if hasattr(diagnose,'report') and diagnose.report and diagnose.report.fileUrl:
            diagDict['reportUrl']= diagnose.report.fileUrl


        if hasattr(diagnose,"pathology") and diagnose.pathology:
            pathology=diagnose.pathology
            if hasattr(pathology,"pathologyPostions") and pathology.pathologyPostions:
                pathologyPositons=pathology.pathologyPostions
                if pathologyPositons and len(pathologyPositons)>0:
                    positions=u''
                    for pathologyPositon in pathologyPositons:
                        position=pathologyPositon.position
                        positions+=(u' '+position.name)
                    diagDict['positionName']=positions
        #print diagDict['doctorName'],diagDict['positons']


        isFeedback=Comment.existCommentBydiagnose(diagnose.id,type=constant.CommentType.DiagnoseComment)
        diagDict['isFeedback']=isFeedback


        result.append(diagDict)

    return result
Ejemplo n.º 9
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)
Ejemplo n.º 10
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)
Ejemplo n.º 11
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)
Ejemplo n.º 12
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)
Ejemplo n.º 13
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)
Ejemplo n.º 14
0
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)
Ejemplo n.º 15
0
def getDiagnoseListByKefu(diagnoses):
    if diagnoses is None or len(diagnoses)<1:
        return
    result=[]
    for diagnose in diagnoses:
        diagDict={}

        if hasattr(diagnose,"patient") and diagnose.patient and diagnose.patient.realname:
            diagDict['patientName']=diagnose.patient.realname
        if hasattr(diagnose,"patient") and diagnose.patient:
            diagDict['mobile']=diagnose.patient.identityPhone
        if hasattr(diagnose,"doctor") and diagnose.doctor and diagnose.doctor.username:
            diagDict['doctorName']=diagnose.doctor.username
            if hasattr(diagnose.doctor,'hospital') and diagnose.doctor.hospital and diagnose.doctor.hospital.name:
                diagDict['doctorHispital']= diagnose.doctor.hospital.name

        if hasattr(diagnose,"hospital") and diagnose.hospital and diagnose.hospital.name:
            diagDict['hispital']=diagnose.hospital.name


        if diagnose.createDate:
            diagDict["date"]=diagnose.createDate.strftime('%Y-%m-%d')
        if diagnose.id:
            diagDict['id']=diagnose.id
        if diagnose.diagnoseSeriesNumber:
            diagDict['diagnosenumber']=diagnose.diagnoseSeriesNumber
        if diagnose.status or diagnose.status==0:
            diagDict['statusId']=diagnose.status
            diagDict['status']=constant.DiagnoseStatus.getStatusName(diagnose.status)
        if diagnose.pathologyId:
            dicomUrl=File.getDicomFileUrl(diagnose.pathologyId)
            if dicomUrl:
                diagDict['dicomUrl'] = dicomUrl
            otherUrls=File.getFilesUrl(diagnose.pathologyId)
            if otherUrls:
                diagDict['otherUrls']=otherUrls
        if hasattr(diagnose,'report') and diagnose.report and diagnose.report.fileUrl:
            diagDict['reportUrl']= diagnose.report.fileUrl


        if hasattr(diagnose,"pathology") and diagnose.pathology:
            pathology=diagnose.pathology
            postionLen=0
            if hasattr(pathology,"pathologyPostions") and pathology.pathologyPostions:
                pathologyPositons=pathology.pathologyPostions
                postionLen=len(pathologyPositons)
                if pathologyPositons and len(pathologyPositons)>0:
                    positions=u''
                    for pathologyPositon in pathologyPositons:
                        position=pathologyPositon.position
                        positions+=(u' '+position.name)
                    diagDict['positionName']=positions
            #print diagDict['doctorName'],diagDict['positons']
            if pathology.diagnoseMethod==constant.DiagnoseMethod.Mri:
                diagDict['payAmount']=diagnose.getPayCount(constant.DiagnoseMethod.Mri,postionLen,diagnose.getUserDiscount(diagnose.patientId))
                diagDict['diagnoseMethod']=constant.DiagnoseMethod.Mri
            elif pathology.diagnoseMethod==constant.DiagnoseMethod.Ct:
                diagDict['payAmount']=diagnose.getPayCount(constant.DiagnoseMethod.Ct,postionLen,diagnose.getUserDiscount(diagnose.patientId))
                diagDict['diagnoseMethod']=constant.DiagnoseMethod.Ct



        isFeedback=Comment.existCommentBydiagnose(diagnose.id,type=constant.CommentType.DiagnoseComment)
        diagDict['isFeedback']=isFeedback


        result.append(diagDict)

    return result
Ejemplo n.º 16
0
def getDiagnoseDetailInfoByPatient(session, diagnose):
    if diagnose is None:
        return
    diagDict = {}
    diagDict['id'] = diagnose.id
    if hasattr(diagnose, "patient") and diagnose.patient:
        if diagnose.patient.realname:
            diagDict['patientName'] = diagnose.patient.realname
        if diagnose.patient.gender:
            diagDict['gender'] = constant.Gender[diagnose.patient.gender]
        if diagnose.patient.birthDate:
            diagDict['birthDate'] = diagnose.patient.birthDate.strftime(
                '%Y-%m-%d')
    if diagnose.diagnoseSeriesNumber:
        diagDict['diagnosenumber'] = diagnose.diagnoseSeriesNumber
    #diagDict['type']=diagnose.type
    if hasattr(diagnose,
               "doctor") and diagnose.doctor and diagnose.doctor.username:
        diagDict['doctorName'] = diagnose.doctor.username
        diagDict['doctorUserId'] = diagnose.doctor.userId
    if diagnose.createDate:
        diagDict["applyTime"] = diagnose.createDate.strftime('%Y-%m-%d')
    if diagnose.status:
        diagDict['diagnoseStatus'] = diagnose.status
    # if hasattr(diagnose,"hospital") and diagnose.hospital:
    #     diagDict['hospitalHistory']=diagnose.hospital.name
    #     diagDict['hospitalId']=diagnose.hospitalId

    if diagnose.pathologyId:
        diagDict['dicomUrl'] = File.getDicomFileUrl(diagnose.pathologyId)

    if diagnose.pathologyId:
        diagDict['docUrl'] = File.getFilesUrl(diagnose.pathologyId)

    if hasattr(diagnose, "pathology") and diagnose.pathology:
        pathology = diagnose.pathology
        diagDict['caseHistory'] = pathology.caseHistory
        diagDict['diagnoseType'] = pathology.diagnoseMethod
        if hasattr(pathology,
                   "pathologyPostions") and pathology.pathologyPostions:
            pathologyPositons = pathology.pathologyPostions
            if pathologyPositons and len(pathologyPositons) > 0:
                positions = u''
                for pathologyPositon in pathologyPositons:
                    position = pathologyPositon.position
                    positions += (u' ' + position.name)
                diagDict['positionName'] = positions

        if hasattr(pathology, "hospital") and pathology.hospital:
            diagDict['hospitalHistory'] = pathology.hospital.name
            diagDict['hospitalId'] = pathology.hospitalId

    if hasattr(diagnose,
               'report') and diagnose.report and diagnose.report.fileUrl:
        diagDict['reportId'] = diagnose.reportId
        diagDict['reportUrl'] = diagnose.report.fileUrl
        # diagDict['techDes']=diagnose.report.techDesc
        # diagDict['imageDes']=diagnose.report.imageDesc
        # diagDict['diagnoseResult']=diagnose.report.diagnoseDesc

    diagnoseLogs = DiagnoseLog.getDiagnoseLogByDiagnoseId(session, diagnose.id)
    diagnoseLogsDict = getDiagnoseLogsDict(diagnoseLogs)
    if diagnoseLogs and len(diagnoseLogs) > 0:
        diagDict['actions'] = diagnoseLogsDict
    isFeedback = Comment.existCommentBydiagnose(
        diagnose.id, type=constant.CommentType.DiagnoseComment)
    diagDict['isFeedback'] = str(isFeedback)

    return diagDict
Ejemplo n.º 17
0
def userCenterDiagnoses(diagnoses, type=None):
    if diagnoses is None or len(diagnoses) < 1:
        return
    result = []
    for diagnose in diagnoses:
        diagDict = {}

        if hasattr(
                diagnose,
                "patient") and diagnose.patient and diagnose.patient.realname:
            diagDict['patientName'] = diagnose.patient.realname
        if hasattr(diagnose,
                   "doctor") and diagnose.doctor and diagnose.doctor.username:
            diagDict['doctorName'] = diagnose.doctor.username
            if hasattr(
                    diagnose.doctor, 'hospital'
            ) and diagnose.doctor.hospital and diagnose.doctor.hospital.name:
                diagDict['doctorHispital'] = diagnose.doctor.hospital.name

        if hasattr(
                diagnose,
                "hospital") and diagnose.hospital and diagnose.hospital.name:
            diagDict['hispital'] = diagnose.hospital.name

        if diagnose.createDate:
            diagDict["date"] = diagnose.createDate.strftime('%Y-%m-%d')
        if diagnose.id:
            diagDict['id'] = diagnose.id
        if diagnose.diagnoseSeriesNumber:
            diagDict['diagnosenumber'] = diagnose.diagnoseSeriesNumber
        if diagnose.status or diagnose.status == 0:
            diagDict['statusId'] = diagnose.status
            diagDict['status'] = constant.DiagnoseStatus.getStatusName(
                diagnose.status)
        dicomUrl = None
        otherUrls = None
        if diagnose.pathologyId:
            dicomUrl = File.getDicomFileUrl(diagnose.pathologyId, type)
            if dicomUrl:
                diagDict['hasDicom'] = True
            else:
                diagDict['hasDicom'] = False
            otherUrls = File.getFilesUrl(diagnose.pathologyId, type)
            if otherUrls:
                diagDict['hasDoc'] = True
            else:
                diagDict['hasDoc'] = False
        if type:
            diagDict['dicomUrl'] = parseFileUrl(dicomUrl)
            diagDict['docUrl'] = parseFilesUrl(otherUrls)
        else:
            diagDict['dicomUrl'] = dicomUrl
            diagDict['docUrl'] = otherUrls

        if hasattr(diagnose,
                   'report') and diagnose.report and diagnose.report.fileUrl:
            diagDict['reportUrl'] = diagnose.report.fileUrl

        if hasattr(diagnose, "pathology") and diagnose.pathology:
            pathology = diagnose.pathology
            if hasattr(pathology,
                       "pathologyPostions") and pathology.pathologyPostions:
                pathologyPositons = pathology.pathologyPostions
                if pathologyPositons and len(pathologyPositons) > 0:
                    positions = u''
                    for pathologyPositon in pathologyPositons:
                        position = pathologyPositon.position
                        positions += (u' ' + position.name)
                    diagDict['positionName'] = positions
        #print diagDict['doctorName'],diagDict['positons']

        isFeedback = Comment.existCommentBydiagnose(
            diagnose.id, type=constant.CommentType.DiagnoseComment)
        diagDict['isFeedback'] = isFeedback

        result.append(diagDict)

    return result
Ejemplo n.º 18
0
def getDiagnoseDetailInfoByPatient(session, diagnose):
    if diagnose is None:
        return
    diagDict = {}
    diagDict["id"] = diagnose.id
    if hasattr(diagnose, "patient") and diagnose.patient:
        if diagnose.patient.realname:
            diagDict["patientName"] = diagnose.patient.realname
        if diagnose.patient.gender:
            diagDict["gender"] = constant.Gender[diagnose.patient.gender]
        if diagnose.patient.birthDate:
            diagDict["birthDate"] = diagnose.patient.birthDate.strftime("%Y-%m-%d")
    if diagnose.diagnoseSeriesNumber:
        diagDict["diagnosenumber"] = diagnose.diagnoseSeriesNumber
    # diagDict['type']=diagnose.type
    if hasattr(diagnose, "doctor") and diagnose.doctor and diagnose.doctor.username:
        diagDict["doctorName"] = diagnose.doctor.username
    if diagnose.createDate:
        diagDict["applyTime"] = diagnose.createDate.strftime("%Y-%m-%d")
    if diagnose.status:
        diagDict["diagnoseStatus"] = diagnose.status
    # if hasattr(diagnose,"hospital") and diagnose.hospital:
    #     diagDict['hospitalHistory']=diagnose.hospital.name
    #     diagDict['hospitalId']=diagnose.hospitalId

    if diagnose.pathologyId:
        diagDict["dicomUrl"] = File.getDicomFileUrl(diagnose.pathologyId)

    if diagnose.pathologyId:
        diagDict["docUrl"] = File.getFilesUrl(diagnose.pathologyId)

    if hasattr(diagnose, "pathology") and diagnose.pathology:
        pathology = diagnose.pathology
        diagDict["caseHistory"] = pathology.caseHistory
        diagDict["diagnoseType"] = pathology.diagnoseMethod
        if hasattr(pathology, "pathologyPostions") and pathology.pathologyPostions:
            pathologyPositons = pathology.pathologyPostions
            if pathologyPositons and len(pathologyPositons) > 0:
                positions = u""
                for pathologyPositon in pathologyPositons:
                    position = pathologyPositon.position
                    positions += u" " + position.name
                diagDict["positionName"] = positions

        if hasattr(pathology, "hospital") and pathology.hospital:
            diagDict["hospitalHistory"] = pathology.hospital.name
            diagDict["hospitalId"] = pathology.hospitalId

    if hasattr(diagnose, "report") and diagnose.report:
        diagDict["reportId"] = diagnose.reportId
        # diagDict['techDes']=diagnose.report.techDesc
        # diagDict['imageDes']=diagnose.report.imageDesc
        # diagDict['diagnoseResult']=diagnose.report.diagnoseDesc

    diagnoseLogs = DiagnoseLog.getDiagnoseLogByDiagnoseId(session, diagnose.id)
    diagnoseLogsDict = getDiagnoseLogsDict(diagnoseLogs)
    if diagnoseLogs and len(diagnoseLogs) > 0:
        diagDict["actions"] = diagnoseLogsDict
    isFeedback = Comment.existCommentBydiagnose(diagnose.id, type=constant.CommentType.DiagnoseComment)
    diagDict["isFeedback"] = str(isFeedback)

    return diagDict
Ejemplo n.º 19
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)
Ejemplo n.º 20
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)
Ejemplo n.º 21
0
def getDiagnoseListByKefu(diagnoses):
    if diagnoses is None or len(diagnoses) < 1:
        return
    result = []
    for diagnose in diagnoses:
        diagDict = {}

        if hasattr(
                diagnose,
                "patient") and diagnose.patient and diagnose.patient.realname:
            diagDict['patientName'] = diagnose.patient.realname
        if hasattr(diagnose, "patient") and diagnose.patient:
            diagDict['mobile'] = diagnose.patient.identityPhone
        if hasattr(diagnose,
                   "doctor") and diagnose.doctor and diagnose.doctor.username:
            diagDict['doctorName'] = diagnose.doctor.username
            if hasattr(
                    diagnose.doctor, 'hospital'
            ) and diagnose.doctor.hospital and diagnose.doctor.hospital.name:
                diagDict['doctorHispital'] = diagnose.doctor.hospital.name

        if hasattr(
                diagnose,
                "hospital") and diagnose.hospital and diagnose.hospital.name:
            diagDict['hispital'] = diagnose.hospital.name

        if diagnose.createDate:
            diagDict["date"] = diagnose.createDate.strftime('%Y-%m-%d')
        if diagnose.id:
            diagDict['id'] = diagnose.id
        if diagnose.diagnoseSeriesNumber:
            diagDict['diagnosenumber'] = diagnose.diagnoseSeriesNumber
        if diagnose.status or diagnose.status == 0:
            diagDict['statusId'] = diagnose.status
            diagDict['status'] = constant.DiagnoseStatus.getStatusName(
                diagnose.status)
        if diagnose.pathologyId:
            dicomUrl = File.getDicomFileUrl(diagnose.pathologyId)
            if dicomUrl:
                diagDict['dicomUrl'] = dicomUrl
            otherUrls = File.getFilesUrl(diagnose.pathologyId)
            if otherUrls:
                diagDict['otherUrls'] = otherUrls
        if hasattr(diagnose,
                   'report') and diagnose.report and diagnose.report.fileUrl:
            diagDict['reportUrl'] = diagnose.report.fileUrl

        if hasattr(diagnose, "pathology") and diagnose.pathology:
            pathology = diagnose.pathology
            postionLen = 0
            if hasattr(pathology,
                       "pathologyPostions") and pathology.pathologyPostions:
                pathologyPositons = pathology.pathologyPostions
                postionLen = len(pathologyPositons)
                if pathologyPositons and len(pathologyPositons) > 0:
                    positions = u''
                    for pathologyPositon in pathologyPositons:
                        position = pathologyPositon.position
                        positions += (u' ' + position.name)
                    diagDict['positionName'] = positions
            #print diagDict['doctorName'],diagDict['positons']
            if pathology.diagnoseMethod == constant.DiagnoseMethod.Mri:
                diagDict['payAmount'] = diagnose.getPayCount(
                    constant.DiagnoseMethod.Mri, postionLen,
                    diagnose.getUserDiscount(diagnose.patientId))
                diagDict['diagnoseMethod'] = constant.DiagnoseMethod.Mri
            elif pathology.diagnoseMethod == constant.DiagnoseMethod.Ct:
                diagDict['payAmount'] = diagnose.getPayCount(
                    constant.DiagnoseMethod.Ct, postionLen,
                    diagnose.getUserDiscount(diagnose.patientId))
                diagDict['diagnoseMethod'] = constant.DiagnoseMethod.Ct

        isFeedback = Comment.existCommentBydiagnose(
            diagnose.id, type=constant.CommentType.DiagnoseComment)
        diagDict['isFeedback'] = isFeedback

        result.append(diagDict)

    return result