package controllers import ( "XT_New/enums" "XT_New/models" "XT_New/service" "XT_New/utils" "bytes" "compress/gzip" "encoding/json" "github.com/astaxie/beego" "net/http" "time" ) type HisChargeApiController struct { BaseAuthAPIController } func HisChargeApiRegistRouters() { beego.Router("/api/his/chargestatistics/detail", &HisChargeApiController{}, "get:GetChargeStatisticsDetail") beego.Router("/api/his/chargestatistics/settle", &HisChargeApiController{}, "get:GetChargeStatisticsSettle") beego.Router("/api/his/prescription/detail", &HisChargeApiController{}, "get:GetPrescriptionStatisticsDetail") beego.Router("/api/his/prescription/initdata", &HisChargeApiController{}, "get:GetPrescriptionInitData") //beego.InsertFilter("/api/his/chargestatistics/detail", beego.BeforeRouter, GzipFilter) beego.Router("/api/his/patient", &HisChargeApiController{}, "get:GetAllPatient") //beego.Router("/api/his/chargestatistics/settle", &HisChargeApiController{}, "get:GetChargeStatisticsSettle") beego.Router("/api/his/inspectionlist/get", &HisChargeApiController{}, "get:GetHisInspectionList") beego.Router("/api/his/inspectionlisttwo/get", &HisChargeApiController{}, "get:GetHisInspectionListTwo") beego.Router("/api/his/inspectioninfo/get", &HisChargeApiController{}, "get:GetHisInspectionInfo") //发票 beego.Router("/api/fapiao/create", &HisChargeApiController{}, "post:CreateFaPiaoRecord") beego.Router("/api/fapiao/modify", &HisChargeApiController{}, "post:ModifyFaPiaoRecord") beego.Router("/api/fapiao/list", &HisChargeApiController{}, "get:GetFaPiaoRecordList") beego.Router("/api/fapiao/delete", &HisChargeApiController{}, "post:DeleteFaPiaoRecord") beego.Router("/api/fapiao", &HisChargeApiController{}, "get:GetFaPiaoRecord") beego.Router("/api/fapiao/is_use", &HisChargeApiController{}, "post:UpdateFaPiaoRecordIsUse") beego.Router("/api/his/getyidiclear", &HisChargeApiController{}, "get:GetHisYidiClearRecord") beego.Router("/api/his/getexportdata", &HisChargeApiController{}, "get:GetExportData") } func (c *HisChargeApiController) GetExportData() { start_time := c.GetString("start_time") end_time := c.GetString("end_time") adminUser := c.GetAdminUserInfo() timeLayout := "2006-01-02" loc, _ := time.LoadLocation("Local") startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc) if err != nil { } startRecordDateTime := startTime.Unix() endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc) if err != nil { } endRecordDateTime := endTime.Unix() chargePatient, err := service.GetAllChargeDetailsTwo(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "patients": chargePatient, }) return } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } } func (c *HisChargeApiController) UpdateFaPiaoRecordIsUse() { id, _ := c.GetInt64("id", 0) is_use, _ := c.GetInt64("is_use") if id <= 0 { utils.ErrorLog("id == 0") c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } record, _ := service.FindFapiaoById(id) adminUserInfo := c.GetAdminUserInfo() service.UpdateFapiaoIsUse(adminUserInfo.CurrentOrgId) records := models.HisFapiaoRecord{ ID: id, FapiaoCode: record.FapiaoCode, FapiaoNumber: record.FapiaoNumber, Ctime: time.Now().Unix(), Mtime: time.Now().Unix(), UserOrgId: adminUserInfo.CurrentOrgId, Status: 1, IsUse: is_use, } err := service.ModifyFapiao(&records) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "fapiao_record": records, }) } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) } } func (c *HisChargeApiController) CreateFaPiaoRecord() { fapiao_code := c.GetString("fapiao_code") fapiao_number := c.GetString("fapiao_number") if len(fapiao_code) <= 0 { utils.ErrorLog("len(fapiao_code) == 0") c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } if len(fapiao_number) <= 0 { utils.ErrorLog("len(fapiao_number) == 0") c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } adminUserInfo := c.GetAdminUserInfo() record := models.HisFapiaoRecord{ FapiaoCode: fapiao_code, FapiaoNumber: fapiao_number, Ctime: time.Now().Unix(), Mtime: time.Now().Unix(), UserOrgId: adminUserInfo.CurrentOrgId, Status: 1, IsUse: 0, } err, records := service.AddSigleFapiaoRecord(&record) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "fapiao_record": records, }) } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) } } func (c *HisChargeApiController) ModifyFaPiaoRecord() { id, _ := c.GetInt64("id", 0) fapiao_code := c.GetString("fapiao_code") fapiao_number := c.GetString("fapiao_number") if id <= 0 { utils.ErrorLog("id == 0") c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } if len(fapiao_code) <= 0 { utils.ErrorLog("len(fapiao_code) == 0") c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } if len(fapiao_number) <= 0 { utils.ErrorLog("len(fapiao_number) == 0") c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } record, _ := service.FindFapiaoById(id) adminUserInfo := c.GetAdminUserInfo() records := models.HisFapiaoRecord{ ID: id, FapiaoCode: fapiao_code, FapiaoNumber: fapiao_number, Ctime: time.Now().Unix(), Mtime: time.Now().Unix(), UserOrgId: adminUserInfo.CurrentOrgId, Status: 1, IsUse: record.IsUse, } err := service.ModifyFapiao(&records) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "fapiao_record": records, }) } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) } } func (c *HisChargeApiController) GetFaPiaoRecordList() { page, _ := c.GetInt64("page", 1) limit, _ := c.GetInt64("limit", 7) adminUserInfo := c.GetAdminUserInfo() fapiaoRecord, total, err := service.FindAllFapiaoList(adminUserInfo.CurrentOrgId, page, limit) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "fapiao_record": fapiaoRecord, "total": total, }) } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) } } func (c *HisChargeApiController) DeleteFaPiaoRecord() { id, _ := c.GetInt64("id", 0) err := service.DeleteFapiaoById(id) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "msg": "删除成功", }) } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) } } func (c *HisChargeApiController) GetFaPiaoRecord() { id, _ := c.GetInt64("id", 0) fapiaoRecord, err := service.FindFapiaoById(id) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "fapiao_record": fapiaoRecord, }) } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) } } func (c *HisChargeApiController) GetChargeStatisticsDetail() { //c.ServeSuccessJSON(map[string]interface{}{ // "msg": "接口优化升级,如有数据需要,请联系客服!", //}) //return start_time := c.GetString("start_time") end_time := c.GetString("end_time") time_type := c.GetString("time_type") keyword := c.GetString("keyword") item_type, _ := c.GetInt64("type") adminUser := c.GetAdminUserInfo() timeLayout := "2006-01-02" loc, _ := time.LoadLocation("Local") startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc) if err != nil { } startRecordDateTime := startTime.Unix() endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc) if err != nil { } endRecordDateTime := endTime.Unix() switch item_type { case 0: chargeDrug, err := service.GetNewAllPatientDrugChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type, time_type) chargeProject, err := service.GetNewAllPatientProjectAndGoodChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type, time_type) chargeDrug = append(chargeDrug, chargeProject...) b, _ := structToBytes(chargeDrug) //cd, _ := compressData(b) // 使用 Gzip 压缩数据 var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err = writer.Write(b) if err != nil { c.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError) c.Ctx.WriteString(err.Error()) return } writer.Close() // 设置响应头,表明数据经过了 Gzip 压缩 c.Ctx.Output.Header("Content-Encoding", "gzip") // 发送压缩后的数据 c.Ctx.ResponseWriter.Write(compressedData.Bytes()) break case 1: chargeDrug, err := service.GetNewAllPatientDrugChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type, time_type) //chargeProject, err := service.GetNewAllPatientProjectAndGoodChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type) //chargeDrug = append(chargeDrug, chargeProject...) b, _ := structToBytes(chargeDrug) //cd, _ := compressData(b) // 使用 Gzip 压缩数据 var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err = writer.Write(b) if err != nil { c.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError) c.Ctx.WriteString(err.Error()) return } writer.Close() // 设置响应头,表明数据经过了 Gzip 压缩 c.Ctx.Output.Header("Content-Encoding", "gzip") // 发送压缩后的数据 c.Ctx.ResponseWriter.Write(compressedData.Bytes()) break case 2: //chargeDrug, err := service.GetNewAllPatientDrugChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type) chargeProject, err := service.GetNewAllPatientProjectAndGoodChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type, time_type) //chargeDrug = append(chargeDrug, chargeProject...) b, _ := structToBytes(chargeProject) //cd, _ := compressData(b) // 使用 Gzip 压缩数据 var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err = writer.Write(b) if err != nil { c.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError) c.Ctx.WriteString(err.Error()) return } writer.Close() // 设置响应头,表明数据经过了 Gzip 压缩 c.Ctx.Output.Header("Content-Encoding", "gzip") // 发送压缩后的数据 c.Ctx.ResponseWriter.Write(compressedData.Bytes()) break case 3: //chargeDrug, err := service.GetNewAllPatientDrugChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type) chargeProject, err := service.GetNewAllPatientProjectAndGoodChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type, time_type) //chargeDrug = append(chargeDrug, chargeProject...) b, _ := structToBytes(chargeProject) //cd, _ := compressData(b) // 使用 Gzip 压缩数据 var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err = writer.Write(b) if err != nil { c.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError) c.Ctx.WriteString(err.Error()) return } writer.Close() // 设置响应头,表明数据经过了 Gzip 压缩 c.Ctx.Output.Header("Content-Encoding", "gzip") // 发送压缩后的数据 c.Ctx.ResponseWriter.Write(compressedData.Bytes()) break case 4: //chargeDrug, err := service.GetNewAllPatientDrugChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type) chargeProject, err := service.GetNewAllPatientProjectAndGoodChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type, time_type) //chargeDrug = append(chargeDrug, chargeProject...) b, _ := structToBytes(chargeProject) //cd, _ := compressData(b) // 使用 Gzip 压缩数据 var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err = writer.Write(b) if err != nil { c.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError) c.Ctx.WriteString(err.Error()) return } writer.Close() // 设置响应头,表明数据经过了 Gzip 压缩 c.Ctx.Output.Header("Content-Encoding", "gzip") // 发送压缩后的数据 c.Ctx.ResponseWriter.Write(compressedData.Bytes()) break case 5: //chargeDrug, err := service.GetNewAllPatientDrugChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type) chargeProject, err := service.GetNewAllPatientProjectAndGoodChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type, time_type) //chargeDrug = append(chargeDrug, chargeProject...) b, _ := structToBytes(chargeProject) //cd, _ := compressData(b) // 使用 Gzip 压缩数据 var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err = writer.Write(b) if err != nil { c.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError) c.Ctx.WriteString(err.Error()) return } writer.Close() // 设置响应头,表明数据经过了 Gzip 压缩 c.Ctx.Output.Header("Content-Encoding", "gzip") // 发送压缩后的数据 c.Ctx.ResponseWriter.Write(compressedData.Bytes()) break case 6: //chargeDrug, err := service.GetNewAllPatientDrugChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type) chargeProject, err := service.GetNewAllPatientProjectAndGoodChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type, time_type) //chargeDrug = append(chargeDrug, chargeProject...) b, _ := structToBytes(chargeProject) //cd, _ := compressData(b) // 使用 Gzip 压缩数据 var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err = writer.Write(b) if err != nil { c.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError) c.Ctx.WriteString(err.Error()) return } writer.Close() // 设置响应头,表明数据经过了 Gzip 压缩 c.Ctx.Output.Header("Content-Encoding", "gzip") // 发送压缩后的数据 c.Ctx.ResponseWriter.Write(compressedData.Bytes()) break case 7: //chargeDrug, err := service.GetNewAllPatientDrugChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type) chargeProject, err := service.GetNewAllPatientProjectAndGoodChargeDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, keyword, item_type, time_type) //chargeDrug = append(chargeDrug, chargeProject...) b, _ := structToBytes(chargeProject) //cd, _ := compressData(b) // 使用 Gzip 压缩数据 var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err = writer.Write(b) if err != nil { c.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError) c.Ctx.WriteString(err.Error()) return } writer.Close() // 设置响应头,表明数据经过了 Gzip 压缩 c.Ctx.Output.Header("Content-Encoding", "gzip") // 发送压缩后的数据 c.Ctx.ResponseWriter.Write(compressedData.Bytes()) break } } func (c *HisChargeApiController) GetPrescriptionStatisticsDetail() { start_time := c.GetString("start_time") end_time := c.GetString("end_time") patient_id, _ := c.GetInt64("patient_id") item_type, _ := c.GetInt64("type") date1, _ := time.Parse("2006-01-02", start_time) date2, _ := time.Parse("2006-01-02", end_time) // 计算日期间隔 duration := date2.Sub(date1) // 一个月的时间跨度为30天 * 24小时 * 60分钟 * 60秒 oneMonthDuration := 30 * 24 * time.Hour if duration <= oneMonthDuration { } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorTimeCodeParamWrong) return } adminUser := c.GetAdminUserInfo() timeLayout := "2006-01-02" loc, _ := time.LoadLocation("Local") startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc) if err != nil { } startRecordDateTime := startTime.Unix() endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc) if err != nil { } endRecordDateTime := endTime.Unix() chargeDrug, err := service.GetHisPrescriptionDrugDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, patient_id, item_type) chargeProject, err := service.GetHisPrescriptionProjectDetails(adminUser.CurrentOrgId, start_time+" 00:00:00", end_time+" 23:59:59", startRecordDateTime, endRecordDateTime, patient_id, item_type) chargeDrug = append(chargeDrug, chargeProject...) b, _ := structpToBytes(chargeDrug) //cd, _ := compressData(b) // 使用 Gzip 压缩数据 var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err = writer.Write(b) if err != nil { c.Ctx.ResponseWriter.WriteHeader(http.StatusInternalServerError) c.Ctx.WriteString(err.Error()) return } writer.Close() // 设置响应头,表明数据经过了 Gzip 压缩 c.Ctx.Output.Header("Content-Encoding", "gzip") // 发送压缩后的数据 c.Ctx.ResponseWriter.Write(compressedData.Bytes()) } func (c *HisChargeApiController) GetPrescriptionInitData() { var drugType = "药品类型" drugTypeParent, _ := service.GetDrugDataConfig(0, drugType) drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, c.GetAdminUserInfo().CurrentOrgId) var costClassify = "费用类别" costClassifyParent, _ := service.GetDrugDataConfig(0, costClassify) costClassifyList, _ := service.GetParentDataConfig(costClassifyParent.ID, c.GetAdminUserInfo().CurrentOrgId) c.ServeSuccessJSON(map[string]interface{}{ "drugTypeList": drugTypeList, "costClassifyList": costClassifyList, }) } func structpToBytes(p []*models.NewPDetail) ([]byte, error) { data, err := json.Marshal(p) if err != nil { return nil, err } return data, nil } func structToBytes(p []*models.NewChargeDetail) ([]byte, error) { data, err := json.Marshal(p) if err != nil { return nil, err } return data, nil } func compressData(data []byte) ([]byte, error) { var compressedData bytes.Buffer writer := gzip.NewWriter(&compressedData) _, err := writer.Write(data) if err != nil { return nil, err } err = writer.Close() if err != nil { return nil, err } return compressedData.Bytes(), nil } func (c *HisChargeApiController) GetChargeStatisticsSettle() { start_time := c.GetString("start_time") end_time := c.GetString("end_time") keyword := c.GetString("keyword") item_type, _ := c.GetInt64("type") adminUser := c.GetAdminUserInfo() timeLayout := "2006-01-02" loc, _ := time.LoadLocation("Local") startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc) if err != nil { } startRecordDateTime := startTime.Unix() endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc) if err != nil { } endRecordDateTime := endTime.Unix() chargePatient, err := service.GetAllPatientChargeSettle(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime, keyword, item_type) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "patients": chargePatient, }) return } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } } func (c *HisChargeApiController) GetHisInspectionList() { record_date := c.GetString("record_date") keyword := c.GetString("keyword") is_print, _ := c.GetInt64("is_print") page, _ := c.GetInt64("page") limit, _ := c.GetInt64("limit") tube_color, _ := c.GetInt64("tube_color") adminUser := c.GetAdminUserInfo() timeLayout := "2006-01-02" loc, _ := time.LoadLocation("Local") startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc) if err != nil { } record_time := startTime.Unix() var labels []*models.HisLabelPrintInfo var labels_two []*models.HisLabelPrintInfo var total int64 var total_two int64 //var err error if tube_color == 0 { labels, total, err = service.GetLabelPrintList(page, limit, adminUser.CurrentOrgId, record_time, is_print, keyword, tube_color) } else { labels, total, err = service.GetLabelPrintList(page, limit, adminUser.CurrentOrgId, record_time, is_print, keyword, tube_color) labels_two, total_two, err = service.GetLabelPrintListTwo(page, limit, adminUser.CurrentOrgId, record_time, is_print, keyword, tube_color) total = total + total_two labels = append(labels, labels_two...) } if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "labels": labels, "total": total, }) return } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } } func (c *HisChargeApiController) GetHisInspectionListTwo() { record_date := c.GetString("record_date") keyword := c.GetString("keyword") is_print, _ := c.GetInt64("is_print") tube_color, _ := c.GetInt64("tube_color") adminUser := c.GetAdminUserInfo() timeLayout := "2006-01-02" loc, _ := time.LoadLocation("Local") startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc) if err != nil { } record_time := startTime.Unix() var labels []*models.HisLabelPrintInfo //var labels_two []*models.HisLabelPrintInfo //var total int64 //var total_two int64 labels, _, err = service.GetLabelPrintListThree(adminUser.CurrentOrgId, record_time, is_print, keyword, tube_color) //labels_two, total_two, err = service.GetLabelPrintListFour(adminUser.CurrentOrgId, record_time, is_print, keyword, tube_color) //total = total + total_two //labels = append(labels, labels_two...) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "labels": labels, //"total": total, }) return } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } } func (c *HisChargeApiController) GetHisInspectionInfo() { id, _ := c.GetInt64("id") label, err := service.GetLabelPrintInfo(id) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "label": label, }) return } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } } func (c *HisChargeApiController) GetHisYidiClearRecord() { records, err := service.FindHisYidiClearRecord(c.GetAdminUserInfo().CurrentOrgId) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "list": records, }) return } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } } func (c *HisChargeApiController) GetAllPatient() { patients, err := service.GetAllPatientTwo(c.GetAdminUserInfo().CurrentOrgId) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "list": patients, }) return } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } } func (c *HisChargeApiController) GetStatisticsDetail() { start_time := c.GetString("start_time") end_time := c.GetString("end_time") keyword := c.GetString("keyword") item_type, _ := c.GetInt64("type") p_type, _ := c.GetInt64("p_type") patinet_id, _ := c.GetInt64("patinet_id") adminUser := c.GetAdminUserInfo() timeLayout := "2006-01-02" loc, _ := time.LoadLocation("Local") startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc) if err != nil { } startRecordDateTime := startTime.Unix() endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc) if err != nil { } endRecordDateTime := endTime.Unix() chargePatient, err := service.GetPatientChargeDetails(patinet_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime, keyword, item_type, p_type) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "patients": chargePatient, }) return } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } } func (c *HisChargeApiController) GetStatisticsGather() { start_time := c.GetString("start_time") end_time := c.GetString("end_time") keyword := c.GetString("keyword") item_type, _ := c.GetInt64("type") adminUser := c.GetAdminUserInfo() timeLayout := "2006-01-02" loc, _ := time.LoadLocation("Local") startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc) if err != nil { } startRecordDateTime := startTime.Unix() endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc) if err != nil { } endRecordDateTime := endTime.Unix() chargePatient, err := service.GetAllPatientChargeDetails(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime, keyword, item_type) if err == nil { c.ServeSuccessJSON(map[string]interface{}{ "patients": chargePatient, }) return } else { c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } }