1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864 |
- package controllers
-
- import (
- "encoding/json"
- "fmt"
- "strconv"
- "strings"
- "time"
-
- "XT_New/enums"
- "XT_New/models"
- "XT_New/service"
- "XT_New/utils"
- "github.com/astaxie/beego"
- "github.com/jinzhu/gorm"
- )
-
- type DoctorsApiController struct {
- BaseAuthAPIController
- }
-
- func DoctorApiRegistRouters() {
- beego.Router("/api/alldoctors", &DoctorsApiController{}, "get:GetAllDoctorAndNurse")
- beego.Router("/api/admin/users", &DoctorsApiController{}, "get:GetAllAdminUsers")
- beego.Router("/api/patient/getdryweightdata", &DoctorsApiController{}, "Get:GetDryWeightData")
- beego.Router("/api/patient/getAllDoctor", &DoctorsApiController{}, "Get:GetAllDoctor")
- beego.Router("/api/patient/updatedryweightdata", &DoctorsApiController{}, "Post:UpdatedDryWeightData")
- beego.Router("/api/patient/getalldata", &DoctorsApiController{}, "Get:GetAllData")
- beego.Router("/api/paients/getdryweightdetail", &DoctorsApiController{}, "Get:GetDryWeightDetail")
- beego.Router("/api/patients/modifydryweightdata", &DoctorsApiController{}, "Get:ModifydryWeightData")
- beego.Router("/api/patient/deletedryweight", &DoctorsApiController{}, "Delete:DeleteDryWeight")
- beego.Router("/api/schedule/advices", &DoctorsApiController{}, "Get:ScheduleAdvices")
- beego.Router("/api/schedule/new/advices", &DoctorsApiController{}, "Get:GetScheduleAdvicesList")
- beego.Router("/api/schedule/getdoctoradvicecount", &DoctorsApiController{}, "Get:GetDoctorAdviceCount")
- beego.Router("/api/patient/savevasularaccess", &DoctorsApiController{}, "Get:SaveVasularAccess")
- beego.Router("/api/patient/getallvascualraccesslist", &DoctorsApiController{}, "Get:GetAllVacualAccessList")
- beego.Router("/api/patient/getvascularaccessbydetial", &DoctorsApiController{}, "Get:GetVascularAccessByDetail")
- beego.Router("/api/patient/updatevasularaccess", &DoctorsApiController{}, "Get:UpdateVasularAccess")
- beego.Router("/api/patient/deletevascularaccess", &DoctorsApiController{}, "Get:DeleteVasularAccess")
- beego.Router("/api/patient/savepasswayassessment", &DoctorsApiController{}, "Get:SavePassWayAssessment")
- beego.Router("/api/patient/getallpasswayassessment", &DoctorsApiController{}, "Get:GetAllPassWayAssessment")
- beego.Router("/api/patient/getpasswayassmentbyid", &DoctorsApiController{}, "Get:GetPasswayAssesmentById")
- beego.Router("/api/patient/updatepasswayassesment", &DoctorsApiController{}, "Get:UpdatePassWayAssesment")
- beego.Router("/api/patient/deletepasswayassessment", &DoctorsApiController{}, "Get:DeleteWayAssessment")
- beego.Router("/api/patient/getaccesslist", &DoctorsApiController{}, "Get:GetAccessList")
-
- //阶段小结路由
- beego.Router("/api/patient/getinspectionmajoritem", &DoctorsApiController{}, "Get:GetInspectionMajorItem")
- beego.Router("/api/patient/getinspectiondetail", &DoctorsApiController{}, "Get:GetInspectionDetailByProject")
- beego.Router("/api/patient/getinspectionitemlist", &DoctorsApiController{}, "Get:GetInspectionItemlist")
- beego.Router("/api/patient/getinitdatelist", &DoctorsApiController{}, "Get:GetInitDateList")
- beego.Router("/api/patient/savecreationinspection", &DoctorsApiController{}, "Post:SaveCreationInspection")
- beego.Router("/api/patient/getemlatesummarylist", &DoctorsApiController{}, "Get:GetTemplateSummaryList")
- beego.Router("/api/patient/gettemplatesummarydetail", &DoctorsApiController{}, "Get:GetTemplateSummaryDetail")
- beego.Router("/api/patient/gettemplatesummaryprintdetail", &DoctorsApiController{}, "Get:GetTemplateSummaryPrintDetail")
- beego.Router("/api/patient/updatetemplatesummary", &DoctorsApiController{}, "Post:UpdateTempalteSummary")
- beego.Router("/api/patient/deletesummary", &DoctorsApiController{}, "Get:DeleteSummary")
- beego.Router("/api/patient/hospitalsummary", &DoctorsApiController{}, "Post:HospitalSummary")
- beego.Router("/api/patient/gethospitalsummarylist", &DoctorsApiController{}, "Get:GetHospitalSummaryList")
- beego.Router("/api/patient/gethospitalsummaydetail", &DoctorsApiController{}, "Get:GetHospitalSummaryDetail")
- beego.Router("/api/patient/updatehospitalsummary", &DoctorsApiController{}, "Post:UpdateHospitalSummary")
- beego.Router("/api/patient/deletehospitalsummary", &DoctorsApiController{}, "Get:DeleteHospitalSummary")
- beego.Router("/api/patient/getpatientinfo", &DoctorsApiController{}, "Get:GetPatientInfo")
- beego.Router("/api/patient/createfirstdisease", &DoctorsApiController{}, "Post:CreateFirstDisease")
- beego.Router("/api/patient/getfirstdiseaselist", &DoctorsApiController{}, "Get:GetFirstDiseaseList")
- beego.Router("/api/patient/getfirstdetailbyid", &DoctorsApiController{}, "Get:GetFirstDetailById")
- beego.Router("/api/patient/updatefirstdisease", &DoctorsApiController{}, "Post:UpdateFirstDisease")
- beego.Router("/api/patient/deletefirstdisease", &DoctorsApiController{}, "Get:DeleteFirstDisease")
-
- beego.Router("/api/schedule/new/long/advices", &DoctorsApiController{}, "Get:GetLongScheduleAdvicesList")
-
- beego.Router("/api/schedule/getpatientbyname", &DoctorsApiController{}, "Get:GetPatientByName")
- beego.Router("/api/schedule/getdocadvicebypatientid", &DoctorsApiController{}, "Get:GetDoctorAdviceByPatientId")
-
- beego.Router("/api/schedule/getdoctoradvicemonthlist", &DoctorsApiController{}, "Get:GetDoctorAdivceMonthList")
-
- beego.Router("/api/schedule/gethisprescriptionprojectmonthlist", &DoctorsApiController{}, "Get:GetHisPrescriptionProjectMonthList")
- }
-
- func (c *DoctorsApiController) ScheduleAdvices() {
- schedualDate := c.GetString("date")
- adviceType, _ := c.GetInt("advice_type")
- patientType, _ := c.GetInt("patient_type")
- delivery_way := c.GetString("delivery_way")
- schedule_type, _ := c.GetInt64("schedule_type")
- partition_type, _ := c.GetInt64("partition_type")
- patient_id, _ := c.GetInt64("patient_id")
- excution_way, _ := c.GetInt64("excution_way")
- execution_frequency := c.GetString("execution_frequency")
- keyword := c.GetString("keyword")
- if adviceType != 1 && adviceType != 3 && adviceType != 2 {
- adviceType = 0
- }
-
- if patientType != 1 && patientType != 2 {
-
- patientType = 0
- }
-
- date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
- if parseDateErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
- orgID := adminUserInfo.CurrentOrgId
-
- config, _ := service.GetHisDoctorConfig(orgID)
- project_config, _ := service.GetHisProjectConfig(orgID)
-
- drugs, _ := service.GetAllBaseDrugLibListTwo(orgID)
-
- if config.IsOpen == 0 || config.IsOpen == 2 {
- scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, 0, execution_frequency, keyword)
- adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
- if err != nil {
- c.ErrorLog("获取排班信息失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- } else {
- filtedScheduals := []*service.MScheduleDoctorAdviceVM{}
- for _, schedual := range scheduals {
- if len(schedual.DoctorAdvices) > 0 {
- filtedScheduals = append(filtedScheduals, schedual)
- }
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "scheduals": filtedScheduals,
- "adminUser": adminUser,
- "config": config,
- "project_config": project_config,
- "drugs": drugs,
- })
- }
- }
-
- if config.IsOpen == 1 {
- hisAdvices, err := service.GetHisDoctorAdvicesTwentyOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way, 0, execution_frequency)
- adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
- project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id, excution_way)
-
- drug, _ := service.GetAllBaseDrugListTwenty(orgID)
- for _, item := range project {
- index := 0
- for _, subItem := range item.HisPrescriptionTeamProject {
-
- if subItem.HisProject.CostClassify != 3 {
- subItem.IsCheckTeam = 2
- item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
- }
-
- if subItem.HisProject.CostClassify == 3 {
- subItem.IsCheckTeam = 1
- index = index + 1
- if index == 1 {
- item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
- }
- }
- }
- }
-
- if err != nil {
- c.ErrorLog("获取排班信息失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "adminUser": adminUser,
- "hisAdvices": hisAdvices,
- "config": config,
- "project_config": project_config,
- "project": project,
- "drug": drug,
- "drugs": drugs,
- })
- }
- }
-
- }
-
- func (c *DoctorsApiController) GetAllDoctorAndNurse() {
-
- adminUserInfo := c.GetAdminUserInfo()
- doctors, nursers, _ := service.GetAllDoctorAndNurseSeven(adminUserInfo.CurrentOrgId)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "doctors": doctors,
- "nursers": nursers,
- })
- return
- }
- func (c *DoctorsApiController) GetAllAdminUsers() {
-
- adminUserInfo := c.GetAdminUserInfo()
- users, _ := service.GetAllAdminUsersTwo(adminUserInfo.CurrentOrgId)
- operators, _ := service.GetAdminUserEsOne(adminUserInfo.CurrentOrgId)
- c.ServeSuccessJSON(map[string]interface{}{
- "users": users,
- "operators": operators,
- })
- return
- }
-
- func (c *DoctorsApiController) GetDryWeightData() {
- adminUserInfo := c.GetAdminUserInfo()
- orgid := adminUserInfo.CurrentOrgId
-
- patientid, _ := c.GetInt64("patientid")
- fmt.Println("patientid", patientid)
- id := adminUserInfo.AdminUser.Id
- fmt.Println("id", id)
- recordDateStr := time.Now().Format("2006-01-02")
- recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
- fmt.Scan("parseDateErr", parseDateErr)
- nowtime := recordDate.Unix()
- fmt.Println("nowtime", nowtime)
- pre, err := service.GetDryWeightByPatientId(patientid, orgid)
- fmt.Println("错误", err)
- c.ServeSuccessJSON(map[string]interface{}{
- "pre": pre,
- })
- }
-
- func (c *DoctorsApiController) GetAllDoctor() {
- adminUserInfo := c.GetAdminUserInfo()
- orgid := adminUserInfo.CurrentOrgId
- appid := adminUserInfo.CurrentAppId
- fmt.Println("appid", appid)
- appRole, err := service.GetAllDoctor(orgid, appid)
- fmt.Println("appRole", appRole)
- fmt.Println("错误", err)
- c.ServeSuccessJSON(map[string]interface{}{
- "appRole": appRole,
- })
- }
-
- func (c *DoctorsApiController) UpdatedDryWeightData() {
- adminUserInfo := c.GetAdminUserInfo()
- orgid := adminUserInfo.CurrentOrgId
- userid := adminUserInfo.AdminUser.Id
-
- dry_weight, _ := c.GetFloat("dry_weight")
-
- doctors, _ := c.GetInt64("doctors")
-
- remarks := c.GetString("remarks")
-
- patientid, _ := c.GetInt64("patient_id")
-
- //透前数据
- dryweight, _ := c.GetFloat("dryweight")
-
- var weight = dryweight - dry_weight
- weights := fmt.Sprintf("%.1f", weight)
-
- var sum string
- _, errcode := service.QueryDryWeight(orgid, patientid)
-
- if errcode == gorm.ErrRecordNotFound {
- sum = "/"
- patientDryweight := models.SgjPatientDryweight{
- DryWeight: dry_weight,
- Creator: doctors,
- Remakes: remarks,
- AdjustedValue: sum,
- PatientId: patientid,
- Ctime: time.Now().Unix(),
- UserOrgId: orgid,
- Status: 1,
- UserId: userid,
- }
-
- err := service.CreatePatientWeight(&patientDryweight)
-
- loc, _ := time.LoadLocation("Local")
- nowTime := time.Now()
- nowDay := nowTime.Format("2006-01-02")
- dayTime, _ := time.ParseInLocation("2006-01-02 15:04:05", nowDay+" 00:00:00", loc)
- redis := service.RedisClient()
- keyTwo := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":last_dry_weight"
- redis.Set(keyTwo, "", time.Second)
-
- prescription := models.PredialysisEvaluation{
- DryWeight: dry_weight,
- AssessmentDate: dayTime.Unix(),
- }
- if orgid != 10016 && orgid != 9882 && orgid != 9671 {
- errors := service.UpdateDialysisPrescription(patientid, orgid, dryweight, prescription)
- fmt.Println(errors)
- }
-
- keyThree := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(dayTime.Unix(), 10) + ":assessment_before_dislysis"
- redis.Set(keyThree, "", time.Second)
- keyFive := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(dayTime.Unix(), 10) + ":assessment_befores_list_all"
- redis.Set(keyFive, "", time.Second)
- redis.Close()
- fmt.Println("err", err)
- c.ServeSuccessJSON(map[string]interface{}{
- "patientDryweight": patientDryweight,
- })
- return
- }
- fmt.Println("sum", sum)
- if weight == 0 {
- sum = "/"
- }
- if weight > 0 {
- sum = weights + "(" + "下调" + ")"
-
- }
- if weight < 0 {
- var sums = dry_weight - dryweight
- float := fmt.Sprintf("%.1f", sums)
- //float := strconv.FormatFloat(sums, 'E', -1, 64)
- sum = float + "(" + "上调" + ")"
- }
-
- patientDryweight := models.SgjPatientDryweight{
- DryWeight: dry_weight,
- Creator: doctors,
- Remakes: remarks,
- AdjustedValue: sum,
- PatientId: patientid,
- Ctime: time.Now().Unix(),
- UserOrgId: orgid,
- Status: 1,
- UserId: userid,
- }
-
- err := service.CreatePatientWeight(&patientDryweight)
-
- recordDateStr := time.Now().Format("2006-01-02")
- recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
- fmt.Scan("parseDateErr", parseDateErr)
- nowtime := recordDate.Unix()
- fmt.Println("nowtime", nowtime)
- loc, _ := time.LoadLocation("Local")
- nowTime := time.Now()
- nowDay := nowTime.Format("2006-01-02")
- dayTime, _ := time.ParseInLocation("2006-01-02 15:04:05", nowDay+" 00:00:00", loc)
- redis := service.RedisClient()
-
- keyTwo := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":last_dry_weight"
- redis.Set(keyTwo, "", time.Second)
-
- prescription := models.PredialysisEvaluation{
- DryWeight: dry_weight,
- AssessmentDate: dayTime.Unix(),
- }
- if orgid != 10016 && orgid != 9882 && orgid != 9671 {
-
- errors := service.UpdateDialysisPrescription(patientid, orgid, dryweight, prescription)
- fmt.Println(errors)
- }
-
- //康桥
- if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10721 {
- timeNowStr := time.Now().Format("2006-01-02")
- timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
-
- beforAssesment, _ := service.GetPatientAssesmentBefor(patientid, timeNewDate.Unix(), adminUserInfo.CurrentOrgId)
-
- dialysisPrescription, _ := service.GetPatientDialysisPrescription(patientid, timeNewDate.Unix(), adminUserInfo.CurrentOrgId)
-
- if beforAssesment.ID > 0 {
-
- service.UpdatePatientAssesmentBefor(beforAssesment.ID, dry_weight)
-
- var dewater_amount float64
-
- dewater_amount = beforAssesment.WeightBefore - dry_weight - beforAssesment.AdditionalWeight
-
- service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
- //获取key,清空redis
- key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_prescribe"
- redis := service.RedisClient()
-
- //清空key 值
- redis.Set(key, "", time.Second)
-
- keyOne := "scheduals_" + timeNowStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
- //清空key 值
- redis.Set(keyOne, "", time.Second)
-
- keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_solution"
- //清空key 值
- redis.Set(keyTwo, "", time.Second)
-
- keySix := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":prescriptions_list_all"
- redis.Set(keySix, "", time.Second)
-
- keySeven := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":dialysis_prescribe_by_mode"
- redis.Set(keySeven, "", time.Second)
- }
-
- }
-
- key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(dayTime.Unix(), 10) + ":assessment_before_dislysis"
- redis.Set(key, "", time.Second)
- keySix := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(dayTime.Unix(), 10) + ":assessment_befores_list_all"
- redis.Set(keySix, "", time.Second)
- fmt.Println("err", err)
- redis.Close()
- c.ServeSuccessJSON(map[string]interface{}{
- "patientDryweight": patientDryweight,
- })
- }
-
- func (c *DoctorsApiController) GetAllData() {
- id, _ := c.GetInt64("id")
- page, _ := c.GetInt64("page")
- fmt.Println("page", page)
- limit, _ := c.GetInt64("limit")
- fmt.Println("limit", limit)
-
- fmt.Println("id", id)
- adminUserInfo := c.GetAdminUserInfo()
- orgid := adminUserInfo.CurrentOrgId
- dry, total, _ := service.GetAllData(orgid, id, page, limit)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "dry": dry,
- "total": total,
- })
- }
-
- func (c *DoctorsApiController) GetDryWeightDetail() {
-
- id, _ := c.GetInt64("id")
- dryweight, _ := service.GetDryWeightDetailById(id)
- c.ServeSuccessJSON(map[string]interface{}{
- "dryweight": dryweight,
- })
- }
-
- func (c *DoctorsApiController) ModifydryWeightData() {
-
- adjustvalue := c.GetString("adjustvalue")
-
- creator, _ := c.GetInt64("creator")
-
- dryweight, _ := c.GetInt64("dryweight")
- dry := strconv.FormatInt(dryweight, 10)
- dry_weight, _ := strconv.ParseFloat(dry, 64)
- id, _ := c.GetInt64("id")
-
- remark := c.GetString("remark")
-
- patientDryweight := models.SgjPatientDryweight{
- AdjustedValue: adjustvalue,
- Creator: creator,
- DryWeight: dry_weight,
- Remakes: remark,
- }
- service.ModifyDryWeightData(&patientDryweight, id)
- c.ServeSuccessJSON(map[string]interface{}{
- "patientDryweight": patientDryweight,
- })
- }
-
- func (c *DoctorsApiController) DeleteDryWeight() {
-
- id, _ := c.GetInt64("id")
- service.DeleteDryWeight(id)
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- c.ServeSuccessJSON(returnData)
- return
- }
-
- func (c *DoctorsApiController) GetDoctorAdviceCount() {
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- start_time := c.GetString("start_time")
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
-
- end_time := c.GetString("end_time")
- endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
-
- delive_way := c.GetString("delive_way")
- adminUserInfo := c.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- list, _ := service.GetDoctorAdviceCount(startTime.Unix(), endTime.Unix(), delive_way, orgId)
- if len(list) == 0 {
- list, _ := service.GetHisDoctorAdviceCount(startTime.Unix(), endTime.Unix(), delive_way, orgId)
- c.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
-
- }
-
- func (this *DoctorsApiController) SaveVasularAccess() {
-
- access_project, _ := this.GetInt64("access_project")
- blood_access_part_id := this.GetString("blood_access_part_id")
- blood_access_part_opera_id := this.GetString("blood_access_part_opera_id")
- first_start_time := this.GetString("first_start_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- firstStartTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", first_start_time+" 00:00:00", loc)
- inflow_pass := this.GetString("inflow_pass")
- remark := this.GetString("remark")
- start_time := this.GetString("start_time")
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- stop_reason := this.GetString("stop_reason")
- user_status, _ := this.GetInt64("user_status")
- stop_time := this.GetString("stop_time")
- stopTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", stop_time+" 00:00:00", loc)
- patient_id, _ := this.GetInt64("patient_id")
- other_vascular := this.GetString("other_vascular")
- ci_type, _ := this.GetInt64("ci_type")
- blood_cultupe, _ := this.GetInt64("blood_cultupe")
- sequelae_type, _ := this.GetInt64("sequelae_type")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- creator := adminUserInfo.AdminUser.Id
-
- //查询改日期是否存在
- access := models.XtPatientVascularAccess{
- AccessProject: access_project,
- BloodAccessPartId: blood_access_part_id,
- BloodAccessPartOperaId: blood_access_part_opera_id,
- FirstStartTime: firstStartTime.Unix(),
- InflowPass: inflow_pass,
- Remark: remark,
- StartTime: startTime.Unix(),
- StopReason: stop_reason,
- UserStatus: user_status,
- Creator: creator,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- StopTime: stopTime.Unix(),
- PatientId: patient_id,
- OtherVascular: other_vascular,
- CiType: ci_type,
- BloodCultupe: blood_cultupe,
- SequelaeType: sequelae_type,
- }
- err := service.SaveVascularAccess(&access)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "access": access,
- })
- return
- //_, errcode := service.GetDialysisDateByDate(startTime.Unix(), patient_id, orgId)
- //if errcode == gorm.ErrRecordNotFound {
- // access := models.XtPatientVascularAccess{
- // AccessProject: access_project,
- // BloodAccessPartId: blood_access_part_id,
- // BloodAccessPartOperaId: blood_access_part_opera_id,
- // FirstStartTime: firstStartTime.Unix(),
- // InflowPass: inflow_pass,
- // Remark: remark,
- // StartTime: startTime.Unix(),
- // StopReason: stop_reason,
- // UserStatus: user_status,
- // Creator: creator,
- // UserOrgId: orgId,
- // Status: 1,
- // Ctime: time.Now().Unix(),
- // StopTime: stopTime.Unix(),
- // PatientId: patient_id,
- // OtherVascular: other_vascular,
- // CiType: ci_type,
- // BloodCultupe: blood_cultupe,
- // SequelaeType: sequelae_type,
- // }
- // err := service.SaveVascularAccess(&access)
- // if err == nil {
- // this.ServeSuccessJSON(map[string]interface{}{
- // "access": access,
- // })
- // return
- // }
- //} else if errcode == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
- // return
- }
-
- }
-
- func (this *DoctorsApiController) GetAllVacualAccessList() {
-
- limit, _ := this.GetInt64("limit")
- page, _ := this.GetInt64("page")
- patient_id, _ := this.GetInt64("patient_id")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- appId := this.GetAdminUserInfo().CurrentAppId
- list, total, err := service.GetAllVacualAccessList(orgId, limit, page, patient_id)
- doctor, err := service.GetAllDoctor(orgId, appId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- "doctor": doctor,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetVascularAccessByDetail() {
-
- id, _ := this.GetInt64("id")
-
- accessDetail, err := service.GetVasularAccessByDetail(id)
- orgId := this.GetAdminUserInfo().CurrentOrgId
- appId := this.GetAdminUserInfo().CurrentAppId
- doctor, err := service.GetAllDoctor(orgId, appId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "accessDetail": accessDetail,
- "doctor": doctor,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) UpdateVasularAccess() {
- id, _ := this.GetInt64("id")
- access_project, _ := this.GetInt64("access_project")
- blood_access_part_id := this.GetString("blood_access_part_id")
- blood_access_part_opera_id := this.GetString("blood_access_part_opera_id")
- first_start_time := this.GetString("first_start_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- firstStartTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", first_start_time+" 00:00:00", loc)
- inflow_pass := this.GetString("inflow_pass")
- remark := this.GetString("remark")
- start_time := this.GetString("start_time")
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- stop_reason := this.GetString("stop_reason")
- user_status, _ := this.GetInt64("user_status")
- stop_time := this.GetString("stop_time")
- stopTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", stop_time+" 00:00:00", loc)
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- creator := adminUserInfo.AdminUser.Id
- patientId, _ := this.GetInt64("patient_id")
- other_vascular := this.GetString("other_vascular")
- ci_type, _ := this.GetInt64("ci_type")
- blood_cultupe, _ := this.GetInt64("blood_cultupe")
- sequelae_type, _ := this.GetInt64("sequelae_type")
- access := models.XtPatientVascularAccess{
- AccessProject: access_project,
- BloodAccessPartId: blood_access_part_id,
- BloodAccessPartOperaId: blood_access_part_opera_id,
- FirstStartTime: firstStartTime.Unix(),
- InflowPass: inflow_pass,
- Remark: remark,
- StartTime: startTime.Unix(),
- StopReason: stop_reason,
- UserStatus: user_status,
- Modify: creator,
- UserOrgId: orgId,
- Status: 1,
- StopTime: stopTime.Unix(),
- OtherVascular: other_vascular,
- CiType: ci_type,
- BloodCultupe: blood_cultupe,
- SequelaeType: sequelae_type,
- PatientId: patientId,
- }
-
- err := service.UpdateVascularAccess(&access, id)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "access": access,
- })
- return
- }
- //_, errcode := service.GetDialysisDateByDateOne(startTime.Unix(), patientId, orgId, id)
- //if errcode == gorm.ErrRecordNotFound {
- // err := service.UpdateVascularAccess(&access, id)
- // if err == nil {
- // this.ServeSuccessJSON(map[string]interface{}{
- // "access": access,
- // })
- // return
- // }
- //} else if errcode == nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
- // return
- //}
-
- }
-
- func (this *DoctorsApiController) DeleteVasularAccess() {
- id, _ := this.GetInt64("id")
- err := service.DeleteVasularAccess(id)
- fmt.Println(err)
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *DoctorsApiController) SavePassWayAssessment() {
-
- blood_dealwidth := this.GetString("blood_dealwith")
- blood_project := this.GetString("blood_project")
- blood_result := this.GetString("blood_result")
- creator, _ := this.GetInt64("creator")
- parent_id, _ := this.GetInt64("parent_id")
- patient_id, _ := this.GetInt64("patient_id")
- start_time := this.GetString("start_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- modify := this.GetAdminUserInfo().AdminUser.Id
- orgId := this.GetAdminUserInfo().CurrentOrgId
- assessment := models.XtPatientPasswayAssessment{
- StartTime: startTime.Unix(),
- BloodDealwith: blood_dealwidth,
- BloodProject: blood_project,
- BloodResult: blood_result,
- Creator: creator,
- PatientId: patient_id,
- ParentId: parent_id,
- Modify: modify,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
-
- err := service.CreatePatientWayAssessment(&assessment)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "assessment": assessment,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetAllPassWayAssessment() {
-
- patient_id, _ := this.GetInt64("patient_id")
- parent_id, _ := this.GetInt64("parent_id")
- page, _ := this.GetInt64("page")
- limit, _ := this.GetInt64("limit")
- adminUserInfo := this.GetAdminUserInfo()
- list, total, err := service.GetAllPassWayAssessment(parent_id, patient_id, page, limit, adminUserInfo.CurrentOrgId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetPasswayAssesmentById() {
-
- id, _ := this.GetInt64("id")
- assessment, err := service.GetPasswayAssesmentById(id)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "assessment": assessment,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) UpdatePassWayAssesment() {
- id, _ := this.GetInt64("id")
- blood_dealwidth := this.GetString("blood_dealwith")
- blood_project := this.GetString("blood_project")
- blood_result := this.GetString("blood_result")
- creator, _ := this.GetInt64("creator")
- start_time := this.GetString("start_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- modify := this.GetAdminUserInfo().AdminUser.Id
- assessment := models.XtPatientPasswayAssessment{
- BloodResult: blood_result,
- BloodDealwith: blood_dealwidth,
- BloodProject: blood_project,
- Creator: creator,
- StartTime: startTime.Unix(),
- Modify: modify,
- }
- err := service.UpdatePassWayAssesment(&assessment, id)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "assessment": assessment,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) DeleteWayAssessment() {
-
- id, _ := this.GetInt64("id")
- err := service.DeleteWayAssessment(id)
- fmt.Println(err)
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *DoctorsApiController) GetAccessList() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- //血管通路
- list, err := service.GetAccessList(orgId)
- blood_access_part_opera, err := service.GetParentAccessList(orgId, list.ID)
-
- //血管通路部位
- access, err := service.GetBloodAccess(orgId)
- blood_access_part, err := service.GetParentAccessList(orgId, access.ID)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "blood_access_part_opera": blood_access_part_opera,
- "blood_access_part": blood_access_part,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetInspectionMajorItem() {
-
- other_start_time := this.GetString("other_start_time")
- last_time := this.GetString("last_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", other_start_time+" 23:59:59", loc)
- lastTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", last_time+" 00:00:00", loc)
- patient_id, _ := this.GetInt64("patient_id")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- list, err := service.GetInspectionMajorItem(startTime.Unix(), lastTime.Unix(), orgId, patient_id)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetInspectionDetailByProject() {
-
- project_id, _ := this.GetInt64("project_id")
- patient_id, _ := this.GetInt64("patient_id")
- inspect_date, _ := this.GetInt64("inspect_date")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- list, err := service.GetInspectionDetailByProject(project_id, patient_id, inspect_date, orgId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetInspectionItemlist() {
- patient_id, _ := this.GetInt64("patient_id")
- ids := this.GetString("ids")
- inspect_date := this.GetString("inspect_date")
- idSplit := strings.Split(ids, ",")
- indateSplit := strings.Split(inspect_date, ",")
- list, err := service.GetInspectionItemlist(patient_id, indateSplit, idSplit)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetInitDateList() {
- patient_id, _ := this.GetInt64("patient_id")
- start_time := this.GetString("start_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- end_time := this.GetString("end_time")
- endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
-
- prescription_list, _ := service.GetDialysisPrescriptionDataList(patient_id, startTime.Unix(), endTime.Unix())
- befor_list, err := service.GetDialysisBeforInitDateList(patient_id, startTime.Unix(), endTime.Unix())
- after_list, err := service.GetDialysisAssementAfter(patient_id, startTime.Unix(), endTime.Unix())
- orgId := this.GetAdminUserInfo().CurrentOrgId
- //统计透析次数
- modelist, err := service.GetDialysisDialysisMode(patient_id, startTime.Unix(), endTime.Unix(), orgId)
-
- docList, _ := service.GetAllDoctorThree(orgId)
- stockType, err := service.GetStockType(orgId)
-
- summaryList, err := service.GetTemplateSummary(orgId)
- planList, err := service.GetTemplatePlan(orgId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "beforlist": befor_list,
- "prescription_list": prescription_list,
- "after_list": after_list,
- "modelist": modelist,
- "docList": docList,
- "stockType": stockType,
- "summaryList": summaryList,
- "planList": planList,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) SaveCreationInspection() {
-
- 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
- }
- title := dataBody["title"].(string)
- dryWeight := dataBody["dry_weight"].(string)
- dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
- dialysis_count := int64(dataBody["dialysis_count"].(float64))
- hd_count := int64(dataBody["hd_count"].(float64))
- hdf_count := int64(dataBody["hdf_count"].(float64))
- hp_count := int64(dataBody["hp_count"].(float64))
- other_count := int64(dataBody["other_count"].(float64))
- dialzer_apparatus := dataBody["dialzer_apparatus"].(string)
- perfusion_apparatus := dataBody["perfusion_apparatus"].(string)
- anticoagulant := int64(dataBody["anticoagulant"].(float64))
- kaliumstr := dataBody["kalium"].(string)
- kalium, _ := strconv.ParseFloat(kaliumstr, 64)
- autunitestr := dataBody["autunite"].(string)
- autunite, _ := strconv.ParseFloat(autunitestr, 64)
- natriumstr := dataBody["natrium"].(string)
- natrium, _ := strconv.ParseFloat(natriumstr, 64)
- hour := int64(dataBody["hour"].(float64))
- minute := int64(dataBody["minute"].(float64))
- beforWeight := dataBody["befor_weight"].(string)
- befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
- afterWeight := dataBody["after_weight"].(string)
- after_weight, _ := strconv.ParseFloat(afterWeight, 64)
- befor_pressure := dataBody["befor_pressure"].(string)
- template_summary_content := dataBody["template_summary_content"].(string)
- template_plan_content := dataBody["template_plan_content"].(string)
- admin_user_id := int64(dataBody["admin_user_id"].(float64))
- record_time := dataBody["record_time"].(string)
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
- after_pressure := dataBody["after_pressure"].(string)
- template_summary_id := int64(dataBody["template_summary_id"].(float64))
- template_plan_id := int64(dataBody["template_plan_id"].(float64))
- patient_id := int64(dataBody["patient_id"].(float64))
- orgId := this.GetAdminUserInfo().CurrentOrgId
- inspect_date := dataBody["inspect_date"].(string)
- project_id := dataBody["project_id"].(string)
- template_inspection_id := int64(dataBody["template_inspection_id"].(float64))
-
- summary := models.XtTemplateSummary{
- StartYear: 0,
- StartMonth: 0,
- Radio: 0,
- Quarter: 0,
- DryWeight: dry_weight,
- DialysisCount: dialysis_count,
- HdCount: hd_count,
- HdfCount: hdf_count,
- HpCount: hp_count,
- OtherCount: other_count,
- DialzerApparatus: dialzer_apparatus,
- PerfusionApparatus: perfusion_apparatus,
- Anticoagulant: anticoagulant,
- Kalium: kalium,
- Autunite: autunite,
- Natrium: natrium,
- Hour: hour,
- Minute: minute,
- BeforWeight: befor_weight,
- AfterWeight: after_weight,
- BeforPressure: befor_pressure,
- AfterPressure: after_pressure,
- TemplateSummaryId: template_summary_id,
- TemplateSummaryContent: template_summary_content,
- TemplatePlanId: template_plan_id,
- TemplatePlanContent: template_plan_content,
- TemplateInspectionId: template_inspection_id,
- AdminUserId: admin_user_id,
- RecordTime: recordTime.Unix(),
- PatientId: patient_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Title: title,
- InspectDate: inspect_date,
- ProjectId: project_id,
- }
-
- err = service.CreateSummary(&summary)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "summary": summary,
- })
- return
- }
-
- }
-
- func (this *DoctorsApiController) GetTemplateSummaryList() {
- patient_id, _ := this.GetInt64("patient_id")
- start_time := this.GetString("start_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- end_time := this.GetString("end_time")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
-
- list, err := service.GetTemplateSummaryList(patient_id, orgId, startTime.Unix(), endTime.Unix())
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetTemplateSummaryDetail() {
-
- id, _ := this.GetInt64("id")
- list, err := service.GetTemplateSummaryDetail(id)
-
- ids := strings.Split(list.ProjectId, ",")
- datelist := strings.Split(list.InspectDate, ",")
- inspectlist, err := service.GetInspectionItemlist(list.PatientId, datelist, ids)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "inspectlist": inspectlist,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetTemplateSummaryPrintDetail() {
-
- id, _ := this.GetInt64("id")
- list, err := service.GetTemplateSummaryPrintDetail(id)
- ids := strings.Split(list.ProjectId, ",")
- datelist := strings.Split(list.InspectDate, ",")
- inspectlist, err := service.GetInspectionItemlist(list.PatientId, datelist, ids)
- orgId := this.GetAdminUserInfo().CurrentOrgId
- doctorList, _ := service.GetAllDoctorThree(orgId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "doctorList": doctorList,
- "inspectlist": inspectlist,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) UpdateTempalteSummary() {
-
- 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
- }
- id := int64(dataBody["id"].(float64))
- title := dataBody["title"].(string)
- dryWeight := dataBody["dry_weight"].(string)
- dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
- dialysis_count := int64(dataBody["dialysis_count"].(float64))
- hd_count := int64(dataBody["hd_count"].(float64))
- hdf_count := int64(dataBody["hdf_count"].(float64))
- hp_count := int64(dataBody["hp_count"].(float64))
- other_count := int64(dataBody["other_count"].(float64))
- dialzer_apparatus := dataBody["dialzer_apparatus"].(string)
- perfusion_apparatus := dataBody["perfusion_apparatus"].(string)
- anticoagulant := int64(dataBody["anticoagulant"].(float64))
- kaliumstr := dataBody["kalium"].(string)
- kalium, _ := strconv.ParseFloat(kaliumstr, 64)
- autunitestr := dataBody["autunite"].(string)
- autunite, _ := strconv.ParseFloat(autunitestr, 64)
- natriumstr := dataBody["natrium"].(string)
- natrium, _ := strconv.ParseFloat(natriumstr, 64)
- hour := int64(dataBody["hour"].(float64))
- minute := int64(dataBody["minute"].(float64))
- beforWeight := dataBody["befor_weight"].(string)
- befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
- afterWeight := dataBody["after_weight"].(string)
- after_weight, _ := strconv.ParseFloat(afterWeight, 64)
- befor_pressure := dataBody["befor_pressure"].(string)
- template_summary_content := dataBody["template_summary_content"].(string)
- template_plan_content := dataBody["template_plan_content"].(string)
- admin_user_id := int64(dataBody["admin_user_id"].(float64))
- record_time := dataBody["record_time"].(string)
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
- after_pressure := dataBody["after_pressure"].(string)
- template_summary_id := int64(dataBody["template_summary_id"].(float64))
- template_plan_id := int64(dataBody["template_plan_id"].(float64))
- patient_id := int64(dataBody["patient_id"].(float64))
- orgId := this.GetAdminUserInfo().CurrentOrgId
- inspect_date := dataBody["inspect_date"].(string)
- project_id := dataBody["project_id"].(string)
- template_inspection_id := int64(dataBody["template_inspection_id"].(float64))
- //dryWeight := this.GetString("dry_weight")
- //dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
- //dialysis_count, _ := this.GetInt64("dialysis_count")
- //hd_count, _ := this.GetInt64("hd_count")
- //hdf_count, _ := this.GetInt64("hdf_count")
- //hp_count, _ := this.GetInt64("hp_count")
- //other_count, _ := this.GetInt64("other_count")
- //dialzer_apparatus := this.GetString("dialzer_apparatus")
- //perfusion_apparatus := this.GetString("perfusion_apparatus")
- //anticoagulant, _ := this.GetInt64("anticoagulant")
- //kaliumstr := this.GetString("kalium")
- //kalium, _ := strconv.ParseFloat(kaliumstr, 64)
- //
- //autunitestr := this.GetString("autunite")
- //autunite, _ := strconv.ParseFloat(autunitestr, 64)
- //natriumstr := this.GetString("natrium")
- //natrium, _ := strconv.ParseFloat(natriumstr, 64)
- //hour, _ := this.GetInt64("hour")
- //minute, _ := this.GetInt64("minute")
- //beforWeight := this.GetString("befor_weight")
- //befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
- //afterWeight := this.GetString("after_weight")
- //after_weight, _ := strconv.ParseFloat(afterWeight, 64)
- //befor_pressure := this.GetString("befor_pressure")
- //template_summary_content := this.GetString("template_summary_content")
- //template_plan_content := this.GetString("template_plan_content")
- //admin_user_id, _ := this.GetInt64("admin_user_id")
- //record_time := this.GetString("record_time")
- //timeLayout := "2006-01-02"
- //loc, _ := time.LoadLocation("Local")
- //recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
- //after_pressure := this.GetString("after_pressure")
- //template_summary_id, _ := this.GetInt64("template_summary_id")
- //template_plan_id, _ := this.GetInt64("template_plan_id")
- //template_inspection_id, _ := this.GetInt64("template_inspection_id")
- //patient_id, _ := this.GetInt64("patient_id")
- //fmt.Println("patient_id", patient_id)
- //orgId := this.GetAdminUserInfo().CurrentOrgId
- //inspect_date := this.GetString("inspect_date")
- //project_id := this.GetString("project_id")
- summary := models.XtTemplateSummary{
- ID: id,
- StartYear: 0,
- StartMonth: 0,
- Radio: 0,
- Quarter: 0,
- DryWeight: dry_weight,
- DialysisCount: dialysis_count,
- HdCount: hd_count,
- HdfCount: hdf_count,
- HpCount: hp_count,
- OtherCount: other_count,
- DialzerApparatus: dialzer_apparatus,
- PerfusionApparatus: perfusion_apparatus,
- Anticoagulant: anticoagulant,
- Kalium: kalium,
- Autunite: autunite,
- Natrium: natrium,
- Hour: hour,
- Minute: minute,
- BeforWeight: befor_weight,
- AfterWeight: after_weight,
- BeforPressure: befor_pressure,
- AfterPressure: after_pressure,
- TemplateSummaryId: template_summary_id,
- TemplateSummaryContent: template_summary_content,
- TemplatePlanId: template_plan_id,
- TemplatePlanContent: template_plan_content,
- TemplateInspectionId: template_inspection_id,
- AdminUserId: admin_user_id,
- RecordTime: recordTime.Unix(),
- PatientId: patient_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Title: title,
- ProjectId: project_id,
- InspectDate: inspect_date,
- }
- err = service.UpdateTempalteSummary(&summary)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": summary,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) DeleteSummary() {
-
- ids := this.GetString("ids")
- idsplit := strings.Split(ids, ",")
- err := service.DeleteSummary(idsplit)
- fmt.Println(err)
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *DoctorsApiController) HospitalSummary() {
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Print("err", err)
- admission_time := dataBody["admission_time"].(string)
- admissionTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", admission_time+" 00:00:00", loc)
- admissiontime := admissionTimes.Unix()
- admitting_diagnosis := dataBody["admitting_diagnosis"].(string)
- admitting_diagnosis_id := dataBody["admitting_diagnosis_id"].(string)
- connecticut := dataBody["connecticut"].(string)
- dean := int64(dataBody["dean"].(float64))
- discharge_diagnosis := dataBody["discharge_diagnosis"].(string)
- discharge_diagnosis_id := dataBody["discharge_diagnosis_id"].(string)
- diagnosis_admission := dataBody["diagnosis_admission"].(string)
- diagnosis_admission_id := dataBody["diagnosis_admission_id"].(string)
- discharge_advice_id := dataBody["discharge_advice_id"].(string)
- discharge_advice := dataBody["discharge_advice"].(string)
- discharge_time := dataBody["discharge_time"].(string)
-
- dischargeTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", discharge_time+" 00:00:00", loc)
- dischargetime := dischargeTimes.Unix()
- doctor := int64(dataBody["doctor"].(float64))
- illness_discharge_id := dataBody["illness_discharge_id"].(string)
- illness_discharge := dataBody["illness_discharge"].(string)
- nuclear_magnetic_resonance := dataBody["nuclear_magnetic_resonance"].(string)
- pathology := dataBody["pathology"].(string)
- record_date := dataBody["record_date"].(string)
- recordDates, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- recordtime := recordDates.Unix()
- sick_personnel := dataBody["sick_personnel"].(string)
- title := dataBody["title"].(string)
- treatment_id := dataBody["treatment_id"].(string)
- treatment := dataBody["treatment"].(string)
- ultrasound := dataBody["ultrasound"].(string)
- xray := dataBody["xray"].(string)
- patient_id := int64(dataBody["patient_id"].(float64))
- orgId := this.GetAdminUserInfo().CurrentOrgId
- summary := models.XtHospitalSummary{
- PatientId: patient_id,
- AdmissionTime: admissiontime,
- DischargeTime: dischargetime,
- SickPersonnel: sick_personnel,
- Xray: xray,
- Connecticut: connecticut,
- NuclearMagneticResonance: nuclear_magnetic_resonance,
- Ultrasound: ultrasound,
- Pathology: pathology,
- AdmittingDiagnosisId: admitting_diagnosis_id,
- AdmittingDiagnosis: admitting_diagnosis,
- DischargeDiagnosis: discharge_diagnosis,
- DiagnosisAdmissionId: diagnosis_admission_id,
- DiagnosisAdmission: diagnosis_admission,
- TreatmentId: treatment_id,
- Treatment: treatment,
- IllnessDischargeId: illness_discharge_id,
- IllnessDischarge: illness_discharge,
- DischargeAdviceId: discharge_advice_id,
- DischargeAdvice: discharge_advice,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- RecordTime: recordtime,
- Title: title,
- Doctor: doctor,
- RecordDate: recordtime,
- DeanId: dean,
- DischargeDiagnosisId: discharge_diagnosis_id,
- }
- service.CreateHisSummary(&summary)
- this.ServeSuccessJSON(map[string]interface{}{
- "list": summary,
- })
- return
- }
-
- func (this *DoctorsApiController) GetHospitalSummaryList() {
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- patient_id, _ := 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+" 00:00:00", loc)
- endtime := endTimes.Unix()
- list, err := service.GetHospitalSummaryList(orgId, patient_id, startime, endtime)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) GetHospitalSummaryDetail() {
-
- id, _ := this.GetInt64("id")
- detail, err := service.GetHospitalSummaryDetail(id)
- orgId := this.GetAdminUserInfo().CurrentOrgId
- operators, err := service.GetAdminUserEsOne(orgId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "detail": detail,
- "operators": operators,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) UpdateHospitalSummary() {
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Print("err", err)
- admission_time := dataBody["admission_time"].(string)
- admissionTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", admission_time+" 00:00:00", loc)
- admissiontime := admissionTimes.Unix()
- admitting_diagnosis := dataBody["admitting_diagnosis"].(string)
- admitting_diagnosis_id := dataBody["admitting_diagnosis_id"].(string)
- connecticut := dataBody["connecticut"].(string)
- dean := int64(dataBody["dean"].(float64))
- discharge_diagnosis := dataBody["discharge_diagnosis"].(string)
- discharge_diagnosis_id := dataBody["discharge_diagnosis_id"].(string)
- diagnosis_admission := dataBody["diagnosis_admission"].(string)
- diagnosis_admission_id := dataBody["diagnosis_admission_id"].(string)
- discharge_advice_id := dataBody["discharge_advice_id"].(string)
- discharge_advice := dataBody["discharge_advice"].(string)
- discharge_time := dataBody["discharge_time"].(string)
-
- dischargeTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", discharge_time+" 00:00:00", loc)
- dischargetime := dischargeTimes.Unix()
- doctor := int64(dataBody["doctor"].(float64))
- illness_discharge_id := dataBody["illness_discharge_id"].(string)
- illness_discharge := dataBody["illness_discharge"].(string)
- nuclear_magnetic_resonance := dataBody["nuclear_magnetic_resonance"].(string)
- pathology := dataBody["pathology"].(string)
- record_date := dataBody["record_date"].(string)
- recordDates, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- recordtime := recordDates.Unix()
- sick_personnel := dataBody["sick_personnel"].(string)
- title := dataBody["title"].(string)
- treatment_id := dataBody["treatment_id"].(string)
- treatment := dataBody["treatment"].(string)
- ultrasound := dataBody["ultrasound"].(string)
- xray := dataBody["xray"].(string)
- patient_id := int64(dataBody["patient_id"].(float64))
- id := int64(dataBody["id"].(float64))
- summary := models.XtHospitalSummary{
- PatientId: patient_id,
- AdmissionTime: admissiontime,
- DischargeTime: dischargetime,
- SickPersonnel: sick_personnel,
- Xray: xray,
- Connecticut: connecticut,
- NuclearMagneticResonance: nuclear_magnetic_resonance,
- Ultrasound: ultrasound,
- Pathology: pathology,
- AdmittingDiagnosisId: admitting_diagnosis_id,
- AdmittingDiagnosis: admitting_diagnosis,
- DischargeDiagnosis: discharge_diagnosis,
- DiagnosisAdmissionId: diagnosis_admission_id,
- DiagnosisAdmission: diagnosis_admission,
- TreatmentId: treatment_id,
- Treatment: treatment,
- IllnessDischargeId: illness_discharge_id,
- IllnessDischarge: illness_discharge,
- DischargeAdviceId: discharge_advice_id,
- DischargeAdvice: discharge_advice,
- Mtime: time.Now().Unix(),
- RecordTime: recordtime,
- Title: title,
- Doctor: doctor,
- RecordDate: recordtime,
- DeanId: dean,
- DischargeDiagnosisId: discharge_diagnosis_id,
- }
- err = service.UpdateHospital(id, summary)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "detail": summary,
- })
- return
- }
- }
-
- func (this *DoctorsApiController) DeleteHospitalSummary() {
-
- schIDStr := this.GetString("ids")
- idStrs := strings.Split(schIDStr, ",")
- err := service.DeleteHospitalSummary(idStrs)
- fmt.Println(err)
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *DoctorsApiController) GetPatientInfo() {
-
- patient_id, _ := this.GetInt64("patient_id")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- detail, err := service.GetPatientDetail(patient_id, orgId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "patient": detail,
- })
- return
- }
- }
-
- func (c *DoctorsApiController) GetScheduleAdvicesList() {
-
- schedualDate := c.GetString("date")
- adviceType, _ := c.GetInt("advice_type")
- patientType, _ := c.GetInt("patient_type")
- delivery_way := c.GetString("delivery_way")
- schedule_type, _ := c.GetInt64("schedule_type")
- partition_type, _ := c.GetInt64("partition_type")
- patient_id, _ := c.GetInt64("patient_id")
- excution_way, _ := c.GetInt64("excution_way")
- cost_type, _ := c.GetInt64("cost_type")
- execution_frequency := c.GetString("execution_frequency")
- keyword := c.GetString("keyword")
- if adviceType != 1 && adviceType != 3 && adviceType != 2 {
- adviceType = 0
- }
-
- if patientType != 1 && patientType != 2 {
-
- patientType = 0
- }
-
- date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
- if parseDateErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
- orgID := adminUserInfo.CurrentOrgId
-
- config, _ := service.GetHisDoctorConfig(orgID)
- project_config, _ := service.GetHisProjectConfig(orgID)
-
- if config.IsOpen == 0 || config.IsOpen == 2 {
- scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, cost_type, execution_frequency, keyword)
- adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
- if err != nil {
- c.ErrorLog("获取排班信息失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- } else {
- filtedScheduals := []*service.MScheduleDoctorAdviceVM{}
- for _, schedual := range scheduals {
- if len(schedual.DoctorAdvices) > 0 {
- filtedScheduals = append(filtedScheduals, schedual)
- }
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "scheduals": filtedScheduals,
- "adminUser": adminUser,
- "config": config,
- "project_config": project_config,
- })
- }
- }
- if config.IsOpen == 1 {
- hisAdvices, err := service.GetHisDoctorAdvicesTwentyOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way, cost_type, execution_frequency)
- adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
- project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id, excution_way)
- for _, item := range project {
- index := 0
- for _, subItem := range item.HisPrescriptionTeamProject {
-
- if subItem.HisProject.CostClassify != 3 {
- subItem.IsCheckTeam = 2
- item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
- }
-
- if subItem.HisProject.CostClassify == 3 {
- subItem.IsCheckTeam = 1
- index = index + 1
- if index == 1 {
- item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
- }
- }
- }
- }
-
- if err != nil {
- c.ErrorLog("获取排班信息失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "adminUser": adminUser,
- "hisAdvices": hisAdvices,
- "config": config,
- "project_config": project_config,
- "project": project,
- })
- }
- }
-
- }
-
- func (c *DoctorsApiController) CreateFirstDisease() {
-
- //timeLayout := "2006-01-02"
- //loc, _ := time.LoadLocation("Local")
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
- fmt.Print("err", err)
-
- doctor := int64(dataBody["doctor"].(float64))
- record_date := dataBody["record_date"].(string)
-
- recordDates, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", record_date)
- recordtime := recordDates.Unix()
-
- patient_id := int64(dataBody["patient_id"].(float64))
- title := dataBody["title"].(string)
- main_content := dataBody["main_content"].(string)
- patient_case := dataBody["patient_case"].(string)
- tentative_diagnosis := dataBody["tentative_diagnosis"].(string)
- diagnostic_basis := dataBody["diagnostic_basis"].(string)
- differential_diagnosis := dataBody["differential_diagnosis"].(string)
- treatment_plan := dataBody["treatment_plan"].(string)
- inspect_date := dataBody["inspect_date"].(string)
- project_id := dataBody["project_id"].(string)
- orgId := c.GetAdminUserInfo().CurrentOrgId
- firstdisease := models.XtPatientFirstDisease{
- Title: title,
- RecordDate: recordtime,
- Doctor: doctor,
- MainContent: main_content,
- PatientCase: patient_case,
- TentativeDiagnosis: tentative_diagnosis,
- DiagnosticBasis: diagnostic_basis,
- DifferentialDiagnosis: differential_diagnosis,
- TreatmentPlan: treatment_plan,
- UserOrgId: orgId,
- PatientId: patient_id,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Status: 1,
- ProjectId: project_id,
- InspectDate: inspect_date,
- }
-
- error := service.CreatePatientFirstDisease(firstdisease)
-
- if error == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "firstDisease": firstdisease,
- })
- }
- }
-
- func (c *DoctorsApiController) GetFirstDiseaseList() {
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- orgId := c.GetAdminUserInfo().CurrentOrgId
- patient_id, _ := c.GetInt64("patient_id")
- start_time := c.GetString("start_time")
-
- dischargeTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- startime := dischargeTimes.Unix()
-
- end_time := c.GetString("end_time")
- endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
- endtime := endTimes.Unix()
- list, err := service.GetPatientDiseaseList(orgId, patient_id, startime, endtime)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- return
- }
- }
-
- func (c *DoctorsApiController) GetFirstDetailById() {
-
- id, _ := c.GetInt64("id")
- list, err := service.GetFirstDetailById(id)
- ids := strings.Split(list.ProjectId, ",")
- datelist := strings.Split(list.InspectDate, ",")
- fmt.Println("list232323232323w", datelist)
- inspectlist, err := service.GetInspectionItemlist(list.PatientId, datelist, ids)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "detail": list,
- "inspectlist": inspectlist,
- })
- return
- }
- }
-
- func (c *DoctorsApiController) UpdateFirstDisease() {
-
- //timeLayout := "2006-01-02"
- //loc, _ := time.LoadLocation("Local")
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
- fmt.Print("err", err)
- id := int64(dataBody["id"].(float64))
- doctor := int64(dataBody["doctor"].(float64))
- record_date := dataBody["record_date"].(string)
- recordDates, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", record_date)
- recordtime := recordDates.Unix()
- patient_id := int64(dataBody["patient_id"].(float64))
- title := dataBody["title"].(string)
- main_content := dataBody["main_content"].(string)
- patient_case := dataBody["patient_case"].(string)
- tentative_diagnosis := dataBody["tentative_diagnosis"].(string)
- diagnostic_basis := dataBody["diagnostic_basis"].(string)
- differential_diagnosis := dataBody["differential_diagnosis"].(string)
- treatment_plan := dataBody["treatment_plan"].(string)
- inspect_date := dataBody["inspect_date"].(string)
- project_id := dataBody["project_id"].(string)
- orgId := c.GetAdminUserInfo().CurrentOrgId
- firstdisease := models.XtPatientFirstDisease{
- Title: title,
- RecordDate: recordtime,
- Doctor: doctor,
- MainContent: main_content,
- PatientCase: patient_case,
- TentativeDiagnosis: tentative_diagnosis,
- DiagnosticBasis: diagnostic_basis,
- DifferentialDiagnosis: differential_diagnosis,
- TreatmentPlan: treatment_plan,
- UserOrgId: orgId,
- PatientId: patient_id,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Status: 1,
- ID: id,
- InspectDate: inspect_date,
- ProjectId: project_id,
- }
-
- error := service.UpdatePatientFirstDisease(firstdisease, id)
-
- if error == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "firstDisease": firstdisease,
- })
- }
-
- }
-
- func (c *DoctorsApiController) DeleteFirstDisease() {
-
- schIDStr := c.GetString("ids")
- idStrs := strings.Split(schIDStr, ",")
- err := service.DeleteFirstDisease(idStrs)
- fmt.Println(err)
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- c.ServeSuccessJSON(returnData)
- return
- }
-
- func (c *DoctorsApiController) GetLongScheduleAdvicesList() {
-
- schedualDate := c.GetString("date")
- adviceType, _ := c.GetInt("advice_type")
- patientType, _ := c.GetInt("patient_type")
- delivery_way := c.GetString("delivery_way")
- schedule_type, _ := c.GetInt64("schedule_type")
- partition_type, _ := c.GetInt64("partition_type")
- patient_id, _ := c.GetInt64("patient_id")
- excution_way, _ := c.GetInt64("excution_way")
- cost_type, _ := c.GetInt64("cost_type")
- execution_frequency := c.GetString("execution_frequency")
- keyword := c.GetString("keyword")
- date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
- if parseDateErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- adminUserInfo := c.GetAdminUserInfo()
- orgID := adminUserInfo.CurrentOrgId
-
- scheduals, err := service.MobileGetLongScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, cost_type, execution_frequency, keyword)
-
- adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
- if err != nil {
- c.ErrorLog("获取排班信息失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- } else {
- filtedScheduals := []*service.MScheduleDoctorAdviceVM{}
- for _, schedual := range scheduals {
- if len(schedual.DoctorAdvices) > 0 {
- filtedScheduals = append(filtedScheduals, schedual)
- }
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "scheduals": filtedScheduals,
- "adminUser": adminUser,
- })
- }
-
- }
-
- func (c *DoctorsApiController) GetPatientByName() {
-
- keyword := c.GetString("keyword")
- orgId := c.GetAdminUserInfo().CurrentOrgId
- patients, _ := service.GetPatientByName(keyword, orgId)
- c.ServeSuccessJSON(map[string]interface{}{
- "patients": patients,
- })
- }
-
- func (c *DoctorsApiController) GetDoctorAdviceByPatientId() {
-
- patient_id, _ := c.GetInt64("patient_id")
- limit, _ := c.GetInt64("limit")
- page, _ := c.GetInt64("page")
- start_time := c.GetString("start_time")
- orgId := c.GetAdminUserInfo().CurrentOrgId
- end_time := c.GetString("end_time")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
-
- var startTimeUnix int64
- if len(start_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTimeUnix = theTime.Unix()
- }
-
- var endTimeUnix int64
- if len(end_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- endTimeUnix = theTime.Unix()
- }
-
- list, total, _ := service.GetDoctorAdviceByPatientId(patient_id, orgId, startTimeUnix, endTimeUnix, limit, page)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- })
- }
-
- func (c *DoctorsApiController) GetDoctorAdivceMonthList() {
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
-
- start_time := c.GetString("start_time")
- orgId := c.GetAdminUserInfo().CurrentOrgId
- end_time := c.GetString("end_time")
- var startTimeUnix int64
- if len(start_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTimeUnix = theTime.Unix()
- }
-
- var endTimeUnix int64
- if len(end_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- endTimeUnix = theTime.Unix()
- }
-
- adviceList, _ := service.GetDoctorAdivceMonthList(orgId, startTimeUnix, endTimeUnix)
-
- hisAdviceList, _ := service.GetHisDoctorAdivceMonthList(orgId, startTimeUnix, endTimeUnix)
-
- drugs, _ := service.GetAllBaseDrugLibList(orgId)
-
- manufacturerList, _ := service.GetAllManufacturerList(orgId)
-
- _, config := service.FindXTHisRecordByOrgId(orgId)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "adviceList": adviceList,
- "hisAdviceList": hisAdviceList,
- "config": config,
- "drugs": drugs,
- "manufacturerList": manufacturerList,
- })
- }
-
- func (c *DoctorsApiController) GetHisPrescriptionProjectMonthList() {
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
-
- start_time := c.GetString("start_time")
- orgId := c.GetAdminUserInfo().CurrentOrgId
- end_time := c.GetString("end_time")
- var startTimeUnix int64
- if len(start_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTimeUnix = theTime.Unix()
- }
-
- var endTimeUnix int64
- if len(end_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- endTimeUnix = theTime.Unix()
- }
-
- projectMonthList, _ := service.GetHisPrescriptionProjectMonthList(orgId, startTimeUnix, endTimeUnix)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "projectMonthList": projectMonthList,
- })
- }
|