Change one's major happened on that day, you need to determine by cutting the time period which is bigger, is the one day go to a department.
As shown in figure: change one's major happened 12 and 14, 12 B will be divided into 2 parts, if before 12 is integral part of many, is a department before 12 belonging, vice after 12, belong to a department.
Change one's major situation may also appear 2 times a day or more
Xiaodi bucai, please bosses provide a train of thought.
CodePudding user response:
Don't understand the hospital business and gives a more detailed example of table structure and test data,CodePudding user response:
1. You stick you change one's major table data structure, put a little data, by the way, it is best to several times a day change one's major,2. Is this your statistics has discharged patients?
3.10 hospital discharge, change one's major 17, 12 first half is 12-10=2 or 12-10 + 1=3? In the same way the second half of the calculate what are the rules?
4. On the day of admission, change one's major, in the day and on the day of discharge from the hospital and how to calculate?
The original poster went to ask the rules come first,
CodePudding user response:
Similar to calculate patient performance attribution departmentHospital admission is into one department, as to leave a department
Change one's major is at the same time to enter a department from another department
Because need to be calculated according to the time, so I can look at midnight again as a bachelor's room to change one's major undergraduate course room
So the time is divided into several small pieces, each small section belong to a department, these segments have start time, also have a deadline, start and end on the same day
To calculate these little bits of time
The same day, see which is the longest length, so the department that belong with the day's performance, attention is likely to have a to b, b he turned back to a situation that may have discrete time within the same department one day
Who in the end, why do you want to have the performance of all day long, the time of this algorithm is manual calculation in order to reduce the workload of, have the computer calculation and can calculate very accurate, can be a completely done 0.6, made 0.3 b, c for 0.1, this process is easy, but also more precise and also reduce the some departments always suffer
CodePudding user response:
Lead/lag functionCodePudding user response:
First, create a table, the table has three columns, patient, department, duration, and patients from the table, Max (duration), associated with the table (=patients, duration=Max (duration), can get the patient, departments of the two fields