Browse Source

医保对接

csx 3 years ago
parent
commit
5c025a8a43
3 changed files with 251 additions and 118 deletions
  1. 60 59
      controllers/base_api_controller.go
  2. 189 57
      controllers/his_api_controller.go
  3. 2 2
      service/schedule_service.go

+ 60 - 59
controllers/base_api_controller.go View File

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
+	"XT_New/models"
5
 	"XT_New/service"
6
 	"XT_New/service"
6
 	"fmt"
7
 	"fmt"
7
 	"strconv"
8
 	"strconv"
69
 func (this *BaseAuthAPIController) Prepare() {
70
 func (this *BaseAuthAPIController) Prepare() {
70
 	this.BaseAPIController.Prepare()
71
 	this.BaseAPIController.Prepare()
71
 	if this.GetAdminUserInfo() == nil {
72
 	if this.GetAdminUserInfo() == nil {
72
-		//var userAdmin models.AdminUser
73
-		//userAdmin.Id = 1448
74
-		//userAdmin.Mobile = "13318599895"
75
-		//
76
-		//userAdmin.Id = 597
77
-		//userAdmin.Mobile = "19874122664"
78
-		//userAdmin.IsSuperAdmin = false
79
-		//userAdmin.Status = 1
80
-		//userAdmin.CreateTime = 1530786071
81
-		//userAdmin.ModifyTime = 1530786071
82
-		//var subscibe models.ServeSubscibe
83
-		//subscibe.ID = 1
84
-		//subscibe.OrgId = 3877
85
-		//subscibe.PeriodStart = 1538035409
86
-		//subscibe.PeriodEnd = 1569571409
87
-		//subscibe.State = 1
88
-		//subscibe.Status = 1
89
-		//subscibe.CreatedTime = 1538035409
90
-		//subscibe.UpdatedTime = 1538035409
91
-		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
-		//subscibes[4] = &subscibe
93
-		//var adminUserInfo service.AdminUserInfo
94
-		//adminUserInfo.CurrentOrgId = 3877
95
-		//adminUserInfo.CurrentAppId = 4
96
-		//adminUserInfo.AdminUser = &userAdmin
97
-		//adminUserInfo.Subscibes = subscibes
98
-		//this.SetSession("admin_user_info", &adminUserInfo)
99
-
100
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
101
-		this.StopRun()
73
+		var userAdmin models.AdminUser
74
+		userAdmin.Id = 1448
75
+		userAdmin.Mobile = "13318599895"
76
+
77
+		userAdmin.Id = 597
78
+		userAdmin.Mobile = "19874122664"
79
+		userAdmin.IsSuperAdmin = false
80
+		userAdmin.Status = 1
81
+		userAdmin.CreateTime = 1530786071
82
+		userAdmin.ModifyTime = 1530786071
83
+		var subscibe models.ServeSubscibe
84
+		subscibe.ID = 1
85
+		subscibe.OrgId = 10106
86
+		subscibe.PeriodStart = 1538035409
87
+		subscibe.PeriodEnd = 1569571409
88
+		subscibe.State = 1
89
+		subscibe.Status = 1
90
+		subscibe.CreatedTime = 1538035409
91
+		subscibe.UpdatedTime = 1538035409
92
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
+		subscibes[4] = &subscibe
94
+		var adminUserInfo service.AdminUserInfo
95
+		adminUserInfo.CurrentOrgId = 10106
96
+		adminUserInfo.CurrentAppId = 4
97
+		adminUserInfo.AdminUser = &userAdmin
98
+		adminUserInfo.Subscibes = subscibes
99
+		this.SetSession("admin_user_info", &adminUserInfo)
100
+
101
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
102
+		//this.StopRun()
102
 
103
 
103
 	}
104
 	}
104
 
105
 
315
 func (this *BaseServeAPIController) Prepare() {
316
 func (this *BaseServeAPIController) Prepare() {
316
 	this.BaseAPIController.Prepare()
317
 	this.BaseAPIController.Prepare()
317
 	if this.GetAdminUserInfo() == nil {
318
 	if this.GetAdminUserInfo() == nil {
318
-		//var userAdmin models.AdminUser
319
-		//userAdmin.Id = 1448
320
-		//userAdmin.Mobile = "13318599895"
321
-		//
322
-		//userAdmin.Id = 597
323
-		//userAdmin.Mobile = "19874122664"
324
-		//userAdmin.IsSuperAdmin = false
325
-		//userAdmin.Status = 1
326
-		//userAdmin.CreateTime = 1530786071
327
-		//userAdmin.ModifyTime = 1530786071
328
-		//var subscibe models.ServeSubscibe
329
-		//subscibe.ID = 1
330
-		//subscibe.OrgId = 3877
331
-		//subscibe.PeriodStart = 1538035409
332
-		//subscibe.PeriodEnd = 1569571409
333
-		//subscibe.State = 1
334
-		//subscibe.Status = 1
335
-		//subscibe.CreatedTime = 1538035409
336
-		//subscibe.UpdatedTime = 1538035409
337
-		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
-		//subscibes[4] = &subscibe
339
-		//var adminUserInfo service.AdminUserInfo
340
-		//adminUserInfo.CurrentOrgId = 3877
341
-		//adminUserInfo.CurrentAppId = 4
342
-		//adminUserInfo.AdminUser = &userAdmin
343
-		//adminUserInfo.Subscibes = subscibes
344
-		//this.SetSession("admin_user_info", &adminUserInfo)
345
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
346
-		this.StopRun()
319
+		var userAdmin models.AdminUser
320
+		userAdmin.Id = 1448
321
+		userAdmin.Mobile = "13318599895"
322
+
323
+		userAdmin.Id = 597
324
+		userAdmin.Mobile = "19874122664"
325
+		userAdmin.IsSuperAdmin = false
326
+		userAdmin.Status = 1
327
+		userAdmin.CreateTime = 1530786071
328
+		userAdmin.ModifyTime = 1530786071
329
+		var subscibe models.ServeSubscibe
330
+		subscibe.ID = 1
331
+		subscibe.OrgId = 10106
332
+		subscibe.PeriodStart = 1538035409
333
+		subscibe.PeriodEnd = 1569571409
334
+		subscibe.State = 1
335
+		subscibe.Status = 1
336
+		subscibe.CreatedTime = 1538035409
337
+		subscibe.UpdatedTime = 1538035409
338
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
+		subscibes[4] = &subscibe
340
+		var adminUserInfo service.AdminUserInfo
341
+		adminUserInfo.CurrentOrgId = 10106
342
+		adminUserInfo.CurrentAppId = 4
343
+		adminUserInfo.AdminUser = &userAdmin
344
+		adminUserInfo.Subscibes = subscibes
345
+		this.SetSession("admin_user_info", &adminUserInfo)
346
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
347
+		//this.StopRun()
347
 	}
348
 	}
348
 
349
 
349
 	//if adminUserInfo.AppRole != nil {
350
 	//if adminUserInfo.AppRole != nil {

+ 189 - 57
controllers/his_api_controller.go View File

100
 
100
 
101
 	beego.Router("/api/uncharge/list", &HisApiController{}, "get:GetHisUnChargePatientList")
101
 	beego.Router("/api/uncharge/list", &HisApiController{}, "get:GetHisUnChargePatientList")
102
 
102
 
103
+	beego.Router("/api/monthcharge/info", &HisApiController{}, "get:GetHisMonthChargePatientInfo")
104
+	beego.Router("/api/monthhispatient/get", &HisApiController{}, "get:GetHisMonthPatientInfo")
105
+
103
 }
106
 }
104
 
107
 
105
 func (c *HisApiController) GetHisUnChargePatientList() {
108
 func (c *HisApiController) GetHisUnChargePatientList() {
349
 	his_patient_id, _ := c.GetInt64("his_patient_id")
352
 	his_patient_id, _ := c.GetInt64("his_patient_id")
350
 	record_date := c.GetString("record_date")
353
 	record_date := c.GetString("record_date")
351
 	number := c.GetString("number")
354
 	number := c.GetString("number")
352
-	start_time := c.GetString("start_time")
353
-	end_time := c.GetString("end_time")
355
+	//start_time := c.GetString("start_time")
356
+	//end_time := c.GetString("end_time")
354
 	p_type, _ := c.GetInt64("p_type")
357
 	p_type, _ := c.GetInt64("p_type")
355
 
358
 
356
 	timeLayout := "2006-01-02"
359
 	timeLayout := "2006-01-02"
361
 		return
364
 		return
362
 	}
365
 	}
363
 	recordDateTime := theTime.Unix()
366
 	recordDateTime := theTime.Unix()
364
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
365
-	if err != nil {
366
-
367
-	}
368
-	startRecordDateTime := startTime.Unix()
369
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
370
-	if err != nil {
371
-
372
-	}
373
-	endRecordDateTime := endTime.Unix()
367
+	//startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
368
+	//if err != nil {
369
+	//
370
+	//}
371
+	//startRecordDateTime := startTime.Unix()
372
+	//endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
373
+	//if err != nil {
374
+	//
375
+	//}
376
+	//endRecordDateTime := endTime.Unix()
374
 	admin := c.GetAdminUserInfo()
377
 	admin := c.GetAdminUserInfo()
375
 	his_patient_info, _ := service.GetNewHisPatientInfoTwo(admin.CurrentOrgId, his_patient_id, recordDateTime)
378
 	his_patient_info, _ := service.GetNewHisPatientInfoTwo(admin.CurrentOrgId, his_patient_id, recordDateTime)
376
 	xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
379
 	xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
396
 
399
 
397
 	}
400
 	}
398
 	//prescriptions, _ := service.GetHisPrescription(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime)
401
 	//prescriptions, _ := service.GetHisPrescription(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime)
399
-	monthPrescriptions, _ := service.GetMonthHisPrescriptionTwo(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
402
+	//monthPrescriptions, _ := service.GetMonthHisPrescriptionTwo(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
400
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
403
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
401
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
404
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
402
 	lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
405
 	lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
409
 	//获取所有科室信息
412
 	//获取所有科室信息
410
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
413
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
411
 	c.ServeSuccessJSON(map[string]interface{}{
414
 	c.ServeSuccessJSON(map[string]interface{}{
412
-		"his_info":            his_patient_info,
413
-		"xt_info":             xt_patient_info,
414
-		"prescription":        prescriptions,
415
-		"case_history":        case_history,
416
-		"info":                patientPrescriptionInfo,
417
-		"month_prescriptions": monthPrescriptions,
418
-		"order":               order,
419
-		"doctors":             doctors,
420
-		"department":          department,
421
-		"sch_prescriptions":   sch_prescriptions,
422
-		"last_prescriptions":  last_prescriptions,
423
-		"schedule":            sch,
424
-		"count":               count,
425
-		"drugStockConfig":     drugStockConfig,
426
-		"last_info":           lastPatientPrescriptionInfo,
415
+		"his_info":     his_patient_info,
416
+		"xt_info":      xt_patient_info,
417
+		"prescription": prescriptions,
418
+		"case_history": case_history,
419
+		"info":         patientPrescriptionInfo,
420
+		//"month_prescriptions": monthPrescriptions,
421
+		"order":              order,
422
+		"doctors":            doctors,
423
+		"department":         department,
424
+		"sch_prescriptions":  sch_prescriptions,
425
+		"last_prescriptions": last_prescriptions,
426
+		"schedule":           sch,
427
+		"count":              count,
428
+		"drugStockConfig":    drugStockConfig,
429
+		"last_info":          lastPatientPrescriptionInfo,
427
 	})
430
 	})
428
 	return
431
 	return
429
 
432
 
3492
 	patient_id, _ := c.GetInt64("patient_id")
3495
 	patient_id, _ := c.GetInt64("patient_id")
3493
 	his_patient_id, _ := c.GetInt64("his_patient_id")
3496
 	his_patient_id, _ := c.GetInt64("his_patient_id")
3494
 	record_date := c.GetString("record_date")
3497
 	record_date := c.GetString("record_date")
3495
-	start_time := c.GetString("start_time")
3496
-	end_time := c.GetString("end_time")
3498
+	//start_time := c.GetString("start_time")
3499
+	//end_time := c.GetString("end_time")
3497
 	order_status, _ := c.GetInt64("type", 0)
3500
 	order_status, _ := c.GetInt64("type", 0)
3498
 	p_type, _ := c.GetInt64("p_type", 0)
3501
 	p_type, _ := c.GetInt64("p_type", 0)
3499
 	order_id, _ := c.GetInt64("order_id", 0)
3502
 	order_id, _ := c.GetInt64("order_id", 0)
3507
 	}
3510
 	}
3508
 	recordDateTime := theTime.Unix()
3511
 	recordDateTime := theTime.Unix()
3509
 
3512
 
3510
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
3511
-	if err != nil {
3512
-
3513
-	}
3514
-	startRecordDateTime := startTime.Unix()
3515
-
3516
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
3517
-	if err != nil {
3518
-
3519
-	}
3520
-	endRecordDateTime := endTime.Unix()
3513
+	//startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
3514
+	//if err != nil {
3515
+	//
3516
+	//}
3517
+	//startRecordDateTime := startTime.Unix()
3518
+	//
3519
+	//endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
3520
+	//if err != nil {
3521
+	//
3522
+	//}
3523
+	//endRecordDateTime := endTime.Unix()
3521
 
3524
 
3522
 	admin := c.GetAdminUserInfo()
3525
 	admin := c.GetAdminUserInfo()
3523
 	his_patient_info, _ := service.GetNewHisPatientInfo(his_patient_id)
3526
 	his_patient_info, _ := service.GetNewHisPatientInfo(his_patient_id)
3533
 		prescriptions, _ = service.GetChargeHisPrescriptionSeven(admin.CurrentOrgId, patient_id, order.Number, p_type)
3536
 		prescriptions, _ = service.GetChargeHisPrescriptionSeven(admin.CurrentOrgId, patient_id, order.Number, p_type)
3534
 	}
3537
 	}
3535
 
3538
 
3536
-	var monthPrescriptions []*models.HisPrescription
3537
-	if order_status == 1 || order_status == 0 {
3538
-		monthPrescriptions, _ = service.GetUnChargeMonthHisPrescriptionThree(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
3539
-	} else if order_status == 2 {
3540
-		monthPrescriptions, _ = service.GetChargeMonthHisPrescriptionFive(admin.CurrentOrgId, patient_id, order.Number, p_type)
3541
-	}
3539
+	//var monthPrescriptions []*models.HisPrescription
3540
+	//if order_status == 1 || order_status == 0 {
3541
+	//	monthPrescriptions, _ = service.GetUnChargeMonthHisPrescriptionThree(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
3542
+	//} else if order_status == 2 {
3543
+	//	monthPrescriptions, _ = service.GetChargeMonthHisPrescriptionFive(admin.CurrentOrgId, patient_id, order.Number, p_type)
3544
+	//}
3545
+
3542
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
3546
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
3543
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
3547
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
3544
 
3548
 
3549
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
3553
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
3550
 
3554
 
3551
 	c.ServeSuccessJSON(map[string]interface{}{
3555
 	c.ServeSuccessJSON(map[string]interface{}{
3552
-		"his_info":            his_patient_info,
3553
-		"xt_info":             xt_patient_info,
3554
-		"prescription":        prescriptions,
3555
-		"case_history":        case_history,
3556
-		"info":                patientPrescriptionInfo,
3557
-		"last_info":           lastPatientPrescriptionInfo,
3558
-		"month_prescriptions": monthPrescriptions,
3559
-		"order":               order,
3560
-		"doctors":             doctors,
3561
-		"department":          department,
3556
+		"his_info":     his_patient_info,
3557
+		"xt_info":      xt_patient_info,
3558
+		"prescription": prescriptions,
3559
+		"case_history": case_history,
3560
+		"info":         patientPrescriptionInfo,
3561
+		"last_info":    lastPatientPrescriptionInfo,
3562
+		//"month_prescriptions": monthPrescriptions,
3563
+		"order":      order,
3564
+		"doctors":    doctors,
3565
+		"department": department,
3562
 	})
3566
 	})
3563
 	return
3567
 	return
3564
 
3568
 
5040
 	}
5044
 	}
5041
 
5045
 
5042
 }
5046
 }
5047
+
5048
+func (c *HisApiController) GetHisMonthChargePatientInfo() {
5049
+	patient_id, _ := c.GetInt64("patient_id")
5050
+	his_patient_id, _ := c.GetInt64("his_patient_id")
5051
+	record_date := c.GetString("record_date")
5052
+	start_time := c.GetString("start_time")
5053
+	end_time := c.GetString("end_time")
5054
+	order_status, _ := c.GetInt64("type", 0)
5055
+	p_type, _ := c.GetInt64("p_type", 0)
5056
+	order_id, _ := c.GetInt64("order_id", 0)
5057
+
5058
+	timeLayout := "2006-01-02"
5059
+	loc, _ := time.LoadLocation("Local")
5060
+	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
5061
+	if err != nil {
5062
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5063
+		return
5064
+	}
5065
+	recordDateTime := theTime.Unix()
5066
+
5067
+	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5068
+	if err != nil {
5069
+
5070
+	}
5071
+	startRecordDateTime := startTime.Unix()
5072
+
5073
+	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
5074
+	if err != nil {
5075
+
5076
+	}
5077
+	endRecordDateTime := endTime.Unix()
5078
+
5079
+	admin := c.GetAdminUserInfo()
5080
+	his_patient_info, _ := service.GetNewHisPatientInfo(his_patient_id)
5081
+	xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
5082
+
5083
+	order, _ := service.GetHisOrderByID(order_id)
5084
+
5085
+	var monthPrescriptions []*models.HisPrescription
5086
+	if order_status == 1 || order_status == 0 {
5087
+		monthPrescriptions, _ = service.GetUnChargeMonthHisPrescriptionThree(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
5088
+	} else if order_status == 2 {
5089
+		monthPrescriptions, _ = service.GetChargeMonthHisPrescriptionFive(admin.CurrentOrgId, patient_id, order.Number, p_type)
5090
+	}
5091
+
5092
+	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
5093
+	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
5094
+
5095
+	lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
5096
+
5097
+	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
5098
+	//获取所有科室信息
5099
+	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
5100
+
5101
+	c.ServeSuccessJSON(map[string]interface{}{
5102
+		"his_info":            his_patient_info,
5103
+		"xt_info":             xt_patient_info,
5104
+		"case_history":        case_history,
5105
+		"info":                patientPrescriptionInfo,
5106
+		"last_info":           lastPatientPrescriptionInfo,
5107
+		"month_prescriptions": monthPrescriptions,
5108
+		"order":               order,
5109
+		"doctors":             doctors,
5110
+		"department":          department,
5111
+	})
5112
+	return
5113
+}
5114
+
5115
+func (c *HisApiController) GetHisMonthPatientInfo() {
5116
+	patient_id, _ := c.GetInt64("patient_id")
5117
+	his_patient_id, _ := c.GetInt64("his_patient_id")
5118
+	record_date := c.GetString("record_date")
5119
+	number := c.GetString("number")
5120
+	start_time := c.GetString("start_time")
5121
+	end_time := c.GetString("end_time")
5122
+	p_type, _ := c.GetInt64("p_type")
5123
+
5124
+	timeLayout := "2006-01-02"
5125
+	loc, _ := time.LoadLocation("Local")
5126
+	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
5127
+	if err != nil {
5128
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5129
+		return
5130
+	}
5131
+	recordDateTime := theTime.Unix()
5132
+	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5133
+	if err != nil {
5134
+
5135
+	}
5136
+	startRecordDateTime := startTime.Unix()
5137
+	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
5138
+	if err != nil {
5139
+
5140
+	}
5141
+	endRecordDateTime := endTime.Unix()
5142
+	admin := c.GetAdminUserInfo()
5143
+	his_patient_info, _ := service.GetNewHisPatientInfoTwo(admin.CurrentOrgId, his_patient_id, recordDateTime)
5144
+	xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
5145
+
5146
+	count, _ := service.GetHisPatientCount(admin.CurrentOrgId, patient_id, recordDateTime)
5147
+
5148
+	monthPrescriptions, _ := service.GetMonthHisPrescriptionTwo(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
5149
+	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
5150
+	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
5151
+	lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
5152
+
5153
+	order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
5154
+	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
5155
+
5156
+	_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(admin.CurrentOrgId)
5157
+	//获取所有科室信息
5158
+	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
5159
+	c.ServeSuccessJSON(map[string]interface{}{
5160
+		"his_info":            his_patient_info,
5161
+		"xt_info":             xt_patient_info,
5162
+		"case_history":        case_history,
5163
+		"info":                patientPrescriptionInfo,
5164
+		"month_prescriptions": monthPrescriptions,
5165
+		"order":               order,
5166
+		"doctors":             doctors,
5167
+		"department":          department,
5168
+		"count":               count,
5169
+		"drugStockConfig":     drugStockConfig,
5170
+		"last_info":           lastPatientPrescriptionInfo,
5171
+	})
5172
+	return
5173
+
5174
+}

+ 2 - 2
service/schedule_service.go View File

583
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
583
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
584
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
584
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
585
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
585
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
586
-		return db.Where("status =1").Order("id desc")
586
+		return db.Where("status =1").Order("id asc")
587
 	}).Find(&list).Error
587
 	}).Find(&list).Error
588
 
588
 
589
 	return list, err
589
 	return list, err
608
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
608
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
609
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
609
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
610
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
610
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
611
-		return db.Where("status =1").Order("id desc")
611
+		return db.Where("status =1").Order("id asc")
612
 	}).Find(&list).Error
612
 	}).Find(&list).Error
613
 
613
 
614
 	return list, err
614
 	return list, err