Compare commits
2 Commits
06d68a46fe
...
674de604e8
Author | SHA1 | Date | |
---|---|---|---|
674de604e8 | |||
84f5f5e676 |
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
1
.idea/encodings.xml
generated
1
.idea/encodings.xml
generated
@@ -2,6 +2,5 @@
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@@ -8,7 +8,5 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" project-jdk-name="21" project-jdk-type="JavaSDK" />
|
||||
</project>
|
124
.idea/uiDesigner.xml
generated
124
.idea/uiDesigner.xml
generated
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
97
.idea/workspace.xml
generated
97
.idea/workspace.xml
generated
@@ -1,97 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e5c0ab69-86a1-48cc-bc4b-2a4ed3402ae8" name="更改" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/Main.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/Doctor.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/Week.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/WorkEnum.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/doctors/GuLei.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/doctors/LiNing.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/doctors/TangTingTing.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/doctors/TianGuoYan.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/doctors/ZhangLiang.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/doctors/ZhouHui.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/dota/domain/doctors/ZuYi.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="package-info" />
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"associatedIndex": 0
|
||||
}]]></component>
|
||||
<component name="ProjectId" id="33Vj0xgzBGBHJYDWFyxFxHyYhjn" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||
<ConfirmationsSetting value="2" id="Add" />
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"应用程序.Main.executor": "Run"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyClassDialog.RECENTS_KEY">
|
||||
<recent name="com.dota.domain" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.dota.Main" />
|
||||
<module name="zy-schedult" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.dota.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="应用程序.Main" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="默认任务">
|
||||
<changelist id="e5c0ab69-86a1-48cc-bc4b-2a4ed3402ae8" name="更改" comment="" />
|
||||
<created>1759408913305</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1759408913305</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
</project>
|
@@ -2,38 +2,279 @@ package com.dota;
|
||||
|
||||
import com.dota.domain.Doctor;
|
||||
import com.dota.domain.Week;
|
||||
import com.dota.domain.doctors.*;
|
||||
import com.dota.domain.WorkEnum;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Main {
|
||||
static Doctor gl;
|
||||
static Doctor zl;
|
||||
static Doctor ttt;
|
||||
static Doctor zy;
|
||||
static Doctor ln;
|
||||
static Doctor zh;
|
||||
static Doctor tgy;
|
||||
|
||||
public static void main(String[] args) {
|
||||
var gl = new GuLei();
|
||||
var zl = new ZhangLiang();
|
||||
var ttt = new TangTingTing();
|
||||
var zy = new ZuYi();
|
||||
var ln = new LiNing();
|
||||
var zh = new ZhouHui();
|
||||
var tgy = new TianGuoYan();
|
||||
init();
|
||||
var doctorOrder = new Doctor[]{
|
||||
gl,zl,ttt,zy,ln,zh
|
||||
gl, zl, ttt, zy, ln, zh
|
||||
};
|
||||
var outputOrder = new Doctor[] {
|
||||
ln,zy,ttt,zl,zh,gl,tgy
|
||||
var outputOrder = new Doctor[]{
|
||||
ln, zy, ttt, zl, zh, gl, tgy
|
||||
};
|
||||
schedule(doctorOrder);
|
||||
print(2, outputOrder);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
schedule(doctorOrder, outputOrder);
|
||||
}
|
||||
}
|
||||
|
||||
static void schedule(Doctor[] doctorOrder) {
|
||||
static void init() {
|
||||
gl = new Doctor("顾磊");
|
||||
gl.group = 1;
|
||||
zl = new Doctor("章亮");
|
||||
zl.opd = 3;
|
||||
zl.works[3] = WorkEnum.OPD;
|
||||
ttt = new Doctor("唐婷婷");
|
||||
ttt.opd = 2;
|
||||
ttt.works[2] = WorkEnum.OPD;
|
||||
zy = new Doctor("杨祖怡");
|
||||
zy.group = 1;
|
||||
ln = new Doctor("李宁");
|
||||
ln.opd = 4;
|
||||
ln.works[4] = WorkEnum.OPD;
|
||||
zh = new Doctor("周晖");
|
||||
zh.opd = 1;
|
||||
zh.works[1] = WorkEnum.OPD;
|
||||
tgy = new Doctor("田国燕");
|
||||
tgy.opd = 0;
|
||||
tgy.group = 0;
|
||||
tgy.works[0] = WorkEnum.OPD;
|
||||
|
||||
zh.swap = gl;
|
||||
ttt.swap = zl;
|
||||
}
|
||||
|
||||
static void print(int weeks, Doctor[] outputOrder) {
|
||||
for (int i = 0; i < weeks; i++) {
|
||||
for (Week value : Week.values()) {
|
||||
System.out.print(value.getValue());
|
||||
static void schedule(Doctor[] doctors, Doctor[] outputOrder) {
|
||||
// 日期
|
||||
int days = 0;
|
||||
// 医生下标
|
||||
int idx = 0;
|
||||
|
||||
for (int k = 0; k < 2; k++) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
var d = doctors[idx];
|
||||
|
||||
if (d.firstRest) {
|
||||
d.firstRest = false;
|
||||
d.works[0] = WorkEnum.HOLIDAY;
|
||||
}
|
||||
|
||||
// 值班第二天是值休
|
||||
// 周六值班有两天额外休息
|
||||
if (i == 5) {
|
||||
d.restCount = 2;
|
||||
d.works[6] = WorkEnum.HOLIDAY;
|
||||
} else if (i == 4) { //周五值班有额外一天休息
|
||||
d.works[5] = WorkEnum.HOLIDAY;
|
||||
d.restCount = 1;
|
||||
} else if (i == 6) { // 周日值班有一天额外休息
|
||||
d.restCount = 1;
|
||||
d.firstRest = true;
|
||||
} else {
|
||||
d.works[days + 1] = WorkEnum.HOLIDAY;
|
||||
}
|
||||
|
||||
if (d.works[days] == WorkEnum.OPD) {
|
||||
d.works[days] = WorkEnum.OPD_AND_DUTY;
|
||||
} else {
|
||||
d.works[days] = WorkEnum.DUTY;
|
||||
}
|
||||
|
||||
days = (days + 1) % 7;
|
||||
idx = (idx + 1) % doctors.length;
|
||||
}
|
||||
|
||||
fix(doctors);
|
||||
rest(doctors);
|
||||
print(outputOrder);
|
||||
for (Doctor d : doctors) {
|
||||
d.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 给有调休的安排休息
|
||||
// 保证同一组必须有一个在
|
||||
static void rest(Doctor[] doctors) {
|
||||
for (Doctor doctor : doctors) {
|
||||
if (doctor.lastRestCount == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
if (checkRest(j, doctor, doctors)) {
|
||||
doctor.works[j] = WorkEnum.REST;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count==doctor.lastRestCount) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Doctor doctor : doctors) {
|
||||
doctor.lastRestCount = doctor.restCount;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否有门诊和值班冲突,有的话调整一下
|
||||
// 冲突的情况是前一天值班,门诊那天变调休了,因此没有门诊或者门诊值班的安排
|
||||
static void fix(Doctor[] doctors) {
|
||||
for (Doctor d : doctors) {
|
||||
if (d.name.equals("杨祖怡") || d.name.equals("顾磊")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Arrays.stream(d.works).anyMatch(workEnum ->
|
||||
workEnum == WorkEnum.OPD || workEnum == WorkEnum.OPD_AND_DUTY)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (d == ln) {
|
||||
ln.works[3] = WorkEnum.OPD_AND_DUTY;
|
||||
zl.works[3] = WorkEnum.WORK;
|
||||
zl.works[4] = WorkEnum.OPD;
|
||||
}
|
||||
|
||||
if (d == zl) {
|
||||
ln.works[3] = WorkEnum.OPD;
|
||||
zl.works[4] = WorkEnum.OPD;
|
||||
}
|
||||
|
||||
// 周晖固定周二门诊,所以不能周一值班
|
||||
if (d == zh) {
|
||||
zh.works[0] = WorkEnum.WORK;
|
||||
zh.works[1] = WorkEnum.OPD;
|
||||
// 和顾磊换值班
|
||||
int t = getDuty(gl);
|
||||
zh.works[t] = gl.works[t];
|
||||
if (t < 6) {
|
||||
zh.works[t + 1] = gl.works[t + 1];
|
||||
}
|
||||
|
||||
if (t < 4) {
|
||||
gl.works[t] = WorkEnum.WORK;
|
||||
gl.works[t + 1] = WorkEnum.WORK;
|
||||
}
|
||||
if (t == 4) {
|
||||
zh.restCount = 1;
|
||||
gl.restCount = 0;
|
||||
gl.works[4] = WorkEnum.WORK;
|
||||
gl.works[5] = WorkEnum.REST;
|
||||
}
|
||||
if (t == 5) {
|
||||
zh.restCount = 2;
|
||||
gl.restCount = 0;
|
||||
gl.works[5] = WorkEnum.REST;
|
||||
gl.works[6] = WorkEnum.REST;
|
||||
}
|
||||
if (t == 6) {
|
||||
zh.restCount = 1;
|
||||
zh.firstRest = true;
|
||||
gl.restCount = 0;
|
||||
gl.firstRest = false;
|
||||
gl.works[6] = WorkEnum.REST;
|
||||
}
|
||||
|
||||
gl.works[0] = WorkEnum.DUTY;
|
||||
gl.works[1] = WorkEnum.HOLIDAY;
|
||||
}
|
||||
|
||||
// 唐婷婷固定周三门诊,周二值班的话和章亮换一下
|
||||
if (d == ttt) {
|
||||
ttt.works[1] = WorkEnum.WORK;
|
||||
ttt.works[2] = WorkEnum.OPD;
|
||||
//和章亮换值班
|
||||
int t = getDuty(zl);
|
||||
ttt.works[t] = zl.works[t];
|
||||
if (t < 6) {
|
||||
ttt.works[t + 1] = zl.works[t + 1];
|
||||
}
|
||||
|
||||
if (t < 4) {
|
||||
zl.works[t] = WorkEnum.WORK;
|
||||
zl.works[t + 1] = WorkEnum.WORK;
|
||||
} else if (t == 4) {
|
||||
ttt.restCount = 1;
|
||||
zl.restCount = 0;
|
||||
zl.works[4] = WorkEnum.WORK;
|
||||
zl.works[5] = WorkEnum.REST;
|
||||
} else if (t == 5) {
|
||||
ttt.restCount = 2;
|
||||
zl.restCount = 0;
|
||||
zl.works[5] = WorkEnum.REST;
|
||||
zl.works[6] = WorkEnum.REST;
|
||||
} else if (t == 6) {
|
||||
ttt.restCount = 1;
|
||||
ttt.firstRest = true;
|
||||
zl.restCount = 0;
|
||||
zl.firstRest = false;
|
||||
zl.works[6] = WorkEnum.REST;
|
||||
}
|
||||
|
||||
zl.works[1] = WorkEnum.DUTY;
|
||||
zl.works[2] = WorkEnum.HOLIDAY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int getDuty(Doctor d) {
|
||||
for (int i = 0; i < d.works.length; i++) {
|
||||
if (d.works[i] == WorkEnum.DUTY) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//判断某天是否可以休息
|
||||
//祖怡和顾磊是一组,其他人是一组
|
||||
static boolean checkRest(int day, Doctor doctor, Doctor[] doctors) {
|
||||
// 只有日班才会安排休息
|
||||
if (doctor.works[day] != WorkEnum.WORK) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Doctor d : doctors) {
|
||||
if (doctor.group == d.group) {
|
||||
var w = d.works[day];
|
||||
if (w == WorkEnum.WORK ||
|
||||
w == WorkEnum.OPD ||
|
||||
w == WorkEnum.DUTY ||
|
||||
w == WorkEnum.OPD_AND_DUTY) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void print(Doctor[] outputOrder) {
|
||||
System.out.printf("%10s", " ");
|
||||
for (Week value : Week.values()) {
|
||||
System.out.printf("%10s", value.getValue());
|
||||
}
|
||||
|
||||
System.out.println(" ");
|
||||
for (Doctor doctor : outputOrder) {
|
||||
System.out.printf("%10s", doctor.name);
|
||||
for (WorkEnum work : doctor.works) {
|
||||
System.out.printf("%10s", work.getName());
|
||||
}
|
||||
System.out.println(" ");
|
||||
}
|
||||
System.out.println(" ");
|
||||
}
|
||||
}
|
@@ -1,14 +1,23 @@
|
||||
package com.dota.domain;
|
||||
|
||||
public class Doctor {
|
||||
// 有多少调休
|
||||
public String name;
|
||||
// 上周的调休
|
||||
public int lastRestCount;
|
||||
// 下周的调休
|
||||
public int restCount = 0;
|
||||
|
||||
// 门诊时间
|
||||
public Week opd;
|
||||
public int opd;
|
||||
|
||||
// 值班
|
||||
public Week duty;
|
||||
//值班和门诊冲突时换班的医生
|
||||
public Doctor swap;
|
||||
|
||||
//周一是否有值休
|
||||
public boolean firstRest;
|
||||
|
||||
//所属分组
|
||||
public int group = 2;
|
||||
|
||||
public WorkEnum[] works = new WorkEnum[]{
|
||||
WorkEnum.WORK,
|
||||
@@ -19,4 +28,25 @@ public class Doctor {
|
||||
WorkEnum.REST,
|
||||
WorkEnum.REST,
|
||||
};
|
||||
|
||||
public Doctor(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
works[i] = WorkEnum.WORK;
|
||||
}
|
||||
for (int i = 5; i < 7; i++) {
|
||||
works[i] = WorkEnum.REST;
|
||||
}
|
||||
|
||||
switch (name) {
|
||||
case "周晖" -> works[1] = WorkEnum.OPD;
|
||||
case "唐婷婷" -> works[2] = WorkEnum.OPD;
|
||||
case "李宁" -> works[3] = WorkEnum.OPD;
|
||||
case "章亮" -> works[4] = WorkEnum.OPD;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ public enum Week {
|
||||
FRI("周五"),
|
||||
SAT("周六"),
|
||||
SUM("周日");
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
Week(String value) {
|
||||
this.value= value;
|
||||
|
@@ -4,10 +4,18 @@ public enum WorkEnum {
|
||||
|
||||
OPD("门诊"),
|
||||
REST("休息"),
|
||||
WORK("白班"),
|
||||
WORK("日班"),
|
||||
DUTY("值班"),
|
||||
HOLIDAY("调休"),
|
||||
OPD_AND_WORK("门诊值班");
|
||||
HOLIDAY("值休"),
|
||||
OPD_AND_DUTY("门诊值班");
|
||||
|
||||
WorkEnum(String name){}
|
||||
private final String name;
|
||||
|
||||
WorkEnum(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +0,0 @@
|
||||
package com.dota.domain.doctors;
|
||||
|
||||
import com.dota.domain.Doctor;
|
||||
|
||||
public class GuLei extends Doctor {
|
||||
public GuLei(){
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package com.dota.domain.doctors;
|
||||
|
||||
import com.dota.domain.Doctor;
|
||||
import com.dota.domain.WorkEnum;
|
||||
|
||||
public class LiNing extends Doctor {
|
||||
public LiNing(){
|
||||
this.works[4] = WorkEnum.OPD;
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package com.dota.domain.doctors;
|
||||
|
||||
import com.dota.domain.Doctor;
|
||||
import com.dota.domain.WorkEnum;
|
||||
|
||||
public class TangTingTing extends Doctor {
|
||||
public TangTingTing(){
|
||||
this.works[2] = WorkEnum.OPD;
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package com.dota.domain.doctors;
|
||||
|
||||
import com.dota.domain.Doctor;
|
||||
import com.dota.domain.WorkEnum;
|
||||
|
||||
public class TianGuoYan extends Doctor {
|
||||
public TianGuoYan(){
|
||||
this.works[0] = WorkEnum.OPD;
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package com.dota.domain.doctors;
|
||||
|
||||
import com.dota.domain.Doctor;
|
||||
import com.dota.domain.WorkEnum;
|
||||
|
||||
public class ZhangLiang extends Doctor {
|
||||
public ZhangLiang(){
|
||||
this.works[3] = WorkEnum.OPD;
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package com.dota.domain.doctors;
|
||||
|
||||
import com.dota.domain.Doctor;
|
||||
import com.dota.domain.WorkEnum;
|
||||
|
||||
public class ZhouHui extends Doctor {
|
||||
public ZhouHui(){
|
||||
this.works[1] = WorkEnum.OPD;
|
||||
}
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
package com.dota.domain.doctors;
|
||||
|
||||
import com.dota.domain.Doctor;
|
||||
|
||||
public class ZuYi extends Doctor {
|
||||
}
|
Reference in New Issue
Block a user