XMLWAN il y a 3 ans
Parent
révision
aff7303a2a

+ 21 - 5
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go Voir le fichier

@@ -596,21 +596,37 @@ func (this *XcxApiController) GetDoctorAdvice() {
596 596
 	loc, _ := time.LoadLocation("Local")
597 597
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
598 598
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
599
-	info, _ := service.GetXcxPatientInfo(1)
599
+	info, _ := service.GetXcxPatientInfo(patient_id)
600 600
 	config, _ := service.GetDoctorAdviceConfig(info.UserOrgId)
601
-	fmt.Println(startTime, endTime)
601
+	fmt.Println(startTime, endTime, config.IsOpenRemind)
602 602
 	if config.IsOpenRemind == 0 || config.IsOpenRemind == 2 {
603
-
603
+		list, _ := service.GetDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
604 604
 		advice, _ := service.GetDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
605
+		for _, item := range list {
606
+			for _, it := range advice {
607
+				if item.AdviceDate == it.AdviceDate {
608
+					item.Childs = append(item.Childs, it)
609
+				}
610
+			}
611
+		}
612
+
605 613
 		this.ServeSuccessJSON(map[string]interface{}{
606
-			"list": advice,
614
+			"list": list,
607 615
 		})
608 616
 	}
609 617
 
610 618
 	if config.IsOpenRemind == 1 {
619
+		list, _ := service.GetHisDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
611 620
 		advice, _ := service.GetHisDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
621
+		for _, item := range list {
622
+			for _, it := range advice {
623
+				if item.AdviceDate == it.AdviceDate {
624
+					item.Childs = append(item.Childs, it)
625
+				}
626
+			}
627
+		}
612 628
 		this.ServeSuccessJSON(map[string]interface{}{
613
-			"list": advice,
629
+			"list": list,
614 630
 		})
615 631
 	}
616 632
 

+ 117 - 104
models/xcx_user_models.go Voir le fichier

@@ -292,55 +292,67 @@ func (XcxDoctorAdviceConfig) TableName() string {
292 292
 	return "xt_doctor_config"
293 293
 }
294 294
 
295
+type XcxDoctorAdviceOne struct {
296
+	ID         int64              `gorm:"column:id" json:"id" form:"id"`
297
+	PatientId  int64              `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
298
+	AdviceDate int64              `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
299
+	Childs     []*XcxDoctorAdvice `json:"childs" `
300
+}
301
+
302
+func (XcxDoctorAdviceOne) TableName() string {
303
+	return "xt_doctor_advice"
304
+}
305
+
295 306
 type XcxDoctorAdvice struct {
296
-	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
297
-	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
298
-	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
299
-	AdviceType            int64   `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
300
-	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
301
-	StartTime             int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
302
-	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
303
-	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
304
-	ReminderDate          int64   `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
305
-	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
306
-	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
307
-	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
308
-	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
309
-	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
310
-	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
311
-	AdviceDoctor          int64   `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
312
-	Status                int64   `gorm:"column:status" json:"status" form:"status"`
313
-	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
314
-	UpdatedTime           int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
315
-	AdviceAffirm          string  `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
316
-	Remark                string  `gorm:"column:remark" json:"remark" form:"remark"`
317
-	StopTime              int64   `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
318
-	StopReason            string  `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
319
-	StopDoctor            int64   `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
320
-	StopState             int64   `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
321
-	ParentId              int64   `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
322
-	ExecutionTime         int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
323
-	ExecutionStaff        int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
324
-	ExecutionState        int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
325
-	Checker               int64   `gorm:"column:checker" json:"checker" form:"checker"`
326
-	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
327
-	DialysisOrderId       int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
328
-	CheckTime             int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
329
-	CheckState            int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
330
-	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
331
-	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
332
-	Groupno               int64   `gorm:"column:groupno" json:"groupno" form:"groupno"`
333
-	FrequencyType         int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
334
-	DayCount              int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
335
-	WeekDay               string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
336
-	RemindType            int64   `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
337
-	TemplateId            string  `gorm:"column:template_id" json:"template_id" form:"template_id"`
338
-	Modifier              int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
339
-	Way                   int64   `gorm:"column:way" json:"way" form:"way"`
340
-	DrugId                int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
341
-	DrugNameId            int64   `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
342
-	SyncAdviceId          int64   `gorm:"column:sync_advice_id" json:"sync_advice_id" form:"sync_advice_id"`
343
-	IsSync                int64   `gorm:"column:is_sync" json:"is_sync" form:"is_sync"`
307
+	ID                    int64              `gorm:"column:id" json:"id" form:"id"`
308
+	UserOrgId             int64              `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
309
+	PatientId             int64              `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
310
+	AdviceType            int64              `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
311
+	AdviceDate            int64              `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
312
+	StartTime             int64              `gorm:"column:start_time" json:"start_time" form:"start_time"`
313
+	AdviceName            string             `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
314
+	AdviceDesc            string             `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
315
+	ReminderDate          int64              `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
316
+	SingleDose            float64            `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
317
+	SingleDoseUnit        string             `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
318
+	PrescribingNumber     float64            `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
319
+	PrescribingNumberUnit string             `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
320
+	DeliveryWay           string             `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
321
+	ExecutionFrequency    string             `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
322
+	AdviceDoctor          int64              `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
323
+	Status                int64              `gorm:"column:status" json:"status" form:"status"`
324
+	CreatedTime           int64              `gorm:"column:created_time" json:"created_time" form:"created_time"`
325
+	UpdatedTime           int64              `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
326
+	AdviceAffirm          string             `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
327
+	Remark                string             `gorm:"column:remark" json:"remark" form:"remark"`
328
+	StopTime              int64              `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
329
+	StopReason            string             `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
330
+	StopDoctor            int64              `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
331
+	StopState             int64              `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
332
+	ParentId              int64              `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
333
+	ExecutionTime         int64              `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
334
+	ExecutionStaff        int64              `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
335
+	ExecutionState        int64              `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
336
+	Checker               int64              `gorm:"column:checker" json:"checker" form:"checker"`
337
+	RecordDate            int64              `gorm:"column:record_date" json:"record_date" form:"record_date"`
338
+	DialysisOrderId       int64              `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
339
+	CheckTime             int64              `gorm:"column:check_time" json:"check_time" form:"check_time"`
340
+	CheckState            int64              `gorm:"column:check_state" json:"check_state" form:"check_state"`
341
+	DrugSpec              float64            `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
342
+	DrugSpecUnit          string             `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
343
+	Groupno               int64              `gorm:"column:groupno" json:"groupno" form:"groupno"`
344
+	FrequencyType         int64              `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
345
+	DayCount              int64              `gorm:"column:day_count" json:"day_count" form:"day_count"`
346
+	WeekDay               string             `gorm:"column:week_day" json:"week_day" form:"week_day"`
347
+	RemindType            int64              `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
348
+	TemplateId            string             `gorm:"column:template_id" json:"template_id" form:"template_id"`
349
+	Modifier              int64              `gorm:"column:modifier" json:"modifier" form:"modifier"`
350
+	Way                   int64              `gorm:"column:way" json:"way" form:"way"`
351
+	DrugId                int64              `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
352
+	DrugNameId            int64              `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
353
+	SyncAdviceId          int64              `gorm:"column:sync_advice_id" json:"sync_advice_id" form:"sync_advice_id"`
354
+	IsSync                int64              `gorm:"column:is_sync" json:"is_sync" form:"is_sync"`
355
+	Childs                []*XcxDoctorAdvice `json:"childs" `
344 356
 }
345 357
 
346 358
 func (XcxDoctorAdvice) TableName() string {
@@ -348,62 +360,63 @@ func (XcxDoctorAdvice) TableName() string {
348 360
 }
349 361
 
350 362
 type XcxHisDoctorAdviceInfo struct {
351
-	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
352
-	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
353
-	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
354
-	HisPatientId          int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
355
-	AdviceType            int64   `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
356
-	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
357
-	StartTime             int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
358
-	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
359
-	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
360
-	ReminderDate          int64   `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
361
-	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
362
-	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
363
-	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
364
-	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
365
-	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
366
-	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
367
-	AdviceDoctor          int64   `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
368
-	Status                int64   `gorm:"column:status" json:"status" form:"status"`
369
-	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
370
-	UpdatedTime           int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
371
-	AdviceAffirm          string  `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
372
-	Remark                string  `gorm:"column:remark" json:"remark" form:"remark"`
373
-	StopTime              int64   `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
374
-	StopReason            string  `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
375
-	StopDoctor            int64   `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
376
-	StopState             int64   `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
377
-	ParentId              int64   `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
378
-	ExecutionTime         int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
379
-	ExecutionStaff        int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
380
-	ExecutionState        int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
381
-	Checker               int64   `gorm:"column:checker" json:"checker" form:"checker"`
382
-	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
383
-	DialysisOrderId       int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
384
-	CheckTime             int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
385
-	CheckState            int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
386
-	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
387
-	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
388
-	Groupno               int64   `gorm:"column:groupno" json:"groupno" form:"groupno"`
389
-	RemindType            int64   `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
390
-	FrequencyType         int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
391
-	DayCount              int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
392
-	WeekDay               string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
393
-	TemplateId            string  `gorm:"column:template_id" json:"template_id" form:"template_id"`
394
-	Modifier              int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
395
-	DrugId                int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
396
-	Price                 float64 `gorm:"column:price" json:"price" form:"price"`
397
-	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
398
-	MedListCodg           string  `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
399
-	FeedetlSn             string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
400
-	Day                   int64   `gorm:"column:day" json:"day" form:"day"`
401
-	Way                   int64   `gorm:"column:way" json:"way" form:"way"`
402
-	DrugNameId            int64   `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
403
-	Diagnosis             int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
404
-	HospApprFlag          int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
405
-	LmtUsedFlag           int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
406
-	Mtime                 int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
363
+	ID                    int64                     `gorm:"column:id" json:"id" form:"id"`
364
+	UserOrgId             int64                     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
365
+	PatientId             int64                     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
366
+	HisPatientId          int64                     `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
367
+	AdviceType            int64                     `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
368
+	AdviceDate            int64                     `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
369
+	StartTime             int64                     `gorm:"column:start_time" json:"start_time" form:"start_time"`
370
+	AdviceName            string                    `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
371
+	AdviceDesc            string                    `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
372
+	ReminderDate          int64                     `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
373
+	SingleDose            float64                   `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
374
+	SingleDoseUnit        string                    `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
375
+	PrescribingNumber     float64                   `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
376
+	PrescribingNumberUnit string                    `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
377
+	DeliveryWay           string                    `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
378
+	ExecutionFrequency    string                    `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
379
+	AdviceDoctor          int64                     `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
380
+	Status                int64                     `gorm:"column:status" json:"status" form:"status"`
381
+	CreatedTime           int64                     `gorm:"column:created_time" json:"created_time" form:"created_time"`
382
+	UpdatedTime           int64                     `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
383
+	AdviceAffirm          string                    `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
384
+	Remark                string                    `gorm:"column:remark" json:"remark" form:"remark"`
385
+	StopTime              int64                     `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
386
+	StopReason            string                    `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
387
+	StopDoctor            int64                     `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
388
+	StopState             int64                     `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
389
+	ParentId              int64                     `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
390
+	ExecutionTime         int64                     `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
391
+	ExecutionStaff        int64                     `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
392
+	ExecutionState        int64                     `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
393
+	Checker               int64                     `gorm:"column:checker" json:"checker" form:"checker"`
394
+	RecordDate            int64                     `gorm:"column:record_date" json:"record_date" form:"record_date"`
395
+	DialysisOrderId       int64                     `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
396
+	CheckTime             int64                     `gorm:"column:check_time" json:"check_time" form:"check_time"`
397
+	CheckState            int64                     `gorm:"column:check_state" json:"check_state" form:"check_state"`
398
+	DrugSpec              float64                   `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
399
+	DrugSpecUnit          string                    `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
400
+	Groupno               int64                     `gorm:"column:groupno" json:"groupno" form:"groupno"`
401
+	RemindType            int64                     `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
402
+	FrequencyType         int64                     `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
403
+	DayCount              int64                     `gorm:"column:day_count" json:"day_count" form:"day_count"`
404
+	WeekDay               string                    `gorm:"column:week_day" json:"week_day" form:"week_day"`
405
+	TemplateId            string                    `gorm:"column:template_id" json:"template_id" form:"template_id"`
406
+	Modifier              int64                     `gorm:"column:modifier" json:"modifier" form:"modifier"`
407
+	DrugId                int64                     `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
408
+	Price                 float64                   `gorm:"column:price" json:"price" form:"price"`
409
+	PrescriptionId        int64                     `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
410
+	MedListCodg           string                    `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
411
+	FeedetlSn             string                    `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
412
+	Day                   int64                     `gorm:"column:day" json:"day" form:"day"`
413
+	Way                   int64                     `gorm:"column:way" json:"way" form:"way"`
414
+	DrugNameId            int64                     `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
415
+	Diagnosis             int64                     `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
416
+	HospApprFlag          int64                     `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
417
+	LmtUsedFlag           int64                     `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
418
+	Mtime                 int64                     `gorm:"column:mtime" json:"mtime" form:"mtime"`
419
+	Childs                []*XcxHisDoctorAdviceInfo `json:"childs" `
407 420
 }
408 421
 
409 422
 func (XcxHisDoctorAdviceInfo) TableName() string {

+ 11 - 1
service/xcx_mobile_api_service.go Voir le fichier

@@ -264,7 +264,17 @@ func GetDoctorAdviceConfig(orgid int64) (models.XcxDoctorAdviceConfig, error) {
264 264
 	return config, err
265 265
 }
266 266
 
267
-func GetDoctorAdvice(patient_id int64, startime int64, endtime int64) (advice []*models.XcxHisDoctorAdviceInfo, err error) {
267
+func GetDoctorAdviceGroup(patient_id int64, startime int64, endtime int64) (advice []*models.XcxDoctorAdvice, err error) {
268
+
269
+	err = XTReadDB().Where("patient_id = ? and advice_date >=? and advice_date<=? and status = 1", patient_id, startime, endtime).Group("advice_date").Find(&advice).Error
270
+	return advice, err
271
+}
272
+
273
+func GetHisDoctorAdviceGroup(patient_id int64, startime int64, endtime int64) (advice []*models.XcxHisDoctorAdviceInfo, err error) {
274
+
275
+}
276
+
277
+func GetDoctorAdvice(patient_id int64, startime int64, endtime int64) (advice []*models.XcxDoctorAdvice, err error) {
268 278
 
269 279
 	err = XTReadDB().Where("patient_id = ? and advice_date >=? and advice_date<=? and status = 1", patient_id, startime, endtime).Find(&advice).Error
270 280
 	return advice, err