from Handle.new_doctor_handle import new_handle
import time
import datetime
import random
from unitl.read_ini import Readini

ronum = random.randint(10, 6000)
name = 'test' + str(ronum)
now_time = datetime.datetime.now().strftime('Test%m%d:%H%M')

class new_bussiness():

    def __init__(self,driver):
        self.b=new_handle(driver)
        self.w_canshu=Readini('D:\po_owens_write\config\example.ini','DEFAULT')
        # self.ronum=random.randint(10,6000)
        # self.name='test'+str(self.ronum)
        # self.now_time = datetime.datetime.now().strftime('Test%m%d:%H%M')

    def new_case_Ymx(self):
        self.b.send_accunt('15890158362')
        self.b.send_password('kle123456')
        self.b.click_login_button()
        time.sleep(3)
        self.b.click_new_case()
        time.sleep(2)
        self.b.send_patientName(now_time)
        self.b.click_sex()
        self.b.click_birthdayYear()
        self.b.click_birthdayMonth()
        self.b.click_birthdayDate()
        self.b.send_phone_num('15890158362')
        self.b.click_hospital()
        self.b.click_t_button()
        time.sleep(3)
        self.b.upodle_img1('D:\\shangctp\\45Profile.jpg')
        time.sleep(1)
        self.b.upodle_img2('D:\\shangctp\\FrontalRepose.jpg')
        time.sleep(1)
        self.b.upodle_img3('D:\\shangctp\\FrontalSmile.jpg')
        time.sleep(1)
        self.b.upodle_img4('D:\\shangctp\\Profile.jpg')
        time.sleep(1)
        self.b.upodle_img5('D:\\shangctp\\Upper.jpg')
        time.sleep(1)
        self.b.upodle_img6('D:\\shangctp\\Left.jpg')
        time.sleep(1)
        self.b.upodle_img7('D:\\shangctp\\Lower.jpg')
        time.sleep(1)
        self.b.upodle_img8('D:\\shangctp\\Anterior.jpg')
        time.sleep(1)
        self.b.upodle_img9('D:\\shangctp\\Right.jpg')
        time.sleep(1)
        self.b.upodle_img10('D:\\shangctp\\Cephalometric.jpg')
        time.sleep(1)
        self.b.upodle_img11('D:\\shangctp\\Panoramic.jpg')
        time.sleep(3)
        self.b.click_s()
        time.sleep(2)
        self.b.click_lingc_text()
        time.sleep(1)
        self.b.click_huanze_tape_button()
        time.sleep(1)
        self.b.click_canpin_tape_button()
        time.sleep(1)
        self.b.click_l()
        time.sleep(1)
        #self.b.click_m()
        self.b.click_shuzi_moxing_button()
        time.sleep(1)
        self.b.click_select_sz_button()
        time.sleep(1)
        self.b.upload_u_stl('D:\\shangctp\\u.stl')
        time.sleep(8)
        self.b.upload_l_stl('D:\\shangctp\\l.stl')
        time.sleep(8)
        self.b.click_case_tijiao()
        time.sleep(3)
        if self.b.get_add_patient_name()==now_time:
            return True
        else:
            return False

    def new_case_Nmx(self):
        self.b.send_accunt('15890158362')
        self.b.send_password('kle123456')
        self.b.click_login_button()
        time.sleep(3)
        self.b.click_new_case()
        time.sleep(2)
        self.b.send_patientName(now_time)
        self.b.click_sex()
        self.b.click_birthdayYear()
        self.b.click_birthdayMonth()
        self.b.click_birthdayDate()
        self.b.send_phone_num('15890158362')
        self.b.click_hospital()
        self.b.click_t_button()
        time.sleep(2)
        self.b.upodle_img1('D:\\shangctp\\45Profile.jpg')
        ##time.sleep(1)
        self.b.upodle_img2('D:\\shangctp\\FrontalRepose.jpg')
        ##time.sleep(1)
        self.b.upodle_img3('D:\\shangctp\\FrontalSmile.jpg')
        ##time.sleep(1)
        self.b.upodle_img4('D:\\shangctp\\Profile.jpg')
        ##time.sleep(1)
        self.b.upodle_img5('D:\\shangctp\\Upper.jpg')
        ##time.sleep(1)
        self.b.upodle_img6('D:\\shangctp\\Left.jpg')
        ##time.sleep(1)
        self.b.upodle_img7('D:\\shangctp\\Lower.jpg')
        ##time.sleep(1)
        self.b.upodle_img8('D:\\shangctp\\Anterior.jpg')
        ##time.sleep(1)
        self.b.upodle_img9('D:\\shangctp\\Right.jpg')
        ##time.sleep(1)
        self.b.upodle_img10('D:\\shangctp\\Cephalometric.jpg')
        ##time.sleep(1)
        self.b.upodle_img11('D:\\shangctp\\Panoramic.jpg')
        time.sleep(2)
        self.b.click_s()
        time.sleep(2)
        self.b.click_lingc_text()
        ##time.sleep(1)
        self.b.click_huanze_tape_button()
        ##time.sleep(1)
        self.b.click_canpin_tape_button()
        ##time.sleep(1)
        self.b.click_l()
        time.sleep(1)
        self.b.click_m()
        self.b.click_case_tijiao()
        time.sleep(3)
        self.b.click_patient_details()
        time.sleep(2)
        self.patient_number=self.b.get_add_patient_number()
        self.w_canshu.write_canshu('caseno',self.patient_number)
        if self.b.get_patient_details_name()==now_time:
            return True
        else:
            return False


if __name__=="__main__":
    now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    print(now_time)

