Ejemplo n.º 1
0
def replyNeedInstruc():
    msgObjs = []
    # append an introduction picture
    msgObjs.append(
        TextSendMessage(
            text=getTextContents('instrucMsg', 'need_instruc_reply')))
    return msgObjs
Ejemplo n.º 2
0
def sendRemindConfirmMsg(postConfirmParam):
    msgObjs=[]
    msgObjs.append(TextSendMessage(text=getContents.getTextContents('msg_contents','reply_pickmedi_confirmed')))
    #get patient pick med info with patient id

    #requests.post('{postParam}'.format(postParam=postPatientIdParam))
    patientName=postConfirmParam["patientName"]
    pickDate1=postConfirmParam["pickDate1"]
    pickDate2=postConfirmParam["pickDate2"]
    weekday1=postConfirmParam["weekday1"]
    weekday2=postConfirmParam["weekday2"]
    symptom=postConfirmParam["symptom"]
    flex=deepcopy(mediConfirmFlex)
    flex["hero"]["url"]=getContents.getPicUrl('pick_medi_confirm_url')
    flex["body"]["contents"][0]["text"]=patientName+":"+symptom
    msg='慢性處方箋領藥日:\n'+pickDate1+getContents.getWeekDay(weekday1)+"~"+pickDate2+getContents.getWeekDay(weekday2)
    flex["footer"]["contents"][0]["text"]=msg
    #+" 您好,\n已確認您的預約慢性處方箋領藥日:"+pickDate1+getContents.getWeekDay(weekday1)+"~"+pickDate2+getContents.getWeekDay(weekday2)
    msgObjs.append(FlexSendMessage(alt_text='慢箋領藥時間確認',contents=flex))
    return msgObjs
Ejemplo n.º 3
0
def replyNoNeedToPick():
    msg = getContents.getTextContents('msg_contents', 'no_medi_to_pick')
    dateToPickFlex["hero"]["url"] = getContents.getPicUrl(
        'mediDateResult_pic_url')
    dateToPickFlex["body"]["contents"][0]["contents"][0]["text"] = msg
    return FlexSendMessage(alt_text="領藥時間查詢結果", contents=dateToPickFlex)
Ejemplo n.º 4
0
def replyNotNeedInstruc():
    return TextSendMessage(
        text=getTextContents('instrucMsg', 'no_need_instruc_reply'))
Ejemplo n.º 5
0
import os
from pathlib import Path
from dotenv import load_dotenv
from getContents import getTextContents

from flask_sqlalchemy import SQLAlchemy
from flask import Flask, jsonify
'''Initialize channel access token and channel secret'''
is_heroku = os.environ.get("IS_HEROKU", None)
if is_heroku:
    channel_access_token = os.environ.get("CHANNEL_ACCESS_TOKEN", None)
    channel_secret = os.environ.get("CHANNEL_SECRET", None)
    db_url = os.environ.get("DB_URL", None)
else:
    env_path = Path('.') / '.env'
    load_dotenv(dotenv_path=env_path)
    channel_access_token = os.getenv("CHANNEL_ACCESS_TOKEN", None)
    channel_secret = os.getenv("CHANNEL_SECRET", None)
    db_url = os.getenv("DB_URL", None)

line_bot_api = LineBotApi(channel_access_token)
handler = WebhookHandler(channel_secret)
headers = {
    'Authorization': 'Bearer {botToken}'.format(botToken=channel_access_token)
}
headers_to_db = {
    'User-Agent':
    'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'
}
backendUrl = getTextContents('server_urls', 'backend_url')