From 4b9d14b564b4eae650bcc52d64c1f90a0863e454 Mon Sep 17 00:00:00 2001 From: jupotter Date: Mon, 8 Apr 2013 14:12:57 +0200 Subject: [PATCH] Allow medical hud to add comment to medical record Add a direct [Add comment] link in the examine text Add a comment in the record comment list, signed with the current authentication of the HUD wearer Add a [View comments log] link in the medical record view from the Medical Hud This list all the comments as on the medical record computer --- .../mob/living/carbon/human/examine.dm | 1 + code/modules/mob/living/carbon/human/human.dm | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index f1e9108e0b8..9f74dd6447d 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -440,6 +440,7 @@ msg += "Physical status: \[[medical]\]\n" msg += "Medical records: \[View\]\n" + msg += "Medical records: \[View\] \[Add comment\]\n" if(print_flavor_text()) msg += "[print_flavor_text()]\n" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2b78063d6d2..9accc05da9f 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -634,10 +634,69 @@ usr << "Major Disabilities: [R.fields["ma_dis"]]" usr << "Details: [R.fields["ma_dis_d"]]" usr << "Notes: [R.fields["notes"]]" + usr << "\[View Comment Log\]" read = 1 if(!read) usr << "\red Unable to locate a data core entry for this person." + + if (href_list["medrecordComment"]) + if(istype(usr, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = usr + if(istype(H.glasses, /obj/item/clothing/glasses/hud/health)) + var/perpname = "wot" + var/read = 0 + + if(wear_id) + if(istype(wear_id,/obj/item/weapon/card/id)) + perpname = wear_id:registered_name + else if(istype(wear_id,/obj/item/device/pda)) + var/obj/item/device/pda/tempPda = wear_id + perpname = tempPda.owner + else + perpname = src.name + for (var/datum/data/record/E in data_core.general) + if (E.fields["name"] == perpname) + for (var/datum/data/record/R in data_core.medical) + if (R.fields["id"] == E.fields["id"]) + if(istype(H.glasses, /obj/item/clothing/glasses/hud/health)) + read = 1 + var/counter = 1 + while(R.fields[text("com_[]", counter)]) + usr << text("[]", R.fields[text("com_[]", counter)]) + counter++ + if (counter == 1) + usr << "No comment found" + usr << "\[Add comment\]" + + if(!read) + usr << "\red Unable to locate a data core entry for this person." + + if (href_list["medrecordadd"]) + if(istype(usr, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = usr + if(istype(H.glasses, /obj/item/clothing/glasses/hud/health)) + var/perpname = "wot" + if(wear_id) + if(istype(wear_id,/obj/item/weapon/card/id)) + perpname = wear_id:registered_name + else if(istype(wear_id,/obj/item/device/pda)) + var/obj/item/device/pda/tempPda = wear_id + perpname = tempPda.owner + else + perpname = src.name + for (var/datum/data/record/E in data_core.general) + if (E.fields["name"] == perpname) + for (var/datum/data/record/R in data_core.medical) + if (R.fields["id"] == E.fields["id"]) + if(istype(H.glasses, /obj/item/clothing/glasses/hud/health)) + var/t1 = copytext(sanitize(input("Add Comment:", "Med. records", null, null) as message),1,MAX_MESSAGE_LEN) + if ((!( t1 ) || src.stat || src.restrained() || !(istype(H.glasses, /obj/item/clothing/glasses/hud/health)))) + return + var/counter = 1 + while(R.fields[text("com_[]", counter)]) + counter++ + R.fields[text("com_[]", counter)] = text("Made by [] ([]) on [], 2053
[]",H.get_authentification_name(), H.get_assignment(), time2text(world.realtime, "DDD MMM DD hh:mm:ss"), t1) ..() return