บริการพยาบาลฉุกเฉิน

ปรึกษาปัญหาการกําหนดเวลาพยาบาลสําหรับแผนกในโรงพยาบาลบางแห่ง ทุกๆ วันจะมีการเปลี่ยนแปลง 12 ชั่วโมงโดยเริ่มตั้งแต่ 7 ชั่วโมง, 13 ชั่วโมง, 19 ชั่วโมง ขอบข่ายการวางแผนคือ 4 วัน เริ่มตั้งแต่วันที่ 1 มกราคม 2023 รวม 12 กะ พยาบาลที่พยาบาลรับผิดชอบอยู่ได้ 4 คนจะแบ่งกันใช้ โดยมีเป้าหมายในการมีพยาบาลอยู่ในแผนก 2 แผนก ข้อกําหนดดังกล่าว เป็นเรื่องจําเป็น

พยาบาลทุกคนต้องพักระหว่างกะอย่างน้อย 12 ชั่วโมง (720 นาที) และทํางานได้นานสุด 36 ชั่วโมง (2,160 นาที) ในขณะวางแผน ข้อจํากัดเหล่านี้มีลําดับความสําคัญสูงและปานกลางตามลําดับ

การเปลี่ยนแปลงหลายครั้งต่อวัน

การเปลี่ยนแปลง 3 ครั้งต่อวันหมายถึงการเปลี่ยนแปลงอย่างอิสระ 3 ครั้ง ตัวอย่างเช่น การเลื่อนเวลาในวันแรก (จากสี่วัน) ที่สถานที่ "แผนก" จะแสดงเป็น

  {
    "shifts": [{
      "id": "2023-05-01 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 19
      }
    }, {
      "id": "2023-05-01 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 1
      }
    }, {
      "id": "2023-05-01 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 7
      }
    },
    ...
    ]
  }

ตัวอย่างการเปลี่ยนแปลง 12 รายการ (4 วันที่มีการเปลี่ยนแปลง 3 ครั้งต่อวัน)


    {
      "shifts": [{
      "id": "2023-05-01 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 19
      }
    }, {
      "id": "2023-05-01 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 1
      }
    }, {
      "id": "2023-05-01 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 7
      }
    }, {
      "id": "2023-05-02 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 19
      }
    }, {
      "id": "2023-05-02 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 1
      }
    }, {
      "id": "2023-05-02 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 7
      }
    }, {
      "id": "2023-05-03 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 19
      }
    }, {
      "id": "2023-05-03 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 1
      }
    }, {
      "id": "2023-05-03 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 7
      }
    }, {
      "id": "2023-05-04 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 19
      }
    }, {
      "id": "2023-05-04 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 5,
        "hours": 1
      }
    }, {
      "id": "2023-05-04 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 5,
        "hours": 7
      }
    }]
  }
  

พักระหว่างกะ

หากต้องการเป็นตัวแทนของส่วนที่เหลือระหว่างการเปลี่ยนแปลงสําหรับพนักงาน ให้ใช้ช่อง minimumRestMinutes จากข้อจํากัดการกําหนดเวลา เวลาเริ่มต้นและเวลาสิ้นสุดของข้อจํากัดนี้ใช้เพื่อพิจารณาว่าการเปลี่ยนแปลงใดที่คุณควรพิจารณา ดังนั้นจึงควรสอดคล้องกับขอบเขตการวางแผนโดยเหลื่อมซ้อนกับการเปลี่ยนแปลงทั้งหมด เวลาที่เหลือจะระบุเป็นนาที (720) และมีลําดับความสําคัญเป็น PRIORITY_HIGH ตามที่ระบุไว้ด้านบน พยาบาลพยาบาลคนแรก (ชื่อ Adam) เป็นตัวแทนของ

  {
    "employees": [{
      "id": "Adam",
      "roleIds": ["Registered Nurse"],
      "schedulingConstraints": [{
        "priority": "PRIORITY_HIGH",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        },
        "minimumRestMinutes": 720
      }]
    }
  }

เวลาทํางานสูงสุด

เวลาสูงสุดที่พนักงานจะทํางานได้จะแสดงเป็นข้อจํากัดการตั้งเวลาโดยใช้ช่อง maximumMinutes เวลาทํางานสูงสุดในตัวอย่างนี้คือ 2160 นาที เวลาเริ่มต้นและสิ้นสุดของข้อจํากัดควรสอดคล้องกับขอบเขตการวางแผนทั้งหมด สถานพยาบาลที่เกี่ยวข้อง (พยาบาล Adam) คนแรกจะอัปเดตเป็นบุคคลต่อไปนี้ได้

  {
    "employees": [{
      "id": "Adam",
      "roleIds": ["Registered Nurse"],
      "schedulingConstraints": [{
        "priority": "PRIORITY_HIGH",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        },
        "minimumRestMinutes": 720
      }, {
        "priority": "PRIORITY_MEDIUM",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        },
        "maximumMinutes": 2160
      }]
    }
  }

ตัวอย่างที่มีพนักงานทั้ง 4 คน


  {
      "employees": [{
        "id": "Adam",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "Grace",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "James",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "Alonso",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }]
  }
  

พยาบาลพยาบาลที่มีใบอนุญาต

การครอบคลุมของพยาบาลพยาบาล 2 คนในช่วงเวลาที่ระบุจะแสดงด้วยข้อกําหนดด้านความคุ้มครอง โดยเฉพาะอย่างยิ่ง roleRequirements จะได้รับการตอบสนองด้วยข้อกําหนดเกี่ยวกับบทบาท 1 รายการ ซึ่งตั้งค่า roleId เป็น "พยาบาลที่มีใบอนุญาต" ส่วน targetEmployeeCount ตั้งค่าเป็น 2 และ priority ตั้งค่าเป็น PRIORITY_MANDATORY เวลาเริ่มต้นและเวลาสิ้นสุดของข้อกําหนดการครอบคลุมควรซ้อนทับกันทุกกะ ช่อง locationId ถูกตั้งค่าเป็น "แผนก" ดังนั้น จึงจะถือว่าเฉพาะการเปลี่ยนแปลงที่เกิดขึ้นในตําแหน่งนี้

  {
    "coverageRequirements": [{
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 5,
        "hours": 7
      },
      "locationId": "department",
      "roleRequirements": [{
        "roleId": "Registered Nurse",
        "targetEmployeeCount": 2,
        "priority": "PRIORITY_MANDATORY"
      }]
    }],
    "roleIds": ["Registered Nurse"],
    "locationIds": ["department"]
  }

ตัวอย่างคําขอที่สมบูรณ์


    {
      "employees": [{
        "id": "Adam",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "Grace",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "James",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "Alonso",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }],
      "shifts": [{
        "id": "2023-05-01 7hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 19
        }
      }, {
        "id": "2023-05-01 13hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 13
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 1
        }
      }, {
        "id": "2023-05-01 19hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 19
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 7
        }
      }, {
        "id": "2023-05-02 7hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 19
        }
      }, {
        "id": "2023-05-02 13hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 13
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 1
        }
      }, {
        "id": "2023-05-02 19hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 19
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 7
        }
      }, {
        "id": "2023-05-03 7hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 19
        }
      }, {
        "id": "2023-05-03 13hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 13
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 1
        }
      }, {
        "id": "2023-05-03 19hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 19
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 7
        }
      }, {
        "id": "2023-05-04 7hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 19
        }
      }, {
        "id": "2023-05-04 13hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 13
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 1
        }
      }, {
        "id": "2023-05-04 19hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 19
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        }
      }],
      "coverageRequirements": [{
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        },
        "locationId": "department",
        "roleRequirements": [{
          "roleId": "Registered Nurse",
          "targetEmployeeCount": 2,
          "priority": "PRIORITY_MANDATORY"
        }]
      }],
      "roleIds": ["Registered Nurse"],
      "locationIds": ["department"]
    }
    

ตัวอย่างคําตอบ

คําตอบของการแก้โจทย์ซึ่งระบุการพยาบาลที่กะและสถานะของกระบวนการเพิ่มประสิทธิภาพ ตัวอย่างเช่น กะที่กําหนดให้พนักงานคนแรก ถูกส่งคืนเป็น

  {
    "solutionStatus": "OPTIMAL",
    "shiftAssignments": [
      {
        "employeeId": "Adam",
        "shiftId": "2023-05-01 7hr",
        "roleId": "Registered Nurse"
      },
      {
        "employeeId": "Adam",
        "shiftId": "2023-05-02 7hr",
        "roleId": "Registered Nurse"
      },
      {
        "employeeId": "Adam",
        "shiftId": "2023-05-03 7hr",
        "roleId": "Registered Nurse"
      },
      {
        "employeeId": "Adam",
        "shiftId": "2023-05-04 7hr",
        "roleId": "Registered Nurse"
      },
      ... ]
  }

ตัวอย่างการตอบกลับที่สมบูรณ์


    {
      "solutionStatus": "OPTIMAL",
      "shiftAssignments": [
        {
          "employeeId": "Adam",
          "shiftId": "2023-05-01 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Adam",
          "shiftId": "2023-05-02 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Adam",
          "shiftId": "2023-05-03 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Adam",
          "shiftId": "2023-05-04 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Grace",
          "shiftId": "2023-05-01 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Grace",
          "shiftId": "2023-05-02 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Grace",
          "shiftId": "2023-05-03 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Grace",
          "shiftId": "2023-05-04 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "James",
          "shiftId": "2023-05-01 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "James",
          "shiftId": "2023-05-02 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "James",
          "shiftId": "2023-05-03 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "James",
          "shiftId": "2023-05-04 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Alonso",
          "shiftId": "2023-05-01 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Alonso",
          "shiftId": "2023-05-02 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Alonso",
          "shiftId": "2023-05-03 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Alonso",
          "shiftId": "2023-05-04 7hr",
          "roleId": "Registered Nurse"
        }
      ]
    }