Esempio n. 1
0
def query_product_by_default():
    samples = query_by_regular(3, '', '', '', '', '')
    sample_list = {}
    line = 1
    for sample in samples:
        sample_list[line] = translate4web(sample.SampleInfo2dict(),
                                          SampleInfoEN2ZH)
        line += 1
    samples = query_by_regular(4, '', '', '', '', '')
    for sample in samples:
        sample_list[line] = translate4web(sample.SampleInfo2dict(),
                                          SampleInfoEN2ZH)
        line += 1
    return json.dumps(sample_list), 200, {'content-type': 'application/json'}
Esempio n. 2
0
def query_mysamples_by_default():
    username = current_user.realname
    samples = query_by_manager('', '', username, '', '', '')
    sample_list = {}
    line = 1
    for sample in samples:
        sample_list[line] = translate4web(sample.SampleInfo2dict(),
                                          SampleInfoEN2ZH)
        line += 1
    samples = query_by_applyer('', '', username, '', '', '')
    for sample in samples:
        sample_list[line] = translate4web(sample.SampleInfo2dict(),
                                          SampleInfoEN2ZH)
        line += 1
    return json.dumps(sample_list), 200, {'content-type': 'application/json'}
Esempio n. 3
0
def query_apply_by_project():
    Project = request.args.get('key', '')
    samples = SampleInfo.query.filter_by(Project_name=Project, Status=1).all()
    sample_list = {}
    line = 1
    for sample in samples:
        sample_list[line] = translate4web(sample.SampleInfo2dict(),
                                          SampleInfoEN2ZH)
        line += 1
    db.session.close()
    return json.dumps(sample_list), 200, {'content-type': 'application/json'}
Esempio n. 4
0
def query_deliever_by_default():
    samples = query_by_regular(6, '', '', '', '', '')
    sample_list = {}
    line = 1
    for sample in samples:
        sample_list[line] = translate4web(sample.SampleInfo2dict(),
                                          SampleInfoEN2ZH)
        line += 1
    # samples = query_by_regular(7, '', '', '', '')
    # for sample in samples:
    #     sample_list[line] = translate4web(
    #         sample.SampleInfo2dict(), SampleInfoEN2ZH)
    #     line += 1
    return json.dumps(sample_list), 200, {'content-type': 'application/json'}
Esempio n. 5
0
def query_mysample_by_detail():
    username = current_user.realname
    select = request.json
    status = select['Status']
    tube_id = select['Tube_ID']
    agent_contacts = select['Agent_contacts']
    time_start = select['Time_start']
    time_end = select['Time_end']

    samples = query_by_manager(status, tube_id, username, agent_contacts,
                               time_start, time_end)
    sample_list = {}
    line = 1
    for sample in samples:
        sample_list[line] = translate4web(sample.SampleInfo2dict(),
                                          SampleInfoEN2ZH)
        line += 1
    samples = query_by_applyer(status, tube_id, username, agent_contacts,
                               time_start, time_end)
    for sample in samples:
        sample_list[line] = translate4web(sample.SampleInfo2dict(),
                                          SampleInfoEN2ZH)
        line += 1
    return json.dumps(sample_list), 200, {'content-type': 'application/json'}
Esempio n. 6
0
def query_sample_by_detail():
    select = request.json
    status = select['Status']
    tube_id = select['Tube_ID']
    agent_manager = select['Agent_manager']
    time_start = select['Time_start']
    time_end = select['Time_end']
    print(type(select))
    tag = select['Tag'] if "tag" in select.keys() else None
    print(f"tag:{tag}")
    print(f"tube_id:{tube_id}")
    samples = query_by_regular(status, tube_id, agent_manager, time_start,
                               time_end, tag)
    sample_list = {}
    line = 1
    print(f"samples:{samples}")
    for sample in samples:
        sample_list[line] = translate4web(sample.SampleInfo2dict(),
                                          SampleInfoEN2ZH)
        line += 1
    return json.dumps(sample_list), 200, {'content-type': 'application/json'}
Esempio n. 7
0
def query_quest_by_prisid():
    prisid = request.args.get('key', '')
    sampleinfo = SampleInfo.query.filter_by(PriSID=prisid).first()
    if None == sampleinfo:
        db.session.close()
        return 'failed', 500, {'content-type': 'application/json'}
    elif None == sampleinfo.Tube_ID:
        db.session.close()
        return 'not ready', 300, {'content-type': 'application/json'}

    question = Questionnaire.query.filter_by(
        Tube_ID=sampleinfo.Tube_ID).first()
    if None == question:
        db.session.close()
        return 'failed', 500, {'content-type': 'application/json'}
    else:
        questionjson = translate4web(question.Questionnaire2dict(),
                                     QuestionnaireEN2ZH)
        db.session.close()
        return json.dumps(questionjson), 200, {
            'content-type': 'application/json'
        }
Esempio n. 8
0
def query_sample_by_prisid():
    PriSID = request.args.get('key', '')
    sampleinfo = SampleInfo.query.filter_by(PriSID=PriSID).first()
    sampleinfo = translate4web(sampleinfo.SampleInfo2dict(), SampleInfoEN2ZH)
    db.session.close()
    return json.dumps(sampleinfo), 200, {'content-type': 'application/json'}