123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- package controllers
-
- import (
- "XT_New/enums"
- "XT_New/service"
- "github.com/astaxie/beego"
- "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/inspectionlist/get", &HisChargeApiController{}, "get:GetHisInspectionList")
- beego.Router("/api/his/inspectioninfo/get", &HisChargeApiController{}, "get:GetHisInspectionInfo")
-
- }
-
- func (c *HisChargeApiController) GetChargeStatisticsDetail() {
- 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
-
- }
-
- }
-
- 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")
-
- 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()
- labels, total, err := service.GetLabelPrintList(page, limit, adminUser.CurrentOrgId, record_time, is_print, keyword)
- 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
- }
- }
|