You can do this as an action in the button where you create a Select in Field action. The Field would be patient and the value can be an expression with an if (e.g. =if(field1<field2,'value').
If you want to do the macro look at APIguide.qvw that is located in C:/Program Files/QlikView/Documentation/ if you did a full install of QlikView Developer. There are plenty of examples to use to create your macro.