1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843 |
- package controllers
-
- import (
- "encoding/json"
- "fmt"
-
- "XT_New/enums"
- "XT_New/models"
- "XT_New/service"
- "XT_New/utils"
- "github.com/astaxie/beego"
- "github.com/jinzhu/gorm"
- "github.com/mozillazg/go-pinyin"
-
- "reflect"
- "strconv"
- "strings"
- "time"
- )
-
- type HisProjectApiController struct {
- BaseAuthAPIController
- }
-
- func HisProjectRouters() {
-
- beego.Router("/api/his/saveproject", &HisProjectApiController{}, "Get:SaveProject")
- beego.Router("/api/his/getprojectlist", &HisProjectApiController{}, "Get:GetProjectList")
- beego.Router("/api/his/getprojectdetail", &HisProjectApiController{}, "Get:GetProjectDetail")
- beego.Router("/api/his/updatedproject", &HisProjectApiController{}, "Get:UpdatedProject")
- beego.Router("/api/his/deletehisproject", &HisProjectApiController{}, "Get:DeleteHisProject")
- beego.Router("/api/his/saveprojectteam", &HisProjectApiController{}, "post:SaveProjectTeam")
- beego.Router("/api/his/getprojectteamlist", &HisProjectApiController{}, "Get:GetProjectTeamList")
- beego.Router("/api/his/getprojectteamdetail", &HisProjectApiController{}, "Get:GetProjectTeamDetail")
- beego.Router("/api/his/updateprojectteam", &HisProjectApiController{}, "post:UpdatedProjectTeam")
- beego.Router("/api/his/deleteprojectteam", &HisProjectApiController{}, "Get:DeleteProjectTeam")
- beego.Router("/api/his/savedepartment", &HisProjectApiController{}, "Get:SaveDePartment")
- beego.Router("/api/his/getdepartmentlist", &HisProjectApiController{}, "Get:GetDepartMentList")
- beego.Router("/api/his/getdepartmentdetail", &HisProjectApiController{}, "Get:GetDepartMentDetail")
- beego.Router("/api/his/updagtedepartment", &HisProjectApiController{}, "Get:UpdatedDeparment")
- beego.Router("/api/his/deletedeparment", &HisProjectApiController{}, "Get:DeleteDepartment")
- beego.Router("/api/his/getallprojectlist", &HisProjectApiController{}, "Get:GetAllProjectList")
- beego.Router("/api/his/addprojectlist", &HisProjectApiController{}, "Get:AddProjectList")
- beego.Router("/api/his/deleteproject", &HisProjectApiController{}, "Get:DeleteProject")
- beego.Router("/api/his/gethisproject", &HisProjectApiController{}, "Get:GetHisProject")
- beego.Router("/api/his/getprojectteam", &HisProjectApiController{}, "Get:GetProjectTeam")
- beego.Router("/api/his/getalldoctorlist", &HisProjectApiController{}, "Get:GetAllDoctorList")
- beego.Router("/api/his/savehispatient", &HisProjectApiController{}, "Get:SaveHisPatient")
- //获取今日血透排班的患者
- beego.Router("/api/his/getbloodpatient", &HisProjectApiController{}, "Get:GetBloodPatientList")
- //获取患者的今日透析处方
- beego.Router("/api/his/gethisprescription", &HisProjectApiController{}, "Get:GetHisPrescription")
-
- //获取治疗单
- beego.Router("/api/his/gettreatlist", &HisProjectApiController{}, "Get:GetTreatmentList")
- beego.Router("/api/his/getpatientinformation", &HisProjectApiController{}, "Get:GetPatientInformation")
- beego.Router("/api/hist/getallprojecteam", &HisProjectApiController{}, "Get:GetAllProjectTeam")
- beego.Router("/api/his/getprojectlistbyid", &HisProjectApiController{}, "Get:GetProjectListById")
- beego.Router("/api/his/gethispatienthistory", &HisProjectApiController{}, "Get:GetHisPatientHistory")
- beego.Router("/api/patient/changepatient", &HisProjectApiController{}, "Get:ChangePatient")
-
- beego.Router("/api/patient/getpatientcasehistory", &HisProjectApiController{}, "Get:GetPatientcaseHistory")
- beego.Router("/api/doctorworkstation/gettemplatedetail", &HisProjectApiController{}, "Get:GetTemplateDetail")
- beego.Router("/api/doctorworkstation/updaterecordtemplate", &HisProjectApiController{}, "Get:UpdateRecordTemplate")
- beego.Router("/api/hispatient/gehispatient", &HisProjectApiController{}, "Get:GetHisPatient")
-
- //获取处方打印单
- beego.Router("/api/hispatient/getprescriptionprint", &HisProjectApiController{}, "Get:GetDoctorAdvicePrint")
- //获取项目打印单
- //beego.Router("/api/hispatient/getprojectprint",&HisApiController{},"Get:GetProjectPrint")
-
- beego.Router("/api/hispatient/postprinthistemplate", &HisProjectApiController{}, "Get:PostPrintHisTemplate")
- beego.Router("/api/gethisprinttemplate", &HisProjectApiController{}, "Get:GetHisPrintTemplate")
- beego.Router("/api/hispatient/postprescriptiontemplate", &HisProjectApiController{}, "Get:PostPrescriptionTempalte")
- beego.Router("/api/hispatient/getprescriptiontemplate", &HisProjectApiController{}, "Get:GetPrescriptionTemplate")
- beego.Router("/api/hispatient/posttreatprinttemplate", &HisProjectApiController{}, "Get:PostTreatPrintTemplate")
- beego.Router("/api/hispatient/gettreatprinttemplate", &HisProjectApiController{}, "Get:GetTreatPrintTemplate")
- beego.Router("/api/hispatient/postchargeprinttemplate", &HisProjectApiController{}, "Get:PostChargePrintTemplate")
- beego.Router("/api/hispatient/getchargeprinttemplate", &HisProjectApiController{}, "Get:GetChargePrintTemplate")
- beego.Router("/api/hispatient/getallhispatient", &HisProjectApiController{}, "Get:GetAllHisPatient")
- beego.Router("/api/hispatient/getchargeprint", &HisProjectApiController{}, "Get:GetChargePrint")
- beego.Router("/api/hispatient/gettodayschedulepatient", &HisProjectApiController{}, "Get:GetTodaySchedulePatient")
- beego.Router("/api/hispatient/gethispatientdetail", &HisProjectApiController{}, "Get:GetHisPatientDetail")
-
- beego.Router("/api/hispatient/getalldepartmentlist", &HisProjectApiController{}, "Get:GetAllDepartmentList")
- beego.Router("/api/hispatient/getprescription", &HisProjectApiController{}, "Get:GetPrescription")
- beego.Router("/api/histpatient/getpatientdetail", &HisProjectApiController{}, "Get:GetPatientDetail")
- beego.Router("/api/hispatient/savemaintemplate", &HisProjectApiController{}, "Get:SaveMainTemplate")
- beego.Router("/api/hispatient/getmedicaltemplatelist", &HisProjectApiController{}, "Get:GetMedicalTempalteList")
- beego.Router("/api/hispatient/getmaintemplatebyid", &HisProjectApiController{}, "Get:GetMainTemplateById")
- beego.Router("/api/hispatient/updatemaintemplate", &HisProjectApiController{}, "Get:UpdateMainTemplate")
- beego.Router("/api/hispatient/deletemaintemplate", &HisProjectApiController{}, "Get:DeleteMainTemplate")
-
- }
-
- func (this *HisProjectApiController) SaveProject() {
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- project_name := this.GetString("project_name")
- wubi := this.GetString("wubi")
- price := this.GetString("price")
- price_float, err := strconv.ParseFloat(price, 64)
- unit := this.GetString("unit")
- cost_classify, _ := this.GetInt64("cost_classify")
- executive_section, _ := this.GetInt64("executive_section")
- medical_coverage, _ := this.GetInt64("medical_coverage")
- statistical_classification, _ := this.GetInt64("statistical_classification")
- disease_directory, _ := this.GetInt64("disease_directory")
- is_record, _ := this.GetInt64("is_record")
- medical_code := this.GetString("medical_code")
- tube_color, _ := this.GetInt64("tube_color")
- medical_status, _ := this.GetInt64("medical_status")
- remark := this.GetString("remark")
- sign, _ := this.GetInt64("sign")
- default_number := this.GetString("default_number")
- is_charge, _ := this.GetInt64("is_charge")
- is_estimate, _ := this.GetInt64("is_estimate")
- is_workload, _ := this.GetInt64("is_workload")
- sort := this.GetString("sort")
- is_advice, _ := this.GetInt64("is_advice")
- is_default, _ := this.GetInt64("is_default")
- single_dose := this.GetString("single_dose")
- delivery_way := this.GetString("delivery_way")
- execution_frequency := this.GetString("execution_frequency")
- number_days := this.GetString("number_days")
- total := this.GetString("total")
- category, _ := this.GetInt64("category")
- specail_project, _ := this.GetInt64("specail_project")
- social_security_directory_code := this.GetString("social_security_directory_code")
- record_date := this.GetString("record_date")
- bbx01 := this.GetString("bbx01")
- bby01 := this.GetString("bby01")
-
- is_print, _ := this.GetInt64("is_print")
- is_show, _ := this.GetInt64("is_show")
- theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
-
- // 创建一个拼音转换器
- p := pinyin.NewArgs()
-
- // 将汉字转为拼音
- pinyinSlice := pinyin.Pinyin(project_name, p)
-
- // 获取首字母
- firstLetter := ""
- for _, py := range pinyinSlice {
- if len(py) > 0 {
- firstLetter += string(py[0][0])
- }
- }
-
- hisProject := models.XtHisProject{
- ProjectName: project_name,
- Pinyin: firstLetter,
- Wubi: wubi,
- Price: price_float,
- Unit: unit,
- CostClassify: cost_classify,
- ExecutiveSection: executive_section,
- MedicalCoverage: medical_coverage,
- StatisticalClassification: statistical_classification,
- DiseaseDirectory: disease_directory,
- IsRecord: is_record,
- MedicalCode: medical_code,
- TubeColor: tube_color,
- MedicalStatus: medical_status,
- Remark: remark,
- Sign: sign,
- DefaultNumber: default_number,
- IsCharge: is_charge,
- IsEstimate: is_estimate,
- IsWorkload: is_workload,
- Sort: sort,
- DoctorAdvice: is_advice,
- IsDefault: is_default,
- UserOrgId: orgId,
- Status: 1,
- CreatedTime: time.Now().Unix(),
- SingleDose: single_dose,
- DeliveryWay: delivery_way,
- ExecutionFrequency: execution_frequency,
- NumberDays: number_days,
- Total: total,
- Category: category,
- SpecailProject: specail_project,
- SocialSecurityDirectoryCode: social_security_directory_code,
- RecordDate: theTime.Unix(),
- IsPrint: is_print,
- Bbx01: bbx01,
- Bby01: bby01,
- ZuobiaoId: bbx01,
- FirstLetter: firstLetter,
- IsShow: is_show,
- }
- if this.GetAdminUserInfo().CurrentOrgId == 10206 {
- de, _ := service.GetDepartMentDetail(executive_section)
- hisProject.Bck01b = de.Number
- }
- //查询项目名称是否存在
- _, errcode := service.GetHisProjectIsExist(project_name, orgId)
- if errcode == gorm.ErrRecordNotFound {
- err = service.CreateHisProject(&hisProject)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "hisProject": hisProject,
- })
- return
- } else if errcode == nil {
-
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- }
-
- func (this *HisProjectApiController) GetProjectList() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- limit, _ := this.GetInt64("limit")
- page, _ := this.GetInt64("page")
- is_charge, _ := this.GetInt64("is_charge")
-
- is_start, _ := this.GetInt64("is_start")
- keyword := this.GetString("keyword")
- is_mark, _ := this.GetInt64("is_mark")
- projecList, total, err := service.GetHisProjectList(orgId, limit, page, is_charge, is_start, keyword, is_mark)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "projecList": projecList,
- "total": total,
- })
- return
- }
-
- func (this *HisProjectApiController) GetProjectDetail() {
- id, _ := this.GetInt64("id")
- projectDetail, err := service.GetProjectDetail(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "projecDetail": projectDetail,
- })
- return
- }
-
- func (this *HisProjectApiController) UpdatedProject() {
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- id, _ := this.GetInt64("id")
- project_name := this.GetString("project_name")
-
- wubi := this.GetString("wubi")
- price := this.GetString("price")
- price_float, _ := strconv.ParseFloat(price, 64)
- unit := this.GetString("unit")
- cost_classify, _ := this.GetInt64("cost_classify")
- executive_section, _ := this.GetInt64("executive_section")
- medical_coverage, _ := this.GetInt64("medical_coverage")
- statistical_classification, _ := this.GetInt64("statistical_classification")
- disease_directory, _ := this.GetInt64("disease_directory")
- is_record, _ := this.GetInt64("is_record")
- medical_code := this.GetString("medical_code")
- tube_color, _ := this.GetInt64("tube_color")
- medical_status, _ := this.GetInt64("medical_status")
- remark := this.GetString("remark")
- sign, _ := this.GetInt64("sign")
- default_number := this.GetString("default_number")
- is_charge, _ := this.GetInt64("is_charge")
- is_estimate, _ := this.GetInt64("is_estimate")
- is_workload, _ := this.GetInt64("is_workload")
- sort := this.GetString("sort")
- is_advice, _ := this.GetInt64("is_advice")
- is_default, _ := this.GetInt64("is_default")
- single_dose := this.GetString("single_dose")
- delivery_way := this.GetString("delivery_way")
- execution_frequency := this.GetString("execution_frequency")
- number_days := this.GetString("number_days")
- category, _ := this.GetInt64("category")
- total := this.GetString("total")
- specail_project, _ := this.GetInt64("specail_project")
- social_security_directory_code := this.GetString("social_security_directory_code")
- record_date := this.GetString("record_date")
- is_print, _ := this.GetInt64("is_print")
- bbx01 := this.GetString("bbx01")
- bby01 := this.GetString("bby01")
- is_show, _ := this.GetInt64("is_show")
- // 创建一个拼音转换器
- p := pinyin.NewArgs()
-
- // 将汉字转为拼音
- pinyinSlice := pinyin.Pinyin(project_name, p)
-
- // 获取首字母
- firstLetter := ""
- for _, py := range pinyinSlice {
- if len(py) > 0 {
- firstLetter += string(py[0][0])
- }
- }
- orgId := this.GetAdminUserInfo().CurrentOrgId
- theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- hisProject := models.XtHisProject{
- ProjectName: project_name,
- Pinyin: firstLetter,
- FirstLetter: firstLetter,
- Wubi: wubi,
- Price: price_float,
- Unit: unit,
- CostClassify: cost_classify,
- ExecutiveSection: executive_section,
- MedicalCoverage: medical_coverage,
- StatisticalClassification: statistical_classification,
- DiseaseDirectory: disease_directory,
- IsRecord: is_record,
- MedicalCode: medical_code,
- TubeColor: tube_color,
- MedicalStatus: medical_status,
- Remark: remark,
- Sign: sign,
- DefaultNumber: default_number,
- IsCharge: is_charge,
- IsEstimate: is_estimate,
- IsWorkload: is_workload,
- Sort: sort,
- DoctorAdvice: is_advice,
- IsDefault: is_default,
- UpdatedTime: time.Now().Unix(),
- SingleDose: single_dose,
- DeliveryWay: delivery_way,
- ExecutionFrequency: execution_frequency,
- NumberDays: number_days,
- Total: total,
- Category: category,
- SpecailProject: specail_project,
- SocialSecurityDirectoryCode: social_security_directory_code,
- RecordDate: theTime.Unix(),
- IsPrint: is_print,
- Bbx01: bbx01,
- Bby01: bby01,
- ZuobiaoId: bbx01,
- UserOrgId: orgId,
- IsShow: is_show,
- }
- if this.GetAdminUserInfo().CurrentOrgId == 10206 {
- de, _ := service.GetDepartMentDetail(executive_section)
- hisProject.Bck01b = de.Number
- }
-
- err := service.UpdatedProject(id, &hisProject)
-
- list, _ := service.GetHisPrescripionProjectListOne(id, orgId)
- for _, item := range list {
- service.UpdateHisPrescriptionProjectList(item.ID, price_float)
- }
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "hisProject": hisProject,
- })
- return
- }
-
- func (this *HisProjectApiController) DeleteHisProject() {
-
- id, _ := this.GetInt64("id")
- err := service.DeleteHisProject(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *HisProjectApiController) SaveProjectTeam() {
-
- project_team := this.GetString("project_team")
-
- price := this.GetString("price")
- price_float, _ := strconv.ParseFloat(price, 64)
- pinyin := this.GetString("pinyin")
- wubi := this.GetString("wubi")
- tube_color, _ := this.GetInt64("tube_color")
- team_type, _ := this.GetInt64("team_type")
- remark := this.GetString("remark")
- sort, _ := this.GetInt64("sort")
- //ids := this.GetString("ids")
- //item_id := this.GetString("item_id")
-
- 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
- }
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- projectTeam := models.XtHisProjectTeam{
- ProjectTeam: project_team,
- Price: price_float,
- Pinyin: pinyin,
- Wubi: wubi,
- TubeColor: tube_color,
- TeamType: team_type,
- Remark: remark,
- UserOrgId: orgId,
- Status: 1,
- CreatedTime: time.Now().Unix(),
- Sort: sort,
- //ProjectId: ids,
- //ItemId: item_id,
- }
- //fmt.Println(projectTeam)
-
- _, errcodes := service.GetHisProjectByNameOne(project_team, orgId)
-
- if errcodes == gorm.ErrRecordNotFound {
- err := service.CreatedProjectTeam(&projectTeam)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- if dataBody["info"] != nil && reflect.TypeOf(dataBody["info"]).String() == "[]interface {}" {
- infos, _ := dataBody["info"].([]interface{})
- if len(infos) > 0 {
- var ids []string
-
- for _, item := range infos {
- items := item.(map[string]interface{})
- if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
- utils.ErrorLog("id")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- id := int64(items["id"].(float64))
-
- if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
- utils.ErrorLog("type")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- types := int64(items["type"].(float64))
-
- if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "string" {
- utils.ErrorLog("number")
- }
-
- number, _ := strconv.ParseInt(items["number"].(string), 10, 64)
-
- list := models.XtHisProjectList{
- Number: number,
- UserOrgId: adminUserInfo.CurrentOrgId,
- ProjectId: id,
- Status: 1,
- CreatedTime: time.Now().Unix(),
- UpdatedTime: time.Now().Unix(),
- TeamId: projectTeam.ID,
- Type: types,
- }
-
- service.CreateProjectList(&list)
-
- ids = append(ids, strconv.FormatInt(list.ID, 10))
-
- }
- ids_str := strings.Join(ids, ",")
- projectTeam.ItemId = ids_str
- service.SaveProjectTeam(&projectTeam)
- this.ServeSuccessJSON(map[string]interface{}{
- "projectTeam": projectTeam,
- })
- }
- }
- return
- } else if errcodes == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- }
-
- func (this *HisProjectApiController) GetProjectTeamList() {
-
- limit, _ := this.GetInt64("limit")
- page, _ := this.GetInt64("page")
- keyword := this.GetString("keyword")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- projectTeamList, total, err := service.GetProjectTeamList(limit, page, orgId, keyword)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "projectTeamList": projectTeamList,
- "total": total,
- })
- return
- }
-
- func (this *HisProjectApiController) GetProjectTeamDetail() {
- id, _ := this.GetInt64("id")
- //adminUserInfo := this.GetAdminUserInfo()
- //orgId := adminUserInfo.CurrentOrgId
- projectTeamDetail, err := service.GetProjectTeamDetail(id)
-
- ids := strings.Split(projectTeamDetail.ItemId, ",")
- hisList, err := service.GetProjectHisListByIds(ids)
-
- //list, err := service.GetAllProjectList(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "projectTeamDetail": projectTeamDetail,
- //"list": list,
- "hisList": hisList,
- })
- return
- }
-
- func (this *HisProjectApiController) UpdatedProjectTeam() {
-
- id, _ := this.GetInt64("id")
- project_team := this.GetString("project_team")
- price := this.GetString("price")
- price_float, _ := strconv.ParseFloat(price, 64)
- pinyin := this.GetString("pinyin")
- wubi := this.GetString("wubi")
- tube_color, _ := this.GetInt64("tube_color")
- team_type, _ := this.GetInt64("team_type")
- remark := this.GetString("remark")
- sort, _ := this.GetInt64("sort")
- projectTeam, _ := service.GetProjectTeamDetail(id)
-
- projectTeam.ProjectTeam = project_team
- projectTeam.Price = price_float
- projectTeam.Pinyin = pinyin
- projectTeam.Wubi = wubi
- projectTeam.TubeColor = tube_color
- projectTeam.TeamType = team_type
- projectTeam.Remark = remark
- projectTeam.Sort = sort
-
- 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
- }
-
- err = service.UpdatedProjectTeam(id, &projectTeam)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
-
- if dataBody["info"] != nil && reflect.TypeOf(dataBody["info"]).String() == "[]interface {}" {
- infos, _ := dataBody["info"].([]interface{})
- if len(infos) > 0 {
- var ids []string
-
- for _, item := range infos {
- items := item.(map[string]interface{})
- if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
- utils.ErrorLog("id")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- id := int64(items["id"].(float64))
-
- if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
- utils.ErrorLog("type")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- types := int64(items["type"].(float64))
-
- if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "string" {
- utils.ErrorLog("number")
- }
-
- number, _ := strconv.ParseInt(items["number"].(string), 10, 64)
-
- list := models.XtHisProjectList{
- Number: number,
- UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
- ProjectId: id,
- Status: 1,
- CreatedTime: time.Now().Unix(),
- UpdatedTime: time.Now().Unix(),
- TeamId: projectTeam.ID,
- Type: types,
- }
-
- service.CreateProjectList(&list)
-
- ids = append(ids, strconv.FormatInt(list.ID, 10))
-
- }
- ids_str := strings.Join(ids, ",")
- projectTeam.ItemId = projectTeam.ItemId + "," + ids_str
- service.SaveProjectTeam(&projectTeam)
- this.ServeSuccessJSON(map[string]interface{}{
- "projectTeam": projectTeam,
- })
- }
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "projectTeam": projectTeam,
- })
- return
- }
-
- func (this *HisProjectApiController) DeleteProjectTeam() {
-
- id, _ := this.GetInt64("id")
- err := service.DeleteProjectTeam(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *HisProjectApiController) SaveDePartment() {
-
- name := this.GetString("name")
- number := this.GetString("number")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- department := models.XtHisDepartment{
- Name: name,
- Number: number,
- UserOrgId: orgId,
- CreatedTime: time.Now().Unix(),
- Status: 1,
- }
- err := service.CreateDePartment(&department)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- department_keys := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + "_department"
- redis := service.RedisClient()
- defer redis.Close()
- redis.Set(department_keys, "", time.Second*60*60*18)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "department": department,
- })
- return
- }
-
- func (this *HisProjectApiController) GetDepartMentList() {
-
- limit, _ := this.GetInt64("limit")
- page, _ := this.GetInt64("page")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- departMentList, total, err := service.GetDepartMentList(limit, page, orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "departMentList": departMentList,
- "total": total,
- })
- return
- }
-
- func (this *HisProjectApiController) GetDepartMentDetail() {
-
- id, _ := this.GetInt64("id")
- departDetail, err := service.GetDepartMentDetail(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "departDetail": departDetail,
- })
- return
- }
-
- func (this *HisProjectApiController) UpdatedDeparment() {
-
- id, _ := this.GetInt64("id")
- name := this.GetString("name")
- number := this.GetString("number")
- department := models.XtHisDepartment{
- Name: name,
- Number: number,
- }
- err := service.UpdatedDepartment(id, &department)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- department_keys := strconv.FormatInt(this.GetAdminUserInfo().CurrentOrgId, 10) + "_department"
- redis := service.RedisClient()
- defer redis.Close()
- redis.Set(department_keys, "", time.Second*60*60*18)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "department": department,
- })
- return
- }
-
- func (this *HisProjectApiController) DeleteDepartment() {
-
- id, _ := this.GetInt64("id")
- err := service.DeleteDepartment(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
-
- department_keys := strconv.FormatInt(this.GetAdminUserInfo().CurrentOrgId, 10) + "_department"
- redis := service.RedisClient()
- defer redis.Close()
- redis.Set(department_keys, "", time.Second*60*60*18)
-
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *HisProjectApiController) GetBloodPatientList() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- timeStr := time.Now().Format("2006-01-02")
- timeLayout := "2006-01-02 15:04:05"
- timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
- timenow := timeStringToTime.Unix()
-
- //统计血透排班的患者
- scheduleList, err := service.GetBloodPatientList(orgId, timenow)
- //统计当日挂号的患者
- hisPatient, _ := service.GetHisPatient(orgId, timenow)
- //统计今天开处方的患者
- prescription, _ := service.GetHisPrescriptionOther(orgId, timenow)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "scheduleList": scheduleList,
- "hisPatient": hisPatient,
- "prescription": prescription,
- })
- return
- }
-
- func (this *HisProjectApiController) GetHisPrescription() {
-
- id, _ := this.GetInt64("id")
- timeStr := time.Now().Format("2006-01-02")
- timeLayout := "2006-01-02 15:04:05"
- timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
- timenow := timeStringToTime.Unix()
- prescriptionList, err := service.GetHisPrescriptionByPatientId(id, timenow)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "prescriptionList": prescriptionList,
- })
- return
- }
-
- func (this *HisProjectApiController) GetTreatmentList() {
-
- patient_id, _ := this.GetInt64("patient_id")
- timeStr := time.Now().Format("2006-01-02")
- timeLayout := "2006-01-02 15:04:05"
- timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
- timenow := timeStringToTime.Unix()
- treatmentList, err := service.GetTreatmentList(patient_id, timenow)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "treatmentList": treatmentList,
- })
- return
- }
-
- func (this *HisProjectApiController) GetAllProjectList() {
- keyword := this.GetString("keyword")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- projectList, err := service.GetAllProjectList(orgId, keyword)
- goodInfos, err := service.GetGoodInfomationList(orgId, keyword)
-
- //获取列表数据
- hisprojectlist, err := service.GetHisProjectListByOrgId(orgId)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "projectList": projectList,
- "hisprojectlist": hisprojectlist,
- "good_info": goodInfos,
- })
- return
- }
-
- func (this *HisProjectApiController) AddProjectList() {
-
- id, _ := this.GetInt64("id")
- number, _ := this.GetInt64("number")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- projectList := models.XtHisProjectList{
- ProjectId: id,
- Number: number,
- UserOrgId: orgId,
- Status: 1,
- CreatedTime: time.Now().Unix(),
- }
- err := service.CreateProjectList(&projectList)
- detail, _ := service.GetProjectDetail(id)
-
- item, err := service.GetLastItem(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "projectList": detail,
- "item": item,
- })
- return
- }
-
- func (this *HisProjectApiController) GetPatientInformation() {
-
- id, _ := this.GetInt64("id")
- information, err := service.GetHisPatientInformation(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "information": information,
- })
- return
- }
-
- func (this *HisProjectApiController) DeleteProject() {
-
- id, _ := this.GetInt64("id")
- err := service.DeleteProjectList(id)
- if err != nil {
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
- return
- }
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *HisProjectApiController) GetHisProject() {
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
-
- houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
- if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10215 {
- project, err := service.GetHisProject(orgId)
- good_info, err := service.GetGoodInfoMationSeven(orgId, houseConfig.StorehouseOutInfo)
- _, config := service.FindHisStockPriceRecordByOrgId(orgId)
- if config.ID > 0 && config.IsOpen == 1 {
- //处理耗材不同批号价格问题
- for _, item := range good_info {
- if len(item.GoodSotckInfo) > 0 {
- if item.GoodSotckInfo[0].Price > 0 {
- item.PackingPrice = item.GoodSotckInfo[0].Price
- }
- }
- }
- }
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "project": project,
- "good_info": good_info,
- })
- }
-
- if adminUserInfo.CurrentOrgId != 9671 && adminUserInfo.CurrentOrgId != 9675 && adminUserInfo.CurrentOrgId != 10215 {
- project, err := service.GetHisProject(orgId)
- good_info, err := service.GetGoodInfoMationSix(orgId, houseConfig.StorehouseOutInfo)
- _, config := service.FindHisStockPriceRecordByOrgId(orgId)
- if config.ID > 0 && config.IsOpen == 1 {
- //处理耗材不同批号价格问题
- for _, item := range good_info {
- if len(item.GoodSotckInfo) > 0 {
- if item.GoodSotckInfo[0].Price > 0 {
- item.PackingPrice = item.GoodSotckInfo[0].Price
- }
- }
- }
- }
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "project": project,
- "good_info": good_info,
- })
- }
- }
-
- func (this *HisProjectApiController) GetProjectTeam() {
-
- strids := this.GetString("strids")
-
- idStrs := strings.Split(strids, ",")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- team, err := service.GetProjectTeam(idStrs, orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "team": team,
- })
- }
-
- func (this *HisProjectApiController) GetAllDoctorList() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- appId := adminUserInfo.CurrentAppId
- //获取所有的医生
- doctor, err := service.GetAllDoctor(orgId, appId)
- //获取所有的科室
- department, err := service.GetAllDepartMent(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "doctor": doctor,
- "department": department,
- })
- }
-
- func (this *HisProjectApiController) SaveHisPatient() {
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- age, _ := this.GetInt64("age")
- birthday := this.GetString("birthday")
-
- patient_id, _ := this.GetInt64("id")
-
- birthdays, _ := time.ParseInLocation(timeLayout+" 15:04:05", birthday+" 00:00:00", loc)
- birthUnix := birthdays.Unix()
- certificates, _ := this.GetInt64("certificates")
- cost_checked, _ := this.GetInt64("costChecked")
- cost, _ := this.GetInt64("cost")
- costs := strconv.FormatInt(cost, 10)
- cost_float, _ := strconv.ParseFloat(costs, 64)
- department, _ := this.GetInt64("department")
- doctor, _ := this.GetInt64("doctor")
- medicalcare, _ := this.GetInt64("medical_care")
- idcard := this.GetString("id_card")
- medicalExpenses, _ := this.GetInt64("medical_expenses")
- medicalExpense := strconv.FormatInt(medicalExpenses, 10)
- medicalExpense_float, _ := strconv.ParseFloat(medicalExpense, 64)
- medicalinsurancecard := this.GetString("medical_insurance_card")
-
- name := this.GetString("name")
- register, _ := this.GetInt64("register")
- registrationfee, _ := this.GetInt64("registration_fee")
- registrationfees := strconv.FormatInt(registrationfee, 10)
- registrationfees_float, _ := strconv.ParseFloat(registrationfees, 64)
- settlementValue, _ := this.GetInt64("settlement_value")
- sex, _ := this.GetInt64("sex")
- total, _ := this.GetInt64("total")
- totals := strconv.FormatInt(total, 10)
- totals_float, _ := strconv.ParseFloat(totals, 64)
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- recordDateStr := time.Now().Format("2006-01-02")
- recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
- nowtime := recordDate.Unix()
- phone := this.GetString("phone")
- social_type, _ := this.GetInt64("social_type")
- id_card_type, _ := this.GetInt64("id_card_type")
-
- //diagnosis_id, _ := this.GetInt64("diagnosis")
-
- diagnosis_ids := this.GetString("diagnosis")
-
- sick_type, _ := this.GetInt64("sick_type")
- reg_type := this.GetString("p_type")
-
- tempPatient, _ := service.GetPatientByIDCardAndName(idcard, adminUserInfo.CurrentOrgId, name)
- if tempPatient.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoBloodPatientException)
- return
- }
-
- var patient service.Patients
- if patient_id == 0 {
- patient, _ = service.GetPatientByIDCard(idcard, adminUserInfo.CurrentOrgId)
-
- } else {
- patient, _ = service.GetPatientByIDTwo(adminUserInfo.CurrentOrgId, patient_id)
-
- }
-
- if patient.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- return
- }
- if len(patient.IdCardNo) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeIDCartNo)
- return
- }
-
- timeStr := time.Now().Format("2006-01-02 15:04:05")
- fmt.Println(timeStr)
- timeArr := strings.Split(timeStr, " ")
- timeArrTwo := strings.Split(timeArr[0], "-")
- timeArrThree := strings.Split(timeArr[1], ":")
- var str = timeArrTwo[0] + timeArrTwo[1] + timeArrTwo[2] + timeArrThree[0] + timeArrThree[1] + timeArrThree[2] + strconv.FormatInt(patient.ID, 10)
-
- //his, _ := service.GetHisPatientInfoTwo(adminUserInfo.CurrentOrgId, patient.ID, recordDate.Unix())
- //if len(his) >= 1 {
- // order, _ := service.GetNewHisOrderTwo(adminUserInfo.CurrentOrgId, his[len(his)-1].Number, his[len(his)-1].PatientId, recordDate.Unix())
- // if len(his) >= 1 && order.ID == 0 {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisPatientParamWrong)
- // return
- // }
- //}
- var hisPatient models.XtHisPatient
- //if err == gorm.ErrRecordNotFound || his.ID == 0 {
- hisPatient = models.XtHisPatient{
- PatientId: patient_id,
- Birthday: birthUnix,
- IdType: certificates,
- CostOfProduction: cost_float,
- Departments: department,
- Doctor: doctor,
- AdminUserId: adminUserInfo.AdminUser.Id,
- MedicalTreatmentType: medicalcare,
- IdCardNo: idcard,
- IsNeedCostOfProduction: cost_checked,
- TreatmentCost: medicalExpense_float,
- MedicalInsuranceNumber: medicalinsurancecard,
- Name: name,
- Age: age,
- Number: str,
- RegisterType: register,
- RegisterCost: registrationfees_float,
- BalanceAccountsType: settlementValue,
- Gender: sex,
- Total: totals_float,
- UserOrgId: orgId,
- Status: 1,
- RecordDate: nowtime,
- IsReturn: 1,
- Ctime: time.Now().Unix(),
- Phone: phone,
- SocialType: social_type,
- IdCardType: id_card_type,
- Diagnosis: diagnosis_ids,
- PType: reg_type,
- SickType: sick_type,
- }
- service.CreateHisPatient(&hisPatient)
- this.ServeSuccessJSON(map[string]interface{}{
- "his_info": hisPatient,
- })
- //}
- //else {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisRegisterException)
- // return
- //}
-
- }
-
- func (this *HisProjectApiController) GetAllProjectTeam() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- team, err := service.GetAllProjectTeam(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "team": team,
- })
- }
-
- func (this *HisProjectApiController) GetProjectListById() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- project_id := this.GetString("project_id")
- idStrs := strings.Split(project_id, ",")
- project, err := service.GetProjectListById(orgId, idStrs)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "project": project,
- })
- }
-
- func (this *HisProjectApiController) GetHisPatientHistory() {
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- keyword := this.GetString("keyword")
- start_time := this.GetString("start_time")
- end_time := this.GetString("end_time")
- register_type, _ := this.GetInt64("register_type")
- limit, _ := this.GetInt64("limit")
- page, _ := this.GetInt64("page")
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+":00", loc)
- endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+":59", loc)
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- history, total, err := service.GetHisPatientHistory(keyword, startTime.Unix(), endTime.Unix(), register_type, limit, page, orgId)
-
- department, err := service.GetAllDepartMent(orgId)
- appId := adminUserInfo.CurrentAppId
- doctor, err := service.GetAllDoctor(orgId, appId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "history": history,
- "total": total,
- "department": department,
- "doctor": doctor,
- })
- }
-
- func (this *HisProjectApiController) ChangePatient() {
-
- id, _ := this.GetInt64("id")
- //查询该患者今日是否已经就诊
- recordDateStr := time.Now().Format("2006-01-02")
- recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
-
- nowtime := recordDate.Unix()
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- _, errcode := service.GetHisPrescriptionTwo(id, orgId, nowtime)
- if errcode == gorm.ErrRecordNotFound {
- err := service.ChangePatient(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- } else if errcode == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
-
- }
-
- func (this *HisProjectApiController) GetPatientcaseHistory() {
-
- patient_id, _ := this.GetInt64("patient_id")
- record_date := this.GetString("record_date")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
-
- patient, err := service.GetBloodPatientInfoById(patient_id)
- history, _ := service.GetPatientCaseHistory(patient_id, startTime.Unix())
- hispatient, _ := service.GetHisPatientById(patient_id)
-
- //获取患者最后一次的血管通路
- accessList, _ := service.GetPatientVascularAccess(patient_id)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patient": patient,
- "history": history,
- "hispatient": hispatient,
- "accessList": accessList,
- })
- }
-
- func (this *HisProjectApiController) GetTemplateDetail() {
-
- id, _ := this.GetInt64("id")
- templateDetail, err := service.GetTemplateDetail(id)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "templateDetail": templateDetail,
- })
- }
-
- func (this *HisProjectApiController) UpdateRecordTemplate() {
- id, _ := this.GetInt64("id")
- template_name := this.GetString("template_name")
- template_remark := this.GetString("template_remark")
-
- diagnostic := this.GetString("diagnostic")
- chief_conplaint := this.GetString("chief_conplaint")
- history_of_present_illness := this.GetString("history_of_present_illness")
- past_history := this.GetString("past_history")
- personal_history := this.GetString("personal_history")
- family_history := this.GetString("family_history")
- doctor_advice := this.GetString("doctor_advice")
- remark := this.GetString("remark")
- adminUserInfo := this.GetAdminUserInfo()
- creater := adminUserInfo.AdminUser.Id
- historyTemplate := models.HisCaseHistoryTemplate{
- HistoryOfPresentIllness: history_of_present_illness,
- PastHistory: past_history,
- ChiefConplaint: chief_conplaint,
- PersonalHistory: personal_history,
- FamilyHistory: family_history,
- Diagnostic: diagnostic,
- Status: 1,
- Mtime: time.Now().Unix(),
- RecordDate: time.Now().Unix(),
- TemplateName: template_name,
- TemplateRemark: template_remark,
- Modifier: creater,
- DoctorAdvice: doctor_advice,
- Remark: remark,
- }
- err := service.UpdateCaseHistoryTemplate(&historyTemplate, id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "templateDetail": historyTemplate,
- })
- }
-
- func (this *HisProjectApiController) GetHisPatient() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- keyword := this.GetString("keyword")
- patient, err := service.GetHistPatient(orgId, keyword)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patient": patient,
- })
- }
-
- func (this *HisProjectApiController) GetDoctorAdvicePrint() {
-
- patient_id, _ := this.GetInt64("patient_id")
- his_patient_id, _ := this.GetInt64("his_patient_id")
-
- record_date := this.GetString("record_date")
- schIDStr := this.GetString("ids")
- p_type, _ := this.GetInt64("p_type")
-
- idStrs := strings.Split(schIDStr, ",")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- recordDateTime := theTime.Unix()
- //prescription_id, _ := this.GetInt64("prescription_id")
- adminUserInfo := this.GetAdminUserInfo()
- var temp_p_type int64
- if p_type == 1 {
-
- temp_p_type = 1
- } else {
- temp_p_type = 2
- }
-
- sch, _ := service.GetScheduleByDate(adminUserInfo.CurrentOrgId, recordDateTime, patient_id)
- advicePrint, err := service.GetDoctorAdvicePrint(patient_id, recordDateTime, idStrs, adminUserInfo.CurrentOrgId, temp_p_type)
- projectlist, err := service.GetAllProjectList(adminUserInfo.CurrentOrgId, "")
- his, _ := service.GetLastHisPatient(patient_id, adminUserInfo.CurrentOrgId)
- prescriptionInfo, _ := service.GetPrscriptionInfo(patient_id, recordDateTime)
- //advicePrint, err := service.GetPre(patient_id, recordDateTime, idStrs, adminUserInfo.CurrentOrgId, temp_p_type)
- hisPatient, _ := service.GetHisPatientInfoFour(adminUserInfo.CurrentOrgId, patient_id, recordDateTime, his_patient_id)
- hisPatient_two, _ := service.GetHisPatientInfoTen(adminUserInfo.CurrentOrgId, patient_id, recordDateTime)
- if hisPatient.ID == 0 {
- hisPatient = hisPatient_two
- }
-
- //hisPatient, _ := service.GetHisPatientById(patient_id)
- hisHospitalRecord, _ := service.GetLastHospitalRecordTwo(patient_id, adminUserInfo.CurrentOrgId)
-
- //psn_info, _ := service.GetPsnInfo(patient_id)
-
- psn_info, _ := service.GetPsnByPatientId(patient_id)
-
- eles, _ := service.GetNewAdminUserES(adminUserInfo.CurrentOrgId)
-
- roles, _ := service.GetAllDoctor(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "advicePrint": advicePrint,
- "projectlist": projectlist,
- "hisPatient": hisPatient,
- "his": his,
- "hisHospitalRecord": hisHospitalRecord,
- "info": prescriptionInfo,
- "eles": eles,
- "psn_info": psn_info,
- "roles": roles,
- "sch": sch,
- })
- }
-
- func (this *HisProjectApiController) GetProjectPrint() {
-
- his_patient_id, _ := this.GetInt64("his_patient_id")
- hisPatient, _ := service.GetHisPatientById(his_patient_id)
- projectPrint, err := service.GetProjectPrint(his_patient_id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "hisPatient": hisPatient,
- "projectPrint": projectPrint,
- })
- }
-
- func (this *HisProjectApiController) PostPrintHisTemplate() {
-
- template_id, _ := this.GetInt64("template_id")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- _, errcode := service.GetHisTemplateId(template_id, orgId)
- //fmt.Println("errcode", errcode)
- if errcode == gorm.ErrRecordNotFound {
- template := models.XtHisTemplate{
- TemplateId: template_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- err := service.CreateHisTemplate(&template)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- "template_id": template_id,
- })
- } else if errcode == nil {
-
- template := models.XtHisTemplate{
- TemplateId: template_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- }
- err := service.UpdateHisTemplate(&template)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- "template_id": template_id,
- })
- }
- }
-
- func (this *HisProjectApiController) GetHisPrintTemplate() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- template, err := service.GetHisPrintTemplate(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- })
- }
-
- func (this *HisProjectApiController) PostPrescriptionTempalte() {
-
- template_id, _ := this.GetInt64("template_id")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- _, errcode := service.GetPrescriptionTemplate(template_id, orgId)
- if errcode == gorm.ErrRecordNotFound {
- template := models.XtHisAdviceTemplate{
- TemplateId: template_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- err := service.CreatePrescriptionTemplate(&template)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- "template_id": template_id,
- })
- } else if errcode == nil {
- template := models.XtHisAdviceTemplate{
- TemplateId: template_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- err := service.UpdatePrescriptionTemplate(&template)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- "template_id": template_id,
- })
- }
- }
-
- func (this *HisProjectApiController) GetPrescriptionTemplate() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- template, err := service.GetPrescriptionTemplateById(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- })
- }
-
- func (this *HisProjectApiController) PostTreatPrintTemplate() {
-
- template_id, _ := this.GetInt64("template_id")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- _, errcode := service.GetTreatPrintTemplate(template_id, orgId)
- if errcode == gorm.ErrRecordNotFound {
- template := models.XtHisTreatmentTemplate{
- TemplateId: template_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- err := service.CreateTreatPrintTemplate(&template)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- "template_id": template_id,
- })
- } else if errcode == nil {
- template := models.XtHisTreatmentTemplate{
- TemplateId: template_id,
- UserOrgId: orgId,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- err := service.UpdatedTreateTemplate(&template)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- "template_id": template_id,
- })
- }
- }
-
- func (this *HisProjectApiController) GetTreatPrintTemplate() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- template, err := service.GetTreatTtreatPrintTemplate(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- })
- }
-
- func (this *HisProjectApiController) PostChargePrintTemplate() {
-
- template_id, _ := this.GetInt64("template_id")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- _, errcode := service.GetChargeTemplate(template_id, orgId)
- if errcode == gorm.ErrRecordNotFound {
- template := models.XtHisChargeTemplate{
- TemplateId: template_id,
- UserOrgId: orgId,
- Ctime: time.Now().Unix(),
- Status: 1,
- }
- err := service.CreateChargePrintTemplate(&template)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- "template_id": template_id,
- })
- } else if errcode == nil {
- template := models.XtHisChargeTemplate{
- TemplateId: template_id,
- UserOrgId: orgId,
- Ctime: time.Now().Unix(),
- Status: 1,
- }
- err := service.UpdateChargePrintTemplate(&template)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- "template_id": template_id,
- })
- }
- }
-
- func (this *HisProjectApiController) GetChargePrintTemplate() {
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- template, err := service.GetChargePrintTemplate(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- })
- }
-
- func (this *HisProjectApiController) GetAllHisPatient() {
- record_date := this.GetString("record_date")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- recordDateTime := theTime.Unix()
- adminUserInfo := this.GetAdminUserInfo()
- patients, err := service.GetScheduleHisPatientList(adminUserInfo.CurrentOrgId, "", recordDateTime, 0, 0)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "list": patients,
- })
-
- }
-
- func (this *HisProjectApiController) GetChargePrint() {
- record_date := this.GetString("record_date")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- recordDateTime := theTime.Unix()
- patient_id, _ := this.GetInt64("patient_id")
- prescription_id, _ := this.GetInt64("prescription_id")
- adminUserInfo := this.GetAdminUserInfo()
- chargePrint, err := service.GetChargePrint(recordDateTime, patient_id, adminUserInfo.CurrentOrgId)
- prescription, err := service.GetHisPrescriptionNight(adminUserInfo.CurrentOrgId, patient_id, recordDateTime, prescription_id)
- patient, err := service.GetFaPiaoPatientByID(adminUserInfo.CurrentOrgId, patient_id)
- hisPatient, err := service.GetHisPatientById(patient_id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "list": chargePrint,
- "prescription": prescription,
- "patient": patient,
- "hisPatient": hisPatient,
- })
- }
-
- func (this *HisProjectApiController) GetTodaySchedulePatient() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- recordDateStr := time.Now().Format("2006-01-02")
- recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
- scheduleDate := recordDate.Unix()
-
- patient, err := service.GetTodaySchedulePatient(orgId, scheduleDate)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patient": patient,
- })
- }
-
- func (this *HisProjectApiController) GetHisPatientDetail() {
- patient_id, _ := this.GetInt64("patient_id")
-
- hisPatient, _ := service.GetHisPatientByIdFour(patient_id)
- //service.GetLastHospitalRecordTwo(patient_id,this.GetAdminUserInfo().CurrentOrgId)
- hisHospitalRecord, _ := service.GetLastHospitalRecordTwo(patient_id, this.GetAdminUserInfo().CurrentOrgId)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "hisPatient": hisPatient,
- "hisHospitalRecord": hisHospitalRecord,
- })
- }
-
- func (this *HisProjectApiController) GetAllDepartmentList() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- departMent, err := service.GetAllDepartMent(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "departMent": departMent,
- })
- }
-
- func (this *HisProjectApiController) GetPrescription() {
-
- patient_id, _ := this.GetInt64("patient_id")
- p_type, _ := this.GetInt64("p_type")
- record_date := this.GetString("record_date")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
-
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDateTime := theTime.Unix()
-
- list, err := service.GetPrescriptionByPatientId(patient_id, recordDateTime, p_type)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
-
- func (this *HisProjectApiController) GetPatientDetail() {
-
- id, _ := this.GetInt64("id")
- adminUserInfo := this.GetAdminUserInfo()
- patient, err := service.GetFaPiaoPatientByID(adminUserInfo.CurrentOrgId, id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patient": patient,
- })
- }
-
- func (this *HisProjectApiController) SaveMainTemplate() {
-
- title := this.GetString("title")
- content := this.GetString("content")
- remark := this.GetString("remark")
- template_id, _ := this.GetInt64("template_id")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- template := models.XtHisMedicalTemplate{
- Title: title,
- Content: content,
- Remark: remark,
- UserOrgId: orgId,
- TemplateId: template_id,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- err := service.CreateHisMedicalTemplate(&template)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- })
- }
-
- func (this *HisProjectApiController) GetMedicalTempalteList() {
-
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- list, err := service.GetMedicalTemplateList(orgId)
- listOne, err := service.GetMedicalTemplateListOne(orgId)
- listTwo, err := service.GetMedicalTemplateListTwo(orgId)
- listThree, err := service.GetMedicalTemplateListThree(orgId)
- listFour, err := service.GetMedicalTemplateListFour(orgId)
- listFive, err := service.GetMedicalTemplateListFive(orgId)
- listSix, err := service.GetMedicalTemplateListSix(orgId)
- listSeven, err := service.GetMedicalTemplateListSeven(orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "listOne": listOne,
- "listTwo": listTwo,
- "listThree": listThree,
- "listFour": listFour,
- "listFive": listFive,
- "listSix": listSix,
- "listSeven": listSeven,
- })
- }
-
- func (this *HisProjectApiController) GetMainTemplateById() {
-
- id, _ := this.GetInt64("id")
- template, err := service.GetMainTemplateById(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- })
- }
-
- func (this *HisProjectApiController) UpdateMainTemplate() {
-
- title := this.GetString("title")
- content := this.GetString("content")
- remark := this.GetString("remark")
- id, _ := this.GetInt64("id")
-
- template := models.XtHisMedicalTemplate{
- Title: title,
- Content: content,
- Remark: remark,
- }
-
- err := service.UpdateMainTemplate(&template, id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "template": template,
- })
- }
-
- func (this *HisProjectApiController) DeleteMainTemplate() {
-
- id, _ := this.GetInt64("id")
- err := service.DeleteMainTemplateById(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
- return
- }
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
-
- }
|