def hang_list(self): api_url = HOST + "/api/Technician/UnFinishList" from techin.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() body.observationDate = today_horizon2str() body.observationLocationIDArray = 'E3773228-3C86-4CAE-AF22-AB6600E618D6' body = body.SerializeToString() res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='查询挂起列表') # 解析结果 from techin.proto_pb.PageResponsePb_pb2 import PageResponsePb data = PageResponsePb() data.ParseFromString(res.content) # 结果转为json from techin.proto_pb.ObservationListResponsePb_pb2 import ObservationListResponsePb res_json = MessageToJson(data) res_dict = json.loads( res_json.encode('utf-8').decode("unicode_escape")) if 'isSuccess' in res_dict.keys() and 'data' in res_dict.keys(): if 'hangUpList' in res_dict['data'][0]: print(res.status_code, res_dict['data'][0]['hangUpList']) else: print(res.status_code, '无查询数据') else: print(res.status_code, res_dict)
def finish_shoot_list(self): api_url = HOST + "/api/Technician/FinishList" from techin.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() # body.observationEndDate = '2020-03-04 00:00:00|2020-03-04 23:59:59' # 检查结束时间 body.observationEndDate = today_horizon2str() # 检查结束时间 body.observationLocationIDArray = 'E3773228-3C86-4CAE-AF22-AB6600E618D6' body = body.SerializeToString() res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='查询完成列表') # 解析结果 from techin.proto_pb.PageResponsePb_pb2 import PageResponsePb data = PageResponsePb() data.ParseFromString(res.content) # 结果转为json from techin.proto_pb.ViOrderReportResponsePb_pb2 import ViOrderReportResponsePb res_json = MessageToJson(data) res_dict = json.loads( res_json.encode('utf-8').decode("unicode_escape")) if 'isSuccess' in res_dict.keys() and 'data' in res_dict.keys(): print(res.status_code, res_dict['data']) else: print(res.status_code, res_dict)
def get_orderID(self): api_url = HOST + "/api/Technician/UnFinishList" from techin.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() body.observationDate = today_horizon2str() body.observationLocationIDArray = 'E3773228-3C86-4CAE-AF22-AB6600E618D6' body = body.SerializeToString() res = requests.request(method='POST', url=api_url, data=body, headers=header) # 解析结果 from techin.proto_pb.PageResponsePb_pb2 import PageResponsePb data = PageResponsePb() data.ParseFromString(res.content) # 结果转为json from techin.proto_pb.ObservationListResponsePb_pb2 import ObservationListResponsePb res_json = MessageToJson(data) res_dict = json.loads( res_json.encode('utf-8').decode("unicode_escape")) if 'isSuccess' in res_dict.keys() and 'data' in res_dict.keys(): if 'unFinishList' in res_dict['data'][0]: order_list = res_dict['data'][0]['unFinishList'] order_choice = random.choice(order_list) # 随机选择一个检查 return order_choice['orderID'] else: return '' else: return ''
def exam_end(self): api_url = HOST + "/api/Exam/Finish" from techin.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() body.orderID = self.orderID # 从呼叫列表获取 body = body.SerializeToString() res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='检查完成') # 解析结果 from techin.proto_pb.PageResponsePb_pb2 import PageResponsePb data = PageResponsePb() data.ParseFromString(res.content) # 结果转为json from techin.proto_pb.FinishExamResponsePb_pb2 import FinishExamResponsePb res_json = MessageToJson(data) res_dict = json.loads( res_json.encode('utf-8').decode("unicode_escape")) if 'isSuccess' in res_dict.keys(): if res_dict['isSuccess']: print(res.status_code, '完成检查', res_dict['isSuccess']) else: print(res.status_code, '检查完成失败')
def refresh_wait_list(self): api_url = HOST + "/api/Technician/UnFinishList" from techin.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() body.observationDate = today_horizon2str() body.observationLocationIDArray = PROCINFO['observationLocationID'] body = body.SerializeToString() res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='sr刷新摄片列表') from techin.proto_pb.PageResponsePb_pb2 import PageResponsePb data = PageResponsePb() data.ParseFromString(res.content) from techin.proto_pb.ObservationListResponsePb_pb2 import ObservationListResponsePb res_json = MessageToJson(data) res_dict = json.loads( res_json.encode('utf-8').decode("unicode_escape")) print('refresh_wait_list返回---------') if 'isSuccess' in res_dict.keys() and 'data' in res_dict.keys(): if 'unFinishList' in res_dict['data'][0]: print(res.status_code, res_dict['data'][0]['unFinishList']) else: print(res.status_code, '无查询数据') else: print(res.status_code, res_dict)
def wait_shoot_list(): api_url = HOST + "/api/Technician/UnFinishList" body = OrderSearchRequestPb() body.observationDate = today_horizon2str() body.observationLocationIDArray = 'E3773228-3C86-4CAE-AF22-AB6600E618D6' body = body.SerializeToString() res = requests.request(method='POST', url=api_url, data=body, headers=header) # 解析结果 data = PageResponsePb() data.ParseFromString(res.content) # 结果转为json res_json = MessageToJson(data) res_dict = json.loads(res_json.encode('utf-8').decode("unicode_escape")) if 'isSuccess' in res_dict.keys() and 'data' in res_dict.keys(): if 'unFinishList' in res_dict['data'][0]: print(res.status_code, res_dict['data'][0]['unFinishList']) else: print(res.status_code, 'unFinishList:[]') else: print(res.status_code)
def postpone(self): api_url = HOST + "/api/Exam/Postpone" from techin.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() body.orderID = self.orderID body = body.SerializeToString() res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='to推迟') print("postpone---------") print(res.status_code, res.content)
def close_exam(self): from techin.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() body.observationDate = today_horizon2str() body.observationLocationIDArray = PROCINFO['observationLocationID'] body = body.SerializeToString() api_url = HOST + "/api/Technician/UnFinishList" un_res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='to关闭检查窗口-刷新等待列表') print(un_res.status_code, un_res.content) api_url = HOST + "/api/Technician/FinishList" res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='to关闭检查窗口-刷新完成列表') print(res.status_code, res.content)
def shoot_finish(): api_url = HOST + "/api/Exam/Finish" body = OrderSearchRequestPb() body.orderID = OrderID # 从呼叫列表获取 body = body.SerializeToString() res = requests.request(method='POST', url=api_url, data=body, headers=header) print('RT: %ss' % res.elapsed.total_seconds()) # 解析结果 data = PageResponsePb() data.ParseFromString(res.content) # 结果转为json res_json = MessageToJson(data) res_dict = json.loads(res_json.encode('utf-8').decode("unicode_escape")) if 'isSuccess' in res_dict.keys(): if res_dict['isSuccess']: print(res.status_code, res_dict['isSuccess']) else: print(res.status_code, res_dict)
def finish_shoot_list(): api_url = HOST + "/api/Technician/FinishList" body = OrderSearchRequestPb() body.observationEndDate = '2020-03-04 00:00:00|2020-03-04 23:59:59' # 检查结束时间 body.observationLocationIDArray = 'E3773228-3C86-4CAE-AF22-AB6600E618D6' body = body.SerializeToString() res = requests.request(method='POST', url=api_url, data=body, headers=header) # 解析结果 data = PageResponsePb() data.ParseFromString(res.content) # 结果转为json res_json = MessageToJson(data) res_dict = json.loads(res_json.encode('utf-8').decode("unicode_escape")) if 'isSuccess' in res_dict.keys() and 'data' in res_dict.keys(): print(res.status_code, res_dict['data']) else: print(res.status_code, 'data:[]')
def start_shoot(self): api_url = HOST + "/api/Exam/Start" from techin.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() body.orderID = self.orderID body = body.SerializeToString() res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='to开始摄片') from techin.proto_pb.PageResponsePb_pb2 import PageResponsePb data = PageResponsePb() data.ParseFromString(res.content) from techin.proto_pb.FinishExamResponsePb_pb2 import FinishExamResponsePb res_json = MessageToJson(data) res_dict = json.loads( res_json.encode('utf-8').decode("unicode_escape")) print('start_shoot返回---------') if 'isSuccess' in res_dict.keys(): if res_dict['isSuccess']: print(res.status_code, '检查开始成功', res_dict['isSuccess']) else: print(res.status_code, '检查开始失败')