test_user 1 year ago
parent
commit
cbc26a3e7d
2 changed files with 462 additions and 125 deletions
  1. 141 45
      controllers/public_api_controller.go
  2. 321 80
      service/app_version.go

+ 141 - 45
controllers/public_api_controller.go View File

@@ -62,35 +62,35 @@ func PublicApiRegistRouters() {
62 62
 	beego.Router("/api/public/handlestockdata", &PublicApiController{}, "get:HandleStockData")
63 63
 	beego.Router("/api/public/handlecomdata", &PublicApiController{}, "get:HandleComData")
64 64
 	beego.Router("/hello", &PublicApiController{}, "get:HandleComData")
65
-
66 65
 	beego.Router("/handel", &PublicApiController{}, "get:HandleHIS")
67
-
68 66
 	beego.Router("/groupno", &PublicApiController{}, "get:HandleGroupNo")
69
-
70 67
 	beego.Router("/handle10215", &PublicApiController{}, "get:Handle10215")
71
-
72 68
 	beego.Router("/handelOrder", &PublicApiController{}, "get:HandleOrder")
73
-
74 69
 	beego.Router("/handelHis", &PublicApiController{}, "get:HandleHisTwo")
75
-
76 70
 	beego.Router("/handelProject", &PublicApiController{}, "get:HandleProject")
77
-
78 71
 	beego.Router("/handelsettledata", &PublicApiController{}, "get:HandleSettleData")
79
-
80 72
 	beego.Router("/handelhispatient", &PublicApiController{}, "get:HandleHisPatient")
81
-
82 73
 	//beego.Router("/handelOrder", &PublicApiController{}, "get:HandleOrder")
83
-
84 74
 	beego.Router("/handleExportData", &PublicApiController{}, "get:HandleExportAllData")
85
-
86 75
 	beego.Router("/handleExportData10138", &PublicApiController{}, "get:HandleExportData10138")
87 76
 
88 77
 	beego.Router("/handleData10265", &PublicApiController{}, "get:HandleData10265")
89 78
 
90 79
 	beego.Router("/handleData10106", &PublicApiController{}, "get:HandleData10106")
80
+	beego.Router("/handleData10318", &PublicApiController{}, "get:HandleData10318")
81
+
82
+	beego.Router("/handleOne", &PublicApiController{}, "get:HandleOne")
91 83
 
92 84
 	beego.Router("/handelschedule", &PublicApiController{}, "get:HandleSchedule")
93
-	beego.Router("/handelscheduleTwo", &PublicApiController{}, "get:HandleScheduleTwo")
85
+	//beego.Router("/handelscheduleTwo", &PublicApiController{}, "get:HandleScheduleTwo")
86
+	//
87
+	//
88
+	//
89
+	//beego.Router("/handelhispatienttwo", &PublicApiController{}, "get:HandleHisPatientTwo")
90
+
91
+	//beego.Router("/handleorderinfo", &PublicApiController{}, "get:HandleOrderInfoData")
92
+	//
93
+	//beego.Router("/hande10138", &PublicApiController{}, "get:HandleOrderInfoData10138")
94 94
 
95 95
 }
96 96
 
@@ -113,41 +113,61 @@ func (c *PublicApiController) HandleSchedule() {
113 113
 
114 114
 }
115 115
 
116
-func (c *PublicApiController) HandleScheduleTwo() {
117
-	models, _ := service.GetAllSchMode()
118
-	for _, item := range models {
119
-		if item.Mode == 1 {
120
-			templates, _ := service.GetOrgPatientScheduleTemplateIDs(item.OrgID)
121
-			thisTime := time.Now()
122
-			_, theWeek := thisTime.ISOWeek()
123
-			templates[0].Week = theWeek
124
-			service.UpdateTemplateItemWeek(templates[0].OrgID, templates[0].ID, int8(templates[0].Week))
125
-		} else if item.Mode == 2 {
126
-			templates, _ := service.GetOrgPatientScheduleTemplateIDs(item.OrgID)
127
-			now := time.Now()
128
-			nextSecWeek := now.AddDate(0, 0, 14)
129
-			nextWeek := now.AddDate(0, 0, 7)
130
-			if item.ExecuteTimes%2 == 0 { //下第二周生成的是
131
-				templates[0].Week = service.GetWeeks(nextWeek.Format("2006-01-02 15:04:05"))
132
-				templates[1].Week = service.GetWeeks(nextSecWeek.Format("2006-01-02 15:04:05"))
133
-				service.UpdateTemplateItemWeek(templates[0].OrgID, templates[0].ID, int8(templates[0].Week))
134
-				service.UpdateTemplateItemWeek(templates[1].OrgID, templates[1].ID, int8(templates[1].Week))
135
-
136
-			} else if item.ExecuteTimes%2 == 1 {
137
-				templates[0].Week = service.GetWeeks(nextSecWeek.Format("2006-01-02 15:04:05"))
138
-				templates[1].Week = service.GetWeeks(nextSecWeek.Format("2006-01-02 15:04:05"))
139
-				service.UpdateTemplateItemWeek(templates[0].OrgID, templates[0].ID, int8(templates[0].Week))
140
-				service.UpdateTemplateItemWeek(templates[1].OrgID, templates[1].ID, int8(templates[1].Week))
141
-
142
-			}
116
+func (c *PublicApiController) HandleOne() {
117
+	//fmt.Println("~~~~~~")
118
+	start_time := c.GetString("start_time")
119
+	end_time := c.GetString("end_time")
143 120
 
144
-		}
121
+	timeLayout := "2006-01-02"
122
+	loc, _ := time.LoadLocation("Local")
123
+	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
124
+	if err != nil {
145 125
 	}
146
-
126
+	startRecordDateTime := startTime.Unix()
127
+	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
128
+	if err != nil {
129
+	}
130
+	endRecordDateTime := endTime.Unix()
131
+	orders, _ := service.GetHisOrderDetailOne(startRecordDateTime, endRecordDateTime)
132
+	c.ServeSuccessJSON(map[string]interface{}{
133
+		"order": orders,
134
+	})
147 135
 }
148 136
 
149
-func (c *PublicApiController) HandleHisPatient() {
137
+//func (c *PublicApiController) HandleScheduleTwo() {
138
+//	models, _ := service.GetAllSchMode()
139
+//	for _, item := range models {
140
+//		if item.Mode == 1 {
141
+//			templates, _ := service.GetOrgPatientScheduleTemplateIDs(item.OrgID)
142
+//			thisTime := time.Now()
143
+//			_, theWeek := thisTime.ISOWeek()
144
+//			templates[0].Week = theWeek
145
+//			service.UpdateTemplateItemWeek(templates[0].OrgID, templates[0].ID, int8(templates[0].Week))
146
+//		} else if item.Mode == 2 {
147
+//			templates, _ := service.GetOrgPatientScheduleTemplateIDs(item.OrgID)
148
+//			now := time.Now()
149
+//			nextSecWeek := now.AddDate(0, 0, 14)
150
+//			nextWeek := now.AddDate(0, 0, 7)
151
+//			if item.ExecuteTimes%2 == 0 { //下第二周生成的是
152
+//				templates[0].Week = service.GetWeeks(nextWeek.Format("2006-01-02 15:04:05"))
153
+//				templates[1].Week = service.GetWeeks(nextSecWeek.Format("2006-01-02 15:04:05"))
154
+//				service.UpdateTemplateItemWeek(templates[0].OrgID, templates[0].ID, int8(templates[0].Week))
155
+//				service.UpdateTemplateItemWeek(templates[1].OrgID, templates[1].ID, int8(templates[1].Week))
156
+//
157
+//			} else if item.ExecuteTimes%2 == 1 {
158
+//				templates[0].Week = service.GetWeeks(nextSecWeek.Format("2006-01-02 15:04:05"))
159
+//				templates[1].Week = service.GetWeeks(nextWeek.Format("2006-01-02 15:04:05"))
160
+//				service.UpdateTemplateItemWeek(templates[0].OrgID, templates[0].ID, int8(templates[0].Week))
161
+//				service.UpdateTemplateItemWeek(templates[1].OrgID, templates[1].ID, int8(templates[1].Week))
162
+//
163
+//			}
164
+//
165
+//		}
166
+//	}
167
+//
168
+//}
150 169
 
170
+func (c *PublicApiController) HandleHisPatient() {
151 171
 	ps, _ := service.GetHisPatient11111(10215)
152 172
 	for _, item := range ps {
153 173
 		var rf []*ResultFiveT
@@ -193,7 +213,7 @@ func (c *PublicApiController) HandleHisPatient() {
193 213
 		}
194 214
 
195 215
 		if len(insutypes) == 0 {
196
-			insutype = "310"
216
+			insutype = "390"
197 217
 		}
198 218
 		for _, item := range rf {
199 219
 			if item.Insutype == insutype {
@@ -206,6 +226,24 @@ func (c *PublicApiController) HandleHisPatient() {
206 226
 	}
207 227
 }
208 228
 
229
+//func (c *PublicApiController) HandleHisPatientTwo() {
230
+//
231
+//	ps, _ := service.GetHisPatient2222(10188)
232
+//	for _, item := range ps {
233
+//		var rf []*ResultFiveT
234
+//		json.Unmarshal([]byte(item.Iinfo), &rf)
235
+//		var insuplc_admdvs string
236
+//
237
+//		for _, subItem := range rf {
238
+//			if subItem.Insutype == item.Insutype {
239
+//				insuplc_admdvs = subItem.InsuplcAdmdvs
240
+//			}
241
+//		}
242
+//		item.InsuplcAdmdvs = insuplc_admdvs
243
+//		service.SaveHPtWO(item)
244
+//	}
245
+//}
246
+
209 247
 func (c *PublicApiController) HandleSettleData() {
210 248
 	orders, _ := service.GetHisOrderDetailThree()
211 249
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -243,8 +281,6 @@ func (c *PublicApiController) HandleData10106() {
243 281
 	start_time := c.GetString("start_time")
244 282
 	end_time := c.GetString("end_time")
245 283
 
246
-	start_time = "2022-11-01"
247
-	end_time = "2022-11-30"
248 284
 	timeLayout := "2006-01-02"
249 285
 	loc, _ := time.LoadLocation("Local")
250 286
 	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
@@ -266,6 +302,31 @@ func (c *PublicApiController) HandleData10106() {
266 302
 	})
267 303
 }
268 304
 
305
+func (c *PublicApiController) HandleData10318() {
306
+	start_time := c.GetString("start_time")
307
+	end_time := c.GetString("end_time")
308
+
309
+	timeLayout := "2006-01-02"
310
+	loc, _ := time.LoadLocation("Local")
311
+	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
312
+	if err != nil {
313
+
314
+	}
315
+	startRecordDateTime := startTime.Unix()
316
+	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
317
+	if err != nil {
318
+
319
+	}
320
+	endRecordDateTime := endTime.Unix()
321
+	fmt.Println(startRecordDateTime)
322
+	fmt.Println(endRecordDateTime)
323
+
324
+	orders, _ := service.GetHisOrderDetail10318(startRecordDateTime, endRecordDateTime)
325
+	c.ServeSuccessJSON(map[string]interface{}{
326
+		"order": orders,
327
+	})
328
+}
329
+
269 330
 func (c *PublicApiController) HandleProject() {
270 331
 	prescriptions := service.GetAllProjectPrescription()
271 332
 	for _, item := range prescriptions {
@@ -2316,3 +2377,38 @@ func (c *PublicApiController) HandleData10265() {
2316 2377
 	}
2317 2378
 
2318 2379
 }
2380
+
2381
+//func (c *PublicApiController) HandleOrderInfoData() {
2382
+//	orders, _ := service.GetHisOrderInfoDetail()
2383
+//	c.ServeSuccessJSON(map[string]interface{}{
2384
+//		"info": orders,
2385
+//	})
2386
+//}
2387
+//
2388
+//func (c *PublicApiController)HandleOrderInfoData10138(){
2389
+//	start_time := c.GetString("start_time")
2390
+//	end_time := c.GetString("end_time")
2391
+//	timeLayout := "2006-01-02"
2392
+//	loc, _ := time.LoadLocation("Local")
2393
+//	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
2394
+//	if err != nil {
2395
+//
2396
+//	}
2397
+//	startRecordDateTime := startTime.Unix()
2398
+//	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
2399
+//	if err != nil {
2400
+//
2401
+//	}
2402
+//	endRecordDateTime := endTime.Unix()
2403
+//	orders, _ := service.GetHisAllPatientOrder(startRecordDateTime,endRecordDateTime)
2404
+//	for _, item := range orders{
2405
+//		for _, subItem := range item.HisOrder10138{
2406
+//			info, _ := service.GetHisOrderInfoDetail10138(subItem.Number)
2407
+//			subItem.VmHisOrderInfo9504 = info
2408
+//		}
2409
+//	}
2410
+//	c.ServeSuccessJSON(map[string]interface{}{
2411
+//		"info": orders,
2412
+//	})
2413
+//
2414
+//}

+ 321 - 80
service/app_version.go View File

@@ -353,7 +353,6 @@ type HisPrescriptionInfoTemplateTwo struct {
353 353
 func (HisPrescriptionInfoTemplateTwo) TableName() string {
354 354
 	return "his_prescription_info_template"
355 355
 }
356
-
357 356
 func GetHisPrescriptionTemplateTwo() (prescription []*HisPrescriptionInfoTemplateTwo, err error) {
358 357
 	err = readDb.Model(&HisPrescriptionInfoTemplateTwo{}).
359 358
 		Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
@@ -363,11 +362,9 @@ func GetHisPrescriptionTemplateTwo() (prescription []*HisPrescriptionInfoTemplat
363 362
 		Find(&prescription).Error
364 363
 	return
365 364
 }
366
-
367 365
 func SaveAdviceTemplate(advice HisPrescriptionAdviceTemplate) {
368 366
 	writeDb.Save(&advice)
369 367
 }
370
-
371 368
 func GetAllPT(org_id int64) (his []*models.HisPrescriptionTemplate, err error) {
372 369
 	err = readDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND status = 1", org_id).Find(&his).Error
373 370
 	return
@@ -425,7 +422,6 @@ type HisPrescriptionInfoTemplateTHree struct {
425 422
 func (HisPrescriptionInfoTemplateTHree) TableName() string {
426 423
 	return "his_prescription_info_template"
427 424
 }
428
-
429 425
 func GetAllPTInfo(org_id int64, p_template_id int64) (his []*HisPrescriptionInfoTemplateTHree, err error) {
430 426
 	err = readDb.Model(&HisPrescriptionInfoTemplateTHree{}).Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
431 427
 		return db.Where("status = 1")
@@ -434,7 +430,6 @@ func GetAllPTInfo(org_id int64, p_template_id int64) (his []*HisPrescriptionInfo
434 430
 	}).Where("user_org_id = ? AND status = 1 AND p_template_id = ?", org_id, p_template_id).Find(&his).Error
435 431
 	return
436 432
 }
437
-
438 433
 func GetAllInfo(org_id int64, project_id int64) (his []*HisPrescriptionProjectTemplate, err error) {
439 434
 	err = readDb.Model(&HisPrescriptionProjectTemplate{}).Where("user_org_id = ? AND status = 1 AND project_id = ? ", org_id, project_id).Find(&his).Error
440 435
 	return
@@ -443,26 +438,21 @@ func UpdateStatus(project_id int64, p_id int64) {
443 438
 	writeDb.Model(&HisPrescriptionProjectTemplate{}).Where("id = ?", project_id).Updates(map[string]interface{}{"status": 0})
444 439
 	writeDb.Model(&HisPrescriptionInfoTemplateTwo{}).Where("id = ?", p_id).Updates(map[string]interface{}{"status": 0})
445 440
 }
446
-
447 441
 func SaveOrder(order *models.HisOrder) {
448 442
 	writeDb.Save(&order)
449 443
 }
450
-
451 444
 func GetAllPrivateHis(org_id int64) (his []*models.HisPatient) {
452 445
 	readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND balance_accounts_type = 2 AND status = 1", org_id).Find(&his)
453 446
 	return
454 447
 }
455
-
456 448
 func SaveHis(his *models.HisPatient) {
457 449
 	writeDb.Save(his)
458 450
 	return
459 451
 }
460
-
461 452
 func GetAllProjectPrescription() (pre []*models.HisPrescription) {
462 453
 	readDb.Model(&models.HisPrescription{}).Where("user_org_id = 10215 AND status = 1 AND type = 2 AND order_status = 1 AND record_date >= 1659283200").Find(&pre)
463 454
 	return
464 455
 }
465
-
466 456
 func GetAllProject(id int64) (pre []*models.HisPrescriptionProject) {
467 457
 	readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = 10215 AND status = 1 AND project_id = 1735  AND prescription_id = ?", id).Find(&pre)
468 458
 	return
@@ -478,7 +468,6 @@ func GetAllProject(id int64) (pre []*models.HisPrescriptionProject) {
478 468
 //	}).Find(&order).Error
479 469
 //	return
480 470
 //}
481
-
482 471
 type HisOrderTen struct {
483 472
 	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
484 473
 	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -554,13 +543,46 @@ type HisOrderTen struct {
554 543
 	PType                 int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
555 544
 	Decimal               float64               `gorm:"column:decimal" json:"decimal" form:"decimal"`
556 545
 	HisPrescriptionTen    []*HisPrescriptionTen `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"info"`
557
-	Patients              Patients              `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
546
+	//VmHisOrderInfo9504    []*VmHisOrderInfo9504 `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"order_info"`
547
+	VmHisOrderInfo9504 []*VmHisOrderInfo9504 `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"order_info"`
548
+	OthDesc            string                `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
549
+	PayWays            string                `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
550
+
551
+	Patients Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
558 552
 }
559 553
 
560 554
 func (HisOrderTen) TableName() string {
561 555
 	return "his_order"
562 556
 }
563 557
 
558
+type HisPrescriptionInfoOne struct {
559
+	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
560
+	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
561
+	RecordDate         int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
562
+	PatientId          int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
563
+	HisPatientId       int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
564
+	Status             int64  `gorm:"column:status" json:"status" form:"status"`
565
+	Ctime              int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
566
+	Mtime              int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
567
+	Creator            int64  `gorm:"column:creator" json:"creator" form:"creator"`
568
+	Modifier           int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
569
+	Diagnosis          string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
570
+	RegisterType       int64  `gorm:"column:register_type" json:"register_type" form:"register_type"`
571
+	Doctor             string `gorm:"column:doctor" json:"doctor" form:"doctor"`
572
+	Departments        int64  `gorm:"column:departments" json:"departments" form:"departments"`
573
+	SickHistory        string `gorm:"column:sick_history" json:"sick_history" form:"sick_history"`
574
+	PrescriptionNumber string `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
575
+	PrescriptionStatus int64  `gorm:"column:prescription_status" json:"prescription_status" form:"prescription_status"`
576
+	BatchNumber        string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
577
+	DoctorId           int64  `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
578
+	SickType           int64  `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
579
+	PType              int64  `gorm:"column:p_type" json:"p_type" form:"p_type"`
580
+}
581
+
582
+func (HisPrescriptionInfoOne) TableName() string {
583
+	return "his_prescription_info"
584
+}
585
+
564 586
 type HisPrescriptionTen struct {
565 587
 	ID                        int64                        `gorm:"column:id" json:"id" form:"id"`
566 588
 	UserOrgId                 int64                        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -582,6 +604,7 @@ type HisPrescriptionTen struct {
582 604
 	Patients                  Patients                     `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
583 605
 	HisDoctorAdviceInfoTen    []*HisDoctorAdviceInfoTen    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
584 606
 	HisPrescriptionProjectTen []*HisPrescriptionProjectTen `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
607
+	HisPrescriptionInfoOne    HisPrescriptionInfoOne       `gorm:"ForeignKey:PrescriptionNumber;AssociationForeignKey:PrescriptionNumber" json:"p_info"`
585 608
 	Total                     string                       `gorm:"-" json:"total" form:"total"`
586 609
 	PType                     int64                        `gorm:"column:p_type" json:"p_type" form:"p_type"`
587 610
 	MedType                   string                       `gorm:"column:med_type" json:"med_type" form:"med_type"`
@@ -591,43 +614,83 @@ type HisPrescriptionTen struct {
591 614
 func (HisPrescriptionTen) TableName() string {
592 615
 	return "his_prescription"
593 616
 }
594
-
595 617
 func GetHisOrderDetailThree() (order []*HisOrderTen, err error) {
596
-	err = readDb.Model(&HisOrderTen{}).Preload("Patients", "status = 1").Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
618
+	err = readDb.Model(&HisOrderTen{}).Preload("VmHisOrderInfo9504", "status = 1").Preload("Patients", "status = 1").Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
597 619
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
598 620
 			return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
599 621
 		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
600 622
 			return db.Where("status = 1").Preload("Drug", "status = 1")
601 623
 		})
602
-	}).Where("settle_accounts_date >= 1659283200 AND settle_accounts_date <= 1661788800 AND status = 1 AND order_status =2 and p_type = 1 AND user_org_id = 10215").Find(&order).Order("patient_id").Error
624
+	}).Where("settle_accounts_date >= 1675180800 AND settle_accounts_date <= 1677513600 AND status = 1 AND order_status =2 and p_type = 1 AND user_org_id = 10215").Find(&order).Order("patient_id").Error
603 625
 	return
604 626
 }
605 627
 
606
-type HisDoctorAdviceInfoTen struct {
607
-	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
608
-	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
609
-	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
610
-	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
611
-	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
612
-	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
613
-	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
614
-	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
615
-	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
616
-	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
617
-	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
618
-	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
619
-	Status                int64   `gorm:"column:status" json:"status" form:"status"`
620
-	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
621
-	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
622
-	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
623
-	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
624
-	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
628
+type VmHisOrderInfo9504Two struct {
629
+	ID               int64   `gorm:"column:id" json:"id" form:"id"`
630
+	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`
631
+	UploadDate       int64   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
632
+	AdviceId         int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
633
+	DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
634
+	Cnt              float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
635
+	Pric             float64 `gorm:"column:pric" json:"pric" form:"pric"`
636
+	PatientId        int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
637
+	PricUplmtAmt     float64 `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
638
+	SelfpayProp      float64 `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
639
+	FulamtOwnpayAmt  float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
640
+	OverlmtAmt       float64 `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
641
+	PreselfpayAmt    float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
642
+	BasMednFlag      string  `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
643
+	MedChrgitmType   string  `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
644
+	HiNegoDrugFlag   string  `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
645
+	Status           int64   `gorm:"column:status" json:"status" form:"status"`
646
+	Memo             string  `gorm:"column:memo" json:"memo" form:"memo"`
647
+	FeedetlSn        string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
648
+	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
649
+	InscpScpAmt      float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
650
+	DrtReimFlag      string  `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
651
+	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
652
+	ListSpItemFlag   string  `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
653
+	ChldMedcFlag     string  `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
654
+	LmtUsedFlag      string  `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
655
+	ChrgitmLv        string  `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
656
+	UserOrgId        int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
657
+	HisPatientId     int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
658
+	OrderId          int64   `gorm:"column:order_id" json:"order_id" form:"order_id"`
659
+	ProjectId        int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
660
+	Type             int64   `gorm:"column:type" json:"type" form:"type"`
661
+	ItemId           int64   `gorm:"column:item_id" json:"item_id" form:"item_id"`
662
+	SettleType       int64   `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
663
+}
625 664
 
626
-	Price                float64 `gorm:"column:price" json:"price" form:"price"`
627
-	DrugId               int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
628
-	Drug                 Drug    `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
629
-	IsMedicine           int64   `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
630
-	ExecutionFrequencyId int64   `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
665
+func (VmHisOrderInfo9504Two) TableName() string {
666
+	return "his_order_info"
667
+}
668
+
669
+type HisDoctorAdviceInfoTen struct {
670
+	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
671
+	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
672
+	PatientId             int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
673
+	AdviceDate            int64                 `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
674
+	AdviceName            string                `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
675
+	AdviceDesc            string                `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
676
+	SingleDose            float64               `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
677
+	SingleDoseUnit        string                `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
678
+	PrescribingNumber     float64               `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
679
+	PrescribingNumberUnit string                `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
680
+	DeliveryWay           string                `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
681
+	ExecutionFrequency    string                `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
682
+	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
683
+	CreatedTime           int64                 `gorm:"column:created_time" json:"created_time" form:"created_time"`
684
+	RecordDate            int64                 `gorm:"column:record_date" json:"record_date" form:"record_date"`
685
+	DrugSpec              float64               `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
686
+	DrugSpecUnit          string                `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
687
+	PrescriptionId        int64                 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
688
+	VmHisOrderInfo9504Two VmHisOrderInfo9504Two `gorm:"ForeignKey:AdviceId;AssociationForeignKey:ID" json:"order_info"`
689
+	Price                 float64               `gorm:"column:price" json:"price" form:"price"`
690
+	DrugId                int64                 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
691
+	Drug                  Drug                  `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
692
+	IsMedicine            int64                 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
693
+	ExecutionFrequencyId  int64                 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
631 694
 }
632 695
 
633 696
 func (HisDoctorAdviceInfoTen) TableName() string {
@@ -635,38 +698,39 @@ func (HisDoctorAdviceInfoTen) TableName() string {
635 698
 }
636 699
 
637 700
 type HisPrescriptionProjectTen struct {
638
-	ID                 int64        `gorm:"column:id" json:"id" form:"id"`
639
-	ProjectId          int64        `gorm:"column:project_id" json:"project_id" form:"project_id"`
640
-	Price              float64      `gorm:"column:price" json:"price" form:"price"`
641
-	UserOrgId          int64        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
642
-	Status             int64        `gorm:"column:status" json:"status" form:"status"`
643
-	Ctime              int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
644
-	Mtime              int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
645
-	PatientId          int64        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
646
-	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
647
-	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
648
-	PrescriptionId     int64        `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
649
-	Count              string       `gorm:"column:count" json:"count" form:"count"`
650
-	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
651
-	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
652
-	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
653
-	DeliveryWay        string       `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
654
-	ExecutionFrequency string       `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
655
-	Day                string       `gorm:"column:day" json:"day" form:"day"`
656
-	VMHisProject       VMHisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
657
-	VMGoodInfo         VMGoodInfo   `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
658
-	Remark             string       `gorm:"column:remark" json:"remark" form:"remark"`
659
-	Unit               string       `gorm:"column:unit" json:"unit" form:"unit"`
660
-	Type               int64        `gorm:"column:type" json:"type" form:"type"`
661
-	Doctor             int64        `gorm:"column:doctor" json:"doctor" form:"doctor"`
662
-	ExecutionTime      int64        `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
663
-	ExecutionStaff     int64        `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
664
-	ExecutionState     int64        `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
665
-	CheckTime          int64        `gorm:"column:check_time" json:"check_time" form:"check_time"`
666
-	CheckState         int64        `gorm:"column:check_state" json:"check_state" form:"check_state"`
667
-	Checker            int64        `gorm:"column:checker" json:"checker" form:"checker"`
668
-	StartTime          int64        `gorm:"column:start_time" json:"start_time" form:"start_time"`
669
-	TeamId             int64        `gorm:"column:team_id" json:"team_id" form:"team_id"`
701
+	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
702
+	ProjectId             int64                 `gorm:"column:project_id" json:"project_id" form:"project_id"`
703
+	Price                 float64               `gorm:"column:price" json:"price" form:"price"`
704
+	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
705
+	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
706
+	Ctime                 int64                 `gorm:"column:ctime" json:"ctime" form:"ctime"`
707
+	Mtime                 int64                 `gorm:"column:mtime" json:"mtime" form:"mtime"`
708
+	PatientId             int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
709
+	HisPatientId          int64                 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
710
+	RecordDate            int64                 `gorm:"column:record_date" json:"record_date" form:"record_date"`
711
+	PrescriptionId        int64                 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
712
+	Count                 string                `gorm:"column:count" json:"count" form:"count"`
713
+	FeedetlSn             string                `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
714
+	MedListCodg           string                `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
715
+	SingleDose            string                `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
716
+	DeliveryWay           string                `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
717
+	ExecutionFrequency    string                `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
718
+	Day                   string                `gorm:"column:day" json:"day" form:"day"`
719
+	VMHisProject          VMHisProject          `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
720
+	VMGoodInfo            VMGoodInfo            `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
721
+	Remark                string                `gorm:"column:remark" json:"remark" form:"remark"`
722
+	Unit                  string                `gorm:"column:unit" json:"unit" form:"unit"`
723
+	Type                  int64                 `gorm:"column:type" json:"type" form:"type"`
724
+	Doctor                int64                 `gorm:"column:doctor" json:"doctor" form:"doctor"`
725
+	ExecutionTime         int64                 `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
726
+	ExecutionStaff        int64                 `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
727
+	ExecutionState        int64                 `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
728
+	CheckTime             int64                 `gorm:"column:check_time" json:"check_time" form:"check_time"`
729
+	CheckState            int64                 `gorm:"column:check_state" json:"check_state" form:"check_state"`
730
+	Checker               int64                 `gorm:"column:checker" json:"checker" form:"checker"`
731
+	StartTime             int64                 `gorm:"column:start_time" json:"start_time" form:"start_time"`
732
+	TeamId                int64                 `gorm:"column:team_id" json:"team_id" form:"team_id"`
733
+	VmHisOrderInfo9504Two VmHisOrderInfo9504Two `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"order_info"`
670 734
 
671 735
 	FrequencyType        int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
672 736
 	DayCount             int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
@@ -677,14 +741,19 @@ type HisPrescriptionProjectTen struct {
677 741
 func (HisPrescriptionProjectTen) TableName() string {
678 742
 	return "his_prescription_project"
679 743
 }
680
-
681 744
 func GetHisPatient11111(orgid int64) (paitent []*models.HisHospitalCheckRecord, err error) {
682
-	err = XTReadDB().Model(&paitent).Where("user_org_id = ?  and status = 1 AND in_hosptial_time >= '2022-12-01 00:00:00' AND in_hosptial_time <= '2022-12-31 23:59:59'", orgid).Find(&paitent).Error
745
+	err = XTReadDB().Model(&paitent).Where("user_org_id = ?  and status = 1 AND in_hosptial_time >= '2023-02-01 00:00:00' AND in_hosptial_time <= '2023-02-28 23:59:59'", orgid).Find(&paitent).Error
746
+	return paitent, err
747
+}
748
+func GetHisPatient2222(orgid int64) (paitent []*models.HisPatient, err error) {
749
+	err = XTReadDB().Model(&models.HisPatient{}).Where("user_org_id = ?  and status = 1 AND record_date >= 1654012800 AND record_date <= 1659196800 ", orgid).Find(&paitent).Error
683 750
 	return paitent, err
684 751
 }
685
-
686 752
 func SaveHP(paitent *models.HisHospitalCheckRecord) {
687 753
 	writeDb.Save(&paitent)
754
+}
755
+func SaveHPtWO(paitent *models.HisPatient) {
756
+	writeDb.Save(&paitent)
688 757
 
689 758
 }
690 759
 
@@ -760,6 +829,8 @@ type HisOrder9504 struct {
760 829
 	DepartmentName        string    `gorm:"-" json:"department_name" form:"department_name"`
761 830
 	DoctorName            string    `gorm:"-" json:"doctor_name" form:"doctor_name"`
762 831
 	SettleStartTime       int64     `gorm:"settle_start_time" json:"settle_start_time" form:"settle_start_time"`
832
+	OthDesc               string    `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
833
+	PayWays               string    `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
763 834
 
764 835
 	Creator            int64                 `gorm:"column:creator" json:"creator" form:"creator"`
765 836
 	PType              int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
@@ -855,7 +926,6 @@ type VmHisOrderInfo95042 struct {
855 926
 func (VmHisOrderInfo95042) TableName() string {
856 927
 	return "his_order_info"
857 928
 }
858
-
859 929
 func GetHisOrderDetail9504() (order []*HisOrder9504, err error) {
860 930
 	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
861 931
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
@@ -866,7 +936,6 @@ func GetHisOrderDetail9504() (order []*HisOrder9504, err error) {
866 936
 	}).Where("settle_accounts_date >= 1640966400 AND settle_accounts_date <= 1661875200 AND status = 1 AND order_status =2  AND user_org_id = 9504").Find(&order).Order("setl_time").Error
867 937
 	return
868 938
 }
869
-
870 939
 func GetHisOrderDetail10188() (order []*HisOrder9504, err error) {
871 940
 	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
872 941
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
@@ -890,7 +959,7 @@ func GetHisOrderDetail10138() (order []*HisOrderTen, err error) {
890 959
 		return db.Where("status = 1 AND order_status = 2").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
891 960
 			return db.Where("status = 1").Preload("VMHisProject")
892 961
 		})
893
-	}).Where("settle_accounts_date >= 1664553600 AND settle_accounts_date <= 1672416000 AND status = 1 AND order_status =2  AND user_org_id = 10278").Find(&order).Error
962
+	}).Where("settle_accounts_date >= 1672502400 AND settle_accounts_date <= 1676822400 AND status = 1 AND order_status =2  AND user_org_id = 10278").Find(&order).Error
894 963
 	return
895 964
 }
896 965
 
@@ -1035,9 +1104,181 @@ func SaveSch(sch models.Schedule) (err error) {
1035 1104
 }
1036 1105
 
1037 1106
 func SaveSchTwo(sch models.Schedule, sch_two models.Schedule) (err error) {
1038
-	//err = writeDb.Save(&sch).Error
1039
-	err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch.ID).Updates(map[string]interface{}{"status": 0}).Error
1040
-	err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch_two.ID).Updates(map[string]interface{}{"status": 0}).Error
1107
+	utx := writeDb.Begin()
1108
+	if err = utx.Model(&Schedule{}).Where("status=1 AND id = ?", sch.ID).Updates(map[string]interface{}{"status": 0}).Error; err != nil {
1109
+		utx.Rollback()
1110
+		return err
1111
+	}
1112
+	if err = utx.Model(&Schedule{}).Where("status=1 AND id = ?", sch_two.ID).Updates(map[string]interface{}{"status": 0}).Error; err != nil {
1113
+		utx.Rollback()
1114
+		return err
1115
+	}
1116
+	utx.Commit()
1117
+	return err
1118
+}
1119
+
1120
+func GetHisOrderInfoDetail() (order []*VmHisOrderInfo9504, err error) {
1121
+	err = readDb.Model(&VmHisOrderInfo9504{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1122
+		return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1123
+	}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1124
+		return db.Where("status = 1").Preload("Drug")
1125
+	}).Where("status = 1 AND order_number = '202302201702258124538'").Find(&order).Error
1126
+	return
1127
+}
1128
+
1129
+func GetHisPrescriptionInfoDetail() (order []*HisPrescriptionProjectTen, err error) {
1130
+	err = readDb.Model(&HisPrescriptionProjectTen{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1131
+		return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1132
+	}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1133
+		return db.Where("status = 1").Preload("Drug")
1134
+	}).Where("status = 1 AND order_number = '202302201702258124538'").Find(&order).Error
1135
+	return
1136
+}
1137
+
1138
+type HisOrder10138 struct {
1139
+	ID                 int64                 `gorm:"column:id" json:"id" form:"id"`
1140
+	UserOrgId          int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1141
+	Status             int64                 `gorm:"column:status" json:"status" form:"status"`
1142
+	Number             string                `gorm:"column:number" json:"number" form:"number"`
1143
+	PatientId          int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1144
+	OrderStatus        int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
1145
+	MdtrtId            string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
1146
+	Ctime              int64                 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1147
+	SettleAccountsDate int64                 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
1148
+	VmHisOrderInfo9504 []*VmHisOrderInfo9504 `json:"infos" form:"infos"`
1149
+}
1150
+
1151
+func (HisOrder10138) TableName() string {
1152
+	return "his_order"
1153
+}
1154
+
1155
+type PatientVM10138 struct {
1156
+	ID            int64            `gorm:"column:id" json:"id" form:"id"`
1157
+	UserOrgId     int64            `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1158
+	Name          string           `gorm:"column:name" json:"name" form:"name"`
1159
+	HisOrder10138 []*HisOrder10138 `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"order"`
1160
+}
1161
+
1162
+func (PatientVM10138) TableName() string {
1163
+	return "xt_patients"
1164
+}
1165
+
1166
+func GetHisAllPatientOrder(start_time int64, end_time int64) (order []*PatientVM10138, err error) {
1167
+	err = readDb.Model(&PatientVM10138{}).Preload("HisOrder10138", " ctime >= ? AND ctime <= ? AND status = 1 AND order_status = 2", start_time, end_time).Where("user_org_id = 10138 AND status = 1").Find(&order).Error
1168
+	return
1169
+}
1041 1170
 
1171
+func GetHisOrderInfoDetail10138(order_number string) (order []*VmHisOrderInfo9504, err error) {
1172
+	err = readDb.Model(&VmHisOrderInfo9504{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1173
+		return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1174
+	}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1175
+		return db.Where("status = 1").Preload("Drug")
1176
+	}).Where("status = 1 AND order_number = ?", order_number).Find(&order).Error
1177
+	return
1178
+}
1179
+
1180
+//func GetHisOrderDetailOne(start_time int64, end_time int64) (order []*HisOrder9504, err error) {
1181
+//	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
1182
+//		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1183
+//			return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1184
+//		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1185
+//			return db.Where("status = 1").Preload("Drug")
1186
+//		})
1187
+//	}).Where("settle_accounts_date >= ? AND settle_accounts_date <= ? AND status = 1 AND order_status =2  AND user_org_id = 9919", start_time, end_time).Find(&order).Order("setl_time").Error
1188
+//	return
1189
+//}
1190
+//
1191
+
1192
+type HisOrderTenOne struct {
1193
+	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
1194
+	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1195
+	HisPatientId          int64                 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1196
+	SettleAccountsDate    int64                 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
1197
+	Ctime                 int64                 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1198
+	Mtime                 int64                 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1199
+	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
1200
+	Number                string                `gorm:"column:number" json:"number" form:"number"`
1201
+	PatientId             int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1202
+	Infcode               int64                 `gorm:"column:infcode" json:"infcode" form:"infcode"`
1203
+	WarnMsg               string                `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
1204
+	Cainfo                string                `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
1205
+	ErrMsg                string                `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
1206
+	RespondTime           string                `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
1207
+	InfRefmsgid           string                `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
1208
+	OrderStatus           int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
1209
+	MdtrtId               string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
1210
+	SetlId                string                `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
1211
+	PsnNo                 string                `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
1212
+	PsnName               string                `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
1213
+	PsnCertType           string                `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
1214
+	Certno                string                `gorm:"column:certno" json:"certno" form:"certno"`
1215
+	Gend                  string                `gorm:"column:gend" json:"gend" form:"gend"`
1216
+	Naty                  string                `gorm:"column:naty" json:"naty" form:"naty"`
1217
+	Brdy                  time.Time             `gorm:"column:brdy" json:"brdy" form:"brdy"`
1218
+	Age                   float64               `gorm:"column:age" json:"age" form:"age"`
1219
+	Insutype              string                `gorm:"column:insutype" json:"insutype" form:"insutype"`
1220
+	PsnType               string                `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
1221
+	CvlservFlag           string                `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
1222
+	SetlTime              string                `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
1223
+	MdtrtCertType         string                `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
1224
+	MedType               string                `gorm:"column:med_type" json:"med_type" form:"med_type"`
1225
+	MedfeeSumamt          float64               `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
1226
+	FulamtOwnpayAmt       float64               `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
1227
+	OverlmtSelfPay        float64               `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
1228
+	PreselfpayAmt         float64               `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
1229
+	InscpScpAmt           float64               `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
1230
+	ActPayDedc            float64               `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
1231
+	HifpPay               float64               `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
1232
+	CvlservPay            float64               `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
1233
+	PoolPropSelfpay       float64               `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
1234
+	HifesPay              float64               `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
1235
+	HifmiPay              float64               `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
1236
+	HifobPay              float64               `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
1237
+	MafPay                float64               `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
1238
+	OthPay                float64               `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
1239
+	FundPaySumamt         float64               `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
1240
+	PsnPartAmt            float64               `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
1241
+	AcctPay               float64               `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
1242
+	PsnCashPay            float64               `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
1243
+	HospPartAmt           float64               `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
1244
+	Balc                  float64               `gorm:"column:balc" json:"balc" form:"balc"`
1245
+	AcctMulaidPay         float64               `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
1246
+	MedinsSetlId          string                `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
1247
+	ClrOptins             string                `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
1248
+	ClrWay                string                `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
1249
+	ClrType               string                `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
1250
+	SetlDetail            string                `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
1251
+	IsMedicineInsurance   int64                 `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
1252
+	PayWay                int64                 `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
1253
+	PayPrice              float64               `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
1254
+	PayCardNo             string                `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
1255
+	DiscountPrice         float64               `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
1256
+	PreferentialPrice     float64               `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
1257
+	RealityPrice          float64               `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
1258
+	FoundPrice            float64               `gorm:"column:found_price" json:"found_price" form:"found_price"`
1259
+	MedicalInsurancePrice float64               `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
1260
+	PrivatePrice          float64               `gorm:"column:private_price" json:"private_price" form:"private_price"`
1261
+	DepartmentName        string                `gorm:"-" json:"department_name" form:"department_name"`
1262
+	DoctorName            string                `gorm:"-" json:"doctor_name" form:"doctor_name"`
1263
+	Creator               int64                 `gorm:"column:creator" json:"creator" form:"creator"`
1264
+	PType                 int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
1265
+	Decimal               float64               `gorm:"column:decimal" json:"decimal" form:"decimal"`
1266
+	HisPrescriptionTen    []*HisPrescriptionTen `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"info"`
1267
+	OthDesc               string                `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
1268
+	PayWays               string                `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
1269
+}
1270
+
1271
+func (HisOrderTenOne) TableName() string {
1272
+	return "his_order"
1273
+}
1274
+
1275
+func GetHisOrderDetailOne(start_time int64, end_time int64) (order []*HisOrderTen, err error) {
1276
+	err = readDb.Model(&HisOrderTen{}).Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
1277
+		return db.Where("status = 1").Preload("HisPrescriptionInfoOne", "status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1278
+			return db.Where("status = 1").Preload("VmHisOrderInfo9504Two", "status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
1279
+		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1280
+			return db.Where("status = 1").Preload("VmHisOrderInfo9504Two", "status = 1").Preload("Drug", "status = 1")
1281
+		})
1282
+	}).Where("settle_accounts_date >= ? AND settle_accounts_date <= ? AND status = 1 AND order_status =2 AND user_org_id = 9919 AND setl_id <> ''", start_time, end_time).Find(&order).Error
1042 1283
 	return
1043 1284
 }