diff --git a/src/medicine/springboot/src/main/java/com/xht/springboot/pythonspider/CancerSpider/spider.py b/src/medicine/springboot/src/main/java/com/xht/springboot/pythonspider/CancerSpider/spider.py deleted file mode 100644 index 9b7ebc20..00000000 --- a/src/medicine/springboot/src/main/java/com/xht/springboot/pythonspider/CancerSpider/spider.py +++ /dev/null @@ -1,89 +0,0 @@ -import requests -from PIL import Image -from selenium import webdriver -from selenium.webdriver import ActionChains -from selenium.webdriver.common.by import By -import time -from lxml import etree - - -def analyse(driver , input_imagexpath , input_anlxpath , imagepath): - # 图片按钮 - loc1 = driver.find_element(By.XPATH, input_imagexpath).send_keys(imagepath) - # 分析按钮 - loc2 = driver.find_element(By.XPATH, input_anlxpath) - - ActionChains(driver).click(loc1).perform() - time.sleep(2) - ActionChains(driver).click(loc2).perform() - time.sleep(2) - -def go_in(driver , input_user , input_password , input_upload): - # 用户名 - loc3 = driver.find_element(By.XPATH, input_user).send_keys("xht") - # 密码 - loc4 = driver.find_element(By.XPATH, input_password).send_keys("Xht@20021213") - # 点击进入 - loc5 = driver.find_element(By.XPATH, input_upload) - - ActionChains(driver).click(loc3).perform() - time.sleep(2) - ActionChains(driver).click(loc4).perform() - time.sleep(2) - - ActionChains(driver).click(loc5).perform() - time.sleep(2) - -def get_information(driver , url): - input_res = [] - for i in range(2 , 7): - if i == 5: - continue - else: - # / html / body / p[3] / text()[2] - t = "/html/body/p[" + str(i) + "]" - input_res.append(t) - loc_res = [] - for i in input_res: - temp = driver.find_element(By.XPATH , i).text - loc_res.append(temp) - - return loc_res - -def get_picture(driver , output_pic , imagename): - return driver.find_element(By.XPATH , output_pic).screenshot(imagename) - - - -if __name__ == "__main__": - # driver.get("http://mammo.neuralrad.com:5300/upload") - option = webdriver.EdgeOptions() - option.add_argument("--headless") - option.add_argument("--disable-gpu") - option.add_argument("--disable-software-rasterizer") - - url = "http://mammo.neuralrad.com:5300/" - driver = webdriver.Edge(options=option) - imagepath = "D:\\pro_of_program\\Java\\test\\SOB_B_A-14-22549AB-400-006.png" - imagename = "SOB_B_A-14-22549AB-400-006.png" - - driver.get(url) - - input_imagexpath = "/html/body/section[2]/form/p/input[1]" - input_anlxpath = "/html/body/section[2]/form/p/input[2]" - - input_user = "/html/body/section[1]/div/header/div/div[2]/a[1]/div/p/input" - input_password = "/html/body/section[1]/div/header/div/div[2]/a[2]/div/p/input" - - input_upload = "/html/body/section[2]/div/div/h1/a" - output_picture = "/html/body/img" - - go_in(driver , input_user , input_password , input_upload) - analyse(driver , input_imagexpath , input_anlxpath , imagepath) - # context 解析结果 - context = get_information(driver , url) - for i in context: - print(i) - # 获取图片 - picture = get_picture(driver , output_picture , imagename) - # print(picture) \ No newline at end of file diff --git a/src/medicine/springboot/src/main/java/com/xht/springboot/pythonspider/PythonSpider.java b/src/medicine/springboot/src/main/java/com/xht/springboot/pythonspider/PythonSpider.java deleted file mode 100644 index d75c8248..00000000 --- a/src/medicine/springboot/src/main/java/com/xht/springboot/pythonspider/PythonSpider.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.xht.springboot.pythonspider; - -import org.python.util.PythonInterpreter; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; - -public class PythonSpider -{ - public static ArrayList Spider() - { - ArrayList res = new ArrayList<>(); - PythonInterpreter Pyit = new PythonInterpreter(); - Process proc; - String path = "src/main/java/com/xht/springboot/pythonspider/CancerSpider/spider.py"; - path = "python " + path; - try { - proc = Runtime.getRuntime().exec(path); - BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream())); - String line = null; - while((line = in.readLine()) != null) - res.add(line); - in.close(); - proc.waitFor(); - } - catch (IOException e) { - e.printStackTrace(); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - return res; - } -}