/obj/machinery/computer/med_data//TODO:SANITY name = "medical records console" desc = "This can be used to check medical records." icon_screen = "medcomp" icon_keyboard = "med_key" req_one_access = list(ACCESS_MEDICAL, ACCESS_FORENSICS_LOCKERS) circuit = /obj/item/circuitboard/computer/med_data var/rank = null var/screen = null var/datum/data/record/active1 var/datum/data/record/active2 var/temp = null var/printing = null //Sorting Variables var/sortBy = "name" var/order = 1 // -1 = Descending - 1 = Ascending light_color = LIGHT_COLOR_BLUE /obj/machinery/computer/med_data/syndie icon_keyboard = "syndie_key" /obj/machinery/computer/med_data/ui_interact(mob/user) . = ..() if(isliving(user)) playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE) var/dat if(temp) dat = text("[temp]

Clear Screen") else if(authenticated) switch(screen) if(1) dat += {" Search Records
List Records

Virus Database
Medbot Tracking

Record Maintenance
{Log Out}
"} if(2) dat += {"

Records:
"} if(!isnull(GLOB.data_core.general)) for(var/datum/data/record/R in sortRecord(GLOB.data_core.general, sortBy, order)) var/blood_type = "" var/b_dna = "" for(var/datum/data/record/E in GLOB.data_core.medical) if((E.fields["name"] == R.fields["name"] && E.fields["id"] == R.fields["id"])) blood_type = E.fields["blood_type"] b_dna = E.fields["b_dna"] var/background if(R.fields["m_stat"] == "*Insane*" || R.fields["p_stat"] == "*Deceased*") background = "'background-color:#990000;'" else if(R.fields["p_stat"] == "*Unconscious*" || R.fields["m_stat"] == "*Unstable*") background = "'background-color:#CD6500;'" else if(R.fields["p_stat"] == "Physically Unfit" || R.fields["m_stat"] == "*Watch*") background = "'background-color:#3BB9FF;'" else background = "'background-color:#4F7529;'" dat += text("", background, R.fields["id"], R.fields["name"]) dat += text("", R.fields["id"]) dat += text("", R.fields["fingerprint"], b_dna) dat += text("", blood_type) dat += text("", R.fields["p_stat"]) dat += text("", R.fields["m_stat"]) dat += "
Name ID Fingerprints (F) | DNA (D) Blood Type Physical Status Mental Status
[][]F: []
D: []
[][][]

" dat += "
Back" if(3) dat += "Records Maintenance
\nBackup To Disk
\nUpload From Disk
\nDelete All Records
\n
\nBack" if(4) dat += "" if(active1 in GLOB.data_core.general) if(istype(active1.fields["photo_front"], /obj/item/photo)) var/obj/item/photo/P1 = active1.fields["photo_front"] user << browse_rsc(P1.picture.picture_image, "photo_front") if(istype(active1.fields["photo_side"], /obj/item/photo)) var/obj/item/photo/P2 = active1.fields["photo_side"] user << browse_rsc(P2.picture.picture_image, "photo_side") dat += "" dat += "" dat += "" dat += "" dat += "" dat += "" dat += "" dat += "" dat += "" dat += "" else dat += "" dat += "" if(active2 in GLOB.data_core.medical) dat += "" dat += "" dat += "" dat += "" dat += "" dat += "" dat += "" dat += "" dat += "" //(per disease info placed in log/comment section) dat += "" dat += "" dat += "" var/counter = 1 while(active2.fields[text("com_[]", counter)]) dat += "" counter++ dat += "" dat += "" else dat += "" dat += "" dat += "" dat += "" dat += "
Medical Record
Name:[active1.fields["name"]]
ID:[active1.fields["id"]]
Gender: [active1.fields["gender"]] 
Age: [active1.fields["age"]] 
Species: [active1.fields["species"]] 
Fingerprint: [active1.fields["fingerprint"]] 
Physical Status: [active1.fields["p_stat"]] 
Mental Status: [active1.fields["m_stat"]] 
General Record Lost!

Medical Data
Blood Type: [active2.fields["blood_type"]] 
DNA: [active2.fields["b_dna"]] 

Minor Disabilities:

 [active2.fields["mi_dis"]] 
Details: [active2.fields["mi_dis_d"]] 

Major Disabilities:

 [active2.fields["ma_dis"]] 
Details: [active2.fields["ma_dis_d"]] 

Allergies:

 [active2.fields["alg"]] 
Details: [active2.fields["alg_d"]] 

Current Diseases:

 [active2.fields["cdi"]] 
Details: [active2.fields["cdi_d"]] 

Important Notes:

 [active2.fields["notes"]] 

Comments/Log
[active2.fields[text("com_[]", counter)]]
Delete Entry
Add Entry

Delete Record (Medical Only)
Medical Record Lost!

New Record
Print Record
Back
" if(5) dat += "
Virus Database
" for(var/Dt in typesof(/datum/disease/)) var/datum/disease/Dis = new Dt(FALSE) if(istype(Dis, /datum/disease/advance)) continue // TODO (tm): Add advance diseases to the virus database which no one uses. if(!Dis.desc) continue dat += "
[Dis.name]" dat += "
Back" if(6) dat += "
Medical Robot Monitor
" dat += "Back" dat += "
Medical Robots:" var/bdat = null for(var/mob/living/simple_animal/bot/medbot/M in GLOB.alive_mob_list) if(M.z != z) continue //only find medibots on the same z-level as the computer var/turf/bl = get_turf(M) if(bl) //if it can't find a turf for the medibot, then it probably shouldn't be showing up bdat += "[M.name] - \[[bl.x],[bl.y]\] - [M.on ? "Online" : "Offline"]
" if((!isnull(M.reagent_glass)) && M.use_beaker) bdat += "Reservoir: \[[M.reagent_glass.reagents.total_volume]/[M.reagent_glass.reagents.maximum_volume]\]
" else bdat += "Using Internal Synthesizer.
" if(!bdat) dat += "
None detected
" else dat += "
[bdat]" else else dat += "{Log In}" var/datum/browser/popup = new(user, "med_rec", "Medical Records Console", 600, 400) popup.set_content(dat) popup.set_title_image(user.browse_rsc_icon(icon, icon_state)) popup.open() /obj/machinery/computer/med_data/Topic(href, href_list) . = ..() if(.) return . if(!(active1 in GLOB.data_core.general)) active1 = null if(!(active2 in GLOB.data_core.medical)) active2 = null if(usr.contents.Find(src) || (in_range(src, usr) && isturf(loc)) || hasSiliconAccessInArea(usr) || IsAdminGhost(usr)) usr.set_machine(src) if(href_list["temp"]) temp = null else if(href_list["logout"]) authenticated = null screen = null active1 = null active2 = null playsound(src, 'sound/machines/terminal_off.ogg', 50, FALSE) else if(href_list["choice"]) // SORTING! if(href_list["choice"] == "Sorting") // Reverse the order if clicked twice if(sortBy == href_list["sort"]) if(order == 1) order = -1 else order = 1 else // New sorting order! sortBy = href_list["sort"] order = initial(order) else if(href_list["login"]) var/mob/M = usr var/obj/item/card/id/I = M.get_idcard(TRUE) if(hasSiliconAccessInArea(M)) active1 = null active2 = null authenticated = 1 rank = "AI" screen = 1 else if(IsAdminGhost(M)) active1 = null active2 = null authenticated = 1 rank = "Central Command" screen = 1 else if(istype(I) && check_access(I)) active1 = null active2 = null authenticated = I.registered_name rank = I.assignment screen = 1 else to_chat(usr, "Unauthorized access.") playsound(src, 'sound/machines/terminal_on.ogg', 50, FALSE) if(authenticated) if(href_list["screen"]) screen = text2num(href_list["screen"]) if(screen < 1) screen = 1 active1 = null active2 = null else if(href_list["vir"]) var/type = href_list["vir"] var/datum/disease/Dis = new type(FALSE) var/AfS = "" for(var/mob/M in Dis.viable_mobtypes) AfS += " [initial(M.name)];" temp = {"Name: [Dis.name]
Number of stages: [Dis.max_stages]
Spread: [Dis.spread_text] Transmission
Possible Cure: [(Dis.cure_text||"none")]
Affected Lifeforms:[AfS]

Notes: [Dis.desc]

Severity: [Dis.severity]"} else if(href_list["del_all"]) temp = "Are you sure you wish to delete all records?
\n\tYes
\n\tNo
" else if(href_list["del_all2"]) investigate_log("[key_name(usr)] has deleted all medical records.", INVESTIGATE_RECORDS) GLOB.data_core.medical.Cut() temp = "All records deleted." else if(href_list["field"]) var/a1 = active1 var/a2 = active2 switch(href_list["field"]) if("fingerprint") if(active1) var/t1 = stripped_input("Please input fingerprint hash:", "Med. records", active1.fields["fingerprint"], null) if(!canUseMedicalRecordsConsole(usr, t1, a1)) return active1.fields["fingerprint"] = t1 if("gender") if(active1) if(active1.fields["gender"] == "Male") active1.fields["gender"] = "Female" else if(active1.fields["gender"] == "Female") active1.fields["gender"] = "Other" else active1.fields["gender"] = "Male" if("age") if(active1) var/t1 = input("Please input age:", "Med. records", active1.fields["age"], null) as num if(!canUseMedicalRecordsConsole(usr, t1, a1)) return active1.fields["age"] = t1 if("species") if(active1) var/t1 = stripped_input("Please input species name", "Med. records", active1.fields["species"], null) if(!canUseMedicalRecordsConsole(usr, t1, a1)) return active1.fields["species"] = t1 if("mi_dis") if(active2) var/t1 = stripped_input("Please input minor disabilities list:", "Med. records", active2.fields["mi_dis"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["mi_dis"] = t1 if("mi_dis_d") if(active2) var/t1 = stripped_input("Please summarize minor dis.:", "Med. records", active2.fields["mi_dis_d"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["mi_dis_d"] = t1 if("ma_dis") if(active2) var/t1 = stripped_input("Please input major disabilities list:", "Med. records", active2.fields["ma_dis"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["ma_dis"] = t1 if("ma_dis_d") if(active2) var/t1 = stripped_input("Please summarize major dis.:", "Med. records", active2.fields["ma_dis_d"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["ma_dis_d"] = t1 if("alg") if(active2) var/t1 = stripped_input("Please state allergies:", "Med. records", active2.fields["alg"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["alg"] = t1 if("alg_d") if(active2) var/t1 = stripped_input("Please summarize allergies:", "Med. records", active2.fields["alg_d"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["alg_d"] = t1 if("cdi") if(active2) var/t1 = stripped_input("Please state diseases:", "Med. records", active2.fields["cdi"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["cdi"] = t1 if("cdi_d") if(active2) var/t1 = stripped_input("Please summarize diseases:", "Med. records", active2.fields["cdi_d"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["cdi_d"] = t1 if("notes") if(active2) var/t1 = stripped_input("Please summarize notes:", "Med. records", active2.fields["notes"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["notes"] = t1 if("p_stat") if(active1) temp = "Physical Condition:
\n\t*Deceased*
\n\t*Unconscious*
\n\tActive
\n\tPhysically Unfit
" if("m_stat") if(active1) temp = "Mental Condition:
\n\t*Insane*
\n\t*Unstable*
\n\t*Watch*
\n\tStable
" if("blood_type") if(active2) temp = "Blood Type:
\n\tA- A+
\n\tB- B+
\n\tAB- AB+
\n\tO- O+
" if("b_dna") if(active2) var/t1 = stripped_input("Please input DNA hash:", "Med. records", active2.fields["b_dna"], null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return active2.fields["b_dna"] = t1 if("show_photo_front") if(active1) if(active1.fields["photo_front"]) if(istype(active1.fields["photo_front"], /obj/item/photo)) var/obj/item/photo/P = active1.fields["photo_front"] P.show(usr) if("show_photo_side") if(active1) if(active1.fields["photo_side"]) if(istype(active1.fields["photo_side"], /obj/item/photo)) var/obj/item/photo/P = active1.fields["photo_side"] P.show(usr) else else if(href_list["p_stat"]) if(active1) switch(href_list["p_stat"]) if("deceased") active1.fields["p_stat"] = "*Deceased*" if("unconscious") active1.fields["p_stat"] = "*Unconscious*" if("active") active1.fields["p_stat"] = "Active" if("unfit") active1.fields["p_stat"] = "Physically Unfit" else if(href_list["m_stat"]) if(active1) switch(href_list["m_stat"]) if("insane") active1.fields["m_stat"] = "*Insane*" if("unstable") active1.fields["m_stat"] = "*Unstable*" if("watch") active1.fields["m_stat"] = "*Watch*" if("stable") active1.fields["m_stat"] = "Stable" else if(href_list["blood_type"]) if(active2) switch(href_list["blood_type"]) if("an") active2.fields["blood_type"] = "A-" if("bn") active2.fields["blood_type"] = "B-" if("abn") active2.fields["blood_type"] = "AB-" if("on") active2.fields["blood_type"] = "O-" if("ap") active2.fields["blood_type"] = "A+" if("bp") active2.fields["blood_type"] = "B+" if("abp") active2.fields["blood_type"] = "AB+" if("op") active2.fields["blood_type"] = "O+" else if(href_list["del_r"]) if(active2) temp = "Are you sure you wish to delete the record (Medical Portion Only)?
\n\tYes
\n\tNo
" else if(href_list["del_r2"]) investigate_log("[key_name(usr)] has deleted the medical records for [active1.fields["name"]].", INVESTIGATE_RECORDS) if(active2) qdel(active2) active2 = null else if(href_list["d_rec"]) active1 = find_record("id", href_list["d_rec"], GLOB.data_core.general) if(active1) active2 = find_record("id", href_list["d_rec"], GLOB.data_core.medical) if(!active2) active1 = null screen = 4 else if(href_list["new"]) if((istype(active1, /datum/data/record) && !( istype(active2, /datum/data/record) ))) var/datum/data/record/R = new /datum/data/record( ) R.fields["name"] = active1.fields["name"] R.fields["id"] = active1.fields["id"] R.name = text("Medical Record #[]", R.fields["id"]) R.fields["blood_type"] = "Unknown" R.fields["b_dna"] = "Unknown" R.fields["mi_dis"] = "None" R.fields["mi_dis_d"] = "No minor disabilities have been diagnosed." R.fields["ma_dis"] = "None" R.fields["ma_dis_d"] = "No major disabilities have been diagnosed." R.fields["alg"] = "None" R.fields["alg_d"] = "No allergies have been detected in this patient." R.fields["cdi"] = "None" R.fields["cdi_d"] = "No diseases have been diagnosed at the moment." R.fields["notes"] = "No notes." GLOB.data_core.medical += R active2 = R screen = 4 else if(href_list["add_c"]) if(!(active2 in GLOB.data_core.medical)) return var/a2 = active2 var/t1 = stripped_multiline_input("Add Comment:", "Med. records", null, null) if(!canUseMedicalRecordsConsole(usr, t1, null, a2)) return var/counter = 1 while(active2.fields[text("com_[]", counter)]) counter++ active2.fields[text("com_[]", counter)] = text("Made by [] ([]) on [] [], []
[]", authenticated, rank, STATION_TIME_TIMESTAMP("hh:mm:ss", world.time), time2text(world.realtime, "MMM DD"), GLOB.year_integer, t1) else if(href_list["del_c"]) if((istype(active2, /datum/data/record) && active2.fields[text("com_[]", href_list["del_c"])])) active2.fields[text("com_[]", href_list["del_c"])] = "Deleted" else if(href_list["search"]) var/t1 = stripped_input(usr, "Search String: (Name, DNA, or ID)", "Med. records") if(!canUseMedicalRecordsConsole(usr, t1)) return active1 = null active2 = null t1 = lowertext(t1) for(var/datum/data/record/R in GLOB.data_core.medical) if((lowertext(R.fields["name"]) == t1 || t1 == lowertext(R.fields["id"]) || t1 == lowertext(R.fields["b_dna"]))) active2 = R else //Foreach continue //goto(3229) if(!( active2 )) temp = text("Could not locate record [].", sanitize(t1)) else for(var/datum/data/record/E in GLOB.data_core.general) if((E.fields["name"] == active2.fields["name"] || E.fields["id"] == active2.fields["id"])) active1 = E else //Foreach continue //goto(3334) screen = 4 else if(href_list["print_p"]) if(!( printing )) printing = 1 GLOB.data_core.medicalPrintCount++ playsound(loc, 'sound/items/poster_being_created.ogg', 100, 1) sleep(30) var/obj/item/paper/P = new /obj/item/paper( loc ) P.info = "
Medical Record - (MR-[GLOB.data_core.medicalPrintCount])

" if(active1 in GLOB.data_core.general) P.info += text("Name: [] ID: []
\nGender: []
\nAge: []
", active1.fields["name"], active1.fields["id"], active1.fields["gender"], active1.fields["age"]) P.info += "\nSpecies: [active1.fields["species"]]
" P.info += text("\nFingerprint: []
\nPhysical Status: []
\nMental Status: []
", active1.fields["fingerprint"], active1.fields["p_stat"], active1.fields["m_stat"]) else P.info += "General Record Lost!
" if(active2 in GLOB.data_core.medical) P.info += text("
\n
Medical Data

\nBlood Type: []
\nDNA: []
\n
\nMinor Disabilities: []
\nDetails: []
\n
\nMajor Disabilities: []
\nDetails: []
\n
\nAllergies: []
\nDetails: []
\n
\nCurrent Diseases: [] (per disease info placed in log/comment section)
\nDetails: []
\n
\nImportant Notes:
\n\t[]
\n
\n
Comments/Log

", active2.fields["blood_type"], active2.fields["b_dna"], active2.fields["mi_dis"], active2.fields["mi_dis_d"], active2.fields["ma_dis"], active2.fields["ma_dis_d"], active2.fields["alg"], active2.fields["alg_d"], active2.fields["cdi"], active2.fields["cdi_d"], active2.fields["notes"]) var/counter = 1 while(active2.fields[text("com_[]", counter)]) P.info += text("[]
", active2.fields[text("com_[]", counter)]) counter++ P.name = text("MR-[] '[]'", GLOB.data_core.medicalPrintCount, active1.fields["name"]) else P.info += "Medical Record Lost!
" P.name = text("MR-[] '[]'", GLOB.data_core.medicalPrintCount, "Record Lost") P.info += "" P.update_icon() printing = null add_fingerprint(usr) updateUsrDialog() return /obj/machinery/computer/med_data/emp_act(severity) . = ..() if(!(stat & (BROKEN|NOPOWER)) && !(. & EMP_PROTECT_SELF)) for(var/datum/data/record/R in GLOB.data_core.medical) if(prob(10/severity)) switch(rand(1,6)) if(1) if(prob(10)) R.fields["name"] = random_unique_lizard_name(R.fields["gender"],1) else R.fields["name"] = random_unique_name(R.fields["gender"],1) if(2) R.fields["gender"] = pick("Male", "Female", "Other") if(3) R.fields["age"] = rand(AGE_MIN, AGE_MAX) if(4) R.fields["blood_type"] = random_blood_type() if(5) R.fields["p_stat"] = pick("*Unconscious*", "Active", "Physically Unfit") if(6) R.fields["m_stat"] = pick("*Insane*", "*Unstable*", "*Watch*", "Stable") continue else if(prob(1)) qdel(R) continue /obj/machinery/computer/med_data/proc/canUseMedicalRecordsConsole(mob/user, message = 1, record1, record2) if(user) if(message) if(authenticated) if(user.canUseTopic(src, !hasSiliconAccessInArea(user))) if(!record1 || record1 == active1) if(!record2 || record2 == active2) return 1 return 0 /obj/machinery/computer/med_data/laptop name = "medical laptop" desc = "A cheap Nanotrasen medical laptop, it functions as a medical records computer. It's bolted to the table." icon_state = "laptop" icon_screen = "medlaptop" icon_keyboard = "laptop_key" clockwork = TRUE //it'd look weird pass_flags = PASSTABLE