csx 3 år sedan
förälder
incheckning
5746cd3741

+ 1 - 1
controllers/his_api_controller.go Visa fil

@@ -5295,7 +5295,7 @@ func (c *HisApiController) GetFaPiaoData() {
5295 5295
 				laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
5296 5296
 			}
5297 5297
 
5298
-			if item.MedChrgitmType == "05" || item.MedChrgitmType == "14" { //治疗费
5298
+			if item.MedChrgitmType == "05" || item.MedChrgitmType == "14" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
5299 5299
 				treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
5300 5300
 				treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
5301 5301
 				treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()

+ 8 - 7
controllers/his_hospital_api_controller.go Visa fil

@@ -421,16 +421,15 @@ func (c *HisHospitalApiController) GetHisHospitalChargePatientInfo() {
421 421
 	his_patient_info, _ := service.GetNewHisHospitalPatientInfo(his_patient_id)
422 422
 	xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
423 423
 
424
-	var prescriptions []*models.HisPrescription
425
-
424
+	var prescriptions []*models.HisHospitalPrescription
426 425
 	if order_status == 1 || order_status == 0 {
427
-		prescriptions, _ = service.GetUnChargeHisHospitalPrescriptionFive(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime)
426
+		prescriptions, _ = service.GetNewUnChargeHisHospitalPrescriptionFive(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime)
428 427
 	} else if order_status == 2 {
429
-		prescriptions, _ = service.GetChargeHisHospitalPrescriptionFive(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime)
428
+		prescriptions, _ = service.GetNewChargeHisHospitalPrescriptionFive(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime)
430 429
 	}
431 430
 
432 431
 	var monthPrescriptions []*models.HisPrescription
433
-	var settle_prescriptions []*models.HisPrescription
432
+	var settle_prescriptions []*models.HisHospitalPrescription
434 433
 	if order_status == 1 || order_status == 0 {
435 434
 		monthPrescriptions, _ = service.GetUnChargeMonthHisPrescriptionThree(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
436 435
 	} else if order_status == 2 {
@@ -769,6 +768,8 @@ func (this *HisHospitalApiController) GetZHInHospitalUnCheck() {
769 768
 
770 769
 func (c *HisHospitalApiController) GetHisHospitalDetailPatientList() {
771 770
 	record_date := c.GetString("record_date")
771
+	sch_type, _ := c.GetInt64("sch_type")
772
+
772 773
 	timeLayout := "2006-01-02"
773 774
 	loc, _ := time.LoadLocation("Local")
774 775
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
@@ -778,8 +779,8 @@ func (c *HisHospitalApiController) GetHisHospitalDetailPatientList() {
778 779
 	}
779 780
 	recordDateTime := theTime.Unix()
780 781
 	adminInfo := c.GetAdminUserInfo()
781
-	UnUploadPrescriptionPatients, _ := service.GetHisHospitalUnUploadPrescriptionDetailPatientList(adminInfo.CurrentOrgId, recordDateTime)
782
-	UploadPrescriptionPatients, _ := service.GetHisHospitalUploadPrescriptionDetailPatientList(adminInfo.CurrentOrgId, recordDateTime)
782
+	UnUploadPrescriptionPatients, _ := service.GetHisHospitalUnUploadPrescriptionDetailPatientList(adminInfo.CurrentOrgId, recordDateTime, sch_type)
783
+	UploadPrescriptionPatients, _ := service.GetHisHospitalUploadPrescriptionDetailPatientList(adminInfo.CurrentOrgId, recordDateTime, sch_type)
783 784
 	//var patients []*models.HisHospitalCheckRecord
784 785
 	/*	for _, item := range tempPatients {
785 786
 		fmt.Println(item.ID)

+ 11 - 1
controllers/his_project_api_controller.go Visa fil

@@ -1203,6 +1203,8 @@ func (this *HisProjectApiController) GetDoctorAdvicePrint() {
1203 1203
 	patient_id, _ := this.GetInt64("patient_id")
1204 1204
 	record_date := this.GetString("record_date")
1205 1205
 	schIDStr := this.GetString("ids")
1206
+	p_type, _ := this.GetInt64("p_type")
1207
+
1206 1208
 	if len(schIDStr) == 0 {
1207 1209
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1208 1210
 		return
@@ -1215,7 +1217,15 @@ func (this *HisProjectApiController) GetDoctorAdvicePrint() {
1215 1217
 	recordDateTime := theTime.Unix()
1216 1218
 	//prescription_id, _ := this.GetInt64("prescription_id")
1217 1219
 	adminUserInfo := this.GetAdminUserInfo()
1218
-	advicePrint, err := service.GetDoctorAdvicePrint(patient_id, recordDateTime, idStrs, adminUserInfo.CurrentOrgId)
1220
+	var temp_p_type int64
1221
+	if p_type == 1 {
1222
+
1223
+		temp_p_type = 1
1224
+	} else {
1225
+		temp_p_type = 2
1226
+	}
1227
+
1228
+	advicePrint, err := service.GetDoctorAdvicePrint(patient_id, recordDateTime, idStrs, adminUserInfo.CurrentOrgId, temp_p_type)
1219 1229
 	projectlist, err := service.GetAllProjectList(adminUserInfo.CurrentOrgId, "")
1220 1230
 	his, _ := service.GetLastHisPatient(patient_id, adminUserInfo.CurrentOrgId)
1221 1231
 	//prescriptionInfo, _ := service.GetPrscriptionInfo(patient_id, recordDateTime)

+ 71 - 0
models/his_hospital_models.go Visa fil

@@ -93,3 +93,74 @@ type NewCustom struct {
93 93
 	HospApprFlag     int64
94 94
 	FeeOcurTime      string
95 95
 }
96
+
97
+type HisHospitalPrescription struct {
98
+	ID                     int64                     `gorm:"column:id" json:"id" form:"id"`
99
+	UserOrgId              int64                     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
100
+	RecordDate             int64                     `gorm:"column:record_date" json:"record_date" form:"record_date"`
101
+	PatientId              int64                     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
102
+	HisPatientId           int64                     `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
103
+	Status                 int64                     `gorm:"column:status" json:"status" form:"status"`
104
+	Ctime                  int64                     `gorm:"column:ctime" json:"ctime" form:"ctime"`
105
+	Mtime                  int64                     `gorm:"column:mtime" json:"mtime" form:"mtime"`
106
+	Number                 string                    `gorm:"column:number" json:"number" form:"number"`
107
+	Type                   int64                     `gorm:"column:type" json:"type" form:"type"`
108
+	Doctor                 string                    `gorm:"column:doctor" json:"doctor" form:"doctor"`
109
+	Creator                int64                     `gorm:"column:creator" json:"creator" form:"creator"`
110
+	Modifier               int64                     `gorm:"column:modifier" json:"modifier" form:"modifier"`
111
+	OrderStatus            int64                     `gorm:"column:order_status" json:"order_status" form:"order_status"`
112
+	PreTime                int64                     `gorm:"column:pre_time" json:"pre_time" form:"pre_time"`
113
+	BatchNumber            string                    `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
114
+	PrescriptionNumber     string                    `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
115
+	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
116
+	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
117
+	HisAdditionalCharge    []*HisAdditionalCharge    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`
118
+
119
+	Total   string `gorm:"-" json:"total" form:"total"`
120
+	PType   int64  `gorm:"column:p_type" json:"p_type" form:"p_type"`
121
+	MedType string `gorm:"column:med_type" json:"med_type" form:"med_type"`
122
+}
123
+
124
+func (HisHospitalPrescription) TableName() string {
125
+	return "his_prescription"
126
+}
127
+
128
+type HisHospitalOrderInfo struct {
129
+	ID               int64   `gorm:"column:id" json:"id" form:"id"`
130
+	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`
131
+	UploadDate       int64   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
132
+	AdviceId         int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
133
+	DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
134
+	Cnt              float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
135
+	Pric             float64 `gorm:"column:pric" json:"pric" form:"pric"`
136
+	PatientId        int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
137
+	PricUplmtAmt     float64 `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
138
+	SelfpayProp      float64 `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
139
+	FulamtOwnpayAmt  float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
140
+	OverlmtAmt       float64 `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
141
+	PreselfpayAmt    float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
142
+	BasMednFlag      string  `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
143
+	MedChrgitmType   string  `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
144
+	HiNegoDrugFlag   string  `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
145
+	Status           int64   `gorm:"column:status" json:"status" form:"status"`
146
+	Memo             string  `gorm:"column:memo" json:"memo" form:"memo"`
147
+	FeedetlSn        string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
148
+	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
149
+	InscpScpAmt      float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
150
+	DrtReimFlag      string  `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
151
+	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
152
+	ListSpItemFlag   string  `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
153
+	ChldMedcFlag     string  `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
154
+	LmtUsedFlag      string  `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
155
+	ChrgitmLv        string  `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
156
+	UserOrgId        int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
157
+	HisPatientId     int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
158
+	OrderId          int64   `gorm:"column:order_id" json:"order_id" form:"order_id"`
159
+	ProjectId        int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
160
+	Type             int64   `gorm:"column:type" json:"type" form:"type"`
161
+	ItemId           int64   `gorm:"column:item_id" json:"item_id" form:"item_id"`
162
+}
163
+
164
+func (HisHospitalOrderInfo) TableName() string {
165
+	return "his_order_info"
166
+}

+ 46 - 8
service/his_hospital_service.go Visa fil

@@ -304,8 +304,8 @@ func GetHospitalMonthHisPrescription(org_id int64, patient_id int64, start_time
304 304
 	return
305 305
 }
306 306
 
307
-func GetSettleHisHospitalPrescription(org_id int64, patient_id int64, his_patient_id int64, record_date int64) (prescription []*models.HisPrescription, err error) {
308
-	err = readDb.Model(&models.HisPrescription{}).
307
+func GetSettleHisHospitalPrescription(org_id int64, patient_id int64, his_patient_id int64, record_date int64) (prescription []*models.HisHospitalPrescription, err error) {
308
+	err = readDb.Model(&models.HisHospitalPrescription{}).
309 309
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
310 310
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
311 311
 		}).
@@ -320,17 +320,23 @@ func GetSettleHisHospitalPrescription(org_id int64, patient_id int64, his_patien
320 320
 	return
321 321
 }
322 322
 
323
-func GetHisHospitalUnUploadPrescriptionDetailPatientList(org_id int64, record_date int64) (patients []*models.HisHospitalCheckRecord, err error) {
323
+func GetHisHospitalUnUploadPrescriptionDetailPatientList(org_id int64, record_date int64, sch_type int64) (patients []*models.HisHospitalCheckRecord, err error) {
324 324
 	db := readDb.Model(&models.HisHospitalCheckRecord{})
325
-	db = db.Joins("inner join his_prescription pre On pre.patient_id = his_hospital_check_record.patient_id and pre.record_date = ? AND pre.p_type = 1 AND pre.user_org_id = ? AND pre.order_status <> 4 AND pre.order_status <> 2", record_date, org_id)
325
+	db = db.Joins("inner join his_prescription pre On pre.patient_id = his_hospital_check_record.patient_id and pre.record_date = ? AND pre.p_type = 1 AND pre.user_org_id = ? AND pre.status = 1 AND pre.order_status <> 4 AND pre.order_status <> 2", record_date, org_id)
326
+	if sch_type > 0 {
327
+		db = db.Joins("join xt_schedule as sch ON sch.patient_id = his_hospital_check_record.patient_id AND sch.status = 1 AND sch.user_org_id = ? AND sch.schedule_date = ? AND sch.schedule_type = ? ", org_id, record_date, sch_type)
328
+	}
326 329
 	db = db.Where("his_hospital_check_record.user_org_id = ? AND his_hospital_check_record.status = 1 AND his_hospital_check_record.in_hospital_status = 1 AND his_hospital_check_record.out_hospital_status = 0", org_id)
327 330
 	err = db.Group("number").Find(&patients).Error
328 331
 	return
329 332
 }
330 333
 
331
-func GetHisHospitalUploadPrescriptionDetailPatientList(org_id int64, record_date int64) (patients []*models.HisHospitalCheckRecord, err error) {
334
+func GetHisHospitalUploadPrescriptionDetailPatientList(org_id int64, record_date int64, sch_type int64) (patients []*models.HisHospitalCheckRecord, err error) {
332 335
 	db := readDb.Model(&models.HisHospitalCheckRecord{})
333
-	db = db.Joins("inner join his_prescription pre On pre.patient_id = his_hospital_check_record.patient_id and pre.record_date = ? AND pre.p_type = 1 AND pre.user_org_id = ? AND pre.order_status = 4", record_date, org_id)
336
+	db = db.Joins("inner join his_prescription pre On pre.patient_id = his_hospital_check_record.patient_id and pre.record_date = ? AND pre.p_type = 1 AND pre.user_org_id = ? AND pre.order_status = 4  AND pre.status = 1 ", record_date, org_id)
337
+	if sch_type > 0 {
338
+		db = db.Joins("join xt_schedule as sch ON sch.patient_id = his_hospital_check_record.patient_id AND sch.status = 1 AND sch.user_org_id = ? AND sch.schedule_date = ? AND sch.schedule_type = ? ", org_id, record_date, sch_type)
339
+	}
334 340
 	db = db.Where("his_hospital_check_record.user_org_id = ? AND his_hospital_check_record.status = 1 AND his_hospital_check_record.in_hospital_status = 1  AND his_hospital_check_record.out_hospital_status = 0", org_id)
335 341
 	err = db.Group("number").Find(&patients).Error
336 342
 	return
@@ -416,8 +422,8 @@ func GetAllMonthHisHospitalPrescription(org_id int64, patient_id int64, start_ti
416 422
 	return
417 423
 }
418 424
 
419
-func GetSettleHisHospitalPrescriptionTwo(org_id int64, patient_id int64, number string) (prescription []*models.HisPrescription, err error) {
420
-	err = readDb.Model(&models.HisPrescription{}).
425
+func GetSettleHisHospitalPrescriptionTwo(org_id int64, patient_id int64, number string) (prescription []*models.HisHospitalPrescription, err error) {
426
+	err = readDb.Model(&models.HisHospitalPrescription{}).
421 427
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
422 428
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
423 429
 		}).
@@ -474,3 +480,35 @@ func GetHisOrderInfoByNumberFour(order_number string) (order []*models.HisOrderI
474 480
 	err = db.Where("order_number = ? AND status = 1", order_number).Find(&order).Error
475 481
 	return
476 482
 }
483
+
484
+func GetNewChargeHisHospitalPrescriptionFive(org_id int64, patient_id int64, his_patient_id int64, record_date int64) (prescription []*models.HisHospitalPrescription, err error) {
485
+	err = readDb.Model(&models.HisHospitalPrescription{}).
486
+		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
487
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
488
+		}).
489
+		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
490
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("Drug", "status=1")
491
+		}).
492
+		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
493
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
494
+		}).
495
+		Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status = 2 ", org_id, record_date, patient_id).
496
+		Find(&prescription).Error
497
+	return
498
+}
499
+
500
+func GetNewUnChargeHisHospitalPrescriptionFive(org_id int64, patient_id int64, his_patient_id int64, record_date int64) (prescription []*models.HisHospitalPrescription, err error) {
501
+	err = readDb.Model(&models.HisHospitalPrescription{}).
502
+		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
503
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
504
+		}).
505
+		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
506
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("Drug", "status=1")
507
+		}).
508
+		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
509
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
510
+		}).
511
+		Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND order_status <> 3", org_id, record_date, patient_id).
512
+		Find(&prescription).Error
513
+	return
514
+}

+ 3 - 3
service/his_print_service.go Visa fil

@@ -8,7 +8,7 @@ import (
8 8
 func GetBatchDrugHisPrescription(ids []string, record_time int64, user_org_id int64) (patients []*models.PrintPatient, err error) {
9 9
 	readDb.Model(&models.PrintPatient{}).Preload("HisPrintPatient", "status = 1 AND record_date = ?", record_time).
10 10
 		Preload("HisPrintPrescription", func(db *gorm.DB) *gorm.DB {
11
-			return db.Where("status = 1 AND user_org_id = ? AND record_date = ? AND type = 1", user_org_id, record_time).
11
+			return db.Where("status = 1 AND user_org_id = ? AND record_date = ? AND type = 1 AND p_type = 2", user_org_id, record_time).
12 12
 				Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
13 13
 					return db.Where("status = 1 AND user_org_id = ?", user_org_id).Preload("Drug", "status=1")
14 14
 				})
@@ -21,7 +21,7 @@ func GetBatchDrugHisPrescription(ids []string, record_time int64, user_org_id in
21 21
 func GetBatchProjectHisPrescription(ids []string, record_time int64, user_org_id int64) (patients []*models.PrintPatient, err error) {
22 22
 	readDb.Model(&models.PrintPatient{}).Preload("HisPrintPatient", "status = 1 AND record_date = ?", record_time).
23 23
 		Preload("HisPrintPrescription", func(db *gorm.DB) *gorm.DB {
24
-			return db.Where("status = 1 AND user_org_id = ? AND record_date = ? AND type <> 1", user_org_id, record_time).
24
+			return db.Where("status = 1 AND user_org_id = ? AND record_date = ? AND type <> 1 AND p_type = 2", user_org_id, record_time).
25 25
 				Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
26 26
 					return db.Where("status = 1 ").Preload("HisProject", "status = 1").Preload("GoodInfo", "status=1")
27 27
 				})
@@ -35,7 +35,7 @@ func GetBatchProjectHisPrescription(ids []string, record_time int64, user_org_id
35 35
 func GetBatchInspectionProjectHisPrescription(ids []string, record_time int64, user_org_id int64) (patients []*models.PrintPatient, err error) {
36 36
 	readDb.Model(&models.PrintPatient{}).Preload("HisPrintPatient", "status = 1 AND record_date = ?", record_time).
37 37
 		Preload("HisPrintPrescription", func(db *gorm.DB) *gorm.DB {
38
-			return db.Where("status = 1 AND user_org_id = ? AND record_date = ? AND type <> 1", user_org_id, record_time).
38
+			return db.Where("status = 1 AND user_org_id = ? AND record_date = ? AND type <> 1 AND p_type = 2", user_org_id, record_time).
39 39
 				Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
40 40
 					return db.Where("status = 1 ").Preload("HisProject", "status = 1 AND cost_classify = 3")
41 41
 				})

+ 3 - 4
service/his_project_service.go Visa fil

@@ -402,13 +402,12 @@ func GetHistPatient(orgid int64, keyword string) (hisPatient []*models.HisPatien
402 402
 	return hisPatient, err
403 403
 }
404 404
 
405
-func GetDoctorAdvicePrint(his_patient_id int64, recorddate int64, schIDs []string, orgid int64) (prescription []*models.HisPrescription, err error) {
406
-
407
-	err = XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and id in(?) and  status = 1 ", his_patient_id, recorddate, schIDs).Preload("Patients", "status = 1 and user_org_id = ?", orgid).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
405
+func GetDoctorAdvicePrint(his_patient_id int64, recorddate int64, schIDs []string, orgid int64, p_type int64) (prescription []*models.HisPrescription, err error) {
406
+	err = XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and id in(?) and  status = 1 and p_type = ? ", his_patient_id, recorddate, schIDs, p_type).Preload("Patients", "status = 1 and user_org_id = ?", orgid).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
408 407
 		return db.Where("status = 1 and user_org_id = ?", orgid).Preload("Drug", "status = 1")
409 408
 	}).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
410 409
 		return db.Where("status = 1 AND user_org_id = ?", orgid).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
411
-	}).Preload("HisPrescriptionInfo", "status =1 and user_org_id = ?", orgid).Preload("HisAdditionalCharge", "status = 1 and user_org_id = ?", orgid).Find(&prescription).Error
410
+	}).Preload("HisPrescriptionInfo", "status =1 and user_org_id = ? and p_type = ? ", orgid, p_type).Preload("HisAdditionalCharge", "status = 1 and user_org_id = ?", orgid).Find(&prescription).Error
412 411
 
413 412
 	return prescription, err
414 413
 }