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 today_patient(self): api_url = HOST + "/api/Patient/PageList" header = {'content-type': CONTENT_TYPE, 'Authorization': TOKEN, 'userInfo': REGINFO, 'Connection': 'close'} from register.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() body.regDate = today_horizon2str() body.currentPage = 1 body.pageSize = 10 body = body.SerializeToString() try: res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='s今日登记患者查询', timeout=10, stream=False) print('s今日登记患者查询-------') # from register.proto_pb.PageResponsePb_pb2 import PageResponsePb # data = PageResponsePb() # data.ParseFromString(res.content) # from register.proto_pb.OrderStaticListResponsePb_pb2 import OrderStaticListResponsePb # from google.protobuf.json_format import MessageToJson # res_json = MessageToJson(data) # print(res.status_code, res_json) print(res.status_code, res.content) except requests.exceptions.ConnectionError: status_code = "Connection refused" print('s今日登记患者查询-------') print(status_code)
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 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 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 order_search(self): api_url = HOST + "/api/Order/PageList" header = { 'content-type': CONTENT_TYPE, 'Authorization': TOKEN, 'userInfo': REGINFO } from register.proto_pb.OrderSearchRequestPb_pb2 import OrderSearchRequestPb body = OrderSearchRequestPb() body.regDate = today_horizon2str() # 预检时间、检查时间也可以查询 # body.observationDate = '2020-03-18|2020-03-18' # body.observationEndDate = '2020-03-18|2020-03-18' body.currentPage = 1 body.pageSize = 10 body = body.SerializeToString() res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='s患者查询', timeout=10, stream=False) print('s患者查询----------') # from register.proto_pb.PageResponsePb_pb2 import PageResponsePb # data = PageResponsePb() # data.ParseFromString(res.content) # from register.proto_pb.OrderStaticListResponsePb_pb2 import OrderStaticListResponsePb # from google.protobuf.json_format import MessageToJson # res_json = MessageToJson(data) # print(res.status_code, res_json) print(res.status_code, res.content)
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 refresh(self): api_url = HOST + "/api/ReportList/PageList" from report.proto_pb.ViOrderReportRequestPb_pb2 import ViOrderReportRequestPb body = ViOrderReportRequestPb() body.observationEndDate = today_horizon2str() body.currentPage = 1 body.pageSize = 10 body = body.SerializeToString() res = self.client.request(method='POST', path=api_url, data=body, headers=header, name='ro刷新报告列表') print("refresh_list返回------------") 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)