Compare commits
3 Commits
043c1b71a1
...
d0d9d6d18b
Author | SHA1 | Date | |
---|---|---|---|
d0d9d6d18b | |||
2949a48e63 | |||
b5a118994a |
28
pom.xml
28
pom.xml
@@ -26,4 +26,32 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>com.dota.App</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
<descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
59
src/main/java/com/dota/App.java
Normal file
59
src/main/java/com/dota/App.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package com.dota;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class App {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SwingUtilities.invokeLater(App::lanuch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static String[] doctors = new String[]{"顾磊", "章亮", "唐婷婷", "杨祖怡", "李宁", "周晖"};
|
||||||
|
|
||||||
|
static void lanuch() {
|
||||||
|
JFrame jframe = new JFrame("排班系统");
|
||||||
|
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
jframe.setSize(600,400);
|
||||||
|
jframe.setLayout(new BorderLayout(10, 10));
|
||||||
|
|
||||||
|
var dateField = new JTextField("2025-10-13");
|
||||||
|
var weekNumField = new JTextField("2");
|
||||||
|
var filePathField = new JTextField("C:\\Users\\yangz\\Documents\\医生排班.xlsx");
|
||||||
|
var doctorField = new JComboBox<>(doctors);
|
||||||
|
doctorField.setSelectedIndex(0);
|
||||||
|
var resText = new JTextArea("点击确定按钮,输出执行结果");
|
||||||
|
var btn = new JButton("确定");
|
||||||
|
|
||||||
|
// 输入区域
|
||||||
|
JPanel inputPanel = new JPanel(new GridLayout(4,2,10,5));
|
||||||
|
jframe.add(inputPanel, BorderLayout.NORTH);
|
||||||
|
inputPanel.add(new JLabel("排班日期"));
|
||||||
|
inputPanel.add(dateField);
|
||||||
|
inputPanel.add(new JLabel("排班周数"));
|
||||||
|
inputPanel.add(weekNumField);
|
||||||
|
inputPanel.add(new JLabel("第一个值班的医生"));
|
||||||
|
inputPanel.add(doctorField);
|
||||||
|
inputPanel.add(new JLabel("输出文件位置"));
|
||||||
|
inputPanel.add(filePathField);
|
||||||
|
|
||||||
|
//结果区域
|
||||||
|
JPanel resPanel = new JPanel();
|
||||||
|
jframe.add(resPanel, BorderLayout.CENTER);
|
||||||
|
resPanel.add(resText);
|
||||||
|
|
||||||
|
// 按钮区域
|
||||||
|
var btnPanel = new JPanel();
|
||||||
|
jframe.add(btnPanel, BorderLayout.SOUTH);
|
||||||
|
btnPanel.add(btn);
|
||||||
|
|
||||||
|
btn.addActionListener(e->{
|
||||||
|
resText.setText("运行中,请稍等");
|
||||||
|
Main.run(dateField.getText(), Integer.parseInt(weekNumField.getText()), (String) doctorField.getSelectedItem(), filePathField.getText());
|
||||||
|
resText.setText("运行结束,请查看排班文件");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
jframe.setLocationRelativeTo(null);
|
||||||
|
jframe.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
@@ -8,6 +8,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||||||
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
@@ -29,6 +30,10 @@ public class Main {
|
|||||||
static LocalDate day;
|
static LocalDate day;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
run("2025-10-13", 2, "周晖", "C:\\Users\\yangz\\Documents\\医生排班.xlsx");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void run(String date, int weekNum, String name, String file){
|
||||||
init();
|
init();
|
||||||
var doctorOrder = new Doctor[]{
|
var doctorOrder = new Doctor[]{
|
||||||
gl, zl, ttt, zy, ln, zh
|
gl, zl, ttt, zy, ln, zh
|
||||||
@@ -37,12 +42,8 @@ public class Main {
|
|||||||
ln, zy, ttt, zl, zh, gl, tgy
|
ln, zy, ttt, zl, zh, gl, tgy
|
||||||
};
|
};
|
||||||
|
|
||||||
// var s = new ArrayList<Doctor>();
|
filePath = file;
|
||||||
// for (int i = -1; i < 2; i++) {
|
write(date, weekNum, name, doctorOrder, outputOrder);
|
||||||
// s.addAll(schedule(doctorOrder, outputOrder));
|
|
||||||
// }
|
|
||||||
// print(s);
|
|
||||||
write("2025-10-13", 4, "顾磊", doctorOrder, outputOrder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -90,10 +91,12 @@ public class Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 写入表头,周几和日期
|
* 写入表头,周几和日期
|
||||||
*/
|
*/
|
||||||
static void writeHead(Sheet sheet, int rowNum, LocalDate day){
|
static void writeHead(Sheet sheet, int rowNum, LocalDate day){
|
||||||
|
DateTimeFormatter mmdd = DateTimeFormatter.ofPattern("MM月dd日");
|
||||||
int i = 1;
|
int i = 1;
|
||||||
var row = sheet.createRow(rowNum++);
|
var row = sheet.createRow(rowNum++);
|
||||||
var r2 = sheet.createRow(rowNum);
|
var r2 = sheet.createRow(rowNum);
|
||||||
@@ -102,7 +105,7 @@ public class Main {
|
|||||||
cell.setCellValue(w.getValue());
|
cell.setCellValue(w.getValue());
|
||||||
|
|
||||||
cell = r2.createCell(i++);
|
cell = r2.createCell(i++);
|
||||||
cell.setCellValue(day.toString());
|
cell.setCellValue(day.format(mmdd));
|
||||||
day = day.plusDays(1);
|
day = day.plusDays(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -48,6 +48,7 @@ public class Doctor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
case "田国燕" -> works[0] = WorkEnum.OPD;
|
||||||
case "周晖" -> works[1] = WorkEnum.OPD;
|
case "周晖" -> works[1] = WorkEnum.OPD;
|
||||||
case "唐婷婷" -> works[2] = WorkEnum.OPD;
|
case "唐婷婷" -> works[2] = WorkEnum.OPD;
|
||||||
case "李宁" -> works[4] = WorkEnum.OPD;
|
case "李宁" -> works[4] = WorkEnum.OPD;
|
||||||
|
Reference in New Issue
Block a user