12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736 |
- package controllers
-
- import (
- "XT_New/enums"
- "XT_New/models"
- "XT_New/service"
- "XT_New/utils"
- "encoding/json"
- "fmt"
- "github.com/astaxie/beego"
- "github.com/jinzhu/gorm"
- "strconv"
- "strings"
- "time"
- )
-
- 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")
- }
-
- 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)
-
- 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,
- })
- }
- }
-
- 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,
- })
- }
- }
-
- }
-
- 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)
- }
- 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")
-
- 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)
-
- 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")
-
- fmt.Println("patient_id", patient_id)
- fmt.Println("startdateunix", start_time)
- fmt.Println("enddateunix", end_time)
- fmt.Println("limit", limit)
- fmt.Println("page", page)
-
- 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,
- })
- }
|