陈少旭 2 mēnešus atpakaļ
vecāks
revīzija
9a54ab40f6

+ 173 - 155
controllers/his_api_controller.go Parādīt failu

@@ -6516,6 +6516,8 @@ func (c *HisApiController) GetHisOrderList() {
6516 6516
 	org_id := adminUser.CurrentOrgId
6517 6517
 	order, err, total := service.GetHisOrderList(org_id, page, limit, startTime, endTime, types, keywords, p_type, sort_type, start_time, end_time, charge_type, sch_type, zone_type, med_type)
6518 6518
 
6519
+	order2, _ := service.GetNewHisOrderListTwo(org_id, startTime, endTime)
6520
+
6519 6521
 	for _, item := range order {
6520 6522
 		info, _ := service.GetHisPrescriptionByPatientID(item.PatientId, item.UserOrgId)
6521 6523
 		item.DoctorName = info.Doctor
@@ -6524,8 +6526,9 @@ func (c *HisApiController) GetHisOrderList() {
6524 6526
 
6525 6527
 	if err == nil {
6526 6528
 		c.ServeSuccessJSON(map[string]interface{}{
6527
-			"order": order,
6528
-			"total": total,
6529
+			"order":  order,
6530
+			"order2": order2,
6531
+			"total":  total,
6529 6532
 		})
6530 6533
 
6531 6534
 	} else {
@@ -10253,193 +10256,208 @@ func (c *HisApiController) CreateHisPrescriptionTemplate() {
10253 10256
 	//如果已经存在记录则删除处方
10254 10257
 	if template_one.ID > 0 {
10255 10258
 		ps, _ := service.GetHisPrescriptionInfoTemplates(template_one.ID, template_one.UserOrgId)
10259
+		var ids []int64
10260
+		var org_id int64
10256 10261
 		for _, item := range ps {
10257
-			service.DelelteHisPrescriptionInfoTemplate(item.ID, item.UserOrgId)
10262
+			org_id = c.GetAdminUserInfo().CurrentOrgId
10263
+			ids = append(ids, item.ID)
10258 10264
 		}
10259
-		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
10260
-			prescriptions, _ := dataBody["prescriptions"].([]interface{})
10261
-			if len(prescriptions) > 0 {
10262
-				for _, item := range prescriptions {
10263
-					items := item.(map[string]interface{})
10264
-					if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
10265
-						utils.ErrorLog("type")
10266
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
10267
-						return
10268
-					}
10269
-					types := int64(items["type"].(float64))
10265
+		err2 := service.BatchDelelteHisPrescriptionInfoTemplate(ids, org_id)
10270 10266
 
10271
-					if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
10272
-						utils.ErrorLog("med_type")
10273
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
10274
-						return
10275
-					}
10276
-					med_type := strconv.Itoa(int(items["med_type"].(float64)))
10267
+		if err2 == nil {
10268
+			if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
10269
+				prescriptions, _ := dataBody["prescriptions"].([]interface{})
10270
+				if len(prescriptions) > 0 {
10271
+					for _, item := range prescriptions {
10272
+						items := item.(map[string]interface{})
10273
+						if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
10274
+							utils.ErrorLog("type")
10275
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
10276
+							return
10277
+						}
10278
+						types := int64(items["type"].(float64))
10277 10279
 
10278
-					ctime := time.Now().Unix()
10279
-					prescription := &models.HisPrescriptionInfoTemplate{
10280
-						PatientId:   patient_id,
10281
-						UserOrgId:   adminInfo.CurrentOrgId,
10282
-						Ctime:       ctime,
10283
-						Mtime:       ctime,
10284
-						Type:        types,
10285
-						Modifier:    adminInfo.AdminUser.Id,
10286
-						Creator:     adminInfo.AdminUser.Id,
10287
-						Status:      1,
10288
-						PTemplateId: template_one.ID,
10289
-						MedType:     med_type,
10290
-					}
10291
-					service.CreateHisPrescriptionInfoTemplate(prescription)
10280
+						if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
10281
+							utils.ErrorLog("med_type")
10282
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
10283
+							return
10284
+						}
10285
+						med_type := strconv.Itoa(int(items["med_type"].(float64)))
10292 10286
 
10293
-					if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
10294
-						advices := items["advices"].([]interface{})
10295
-						//group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
10296 10287
 						ctime := time.Now().Unix()
10297
-						mtime := ctime
10298
-						if len(advices) > 0 {
10299
-							for _, advice := range advices {
10300
-								var s models.HisPrescriptionAdviceTemplate
10301
-								s.PrescriptionId = prescription.ID
10302
-								s.AdviceType = 2
10303
-								s.StopState = 2
10304
-								s.ExecutionState = 2
10305
-								s.Status = 1
10306
-								s.UserOrgId = adminInfo.CurrentOrgId
10307
-								s.CreatedTime = ctime
10308
-								s.UpdatedTime = mtime
10309
-								s.PatientId = patient_id
10310
-								errcode := c.setAdviceTemplateWithJSON(&s, advice.(map[string]interface{}))
10311
-								if errcode > 0 {
10312
-									c.ServeFailJSONWithSGJErrorCode(errcode)
10313
-									return
10314
-								}
10288
+						prescription := &models.HisPrescriptionInfoTemplate{
10289
+							PatientId:   patient_id,
10290
+							UserOrgId:   adminInfo.CurrentOrgId,
10291
+							Ctime:       ctime,
10292
+							Mtime:       ctime,
10293
+							Type:        types,
10294
+							Modifier:    adminInfo.AdminUser.Id,
10295
+							Creator:     adminInfo.AdminUser.Id,
10296
+							Status:      1,
10297
+							PTemplateId: template_one.ID,
10298
+							MedType:     med_type,
10299
+						}
10300
+						service.CreateHisPrescriptionInfoTemplate(prescription)
10301
+
10302
+						if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
10303
+							advices := items["advices"].([]interface{})
10304
+							//group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
10305
+							ctime := time.Now().Unix()
10306
+							mtime := ctime
10307
+							if len(advices) > 0 {
10308
+								for _, advice := range advices {
10309
+									var s models.HisPrescriptionAdviceTemplate
10310
+									s.PrescriptionId = prescription.ID
10311
+									s.AdviceType = 2
10312
+									s.StopState = 2
10313
+									s.ExecutionState = 2
10314
+									s.Status = 1
10315
+									s.UserOrgId = adminInfo.CurrentOrgId
10316
+									s.CreatedTime = ctime
10317
+									s.UpdatedTime = mtime
10318
+									s.PatientId = patient_id
10319
+									errcode := c.setAdviceTemplateWithJSON(&s, advice.(map[string]interface{}))
10320
+									if errcode > 0 {
10321
+										c.ServeFailJSONWithSGJErrorCode(errcode)
10322
+										return
10323
+									}
10315 10324
 
10316
-								service.CreateHisPrescriptionAdviceTemplate(&s)
10325
+									service.CreateHisPrescriptionAdviceTemplate(&s)
10317 10326
 
10327
+								}
10318 10328
 							}
10319 10329
 						}
10320
-					}
10321
-					if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
10322
-						projects := items["project"].([]interface{})
10323
-						if len(projects) > 0 {
10324
-							for _, project := range projects {
10325
-								var p models.HisPrescriptionProjectTemplate
10326
-								p.PrescriptionId = prescription.ID
10327
-								p.Ctime = time.Now().Unix()
10328
-								p.Mtime = time.Now().Unix()
10329
-								p.PatientId = patient_id
10330
-								p.UserOrgId = adminInfo.CurrentOrgId
10331
-								p.Status = 1
10332
-								errcode := c.setProjectTemplateWithJSON(&p, project.(map[string]interface{}))
10333
-								if errcode > 0 {
10334
-									c.ServeFailJSONWithSGJErrorCode(errcode)
10335
-									return
10336
-								}
10337
-								service.CreateHisPrescriptionProjectTemplate(&p)
10330
+						if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
10331
+							projects := items["project"].([]interface{})
10332
+							if len(projects) > 0 {
10333
+								for _, project := range projects {
10334
+									var p models.HisPrescriptionProjectTemplate
10335
+									p.PrescriptionId = prescription.ID
10336
+									p.Ctime = time.Now().Unix()
10337
+									p.Mtime = time.Now().Unix()
10338
+									p.PatientId = patient_id
10339
+									p.UserOrgId = adminInfo.CurrentOrgId
10340
+									p.Status = 1
10341
+									errcode := c.setProjectTemplateWithJSON(&p, project.(map[string]interface{}))
10342
+									if errcode > 0 {
10343
+										c.ServeFailJSONWithSGJErrorCode(errcode)
10344
+										return
10345
+									}
10346
+									service.CreateHisPrescriptionProjectTemplate(&p)
10338 10347
 
10348
+								}
10339 10349
 							}
10340 10350
 						}
10351
+
10341 10352
 					}
10342 10353
 
10354
+					c.ServeSuccessJSON(map[string]interface{}{
10355
+						"msg": "创建成功",
10356
+					})
10343 10357
 				}
10344
-
10345
-				c.ServeSuccessJSON(map[string]interface{}{
10346
-					"msg": "创建成功",
10347
-				})
10348 10358
 			}
10359
+		} else {
10360
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
10361
+			return
10349 10362
 		}
10350 10363
 
10351 10364
 	} else {
10352
-		err = service.CreateHisPrescriptionTemplate(template)
10353
-		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
10354
-			prescriptions, _ := dataBody["prescriptions"].([]interface{})
10355
-			if len(prescriptions) > 0 {
10356
-				for _, item := range prescriptions {
10357
-					items := item.(map[string]interface{})
10358
-					if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
10359
-						utils.ErrorLog("type")
10360
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
10361
-						return
10362
-					}
10363
-					types := int64(items["type"].(float64))
10364
-
10365
-					if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
10366
-						utils.ErrorLog("med_type")
10367
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
10368
-						return
10369
-					}
10370
-					med_type := strconv.Itoa(int(items["med_type"].(float64)))
10365
+		err3 := service.CreateHisPrescriptionTemplate(template)
10366
+		if err3 == nil {
10367
+			if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
10368
+				prescriptions, _ := dataBody["prescriptions"].([]interface{})
10369
+				if len(prescriptions) > 0 {
10370
+					for _, item := range prescriptions {
10371
+						items := item.(map[string]interface{})
10372
+						if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
10373
+							utils.ErrorLog("type")
10374
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
10375
+							return
10376
+						}
10377
+						types := int64(items["type"].(float64))
10371 10378
 
10372
-					ctime := time.Now().Unix()
10373
-					prescription := &models.HisPrescriptionInfoTemplate{
10374
-						PatientId:   patient_id,
10375
-						UserOrgId:   adminInfo.CurrentOrgId,
10376
-						Ctime:       ctime,
10377
-						Mtime:       ctime,
10378
-						Type:        types,
10379
-						Modifier:    adminInfo.AdminUser.Id,
10380
-						Creator:     adminInfo.AdminUser.Id,
10381
-						Status:      1,
10382
-						PTemplateId: template.ID,
10383
-						MedType:     med_type,
10384
-					}
10385
-					service.CreateHisPrescriptionInfoTemplate(prescription)
10379
+						if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
10380
+							utils.ErrorLog("med_type")
10381
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
10382
+							return
10383
+						}
10384
+						med_type := strconv.Itoa(int(items["med_type"].(float64)))
10386 10385
 
10387
-					if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
10388
-						advices := items["advices"].([]interface{})
10389
-						//group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
10390 10386
 						ctime := time.Now().Unix()
10391
-						mtime := ctime
10392
-						if len(advices) > 0 {
10393
-							for _, advice := range advices {
10394
-								var s models.HisPrescriptionAdviceTemplate
10395
-								s.PrescriptionId = prescription.ID
10396
-								s.AdviceType = 2
10397
-								s.StopState = 2
10398
-								s.ExecutionState = 2
10399
-								s.Status = 1
10400
-								s.UserOrgId = adminInfo.CurrentOrgId
10401
-								s.CreatedTime = ctime
10402
-								s.UpdatedTime = mtime
10403
-								s.PatientId = patient_id
10404
-								errcode := c.setAdviceTemplateWithJSON(&s, advice.(map[string]interface{}))
10405
-								if errcode > 0 {
10406
-									c.ServeFailJSONWithSGJErrorCode(errcode)
10407
-									return
10408
-								}
10387
+						prescription := &models.HisPrescriptionInfoTemplate{
10388
+							PatientId:   patient_id,
10389
+							UserOrgId:   adminInfo.CurrentOrgId,
10390
+							Ctime:       ctime,
10391
+							Mtime:       ctime,
10392
+							Type:        types,
10393
+							Modifier:    adminInfo.AdminUser.Id,
10394
+							Creator:     adminInfo.AdminUser.Id,
10395
+							Status:      1,
10396
+							PTemplateId: template.ID,
10397
+							MedType:     med_type,
10398
+						}
10399
+						service.CreateHisPrescriptionInfoTemplate(prescription)
10400
+
10401
+						if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
10402
+							advices := items["advices"].([]interface{})
10403
+							//group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
10404
+							ctime := time.Now().Unix()
10405
+							mtime := ctime
10406
+							if len(advices) > 0 {
10407
+								for _, advice := range advices {
10408
+									var s models.HisPrescriptionAdviceTemplate
10409
+									s.PrescriptionId = prescription.ID
10410
+									s.AdviceType = 2
10411
+									s.StopState = 2
10412
+									s.ExecutionState = 2
10413
+									s.Status = 1
10414
+									s.UserOrgId = adminInfo.CurrentOrgId
10415
+									s.CreatedTime = ctime
10416
+									s.UpdatedTime = mtime
10417
+									s.PatientId = patient_id
10418
+									errcode := c.setAdviceTemplateWithJSON(&s, advice.(map[string]interface{}))
10419
+									if errcode > 0 {
10420
+										c.ServeFailJSONWithSGJErrorCode(errcode)
10421
+										return
10422
+									}
10409 10423
 
10410
-								service.CreateHisPrescriptionAdviceTemplate(&s)
10424
+									service.CreateHisPrescriptionAdviceTemplate(&s)
10411 10425
 
10426
+								}
10412 10427
 							}
10413 10428
 						}
10414
-					}
10415
-					if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
10416
-						projects := items["project"].([]interface{})
10417
-						if len(projects) > 0 {
10418
-							for _, project := range projects {
10419
-								var p models.HisPrescriptionProjectTemplate
10420
-								p.PrescriptionId = prescription.ID
10421
-								p.Ctime = time.Now().Unix()
10422
-								p.Mtime = time.Now().Unix()
10423
-								p.PatientId = patient_id
10424
-								p.UserOrgId = adminInfo.CurrentOrgId
10425
-								p.Status = 1
10426
-								errcode := c.setProjectTemplateWithJSON(&p, project.(map[string]interface{}))
10427
-								if errcode > 0 {
10428
-									c.ServeFailJSONWithSGJErrorCode(errcode)
10429
-									return
10430
-								}
10431
-								service.CreateHisPrescriptionProjectTemplate(&p)
10429
+						if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
10430
+							projects := items["project"].([]interface{})
10431
+							if len(projects) > 0 {
10432
+								for _, project := range projects {
10433
+									var p models.HisPrescriptionProjectTemplate
10434
+									p.PrescriptionId = prescription.ID
10435
+									p.Ctime = time.Now().Unix()
10436
+									p.Mtime = time.Now().Unix()
10437
+									p.PatientId = patient_id
10438
+									p.UserOrgId = adminInfo.CurrentOrgId
10439
+									p.Status = 1
10440
+									errcode := c.setProjectTemplateWithJSON(&p, project.(map[string]interface{}))
10441
+									if errcode > 0 {
10442
+										c.ServeFailJSONWithSGJErrorCode(errcode)
10443
+										return
10444
+									}
10445
+									service.CreateHisPrescriptionProjectTemplate(&p)
10432 10446
 
10447
+								}
10433 10448
 							}
10434 10449
 						}
10450
+
10435 10451
 					}
10436 10452
 
10453
+					c.ServeSuccessJSON(map[string]interface{}{
10454
+						"msg": "创建成功",
10455
+					})
10437 10456
 				}
10438
-
10439
-				c.ServeSuccessJSON(map[string]interface{}{
10440
-					"msg": "创建成功",
10441
-				})
10442 10457
 			}
10458
+		} else {
10459
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
10460
+			return
10443 10461
 		}
10444 10462
 	}
10445 10463
 

+ 100 - 0
models/his_models.go Parādīt failu

@@ -1098,6 +1098,106 @@ func (HisOrder) TableName() string {
1098 1098
 	return "his_order"
1099 1099
 }
1100 1100
 
1101
+type HisOrderOther struct {
1102
+	ID                  int64     `gorm:"column:id" json:"id" form:"id"`
1103
+	UserOrgId           int64     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1104
+	HisPatientId        int64     `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1105
+	SettleAccountsDate  int64     `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
1106
+	Ctime               int64     `gorm:"column:ctime" json:"ctime" form:"ctime"`
1107
+	Mtime               int64     `gorm:"column:mtime" json:"mtime" form:"mtime"`
1108
+	Status              int64     `gorm:"column:status" json:"status" form:"status"`
1109
+	Number              string    `gorm:"column:number" json:"number" form:"number"`
1110
+	PatientId           int64     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1111
+	Infcode             int64     `gorm:"column:infcode" json:"infcode" form:"infcode"`
1112
+	WarnMsg             string    `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
1113
+	Cainfo              string    `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
1114
+	ErrMsg              string    `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
1115
+	RespondTime         string    `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
1116
+	InfRefmsgid         string    `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
1117
+	OrderStatus         int64     `gorm:"column:order_status" json:"order_status" form:"order_status"`
1118
+	MdtrtId             string    `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
1119
+	SetlId              string    `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
1120
+	PsnNo               string    `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
1121
+	PsnName             string    `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
1122
+	PsnCertType         string    `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
1123
+	Certno              string    `gorm:"column:certno" json:"certno" form:"certno"`
1124
+	Gend                string    `gorm:"column:gend" json:"gend" form:"gend"`
1125
+	Naty                string    `gorm:"column:naty" json:"naty" form:"naty"`
1126
+	Brdy                time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
1127
+	Age                 float64   `gorm:"column:age" json:"age" form:"age"`
1128
+	Insutype            string    `gorm:"column:insutype" json:"insutype" form:"insutype"`
1129
+	PsnType             string    `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
1130
+	CvlservFlag         string    `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
1131
+	SetlTime            string    `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
1132
+	MdtrtCertType       string    `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
1133
+	MedType             string    `gorm:"column:med_type" json:"med_type" form:"med_type"`
1134
+	MedfeeSumamt        float64   `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
1135
+	FulamtOwnpayAmt     float64   `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
1136
+	OverlmtSelfPay      float64   `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
1137
+	PreselfpayAmt       float64   `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
1138
+	InscpScpAmt         float64   `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
1139
+	ActPayDedc          float64   `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
1140
+	HifpPay             float64   `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
1141
+	CvlservPay          float64   `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
1142
+	PoolPropSelfpay     float64   `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
1143
+	HifesPay            float64   `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
1144
+	HifmiPay            float64   `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
1145
+	HifobPay            float64   `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
1146
+	MafPay              float64   `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
1147
+	OthPay              float64   `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
1148
+	FundPaySumamt       float64   `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
1149
+	PsnPartAmt          float64   `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
1150
+	AcctPay             float64   `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
1151
+	PsnCashPay          float64   `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
1152
+	HospPartAmt         float64   `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
1153
+	Balc                float64   `gorm:"column:balc" json:"balc" form:"balc"`
1154
+	AcctMulaidPay       float64   `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
1155
+	MedinsSetlId        string    `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
1156
+	ClrOptins           string    `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
1157
+	ClrWay              string    `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
1158
+	ClrType             string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
1159
+	SetlDetail          string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
1160
+	IsMedicineInsurance int64     `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
1161
+	PayWay              int64     `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
1162
+
1163
+	PayPrice              float64  `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
1164
+	PayCardNo             string   `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
1165
+	DiscountPrice         float64  `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
1166
+	PreferentialPrice     float64  `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
1167
+	RealityPrice          float64  `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
1168
+	FoundPrice            float64  `gorm:"column:found_price" json:"found_price" form:"found_price"`
1169
+	MedicalInsurancePrice float64  `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
1170
+	PrivatePrice          float64  `gorm:"column:private_price" json:"private_price" form:"private_price"`
1171
+	DepartmentName        string   `gorm:"-" json:"department_name" form:"department_name"`
1172
+	DoctorName            string   `gorm:"-" json:"doctor_name" form:"doctor_name"`
1173
+	Creator               int64    `gorm:"column:creator" json:"creator" form:"creator"`
1174
+	PType                 int64    `gorm:"column:p_type" json:"p_type" form:"p_type"`
1175
+	Decimal               float64  `gorm:"column:decimal" json:"decimal" form:"decimal"`
1176
+	OthDesc               string   `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
1177
+	PayWays               string   `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
1178
+	CashPay               string   `gorm:"cash_pay" json:"cash_pay" form:"cash_pay"`
1179
+	BandCardPay           string   `gorm:"band_card_pay" json:"band_card_pay" form:"band_card_pay"`
1180
+	WechatPay             string   `gorm:"wechat_pay" json:"wechat_pay" form:"wechat_pay"`
1181
+	AliPay                string   `gorm:"ali_pay" json:"ali_pay" form:"ali_pay"`
1182
+	JifenPay              string   `gorm:"jifen_pay" json:"jifen_pay" form:"jifen_pay"`
1183
+	FaPiaoCode            string   `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
1184
+	FaPiaoNumber          string   `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
1185
+	SettleType            int64    `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
1186
+	SettleStartTime       int64    `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
1187
+	SettleEndTime         int64    `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
1188
+	Patients              Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
1189
+	IsPre                 int64    `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
1190
+	Diagnosis             string   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
1191
+	FaPiaoBatchnumberId   int64    `gorm:"column:fa_piao_batchnumber_id" json:"fa_piao_batchnumber_id" form:"fa_piao_batchnumber_id"`
1192
+	IsUploadDiagnose      int64    `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
1193
+	IsUploadOrderInfo     int64    `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
1194
+	IsUploadSuccess       int64    `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
1195
+}
1196
+
1197
+func (HisOrderOther) TableName() string {
1198
+	return "his_order"
1199
+}
1200
+
1101 1201
 type HisOrderInfo struct {
1102 1202
 	ID               int64   `gorm:"column:id" json:"id" form:"id"`
1103 1203
 	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`

+ 3 - 3
service/his_charge_service.go Parādīt failu

@@ -157,7 +157,7 @@ func GetNewAllPatientDrugChargeDetails(org_id int64, start_time_str string, end_
157 157
 		switch item_type {
158 158
 		case 0:
159 159
 			err = readDb.Table("his_order_info as oi").Select("oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
160
-				Joins("JOIN his_order o ON oi.order_number = o.number   and o.setl_time BETWEEN  ? AND ?  and o.order_status = 2 and o.status = 1 and o.is_medicine_insurance = 1", start_time_str, end_time_str).
160
+				Joins("JOIN his_order o ON oi.order_number = o.number   and o.setl_time BETWEEN  ? AND ?  and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
161 161
 				Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
162 162
 				Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
163 163
 				Joins(" JOIN  xt_base_drug drug on  a.drug_id = drug.id").
@@ -165,7 +165,7 @@ func GetNewAllPatientDrugChargeDetails(org_id int64, start_time_str string, end_
165 165
 			break
166 166
 		case 1:
167 167
 			err = readDb.Table("his_order_info as oi").Select("oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
168
-				Joins("JOIN his_order o ON oi.order_number = o.number   and o.setl_time BETWEEN  ? AND ?  and o.order_status = 2 and o.status = 1 and o.is_medicine_insurance = 1", start_time_str, end_time_str).
168
+				Joins("JOIN his_order o ON oi.order_number = o.number   and o.setl_time BETWEEN  ? AND ?  and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
169 169
 				Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
170 170
 				Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
171 171
 				Joins(" JOIN  xt_base_drug drug on  a.drug_id = drug.id").
@@ -243,7 +243,7 @@ func GetNewAllPatientProjectAndGoodChargeDetails(org_id int64, start_time_str st
243 243
 			break
244 244
 		case 3:
245 245
 			err = readDb.Table("his_order_info as oi").Select("0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type,  (case p.type  when 2 then project.project_name  when 3 then good.good_name  END) as item_name,(case p.type  when 2 then ''  when 3 then good.specification_name  END) as specification_name, p.project_id as item_id").
246
-				Joins("JOIN his_order o ON oi.order_number = o.number   and o.setl_time BETWEEN  ? AND ?  and o.order_status = 2 and o.status = 1 and o.is_medicine_insurance <> 1", start_time_str, end_time_str).
246
+				Joins("JOIN his_order o ON oi.order_number = o.number   and o.setl_time BETWEEN  ? AND ?  and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
247 247
 				Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 3").
248 248
 				Joins("left join xt_his_project project on  p.project_id = project.id").
249 249
 				Joins("left join  xt_good_information good on  p.project_id = good.id").

+ 8 - 0
service/his_config_service.go Parādīt failu

@@ -52,6 +52,14 @@ func DelelteHisPrescriptionInfoTemplate(id int64, user_org_id int64) (err error)
52 52
 	return
53 53
 }
54 54
 
55
+func BatchDelelteHisPrescriptionInfoTemplate(id []int64, user_org_id int64) (err error) {
56
+
57
+	err = writeDb.Model(&models.HisPrescriptionInfoTemplate{}).Where("user_org_id = ? AND id in (?)", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
58
+	err = writeDb.Model(&models.HisPrescriptionAdviceTemplate{}).Where("user_org_id = ? AND prescription_id in (?)", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
59
+	err = writeDb.Model(&models.HisPrescriptionProjectTemplate{}).Where("user_org_id = ? AND prescription_id in (?)", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
60
+	return
61
+}
62
+
55 63
 func DelelteHisPrescriptionTemplate(id int64, user_org_id int64) (err error) {
56 64
 	err = writeDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0}).Error
57 65
 	err = writeDb.Model(&models.HisPrescriptionInfoTemplate{}).Where("user_org_id = ? AND p_template_id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error

+ 13 - 0
service/his_service.go Parādīt failu

@@ -1073,6 +1073,19 @@ func GetHisOrderList(user_org_id int64, page int64, limit int64, start_time_time
1073 1073
 	return
1074 1074
 }
1075 1075
 
1076
+func GetNewHisOrderListTwo(user_org_id int64, start_time_timestamp int64, end_time_timestamp int64) (order []*models.HisOrder, err error) {
1077
+	db := readDb.Model(&models.HisOrder{})
1078
+	if start_time_timestamp != 0 {
1079
+		db = db.Where("his_order.settle_accounts_date>=?", start_time_timestamp)
1080
+	}
1081
+	if end_time_timestamp != 0 {
1082
+		db = db.Where("his_order.settle_accounts_date<=?", end_time_timestamp)
1083
+	}
1084
+	db = db.Where("user_org_id = ?", user_org_id)
1085
+	err = db.Preload("Patients", "status = 1 AND user_org_id = ?", user_org_id).Find(&order).Error
1086
+	return
1087
+}
1088
+
1076 1089
 func UpDatePrescriptionNumber(user_org_id int64, ids []int64, number string) (err error) {
1077 1090
 	err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND id in (?)", user_org_id, ids).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix()}).Error
1078 1091
 	return