1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773 |
- package controllers
-
- import (
- "encoding/json"
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "time"
-
- "XT_New/enums"
- "XT_New/models"
- "XT_New/service"
- "XT_New/utils"
-
- "github.com/astaxie/beego"
- )
-
- func PatientDataConfigAPIControllerRegistRouters() {
- beego.Router("/api/patient/courses", &PatientDataConfigAPIController{}, "get:Courses")
- beego.Router("/api/patient/course/create", &PatientDataConfigAPIController{}, "get:CreateCourse")
- beego.Router("/api/patient/course/delete", &PatientDataConfigAPIController{}, "post:DeleteCourse")
- beego.Router("/api/patient/course/modify", &PatientDataConfigAPIController{}, "get:ModifyCourse")
-
- beego.Router("/api/patient/rescues", &PatientDataConfigAPIController{}, "get:Rescues")
- beego.Router("/api/patient/rescue/create", &PatientDataConfigAPIController{}, "post:CreateRescue")
- beego.Router("/api/patient/rescue/delete", &PatientDataConfigAPIController{}, "post:DeleteRescue")
-
- beego.Router("/api/patient/sickhistory", &PatientDataConfigAPIController{}, "get:GetSickHistorys")
- beego.Router("/api/patient/sickhistory/create", &PatientDataConfigAPIController{}, "get:CreateSickHistory")
- beego.Router("/api/patient/sickhistory/delete", &PatientDataConfigAPIController{}, "post:DeleteSickHistory")
- beego.Router("/api/patient/sickhistory/modify", &PatientDataConfigAPIController{}, "get:ModifySickHistory")
-
- beego.Router("/api/patient/physiquecheck", &PatientDataConfigAPIController{}, "get:GetPhysiqueChecks")
- beego.Router("/api/patient/physiquecheck/create", &PatientDataConfigAPIController{}, "get:CreatePhysiqueCheck")
- beego.Router("/api/patient/physiquecheck/delete", &PatientDataConfigAPIController{}, "post:DeletePhysiqueCheck")
- beego.Router("/api/patient/physiquecheck/modify", &PatientDataConfigAPIController{}, "get:ModifyPhysiqueCheck")
-
- beego.Router("/api/patient/sickhistory/print", &PatientDataConfigAPIController{}, "get:GetSickhistoryPrints")
- beego.Router("/api/patient/physiquecheck/print", &PatientDataConfigAPIController{}, "get:GetPhysiquecheckPrints")
-
- beego.Router("/api/patient/getpatientdialysisinforlist", &PatientDataConfigAPIController{}, "get:GetPatientDialysisInforList")
-
- beego.Router("/api/patient/getcontextschedulelist", &PatientDataConfigAPIController{}, "Get:GetContextScheduleList")
-
- beego.Router("/api/patient/getpatientallagic", &PatientDataConfigAPIController{}, "Get:GetPatientAllagicList")
-
- beego.Router("/api/patient/savesitemap", &PatientDataConfigAPIController{}, "Post:SaveSiteMap")
-
- beego.Router("/api/patient/getpatientsitemap", &PatientDataConfigAPIController{}, "Get:GetPatientSitemap")
-
- beego.Router("/api/patient/getpatientdetailinformedconsent", &PatientDataConfigAPIController{}, "Get:GetPatientDetailInformedConsent")
-
- beego.Router("/api/patient/getpatientmedicallist", &PatientDataConfigAPIController{}, "Get:GetPatientMedicalList")
-
- //评估工具的接口
- beego.Router("/api/patient/fallassement/getallnurselist", &PatientDataConfigAPIController{}, "Get:GetAllNurseList")
-
- beego.Router("/api/patient/fallassment/savefllassessmentlist", &PatientDataConfigAPIController{}, "Post:SaveFllassessmentList")
-
- beego.Router("/api/patient/getpatientfallsessmentlist", &PatientDataConfigAPIController{}, "Get:GetPatientFallsessMentList")
-
- beego.Router("/api/patient/getpatientfallssessmentById", &PatientDataConfigAPIController{}, "Get:GetPatientFallsessmentById")
-
- beego.Router("/api/patient/deletepatientfallassessment", &PatientDataConfigAPIController{}, "Get:DeletePatientFallsessment")
-
- beego.Router("/api/patient/updatepatientfallassment", &PatientDataConfigAPIController{}, "Post:UpdatePatientFallassment")
-
- beego.Router("/api/patient/savepediatrcfallassesment", &PatientDataConfigAPIController{}, "Post:SavePediatrcFallassment")
-
- beego.Router("/api/patient/getbeddiatricfallassessmentlist", &PatientDataConfigAPIController{}, "Get:GetBedDiatricFallassessmentList")
-
- beego.Router("/api/patient/getpedpatientfallassessmentbyid", &PatientDataConfigAPIController{}, "Get:GetPedPatientFallassessmentById")
-
- beego.Router("/api/patient/updatepatientfallassessmentbyid", &PatientDataConfigAPIController{}, "Post:UpdatePedPatientFallassessment")
-
- beego.Router("/api/patient/deletepedpatientfallassment", &PatientDataConfigAPIController{}, "Get:DeletePadPatientFallassment")
-
- beego.Router("/api/patient/getpatientbedlist", &PatientDataConfigAPIController{}, "Get:GetPatientBedList")
-
- beego.Router("/api/patient/updatebedpatientlist", &PatientDataConfigAPIController{}, "Post:UpdateBedPatientList")
-
- beego.Router("/api/patient/getpatientfallaessmentlistbyids", &PatientDataConfigAPIController{}, "Get:GetPatientFallaessmentListMap")
-
- beego.Router("/api/patient/getpatientfallaessmentlistone", &PatientDataConfigAPIController{}, "Get:GetPatientFallaessmentListOne")
-
- beego.Router("/api/patient/savepatientbraden", &PatientDataConfigAPIController{}, "Post:SavePatientBraden")
-
- beego.Router("/api/patient/getpatientbradenlist", &PatientDataConfigAPIController{}, "Get:GetPatientBradenList")
-
- beego.Router("/api/patient/getpatientbradenbyid", &PatientDataConfigAPIController{}, "Get:GetPatientBradenById")
-
- beego.Router("/api/patient/updatepatientbraden", &PatientDataConfigAPIController{}, "Post:UpdatePatientBraden")
-
- beego.Router("/api/patient/deletepatientbraden", &PatientDataConfigAPIController{}, "Get:DeletePatientBraden")
-
- beego.Router("/api/patient/getbatchpatientbraden", &PatientDataConfigAPIController{}, "Get:GetBatchPatientBraden")
-
- beego.Router("/api/patient/savepatienthpressuresore", &PatientDataConfigAPIController{}, "Post:SavePatientHpPressuresore")
-
- }
-
- type PatientDataConfigAPIController struct {
- BaseAuthAPIController
- }
-
- func (this *PatientDataConfigAPIController) GetPhysiquecheckPrints() {
-
- patientID, _ := this.GetInt64("patient_id")
- idsStr := this.GetString("ids")
- if patientID <= 0 || len(idsStr) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordIDStrs := strings.Split(idsStr, ",")
- patient, _ := service.GetPatientByID(this.GetAdminUserInfo().CurrentOrgId, patientID)
- sickHostory, _ := service.GetPatienttPhysiqueByIds(this.GetAdminUserInfo().CurrentOrgId, patientID, recordIDStrs)
- this.ServeSuccessJSON(map[string]interface{}{
- "patient": patient,
- "sickhistorys": sickHostory,
- })
-
- }
- func (this *PatientDataConfigAPIController) GetSickhistoryPrints() {
- patientID, _ := this.GetInt64("patient_id")
- idsStr := this.GetString("ids")
- if patientID <= 0 || len(idsStr) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordIDStrs := strings.Split(idsStr, ",")
- patient, _ := service.GetPatientByID(this.GetAdminUserInfo().CurrentOrgId, patientID)
- sickHostory, _ := service.GetPatientSickHistoryByIds(this.GetAdminUserInfo().CurrentOrgId, patientID, recordIDStrs)
- for _, item := range sickHostory {
- pc, _ := service.GetLastPatientPhysiqueCheck(this.GetAdminUserInfo().CurrentOrgId, item.PatientId, item.RecordDate)
- item.XtPatientPhysiqueCheck = pc
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patient": patient,
- "sickhistorys": sickHostory,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetSickHistorys() {
- patientID, _ := this.GetInt64("patient_id")
- startTimeYMDStr := this.GetString("start_time")
- endTimeYMDStr := this.GetString("end_time")
- if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
- startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
- endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
- if parseStartTimeErr != nil || parseEndTimeErr != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
- return
- }
-
- adminUserInfo := this.GetAdminUserInfo()
- //patient, _ := service.GetPatientByIDOne(adminUserInfo.CurrentOrgId, patientID)
- //if getPatientErr != nil {
- // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //} else if patient == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- //}
-
- records, getRecordsErr := service.GetPatientSickHistory(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
- if getRecordsErr != nil {
- this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
- if getAllAdminsErr != nil {
- this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "records": records,
- "doctors": admins,
- })
- }
- func (this *PatientDataConfigAPIController) CreateSickHistory() {
- patientID, _ := this.GetInt64("patient_id")
- content := this.GetString("content")
- record_time_str := this.GetString("record_time")
- title := this.GetString("title")
- is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
- is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
- is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
- guominyaowu_desc := this.GetString("guominyaowu_desc")
- doctor_id, _ := this.GetInt64("doctor_id")
-
- //if patientID <= 0 || len(content) == 0 {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- //}
-
- if len(record_time_str) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- record_date := strings.Split(record_time_str, " ")
-
- checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
- checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
-
- adminUserInfo := this.GetAdminUserInfo()
- //patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- //if getPatientErr != nil {
- // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //} else if patient == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- //}
-
- now := time.Now().Unix()
- record := models.XtPatientSickHistory{
- OrgId: adminUserInfo.CurrentOrgId,
- PatientId: patientID,
- Recorder: adminUserInfo.AdminUser.Id,
- RecordTime: checkDate.Unix(),
- Content: content,
- Status: 1,
- Title: title,
- IsShenyizhiHistory: is_shenyizhishi,
- IsFumoDialysisHistory: is_fumotouxishi,
- HypersusceptibilityDesc: guominyaowu_desc,
- IsHypersusceptibility: is_guominyaowu,
- Ctime: now,
- Mtime: now,
- DoctorId: doctor_id,
- RecordDate: checkDate_two.Unix(),
- }
-
- createErr := service.CreatePatientSickHistory(&record)
- if createErr != nil {
- this.ErrorLog("创建患者病史记录失败:%v", createErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "record": record,
- })
- }
- func (this *PatientDataConfigAPIController) DeleteSickHistory() {
- patientID, _ := this.GetInt64("patient_id")
- idsStr := this.GetString("ids")
- if patientID <= 0 || len(idsStr) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := this.GetAdminUserInfo()
- patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- if getPatientErr != nil {
- this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- } else if patient == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- return
- }
-
- recordIDStrs := strings.Split(idsStr, ",")
- recordIDs := make([]int64, 0, len(recordIDStrs))
- for _, idStr := range recordIDStrs {
- id, parseErr := strconv.Atoi(idStr)
- if parseErr != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordIDs = append(recordIDs, int64(id))
- }
-
- deleteErr := service.DeletePatientSickHistoryInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
- if deleteErr != nil {
- this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- this.ServeSuccessJSON(nil)
- }
- func (this *PatientDataConfigAPIController) ModifySickHistory() {
- patientID, _ := this.GetInt64("patient_id")
- content := this.GetString("content")
- id, _ := this.GetInt64("id", 0)
- record_time_str := this.GetString("record_time")
- title := this.GetString("title")
-
- is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
- is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
- is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
- guominyaowu_desc := this.GetString("guominyaowu_desc")
- doctor_id, _ := this.GetInt64("doctor_id")
-
- if patientID <= 0 || len(content) == 0 || id == 0 || len(record_time_str) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- //timeLayout := "2006-01-02"
- //loc, _ := time.LoadLocation("Local")
- checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
-
- fmt.Println("checkDate--------------", checkDate)
- adminUserInfo := this.GetAdminUserInfo()
- patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- if getPatientErr != nil {
- this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- } else if patient == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- return
- }
-
- now := time.Now().Unix()
-
- record := models.XtPatientSickHistory{
- ID: id,
- OrgId: adminUserInfo.CurrentOrgId,
- PatientId: patientID,
- Recorder: adminUserInfo.AdminUser.Id,
- Content: content,
- Status: 1,
- Ctime: now,
- Mtime: now,
- Title: title,
- RecordTime: checkDate.Unix(),
- IsShenyizhiHistory: is_shenyizhishi,
- IsFumoDialysisHistory: is_fumotouxishi,
- HypersusceptibilityDesc: guominyaowu_desc,
- IsHypersusceptibility: is_guominyaowu,
- DoctorId: doctor_id,
- }
- createErr := service.ModifyPatientSickHistory(&record)
- if createErr != nil {
- this.ErrorLog("创建患者抢救记录失败:%v", createErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "record": record,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPhysiqueChecks() {
- patientID, _ := this.GetInt64("patient_id")
- startTimeYMDStr := this.GetString("start_time")
- endTimeYMDStr := this.GetString("end_time")
- if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
- startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
- endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
- if parseStartTimeErr != nil || parseEndTimeErr != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
- return
- }
-
- adminUserInfo := this.GetAdminUserInfo()
- //patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- //if getPatientErr != nil {
- // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //} else if patient == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- //}
-
- records, getRecordsErr := service.GetPatientPhysiqueCheck(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
- if getRecordsErr != nil {
- this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
- if getAllAdminsErr != nil {
- this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "records": records,
- "doctors": admins,
- })
- }
- func (this *PatientDataConfigAPIController) CreatePhysiqueCheck() {
- patientID, _ := this.GetInt64("patient_id")
- doctor_id, _ := this.GetInt64("doctor_id")
- record_time_str := this.GetString("record_time")
- t := this.GetString("t")
- p := this.GetString("p")
- r := this.GetString("r")
- bp_left := this.GetString("bp_left")
- bp_right := this.GetString("bp_right")
- pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
- tiwei, _ := this.GetInt64("tiwei")
- fuzhong, _ := this.GetInt64("fuzhong")
- chuxuedian, _ := this.GetInt64("chuxuedian")
-
- fayu, _ := this.GetInt64("fayu")
- yinyang, _ := this.GetInt64("yinyang")
- shenzhi, _ := this.GetInt64("shenzhi")
- pifunianmo, _ := this.GetInt64("pifunianmo")
- buwei := this.GetString("buwei")
- chengdu := this.GetString("chengdu")
- pixiachuxue, _ := this.GetInt64("pixiachuxue")
- zidian, _ := this.GetInt64("zidian")
- pifuwendu, _ := this.GetInt64("pifuwendu")
- qita := this.GetString("qita")
-
- linbazhongda, _ := this.GetInt64("linbazhongda")
- linbabuwei := this.GetString("linbabuwei")
-
- yanlian, _ := this.GetInt64("yanlian")
- tongkong, _ := this.GetInt64("tongkong")
- zuo := this.GetString("zuo")
- you := this.GetString("you")
-
- duiguangfanshe := this.GetString("duiguangfanshe")
- biantaoti := this.GetString("biantaoti")
- yanbu := this.GetString("yanbu")
- toubuqita := this.GetString("toubuqita")
- huxiyin := this.GetString("huxiyin")
-
- xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
- feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
- luoyin, _ := this.GetInt64("luoyin")
- desc := this.GetString("desc")
-
- xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
- xinlv, _ := this.GetInt64("xinlv")
- xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
- zayin, _ := this.GetInt64("zayin")
- fujiayin, _ := this.GetInt64("fujiayin")
- xinzangdesc := this.GetString("xinzangdesc")
-
- fushuizheng, _ := this.GetInt64("fushuizheng")
- ganjingjingmai := this.GetString("ganjingjingmai")
-
- gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
- gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
- pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
- pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
-
- shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
- shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
- fubu_desc := this.GetString("fubu_desc")
- oth_desc := this.GetString("oth_desc")
-
- if patientID <= 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(record_time_str) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- record_date := strings.Split(record_time_str, " ")
- checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
- checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
-
- adminUserInfo := this.GetAdminUserInfo()
- //patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- //if getPatientErr != nil {
- // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //} else if patient == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- //}
-
- now := time.Now().Unix()
- record := models.XtPatientPhysiqueCheck{
- DoctorId: doctor_id,
- OrgId: adminUserInfo.CurrentOrgId,
- PatientId: patientID,
- Recorder: adminUserInfo.AdminUser.Id,
- RecordTime: checkDate.Unix(),
- Status: 1,
- Ctime: now,
- Mtime: now,
- T: t,
- P: p,
- R: r,
- BpRight: bp_right,
- BpLeft: bp_left,
- Pinxuerongmao: pinxuerongmao,
- Tiwei: tiwei,
- Fuzhong: fuzhong,
- Chuxuedian: chuxuedian,
- Fayu: fayu,
- Yinyang: yinyang,
- Shenzhi: shenzhi,
- Pifunianmo: pifunianmo,
- Buwei: buwei,
- Chengdu: chengdu,
- Pixiachuxue: pixiachuxue,
- Zidian: zidian,
- Pifuwendu: pifuwendu,
- Qita: qita,
- Linbazhongda: linbazhongda,
- Linbabuwei: linbabuwei,
- Yanlian: yanlian,
- Tongkong: tongkong,
- Zuo: zuo,
- You: you,
- Duiguangfanshe: duiguangfanshe,
- Biantaoti: biantaoti,
- Yanbu: yanbu,
- Toubuqita: toubuqita,
- Huxiyin: huxiyin,
- Xiongmomocayin: xiongmomocayin,
- Feizhangbuwei: feizhangbuwei,
- Luoyin: luoyin,
- Desc: desc,
- Xinzangdaxiao: xinzangdaxiao,
- Xinlv: xinlv,
- Xinbaomocasheng: xinbaomocasheng,
- Zayin: zayin,
- Fujiayin: fujiayin,
- Xinzangdesc: xinzangdesc,
- Fushuizheng: fushuizheng,
- Ganjingjingmai: ganjingjingmai,
- GangzhangYatong: gangzhang_yatong,
- GangzhangKoutong: gangzhang_koutong,
- PizhangKoutong: pizhang_koutong,
- PizhangYatong: pizhang_yatong,
- ShenzhangKoutong: shenzhang_koutong,
- ShenzhangYatong: shenzhang_yatong,
- FubuDesc: fubu_desc,
- OthDesc: oth_desc,
- RecordDate: checkDate_two.Unix(),
- }
- createErr := service.CreatePatientPhysiqueCheck(&record)
- if createErr != nil {
- this.ErrorLog("创建患者病史记录失败:%v", createErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "record": record,
- })
- }
- func (this *PatientDataConfigAPIController) DeletePhysiqueCheck() {
- patientID, _ := this.GetInt64("patient_id")
- idsStr := this.GetString("ids")
- if patientID <= 0 || len(idsStr) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := this.GetAdminUserInfo()
- //patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- //if getPatientErr != nil {
- // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //} else if patient == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- //}
-
- recordIDStrs := strings.Split(idsStr, ",")
- recordIDs := make([]int64, 0, len(recordIDStrs))
- for _, idStr := range recordIDStrs {
- id, parseErr := strconv.Atoi(idStr)
- if parseErr != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordIDs = append(recordIDs, int64(id))
- }
-
- deleteErr := service.DeletePatientPhysiqueCheckInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
- if deleteErr != nil {
- this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- this.ServeSuccessJSON(nil)
- }
- func (this *PatientDataConfigAPIController) ModifyPhysiqueCheck() {
- patientID, _ := this.GetInt64("patient_id")
- id, _ := this.GetInt64("id", 0)
- doctor_id, _ := this.GetInt64("doctor_id", 0)
-
- record_time_str := this.GetString("record_time")
-
- if patientID <= 0 || id == 0 || len(record_time_str) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- t := this.GetString("t")
- p := this.GetString("p")
- r := this.GetString("r")
- bp_left := this.GetString("bp_left")
- bp_right := this.GetString("bp_right")
- pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
- tiwei, _ := this.GetInt64("tiwei")
- fuzhong, _ := this.GetInt64("fuzhong")
- chuxuedian, _ := this.GetInt64("chuxuedian")
-
- fayu, _ := this.GetInt64("fayu")
- yinyang, _ := this.GetInt64("yinyang")
- shenzhi, _ := this.GetInt64("shenzhi")
- pifunianmo, _ := this.GetInt64("pifunianmo")
- buwei := this.GetString("buwei")
- chengdu := this.GetString("chengdu")
- pixiachuxue, _ := this.GetInt64("pixiachuxue")
- zidian, _ := this.GetInt64("zidian")
- pifuwendu, _ := this.GetInt64("pifuwendu")
- qita := this.GetString("qita")
-
- linbazhongda, _ := this.GetInt64("linbazhongda")
- linbabuwei := this.GetString("linbabuwei")
-
- yanlian, _ := this.GetInt64("yanlian")
- tongkong, _ := this.GetInt64("tongkong")
- zuo := this.GetString("zuo")
- you := this.GetString("you")
-
- duiguangfanshe := this.GetString("duiguangfanshe")
- biantaoti := this.GetString("biantaoti")
- yanbu := this.GetString("yanbu")
- toubuqita := this.GetString("toubuqita")
- huxiyin := this.GetString("huxiyin")
-
- xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
- feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
- luoyin, _ := this.GetInt64("luoyin")
- desc := this.GetString("desc")
-
- xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
- xinlv, _ := this.GetInt64("xinlv")
- xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
- zayin, _ := this.GetInt64("zayin")
- fujiayin, _ := this.GetInt64("fujiayin")
- xinzangdesc := this.GetString("xinzangdesc")
-
- fushuizheng, _ := this.GetInt64("fushuizheng")
- ganjingjingmai := this.GetString("ganjingjingmai")
-
- gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
- gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
- pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
- pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
-
- shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
- shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
- fubu_desc := this.GetString("fubu_desc")
- oth_desc := this.GetString("oth_desc")
-
- checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
- adminUserInfo := this.GetAdminUserInfo()
- //patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- //if getPatientErr != nil {
- // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //} else if patient == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- //}
- now := time.Now().Unix()
-
- record := models.XtPatientPhysiqueCheck{
- ID: id,
- OrgId: adminUserInfo.CurrentOrgId,
- PatientId: patientID,
- Recorder: adminUserInfo.AdminUser.Id,
- RecordTime: checkDate.Unix(),
- DoctorId: doctor_id,
- Status: 1,
- Ctime: now,
- Mtime: now,
- T: t,
- P: p,
- R: r,
- BpRight: bp_right,
- BpLeft: bp_left,
- Pinxuerongmao: pinxuerongmao,
- Tiwei: tiwei,
- Fuzhong: fuzhong,
- Chuxuedian: chuxuedian,
- Fayu: fayu,
- Yinyang: yinyang,
- Shenzhi: shenzhi,
- Pifunianmo: pifunianmo,
- Buwei: buwei,
- Chengdu: chengdu,
- Pixiachuxue: pixiachuxue,
- Zidian: zidian,
- Pifuwendu: pifuwendu,
- Qita: qita,
- Linbazhongda: linbazhongda,
- Linbabuwei: linbabuwei,
- Yanlian: yanlian,
- Tongkong: tongkong,
- Zuo: zuo,
- You: you,
- Duiguangfanshe: duiguangfanshe,
- Biantaoti: biantaoti,
- Yanbu: yanbu,
- Toubuqita: toubuqita,
- Huxiyin: huxiyin,
- Xiongmomocayin: xiongmomocayin,
- Feizhangbuwei: feizhangbuwei,
- Luoyin: luoyin,
- Desc: desc,
- Xinzangdaxiao: xinzangdaxiao,
- Xinlv: xinlv,
- Xinbaomocasheng: xinbaomocasheng,
- Zayin: zayin,
- Fujiayin: fujiayin,
- Xinzangdesc: xinzangdesc,
- Fushuizheng: fushuizheng,
- Ganjingjingmai: ganjingjingmai,
- GangzhangYatong: gangzhang_yatong,
- GangzhangKoutong: gangzhang_koutong,
- PizhangKoutong: pizhang_koutong,
- PizhangYatong: pizhang_yatong,
- ShenzhangKoutong: shenzhang_koutong,
- ShenzhangYatong: shenzhang_yatong,
- FubuDesc: fubu_desc,
- OthDesc: oth_desc,
- }
- createErr := service.ModifyPatientPhysiqueCheck(&record)
- if createErr != nil {
- this.ErrorLog("修改患者体格检查失败:%v", createErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "record": record,
- })
- }
-
- // /api/patient/courses [get]
- // @param patient_id:int
- // @param start_time:string (yyyy-MM-dd)
- // @param end_time:string (yyyy-MM-dd)
- func (this *PatientDataConfigAPIController) Courses() {
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- patientID, _ := this.GetInt64("patient_id")
- start_time := this.GetString("start_time")
-
- dischargeTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- startime := dischargeTimes.Unix()
-
- end_time := this.GetString("end_time")
- endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
- endtime := endTimes.Unix()
-
- adminUserInfo := this.GetAdminUserInfo()
-
- records, getRecordsErr := service.GetPatientCourseOfDisease(adminUserInfo.CurrentOrgId, patientID, startime, endtime)
- if getRecordsErr != nil {
- this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
- if getAllAdminsErr != nil {
- this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "records": records,
- "doctors": admins,
- })
- }
-
- // /api/patient/course/create [post]
- // @param patient_id:int
- // @param content:string
- func (this *PatientDataConfigAPIController) CreateCourse() {
- patientID, _ := this.GetInt64("patient_id")
- fmt.Println(patientID)
- content := this.GetString("content")
-
- record_time_str := this.GetString("record_time")
- title := this.GetString("title")
-
- if patientID <= 0 || len(content) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- if len(record_time_str) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
-
- adminUserInfo := this.GetAdminUserInfo()
- //patient, _ := service.GetPatientByIDOne(adminUserInfo.CurrentOrgId, patientID)
- //if getPatientErr != nil {
- // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //} else if patient == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- //}
-
- now := time.Now().Unix()
- record := models.PatientDiseaseCourse{
- OrgID: adminUserInfo.CurrentOrgId,
- PatientID: patientID,
- Recorder: adminUserInfo.AdminUser.Id,
- RecordTime: checkDate.Unix(),
- Content: content,
- Status: 1,
- CreateTime: now,
- ModifyTime: now,
- Title: title,
- }
-
- createErr := service.CreatePatientCourseOfDisease(&record)
- if createErr != nil {
- this.ErrorLog("创建患者病程记录失败:%v", createErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "record": record,
- })
- }
-
- // /api/patient/course/delete
- // @param patient_id:int
- // @param ids:string 一个或多个record_id以逗号相隔 ("1,3,7")
- func (this *PatientDataConfigAPIController) DeleteCourse() {
- patientID, _ := this.GetInt64("patient_id")
- idsStr := this.GetString("ids")
- if patientID <= 0 || len(idsStr) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := this.GetAdminUserInfo()
- patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- if getPatientErr != nil {
- this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- } else if patient == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- return
- }
-
- recordIDStrs := strings.Split(idsStr, ",")
- recordIDs := make([]int64, 0, len(recordIDStrs))
- for _, idStr := range recordIDStrs {
- id, parseErr := strconv.Atoi(idStr)
- if parseErr != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordIDs = append(recordIDs, int64(id))
- }
-
- deleteErr := service.DeletePatientCoursesInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
- if deleteErr != nil {
- this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- this.ServeSuccessJSON(nil)
- }
-
- // /api/patient/rescues [get]
- // @param patient_id:int
- // @param start_time:string (yyyy-MM-dd)
- // @param end_time:string (yyyy-MM-dd)
- func (this *PatientDataConfigAPIController) Rescues() {
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- patientID, _ := this.GetInt64("patient_id")
- start_time := this.GetString("start_time")
-
- dischargeTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- startime := dischargeTimes.Unix()
-
- end_time := this.GetString("end_time")
- endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
- endtime := endTimes.Unix()
-
- adminUserInfo := this.GetAdminUserInfo()
- patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- if getPatientErr != nil {
- this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- } else if patient == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- return
- }
-
- records, getRecordsErr := service.GetPatientRescueRecords(adminUserInfo.CurrentOrgId, patientID, startime, endtime)
- if getRecordsErr != nil {
- this.ErrorLog("获取患者抢救记录失败:%v", getRecordsErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
- if getAllAdminsErr != nil {
- this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "records": records,
- "doctors": admins,
- })
- }
-
- // /api/patient/rescue/create [post]
- // @param patient_id:int
- // @param content:string
- func (this *PatientDataConfigAPIController) CreateRescue() {
- patientID, _ := this.GetInt64("patient_id")
- content := this.GetString("content")
- if patientID <= 0 || len(content) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := this.GetAdminUserInfo()
- patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- if getPatientErr != nil {
- this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- } else if patient == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- return
- }
-
- now := time.Now().Unix()
- record := models.PatientRescueRecord{
- OrgID: adminUserInfo.CurrentOrgId,
- PatientID: patientID,
- Recorder: adminUserInfo.AdminUser.Id,
- RecordTime: now,
- Content: content,
- Status: 1,
- CreateTime: now,
- ModifyTime: now,
- }
-
- createErr := service.CreatePatientRescueRecord(&record)
- if createErr != nil {
- this.ErrorLog("创建患者抢救记录失败:%v", createErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "record": record,
- })
- }
-
- // /api/patient/rescue/delete
- // @param patient_id:int
- // @param ids:string 一个或多个record_id以逗号相隔 ("1,3,7")
- func (this *PatientDataConfigAPIController) DeleteRescue() {
- patientID, _ := this.GetInt64("patient_id")
- idsStr := this.GetString("ids")
- if patientID <= 0 || len(idsStr) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := this.GetAdminUserInfo()
- patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- if getPatientErr != nil {
- this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- } else if patient == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- return
- }
-
- recordIDStrs := strings.Split(idsStr, ",")
- recordIDs := make([]int64, 0, len(recordIDStrs))
- for _, idStr := range recordIDStrs {
- id, parseErr := strconv.Atoi(idStr)
- if parseErr != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordIDs = append(recordIDs, int64(id))
- }
-
- deleteErr := service.DeletePatientResuceRecordsInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
- if deleteErr != nil {
- this.ErrorLog("删除患者抢救记录失败:%v", deleteErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- this.ServeSuccessJSON(nil)
- }
-
- func (this *PatientDataConfigAPIController) ModifyCourse() {
- patientID, _ := this.GetInt64("patient_id")
- content := this.GetString("content")
- id, _ := this.GetInt64("id", 0)
- record_time_str := this.GetString("record_time")
- title := this.GetString("title")
-
- if patientID <= 0 || len(content) == 0 || id == 0 || len(record_time_str) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- //timeLayout := "2006-01-02"
- //loc, _ := time.LoadLocation("Local")
- checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
-
- adminUserInfo := this.GetAdminUserInfo()
- //patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
- //if getPatientErr != nil {
- // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //} else if patient == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- //}
-
- now := time.Now().Unix()
-
- record := models.PatientDiseaseCourse{
- ID: id,
- OrgID: adminUserInfo.CurrentOrgId,
- PatientID: patientID,
- Recorder: adminUserInfo.AdminUser.Id,
- Content: content,
- Status: 1,
- CreateTime: now,
- ModifyTime: now,
- Title: title,
- RecordTime: checkDate.Unix(),
- }
-
- createErr := service.ModifyPatientCourses(&record)
- if createErr != nil {
- this.ErrorLog("创建患者抢救记录失败:%v", createErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "record": record,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPatientDialysisInforList() {
-
- patientID, _ := this.GetInt64("patient_id")
- record_date := this.GetString("record_date")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var startTime int64
- if len(record_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTime = theTime.Unix()
- }
-
- //获取患者姓名
- patient, _ := service.GetPatientName(patientID)
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
- //获取透析处方
- prescription, _ := service.GetDialysisPrescription(patientID, orgId, startTime)
-
- //获取透前评估
- assessmentBefor, _ := service.GetAssessmentBefor(orgId, patientID, startTime)
-
- //透析上机
- order, _ := service.GetDialysisOrder(orgId, patientID, startTime)
-
- //透析监测
- monitor, _ := service.GetFistMonitorSix(orgId, patientID, startTime)
-
- //透析医嘱
- advice, _ := service.GetBloodDoctorAdvice(startTime, orgId, patientID)
-
- //透后评估
- afterDislysis, _ := service.GetAssessmentAfterDissData(patientID, orgId, startTime)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "patient": patient,
- "prescription": prescription,
- "assessmentBefor": assessmentBefor,
- "order": order,
- "monitor": monitor,
- "advice": advice,
- "afterDislysis": afterDislysis,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetContextScheduleList() {
-
- limit, _ := this.GetInt64("limit")
-
- page, _ := this.GetInt64("page")
-
- start_time := this.GetString("start_time")
-
- end_time := this.GetString("end_time")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var startTime int64
- if len(start_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTime = theTime.Unix()
- }
-
- var endTime int64
- if len(end_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTime = theTime.Unix()
- }
-
- org_id := this.GetAdminUserInfo().CurrentOrgId
-
- schedule, total, _ := service.GetContextScheduleListGroupPatientId(limit, page, startTime, endTime, org_id)
-
- list, _, _ := service.GetContextScheduleListPatientId(startTime, endTime, org_id)
-
- patients, _ := service.GetAllpatientThirty(org_id)
-
- devicenumber, _ := service.GetAllBedNumber(org_id)
- this.ServeSuccessJSON(map[string]interface{}{
- "schedule": schedule,
- "total": total,
- "list": list,
- "patients": patients,
- "devicenumber": devicenumber,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPatientAllagicList() {
-
- id, _ := this.GetInt64("id")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- list, _ := service.GetPatientAllagicList(id, orgId)
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
-
- func (this *PatientDataConfigAPIController) SaveSiteMap() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- patient_id := int64(dataBody["patient_id"].(float64))
- user_org_id := this.GetAdminUserInfo().CurrentOrgId
- id := int64(dataBody["id"].(float64))
-
- if dataBody["a_left"] != nil && reflect.TypeOf(dataBody["a_left"]).String() == "[]interface {}" {
- prescriptions, _ := dataBody["a_left"].([]interface{})
-
- service.UpdateValsualAleft(patient_id, user_org_id)
- for _, item := range prescriptions {
- var a_num float64
- var mark_num float64
- if item.(map[string]interface{})["a_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["a_num"]).String() == "float64" {
- a_num = item.(map[string]interface{})["a_num"].(float64)
- }
- if item.(map[string]interface{})["markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["markNum"]).String() == "float64" {
- mark_num = item.(map[string]interface{})["markNum"].(float64)
- }
- fmt.Println(a_num, mark_num)
-
- valsualALeft := models.XtDeviceValsualALeft{
- ANum: a_num,
- MarkNum: mark_num,
- UserOrgId: user_org_id,
- PatientId: patient_id,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- MapId: 0,
- Status: 1,
- }
-
- service.CreateValsualAleft(valsualALeft)
-
- }
- }
-
- is_append := int64(dataBody["is_append"].(float64))
-
- is_img_v := int64(dataBody["is_img_v"].(float64))
-
- is_img_a := int64(dataBody["is_img_a"].(float64))
-
- a_top := dataBody["a_top"].(float64)
-
- av_bkx := dataBody["av_bkx"].(float64)
-
- av_bky := dataBody["av_bky"].(float64)
-
- if dataBody["fangxiang_a"] != nil && reflect.TypeOf(dataBody["fangxiang_a"]).String() == "[]interface {}" {
- prescriptions, _ := dataBody["fangxiang_a"].([]interface{})
- service.ValsualMapFangxiangA(patient_id, user_org_id)
- for _, item := range prescriptions {
- var a_num float64
- var mark_num float64
- var mark_top float64
- if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
- a_num = item.(map[string]interface{})["left"].(float64)
- }
- if item.(map[string]interface{})["markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["markNum"]).String() == "float64" {
- mark_num = item.(map[string]interface{})["markNum"].(float64)
- }
-
- if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
- mark_top = item.(map[string]interface{})["top"].(float64)
- }
-
- ValsualMapFangxiangA := models.XtDeviceValsualMapFangxiangA{
-
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Status: 1,
- Left: a_num,
- MarkNum: mark_num,
- Top: mark_top,
- MapId: 0,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- }
-
- service.CreateValsualMapFangxiangA(ValsualMapFangxiangA)
- }
-
- }
-
- fangxiang_a_num := dataBody["fangxiang_a_num"].(float64)
- fangxiang_a_top := dataBody["fangxiang_a_top"].(float64)
-
- fangxiang_v_left := dataBody["fangxiang_v_left"].(float64)
- fangxiang_v_num := dataBody["fangxiang_v_num"].(float64)
- fangxiang_v_top := dataBody["fangxiang_v_top"].(float64)
-
- if dataBody["fangxiang_v"] != nil && reflect.TypeOf(dataBody["fangxiang_v"]).String() == "[]interface {}" {
- prescriptions, _ := dataBody["fangxiang_v"].([]interface{})
- service.UpdateValsualMapFangxiangV(patient_id, user_org_id)
- for _, item := range prescriptions {
- var a_num float64
- var mark_num float64
- var mark_top float64
- if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
- a_num = item.(map[string]interface{})["left"].(float64)
- }
- if item.(map[string]interface{})["markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["markNum"]).String() == "float64" {
- mark_num = item.(map[string]interface{})["markNum"].(float64)
- }
-
- if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
- mark_top = item.(map[string]interface{})["top"].(float64)
- }
-
- ValsualMapFangxiangV := models.XtDeviceValsualMapFangxiangV{
-
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Status: 1,
- Left: a_num,
- MarkNum: mark_num,
- Top: mark_top,
- MapId: 0,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- }
-
- service.CreateValsualMapFangxiangV(ValsualMapFangxiangV)
- }
-
- }
-
- fangxiang_a_left := dataBody["fangxiang_a_left"].(float64)
-
- if dataBody["fuzhu_a"] != nil && reflect.TypeOf(dataBody["fuzhu_a"]).String() == "[]interface {}" {
- prescriptions, _ := dataBody["fuzhu_a"].([]interface{})
- service.UpdateValSualFuzhA(patient_id, user_org_id)
- for _, item := range prescriptions {
- var a_left float64
- var a_markNum float64
- var a_top float64
- if item.(map[string]interface{})["a_left"] != nil || reflect.TypeOf(item.(map[string]interface{})["a_left"]).String() == "float64" {
- a_left = item.(map[string]interface{})["a_left"].(float64)
- }
- if item.(map[string]interface{})["a_markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["a_markNum"]).String() == "float64" {
- a_markNum = item.(map[string]interface{})["a_markNum"].(float64)
- }
-
- if item.(map[string]interface{})["a_top"] != nil || reflect.TypeOf(item.(map[string]interface{})["a_top"]).String() == "float64" {
- a_top = item.(map[string]interface{})["a_top"].(float64)
- }
-
- valsualFuzhuA := models.XtDeviceValsualFuzhuA{
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ALeft: a_left,
- AMarkNum: a_markNum,
- ATop: a_top,
- MapId: 0,
- }
- service.CreateValSualFuzhA(valsualFuzhuA)
- }
- }
-
- fuzhu_a_left := dataBody["fuzhu_a_left"].(float64)
- fuzhu_a_num := dataBody["fuzhu_a_num"].(float64)
- fuzhu_a_top := dataBody["fuzhu_a_top"].(float64)
-
- left_a := dataBody["left_a"].(float64)
- left_v := dataBody["left_v"].(float64)
-
- if dataBody["fuzhu_v"] != nil && reflect.TypeOf(dataBody["fuzhu_v"]).String() == "[]interface {}" {
- prescriptions, _ := dataBody["fuzhu_v"].([]interface{})
-
- service.UpdateVasuaLfuzhuV(patient_id, user_org_id)
- for _, item := range prescriptions {
- var v_left float64
- var v_markNum float64
- var v_top float64
- if item.(map[string]interface{})["v_left"] != nil || reflect.TypeOf(item.(map[string]interface{})["v_left"]).String() == "float64" {
- v_left = item.(map[string]interface{})["v_left"].(float64)
- }
- if item.(map[string]interface{})["v_markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["v_markNum"]).String() == "float64" {
- v_markNum = item.(map[string]interface{})["v_markNum"].(float64)
- }
-
- if item.(map[string]interface{})["v_top"] != nil || reflect.TypeOf(item.(map[string]interface{})["v_top"]).String() == "float64" {
- v_top = item.(map[string]interface{})["v_top"].(float64)
- }
-
- fuzhuV := models.XtDeviceValsualFuzhuV{
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: 1,
- VMarkNum: v_markNum,
- VLeft: v_left,
- VTop: v_top,
- MapId: 0,
- }
-
- service.CreateVasuaLfuzhuV(fuzhuV)
-
- }
- }
-
- fuzhu_v_left := dataBody["fuzhu_v_left"].(float64)
- fuzhu_v_num := dataBody["fuzhu_v_num"].(float64)
- fuzhu_v_top := dataBody["fuzhu_v_top"].(float64)
-
- scalea_num := dataBody["scalea_num"].(float64)
- scalev_num := dataBody["scalev_num"].(float64)
-
- if dataBody["text_arr"] != nil && reflect.TypeOf(dataBody["text_arr"]).String() == "[]interface {}" {
- prescriptions, _ := dataBody["text_arr"].([]interface{})
-
- service.UpdateTextArr(patient_id, user_org_id)
- for _, item := range prescriptions {
- var left float64
- var text_markNum string
- var v_top float64
- var width float64
- if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
- left = item.(map[string]interface{})["left"].(float64)
- }
- if item.(map[string]interface{})["text"] != nil || reflect.TypeOf(item.(map[string]interface{})["text"]).String() == "string" {
- text_markNum = item.(map[string]interface{})["text"].(string)
- }
-
- if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
- v_top = item.(map[string]interface{})["top"].(float64)
- }
-
- if item.(map[string]interface{})["width"] != nil || reflect.TypeOf(item.(map[string]interface{})["width"]).String() == "float64" {
- width = item.(map[string]interface{})["width"].(float64)
- }
-
- textArr := models.XtDeviceValsualTextArr{
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Status: 1,
- Left: left,
- Text: text_markNum,
- Top: v_top,
- Width: width,
- MapId: 0,
- }
-
- service.CreateTextArr(textArr)
- }
-
- text_left := dataBody["text_left"].(float64)
- text_num := dataBody["text_num"].(float64)
- text_top := dataBody["text_top"].(float64)
-
- if dataBody["v_left"] != nil && reflect.TypeOf(dataBody["v_left"]).String() == "[]interface {}" {
- prescriptions, _ := dataBody["v_left"].([]interface{})
- service.UpdateValsualVleft(patient_id, user_org_id)
- for _, item := range prescriptions {
- var v_num float64
- var markNum float64
-
- if item.(map[string]interface{})["v_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["v_num"]).String() == "float64" {
- v_num = item.(map[string]interface{})["v_num"].(float64)
- }
- if item.(map[string]interface{})["mark_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["mark_num"]).String() == "float64" {
- markNum = item.(map[string]interface{})["mark_num"].(float64)
- }
-
- valsualVLeft := models.XtDeviceValsualVLeft{
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- MarkNum: markNum,
- VNum: v_num,
- MapId: 0,
- }
-
- service.CreateValsualVleft(valsualVLeft)
-
- }
- }
-
- if dataBody["aarr"] != nil && reflect.TypeOf(dataBody["aarr"]).String() == "[]interface {}" {
- prescriptions, _ := dataBody["aarr"].([]interface{})
- service.UpdateValusalMapArr(patient_id, user_org_id)
- for _, item := range prescriptions {
- var mark_num float64
- var is_status float64
- var left float64
- var top float64
-
- if item.(map[string]interface{})["mark_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["mark_num"]).String() == "float64" {
- mark_num = item.(map[string]interface{})["mark_num"].(float64)
- }
- if item.(map[string]interface{})["is_status"] != nil || reflect.TypeOf(item.(map[string]interface{})["is_status"]).String() == "float64" {
- is_status = item.(map[string]interface{})["is_status"].(float64)
- }
- if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
- left = item.(map[string]interface{})["left"].(float64)
- }
- if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
- top = item.(map[string]interface{})["top"].(float64)
- }
-
- mapArr := models.XtDeviceValusalMapArr{
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Status: 1,
- MarkNum: mark_num,
- Left: left,
- Top: top,
- IsStatus: is_status,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- }
- service.CreateDeviceValusalMapArr(mapArr)
-
- }
- }
-
- if dataBody["varr"] != nil && reflect.TypeOf(dataBody["varr"]).String() == "[]interface {}" {
- prescriptions, _ := dataBody["varr"].([]interface{})
- service.UpdateDeviceValusalMapVrr(patient_id, user_org_id)
- for _, item := range prescriptions {
- var mark_num float64
- var is_status float64
- var left float64
- var top float64
-
- if item.(map[string]interface{})["mark_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["mark_num"]).String() == "float64" {
- mark_num = item.(map[string]interface{})["mark_num"].(float64)
- }
- if item.(map[string]interface{})["is_status"] != nil || reflect.TypeOf(item.(map[string]interface{})["is_status"]).String() == "float64" {
- is_status = item.(map[string]interface{})["is_status"].(float64)
- }
- if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
- left = item.(map[string]interface{})["left"].(float64)
- }
- if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
- top = item.(map[string]interface{})["top"].(float64)
- }
-
- mapVrr := models.XtDeviceValusalMapVrr{
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Status: 1,
- MarkNum: mark_num,
- Left: left,
- Top: top,
- IsStatus: is_status,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- }
- service.CreateDeviceValusalMapVrr(mapVrr)
-
- }
- }
-
- v_num := dataBody["v_num"].(float64)
- v_top := dataBody["v_top"].(float64)
- xuanzhuan_a := dataBody["xuanzhuan_a"].(float64)
- xuanzhuan_v := dataBody["xuanzhuan_v"].(float64)
-
- img_url := dataBody["img_url"].(string)
-
- deviceValsualMap := models.XtDeviceValsualMap{
- ID: id,
- PatientId: patient_id,
- IsAppend: is_append,
- IsImgV: is_img_v,
- IsImgA: is_img_a,
- VNum: v_num,
- Status: 1,
- UserOrgId: user_org_id,
- ATop: a_top,
- AvBkx: av_bkx,
- AvBky: av_bky,
- FangxiangALeft: fangxiang_a_left,
- FangxiangANum: fangxiang_a_num,
- FangxiangATop: fangxiang_a_top,
- FangxiangVLeft: fangxiang_v_left,
- FangxiangVNum: fangxiang_v_num,
- FangxiangVTop: fangxiang_v_top,
- FuzhuALeft: fuzhu_a_left,
- FuzhuANum: fuzhu_a_num,
- FuzhuATop: fuzhu_a_top,
- FuzhuVLeft: fuzhu_v_left,
- FuzhuVNum: fuzhu_v_num,
- FuzhuVTop: fuzhu_v_top,
- ScaleaNum: scalea_num,
- ScalevNum: scalev_num,
- TextLeft: text_left,
- TextNum: text_num,
- TextTop: text_top,
- VTop: v_top,
- XuanzhuanA: xuanzhuan_a,
- XuanzhuanV: xuanzhuan_v,
- ALeft: left_a,
- VLeft: left_v,
- ImgUrl: img_url,
- }
-
- err = service.CreateDeviceValsualMap(deviceValsualMap)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "deviceValsualMap": deviceValsualMap,
- })
-
- }
- }
-
- func (this *PatientDataConfigAPIController) GetPatientSitemap() {
-
- patient_id, _ := this.GetInt64("patient_id")
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- sitemap, _ := service.GetPatientSitemap(patient_id, orgId)
-
- patients, _ := service.GetPatientByIDOne(orgId, patient_id)
- this.ServeSuccessJSON(map[string]interface{}{
- "sitemap": sitemap,
- "patients": patients,
- })
-
- }
-
- func (this *PatientDataConfigAPIController) GetPatientDetailInformedConsent() {
-
- patient_id, _ := this.GetInt64("patient_id")
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- patients, _ := service.GetPatientDetailInformedConsent(patient_id, orgId)
-
- this.ServeSuccessJSON(map[string]interface{}{
-
- "patients": patients,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPatientMedicalList() {
-
- patient_id, _ := this.GetInt64("patient_id")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- list, _ := service.GetPatientMedicalList(patient_id, orgId)
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetAllNurseList() {
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
- appId := this.GetAdminUserInfo().CurrentAppId
- nurseList, _ := service.GetAllNurseList(orgId, appId)
- this.ServeSuccessJSON(map[string]interface{}{
- "nurseList": nurseList,
- })
- }
-
- func (this *PatientDataConfigAPIController) SaveFllassessmentList() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- user_org_id := this.GetAdminUserInfo().CurrentOrgId
-
- admin_user_id := int64(dataBody["admin_user_id"].(float64))
-
- is_check := int64(dataBody["is_check"].(float64))
-
- is_check_one := int64(dataBody["is_check_one"].(float64))
-
- is_check_two := int64(dataBody["is_check_two"].(float64))
-
- is_check_three := int64(dataBody["is_check_three"].(float64))
-
- is_check_four := int64(dataBody["is_check_four"].(float64))
-
- is_check_five := int64(dataBody["is_check_five"].(float64))
-
- is_check_six := int64(dataBody["is_check_six"].(float64))
-
- is_check_seven := int64(dataBody["is_check_seven"].(float64))
-
- is_check_eight := int64(dataBody["is_check_eight"].(float64))
-
- is_check_night := int64(dataBody["is_check_night"].(float64))
-
- is_check_ten := int64(dataBody["is_check_ten"].(float64))
-
- is_check_eleven := int64(dataBody["is_check_eleven"].(float64))
-
- is_check_twelve := int64(dataBody["is_check_twelve"].(float64))
-
- is_check_thirteen := int64(dataBody["is_check_thirteen"].(float64))
-
- is_check_fourteen := int64(dataBody["is_check_fourteen"].(float64))
-
- is_check_fifteen := int64(dataBody["is_check_fifteen"].(float64))
-
- is_check_sixteen := int64(dataBody["is_check_sixteen"].(float64))
-
- is_check_seventeen := int64(dataBody["is_check_seventeen"].(float64))
-
- is_check_eighteen := int64(dataBody["is_check_eighteen"].(float64))
-
- is_check_nineteen := int64(dataBody["is_check_nineteen"].(float64))
-
- patient_id := int64(dataBody["patient_id"].(float64))
-
- total := int64(dataBody["total"].(float64))
-
- ping_date := dataBody["ping_date"].(string)
-
- record_date := dataBody["record_date"].(string)
-
- content := dataBody["is_age"].(string)
-
- content_one := dataBody["is_jiwang"].(string)
-
- content_two := dataBody["is_yishizt"].(string)
-
- content_three := dataBody["is_ganguan"].(string)
-
- content_four := dataBody["is_shentizk"].(string)
-
- content_five := dataBody["is_syyaowu"].(string)
-
- content_six := dataBody["is_paixie"].(string)
-
- content_seven := dataBody["is_zilin"].(string)
-
- content_eight := dataBody["is_xiaoguo"].(string)
-
- content_night := dataBody["is_touxidiedao"].(string)
-
- content_add := dataBody["list"].(string)
-
- content_add_one := dataBody["listOne"].(string)
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var pingDate int64
- if len(ping_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", ping_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- pingDate = theTime.Unix()
- }
-
- var recordDate int64
- if len(record_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDate = theTime.Unix()
- }
-
- // 开始主事务
- db := service.XTWriteDB()
- tx := db.Begin()
-
- // 在函数结束时处理事务回滚
- defer func() {
- if r := recover(); r != nil {
- tx.Rollback()
- }
- }()
- patientFallassessment := models.XtPatientFallassessment{
- PatientId: patient_id,
- UserOrgId: user_org_id,
- RecordDate: recordDate,
- PingDate: pingDate,
- AdminUserId: admin_user_id,
- Status: 1,
- IsCheck: is_check,
- IsCheckOne: is_check_one,
- IsCheckTwo: is_check_two,
- IsCheckThree: is_check_three,
- IsCheckFour: is_check_four,
- IsCheckFive: is_check_five,
- IsCheckSix: is_check_six,
- IsCheckSeven: is_check_seven,
- IsCheckEight: is_check_eight,
- IsCheckNight: is_check_night,
- IsCheckTen: is_check_ten,
- IsCheckEleven: is_check_eleven,
- IsCheckTwelve: is_check_twelve,
- IsCheckThirteen: is_check_thirteen,
- IsCheckFourteen: is_check_fourteen,
- IsCheckFifteen: is_check_fifteen,
- IsCheckSixteen: is_check_sixteen,
- IsCheckSeventeen: is_check_seventeen,
- IsCheckEighteen: is_check_eighteen,
- IsCheckNineteen: is_check_nineteen,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Total: total,
- Content: content,
- ContentOne: content_one,
- ContentTwo: content_two,
- ContentThree: content_three,
- ContentFour: content_four,
- ContentFive: content_five,
- ContentSix: content_six,
- ContentSeven: content_seven,
- ContentEight: content_eight,
- ContentNight: content_night,
- ContentAdd: content_add,
- ContentAddOne: content_add_one,
- }
- service.CreatePatientFallassessment(tx, patientFallassessment)
- tx.Commit()
- this.ServeSuccessJSON(map[string]interface{}{
- "patientFallassessment": patientFallassessment,
- })
-
- }
-
- func (this *PatientDataConfigAPIController) GetPatientFallsessMentList() {
-
- patient_id, _ := this.GetInt64("patient_id")
-
- limit, _ := this.GetInt64("limit")
-
- page, _ := this.GetInt64("page")
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- list, total, _ := service.GetPatientFallsessMentList(patient_id, orgId, limit, page)
- appId := this.GetAdminUserInfo().CurrentAppId
- roleList, _ := service.GetAllNurseList(orgId, appId)
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- "roleList": roleList,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPatientFallsessmentById() {
-
- id, _ := this.GetInt64("id")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- patientFallsessment, _ := service.GetPatientFallsessmentById(id, orgId)
- this.ServeSuccessJSON(map[string]interface{}{
- "patientFallsessment": patientFallsessment,
- })
- }
-
- func (this *PatientDataConfigAPIController) DeletePatientFallsessment() {
-
- id, _ := this.GetInt64("id")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- service.DeletePatientFallsessment(id, orgId)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "ok",
- })
- }
-
- func (this *PatientDataConfigAPIController) UpdatePatientFallassment() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- user_org_id := this.GetAdminUserInfo().CurrentOrgId
-
- admin_user_id := int64(dataBody["admin_user_id"].(float64))
-
- id := int64(dataBody["id"].(float64))
-
- is_check := int64(dataBody["is_check"].(float64))
-
- is_check_one := int64(dataBody["is_check_one"].(float64))
-
- is_check_two := int64(dataBody["is_check_two"].(float64))
-
- is_check_three := int64(dataBody["is_check_three"].(float64))
-
- is_check_four := int64(dataBody["is_check_four"].(float64))
-
- is_check_five := int64(dataBody["is_check_five"].(float64))
-
- is_check_six := int64(dataBody["is_check_six"].(float64))
-
- is_check_seven := int64(dataBody["is_check_seven"].(float64))
-
- is_check_eight := int64(dataBody["is_check_eight"].(float64))
-
- is_check_night := int64(dataBody["is_check_night"].(float64))
-
- is_check_ten := int64(dataBody["is_check_ten"].(float64))
-
- is_check_eleven := int64(dataBody["is_check_eleven"].(float64))
-
- is_check_twelve := int64(dataBody["is_check_twelve"].(float64))
-
- is_check_thirteen := int64(dataBody["is_check_thirteen"].(float64))
-
- is_check_fourteen := int64(dataBody["is_check_fourteen"].(float64))
-
- is_check_fifteen := int64(dataBody["is_check_fifteen"].(float64))
-
- is_check_sixteen := int64(dataBody["is_check_sixteen"].(float64))
-
- is_check_seventeen := int64(dataBody["is_check_seventeen"].(float64))
-
- is_check_eighteen := int64(dataBody["is_check_eighteen"].(float64))
-
- is_check_nineteen := int64(dataBody["is_check_nineteen"].(float64))
-
- patient_id := int64(dataBody["patient_id"].(float64))
-
- total := int64(dataBody["total"].(float64))
-
- ping_date := dataBody["ping_date"].(string)
-
- record_date := dataBody["record_date"].(string)
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var pingDate int64
- if len(ping_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", ping_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- pingDate = theTime.Unix()
- }
-
- var recordDate int64
- if len(record_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDate = theTime.Unix()
- }
-
- content := dataBody["is_age"].(string)
-
- content_one := dataBody["is_jiwang"].(string)
-
- content_two := dataBody["is_yishizt"].(string)
-
- content_three := dataBody["is_ganguan"].(string)
-
- content_four := dataBody["is_shentizk"].(string)
-
- content_five := dataBody["is_syyaowu"].(string)
-
- content_six := dataBody["is_paixie"].(string)
-
- content_seven := dataBody["is_zilin"].(string)
-
- content_eight := dataBody["is_xiaoguo"].(string)
-
- content_night := dataBody["is_touxidiedao"].(string)
-
- content_add := dataBody["list"].(string)
-
- content_add_one := dataBody["listOne"].(string)
-
- // 开始主事务
- db := service.XTWriteDB()
- tx := db.Begin()
-
- // 在函数结束时处理事务回滚
- defer func() {
- if r := recover(); r != nil {
- tx.Rollback()
- }
- }()
- patientFallassessment := models.XtPatientFallassessment{
- ID: id,
- PatientId: patient_id,
- UserOrgId: user_org_id,
- RecordDate: recordDate,
- PingDate: pingDate,
- AdminUserId: admin_user_id,
- Status: 1,
- IsCheck: is_check,
- IsCheckOne: is_check_one,
- IsCheckTwo: is_check_two,
- IsCheckThree: is_check_three,
- IsCheckFour: is_check_four,
- IsCheckFive: is_check_five,
- IsCheckSix: is_check_six,
- IsCheckSeven: is_check_seven,
- IsCheckEight: is_check_eight,
- IsCheckNight: is_check_night,
- IsCheckTen: is_check_ten,
- IsCheckEleven: is_check_eleven,
- IsCheckTwelve: is_check_twelve,
- IsCheckThirteen: is_check_thirteen,
- IsCheckFourteen: is_check_fourteen,
- IsCheckFifteen: is_check_fifteen,
- IsCheckSixteen: is_check_sixteen,
- IsCheckSeventeen: is_check_seventeen,
- IsCheckEighteen: is_check_eighteen,
- IsCheckNineteen: is_check_nineteen,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Total: total,
- Content: content,
- ContentOne: content_one,
- ContentTwo: content_two,
- ContentThree: content_three,
- ContentFour: content_four,
- ContentFive: content_five,
- ContentSix: content_six,
- ContentSeven: content_seven,
- ContentEight: content_eight,
- ContentNight: content_night,
- ContentAdd: content_add,
- ContentAddOne: content_add_one,
- }
- service.SavePatientFallassessment(tx, patientFallassessment)
-
- tx.Commit()
- this.ServeSuccessJSON(map[string]interface{}{
- "patientFallassessment": patientFallassessment,
- })
- }
-
- func (this *PatientDataConfigAPIController) SavePediatrcFallassment() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- user_org_id := this.GetAdminUserInfo().CurrentOrgId
-
- admin_user_id := int64(dataBody["tumble"].(float64))
-
- patient_id := int64(dataBody["patient_id"].(float64))
-
- record_date := dataBody["date"].(string)
-
- total := int64(dataBody["pedia_Totalpoints"].(float64))
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var recordDate int64
- var str string
- if len(record_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDate = theTime.Unix()
- }
-
- //if dataBody["age"] != nil && reflect.TypeOf(dataBody["age"]).String() == "[]interface {}" {
- // ageList, _ := dataBody["age"].([]interface{})
- //
- // for _, item := range ageList {
- // //记录日志
- // byterequest, _ := json.Marshal(item)
- // str += string(byterequest) + ","
- // }
- //}
- //
- //if dataBody["cognize"] != nil && reflect.TypeOf(dataBody["cognize"]).String() == "[]interface {}" {
- // cognizeList, _ := dataBody["cognize"].([]interface{})
- //
- // for _, item := range cognizeList {
- // //记录日志
- // byterequest, _ := json.Marshal(item)
- // str += string(byterequest) + ","
- // }
- //}
- //
- //if dataBody["diagnosis"] != nil && reflect.TypeOf(dataBody["diagnosis"]).String() == "[]interface {}" {
- // diagnosisList, _ := dataBody["diagnosis"].([]interface{})
- //
- // for _, item := range diagnosisList {
- // //记录日志
- // byterequest, _ := json.Marshal(item)
- // str += string(byterequest) + ","
- // }
- //}
- //
- //if dataBody["environment"] != nil && reflect.TypeOf(dataBody["environment"]).String() == "[]interface {}" {
- // environmentList, _ := dataBody["environment"].([]interface{})
- //
- // for _, item := range environmentList {
- // //记录日志
- // byterequest, _ := json.Marshal(item)
- // str += string(byterequest) + ","
- // }
- //}
- //
- //if dataBody["medicine"] != nil && reflect.TypeOf(dataBody["medicine"]).String() == "[]interface {}" {
- // medicineList, _ := dataBody["medicine"].([]interface{})
- //
- // for _, item := range medicineList {
- // //记录日志
- // byterequest, _ := json.Marshal(item)
- // str += string(byterequest) + ","
- // }
- //}
- //
- //if dataBody["sex"] != nil && reflect.TypeOf(dataBody["sex"]).String() == "[]interface {}" {
- // sexList, _ := dataBody["medicine"].([]interface{})
- //
- // for _, item := range sexList {
- // //记录日志
- // byterequest, _ := json.Marshal(item)
- // str += string(byterequest) + ","
- // }
- //}
-
- age := int64(dataBody["age"].(float64))
-
- sex := int64(dataBody["sex"].(float64))
-
- diagnosis := int64(dataBody["diagnosis"].(float64))
-
- cognize := int64(dataBody["cognize"].(float64))
-
- environment := int64(dataBody["environment"].(float64))
-
- medicine := int64(dataBody["medicine"].(float64))
-
- tumble := int64(dataBody["tumble"].(float64))
-
- pedFallssessment := models.XtPatientPedFallssessment{
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Text: str,
- RecordDate: recordDate,
- Total: total,
- AdminUserId: admin_user_id,
- Type: 1,
- Age: age,
- Sex: sex,
- Diagnosis: diagnosis,
- Environment: environment,
- Medicine: medicine,
- Tumble: tumble,
- Cognize: cognize,
- }
-
- service.CreatePadFallssessment(pedFallssessment)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "pedFallssessment": pedFallssessment,
- })
-
- }
-
- func (this *PatientDataConfigAPIController) GetBedDiatricFallassessmentList() {
-
- patient_id, _ := this.GetInt64("patient_id")
- is_type, _ := this.GetInt64("is_type")
- limit, _ := this.GetInt64("limit")
- page, _ := this.GetInt64("page")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- list, total, _ := service.GetBedDiatricFallassessmentList(patient_id, is_type, orgId, limit, page)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPedPatientFallassessmentById() {
-
- id, _ := this.GetInt64("id")
-
- fallassessment, _ := service.GetPedPatientFallassessmentById(id)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "fallassessment": fallassessment,
- })
- }
-
- func (this *PatientDataConfigAPIController) DeletePadPatientFallassment() {
-
- id, _ := this.GetInt64("id")
-
- service.DeletePadPatientFallassment(id)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "ok",
- })
- }
-
- func (this *PatientDataConfigAPIController) UpdatePedPatientFallassessment() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- user_org_id := this.GetAdminUserInfo().CurrentOrgId
-
- id := int64(dataBody["id"].(float64))
-
- admin_user_id := int64(dataBody["tumble"].(float64))
-
- patient_id := int64(dataBody["patient_id"].(float64))
-
- record_date := dataBody["date"].(string)
-
- total := int64(dataBody["pedia_Totalpoints"].(float64))
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var recordDate int64
- var str string
- if len(record_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDate = theTime.Unix()
- }
-
- age := int64(dataBody["age"].(float64))
-
- sex := int64(dataBody["sex"].(float64))
-
- diagnosis := int64(dataBody["diagnosis"].(float64))
-
- environment := int64(dataBody["environment"].(float64))
-
- medicine := int64(dataBody["medicine"].(float64))
-
- tumble := int64(dataBody["tumble"].(float64))
-
- cognize := int64(dataBody["cognize"].(float64))
-
- pedFallssessment := models.XtPatientPedFallssessment{
- ID: id,
- PatientId: patient_id,
- UserOrgId: user_org_id,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Text: str,
- RecordDate: recordDate,
- Total: total,
- AdminUserId: admin_user_id,
- Type: 1,
- Age: age,
- Sex: sex,
- Diagnosis: diagnosis,
- Environment: environment,
- Medicine: medicine,
- Tumble: tumble,
- Cognize: cognize,
- }
-
- service.UpdatePedFallssessment(pedFallssessment)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "pedFallssessment": pedFallssessment,
- })
- }
-
- func (this *PatientDataConfigAPIController) SavePatientHpPressuresore() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- record_date := dataBody["record_date"].(string)
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var recordDate int64
- if len(record_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDate = theTime.Unix()
- }
- var str string
- if dataBody["list"] != nil && reflect.TypeOf(dataBody["list"]).String() == "[]interface {}" {
- list, _ := dataBody["list"].([]interface{})
- for _, item := range list {
- byterequest, _ := json.Marshal(item)
- str += string(byterequest)
- }
- }
- patient_id := int64(dataBody["patient_id"].(float64))
-
- is_type := int64(dataBody["is_type"].(float64))
- var data models.XtPatientPedFallssessment
-
- json.Unmarshal(this.Ctx.Input.RequestBody, &data)
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- pedFallssessment := models.XtPatientPedFallssessment{
- PatientId: patient_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Text: str,
- RecordDate: recordDate,
- Total: 0,
- AdminUserId: 0,
- Type: is_type,
- Age: 0,
- Cognize: 0,
- Diagnosis: 0,
- Environment: 0,
- Medicine: 0,
- Sex: 0,
- Tumble: 0,
- }
-
- service.CreatePatientPedList(pedFallssessment)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "pedFallssessment": pedFallssessment,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPatientBedList() {
-
- patient_id, _ := this.GetInt64("patient_id")
- page, _ := this.GetInt64("page")
- limit, _ := this.GetInt64("limit")
- is_type, _ := this.GetInt64("is_type")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- list, total, _ := service.GetBedDiatricFallassessmentList(patient_id, is_type, orgId, limit, page)
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- })
- }
-
- func (this *PatientDataConfigAPIController) UpdateBedPatientList() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- record_date := dataBody["record_date"].(string)
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var recordDate int64
- if len(record_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDate = theTime.Unix()
- }
- var str string
- if dataBody["list"] != nil && reflect.TypeOf(dataBody["list"]).String() == "[]interface {}" {
- list, _ := dataBody["list"].([]interface{})
- for _, item := range list {
- byterequest, _ := json.Marshal(item)
- str += string(byterequest)
- }
- }
- patient_id := int64(dataBody["patient_id"].(float64))
-
- id := int64(dataBody["id"].(float64))
-
- is_type := int64(dataBody["is_type"].(float64))
- var data models.XtPatientPedFallssessment
-
- json.Unmarshal(this.Ctx.Input.RequestBody, &data)
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- pedFallssessment := models.XtPatientPedFallssessment{
- ID: id,
- PatientId: patient_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Text: str,
- RecordDate: recordDate,
- Total: 0,
- AdminUserId: 0,
- Type: is_type,
- Age: 0,
- Cognize: 0,
- Diagnosis: 0,
- Environment: 0,
- Medicine: 0,
- Sex: 0,
- Tumble: 0,
- }
- service.UpdatePatientPedList(pedFallssessment)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "pedFallssessment": pedFallssessment,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPatientFallaessmentListMap() {
-
- ids := this.GetString("ids")
- patient_id, _ := this.GetInt64("patient_id")
- indateSplit := strings.Split(ids, ",")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- list, _ := service.GetPatientFallsessMentListOne(indateSplit, orgId)
- patients, _ := service.GetPatientName(patient_id)
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "patients": patients,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPatientFallaessmentListOne() {
-
- ids := this.GetString("ids")
- patient_id, _ := this.GetInt64("patient_id")
- indateSplit := strings.Split(ids, ",")
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- service.GetAllPatientListMap(orgId)
- list, _ := service.GetPatientFallsessMentListTwo(indateSplit, orgId)
- patients, _ := service.GetPatientName(patient_id)
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "patients": patients,
- })
- }
-
- func (this *PatientDataConfigAPIController) SavePatientBraden() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- admin_user_id := int64(dataBody["admin_user_id"].(float64))
- famaliy_sign := dataBody["famaliy_sign"].(string)
- leader_sign := dataBody["leader_sign"].(string)
- ping_sign := dataBody["ping_sign"].(string)
- first_check := int64(dataBody["first_check"].(float64))
- two_check := int64(dataBody["two_check"].(float64))
- three_check := int64(dataBody["three_check"].(float64))
- four_check := int64(dataBody["four_check"].(float64))
- five_check := int64(dataBody["five_check"].(float64))
- six_check := int64(dataBody["six_check"].(float64))
-
- first_lapeso := int64(dataBody["first_lapeso"].(float64))
- two_lapeso := int64(dataBody["two_lapeso"].(float64))
- three_lapeso := int64(dataBody["three_lapeso"].(float64))
-
- patient_id := int64(dataBody["patient_id"].(float64))
-
- record_date := dataBody["record_date"].(string)
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var recordDate int64
- if len(record_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDate = theTime.Unix()
- }
-
- leader_date := dataBody["leader_date"].(string)
- var leaderDate int64
- if len(leader_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", leader_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- leaderDate = theTime.Unix()
- }
-
- ping_date := dataBody["ping_date"].(string)
-
- str := dataBody["list"].(string)
-
- var pingDate int64
- if len(ping_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", ping_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- pingDate = theTime.Unix()
- }
-
- first_pingfen := int64(dataBody["first_pingfen"].(float64))
-
- two_pingfen := int64(dataBody["two_pingfen"].(float64))
-
- three_pingfen := int64(dataBody["three_pingfen"].(float64))
-
- four_pingfen := int64(dataBody["four_pingfen"].(float64))
-
- five_pingfen := int64(dataBody["five_pingfen"].(float64))
-
- six_pingfen := int64(dataBody["six_pingfen"].(float64))
-
- total := int64(dataBody["total"].(float64))
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- xtPatientBraden := models.XtPatientBraden{
- PatientId: patient_id,
- UserOrgId: orgId,
- AdminUserId: admin_user_id,
- RecordDate: recordDate,
- Total: total,
- FirstPingfen: first_pingfen,
- TwoPingfen: two_pingfen,
- ThreePingfen: three_pingfen,
- FourPingfen: four_pingfen,
- FivePingfen: five_pingfen,
- SixPingfen: six_pingfen,
- FamaliySign: famaliy_sign,
- PingDate: pingDate,
- FirstLapeso: first_lapeso,
- PingSign: ping_sign,
- LeaderSign: leader_sign,
- LeaderDate: leaderDate,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Status: 1,
- FirstCheck: first_check,
- TwoCheck: two_check,
- ThreeCheck: three_check,
- FourCheck: four_check,
- FiveCheck: five_check,
- SixCheck: six_check,
- TwoLapeso: two_lapeso,
- ThreeLapeso: three_lapeso,
- Content: str,
- }
-
- service.CeatePatientSign(xtPatientBraden)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "xtPatientBraden": xtPatientBraden,
- })
-
- }
-
- func (this *PatientDataConfigAPIController) GetPatientBradenList() {
-
- patient_id, _ := this.GetInt64("patient_id")
-
- limt, _ := this.GetInt64("limit")
-
- page, _ := this.GetInt64("page")
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
- appId := this.GetAdminUserInfo().CurrentAppId
- list, total, _ := service.GetPatientBradenList(patient_id, limt, page, orgId)
- nurseList, _ := service.GetAllNurseList(orgId, appId)
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- "nurseList": nurseList,
- })
- }
-
- func (this *PatientDataConfigAPIController) GetPatientBradenById() {
-
- id, _ := this.GetInt64("id")
-
- braden, _ := service.GetPatientBradenById(id)
- orgId := this.GetAdminUserInfo().CurrentOrgId
- appId := this.GetAdminUserInfo().CurrentAppId
- nurseList, _ := service.GetAllNurseList(orgId, appId)
- this.ServeSuccessJSON(map[string]interface{}{
- "braden": braden,
- "nurseList": nurseList,
- })
- }
-
- func (this *PatientDataConfigAPIController) UpdatePatientBraden() {
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- admin_user_id := int64(dataBody["admin_user_id"].(float64))
- famaliy_sign := dataBody["famaliy_sign"].(string)
- leader_sign := dataBody["leader_sign"].(string)
- ping_sign := dataBody["ping_sign"].(string)
- first_check := int64(dataBody["first_check"].(float64))
- two_check := int64(dataBody["two_check"].(float64))
- three_check := int64(dataBody["three_check"].(float64))
- four_check := int64(dataBody["four_check"].(float64))
- five_check := int64(dataBody["five_check"].(float64))
- six_check := int64(dataBody["six_check"].(float64))
-
- first_lapeso := int64(dataBody["first_lapeso"].(float64))
- two_lapeso := int64(dataBody["two_lapeso"].(float64))
- three_lapeso := int64(dataBody["three_lapeso"].(float64))
-
- patient_id := int64(dataBody["patient_id"].(float64))
-
- record_date := dataBody["record_date"].(string)
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var recordDate int64
- if len(record_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDate = theTime.Unix()
- }
-
- leader_date := dataBody["leader_date"].(string)
- var leaderDate int64
- if len(leader_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", leader_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- leaderDate = theTime.Unix()
- }
-
- ping_date := dataBody["ping_date"].(string)
-
- str := dataBody["list"].(string)
-
- var pingDate int64
- if len(ping_date) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", ping_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- pingDate = theTime.Unix()
- }
-
- first_pingfen := int64(dataBody["first_pingfen"].(float64))
-
- two_pingfen := int64(dataBody["two_pingfen"].(float64))
-
- three_pingfen := int64(dataBody["three_pingfen"].(float64))
-
- four_pingfen := int64(dataBody["four_pingfen"].(float64))
-
- five_pingfen := int64(dataBody["five_pingfen"].(float64))
-
- six_pingfen := int64(dataBody["six_pingfen"].(float64))
-
- total := int64(dataBody["total"].(float64))
-
- id := int64(dataBody["id"].(float64))
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- xtPatientBraden := models.XtPatientBraden{
- ID: id,
- PatientId: patient_id,
- UserOrgId: orgId,
- AdminUserId: admin_user_id,
- RecordDate: recordDate,
- Total: total,
- FirstPingfen: first_pingfen,
- TwoPingfen: two_pingfen,
- ThreePingfen: three_pingfen,
- FourPingfen: four_pingfen,
- FivePingfen: five_pingfen,
- SixPingfen: six_pingfen,
- FamaliySign: famaliy_sign,
- PingDate: pingDate,
- FirstLapeso: first_lapeso,
- PingSign: ping_sign,
- LeaderSign: leader_sign,
- LeaderDate: leaderDate,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Status: 1,
- FirstCheck: first_check,
- TwoCheck: two_check,
- ThreeCheck: three_check,
- FourCheck: four_check,
- FiveCheck: five_check,
- SixCheck: six_check,
- TwoLapeso: two_lapeso,
- ThreeLapeso: three_lapeso,
- Content: str,
- }
- service.SavePatientBraden(xtPatientBraden)
- this.ServeSuccessJSON(map[string]interface{}{
- "xtPatientBraden": xtPatientBraden,
- })
- }
-
- func (this *PatientDataConfigAPIController) DeletePatientBraden() {
-
- id, _ := this.GetInt64("id")
- service.DeletePatientBraden(id)
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "ok",
- })
- }
-
- func (this *PatientDataConfigAPIController) GetBatchPatientBraden() {
-
- ids := this.GetString("ids")
- patient_id, _ := this.GetInt64("patient_id")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- indateSplit := strings.Split(ids, ",")
- list, _ := service.GetBatchPatientBraden(indateSplit, orgId)
- patients, _ := service.GetPatientName(patient_id)
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "patients": patients,
- })
- }
|