|
@@ -322,6 +322,28 @@ func GetWarehouseCancelPrintList(orgid int64, startime int64, endtime int64) (ca
|
322
|
322
|
return cancel, err
|
323
|
323
|
}
|
324
|
324
|
|
|
325
|
+func GetSchedulesSeven(orgID int64, schIDs []string) ([]*ScheduleVMSix, error) {
|
|
326
|
+ //recordDateStr := time.Now().Format("2006-01-02")
|
|
327
|
+ //recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
|
328
|
+ var schedules []*ScheduleVMSix
|
|
329
|
+ db := p_service.XTReadDB()
|
|
330
|
+ err := db.Model(&ScheduleVMSix{}).
|
|
331
|
+ Preload("Patient", "user_org_id = ? AND status = 1", orgID).
|
|
332
|
+ Preload("DeviceNumber", "org_id = ?", orgID).
|
|
333
|
+ Preload("DeviceZone", "org_id = ?", orgID).
|
|
334
|
+ Where("user_org_id = ? AND status = 1 AND id in (?)", orgID, schIDs).Order("schedule_date asc").
|
|
335
|
+ Find(&schedules).
|
|
336
|
+ Error
|
|
337
|
+ if err != nil {
|
|
338
|
+ return nil, err
|
|
339
|
+ }
|
|
340
|
+ for _, item := range schedules {
|
|
341
|
+ dialysis_count, _ := GetDialysisOrderCount(orgID, item.PatientID, item.ScheduleDate)
|
|
342
|
+ item.Patient.TotalDialysis = dialysis_count
|
|
343
|
+ }
|
|
344
|
+ return schedules, nil
|
|
345
|
+}
|
|
346
|
+
|
325
|
347
|
func GetSchedulesSix(orgID int64, schIDs []string) ([]*ScheduleVMSix, error) {
|
326
|
348
|
recordDateStr := time.Now().Format("2006-01-02")
|
327
|
349
|
recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
|
@@ -365,3 +387,71 @@ func GetSchedulesSix(orgID int64, schIDs []string) ([]*ScheduleVMSix, error) {
|
365
|
387
|
}
|
366
|
388
|
return schedules, nil
|
367
|
389
|
}
|
|
390
|
+
|
|
391
|
+func GetBatchDialysisOrder(orgid int64, patient_id int64, dialysis_date int64) (DialysisOrderVM, error) {
|
|
392
|
+
|
|
393
|
+ orderVM := DialysisOrderVM{}
|
|
394
|
+ err := p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and dialysis_date = ? and status = 1", orgid, patient_id, dialysis_date).Preload("DeviceNumber", "org_id = ? AND status = 1", orgid).Find(&orderVM).Error
|
|
395
|
+ return orderVM, err
|
|
396
|
+}
|
|
397
|
+
|
|
398
|
+func GetBatchPrescription(orgid int64, patient_id int64, record_date int64) (PrescriptionVM, error) {
|
|
399
|
+
|
|
400
|
+ prescriptionVM := PrescriptionVM{}
|
|
401
|
+ err := p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and record_date = ? and status = 1", orgid, patient_id, record_date).Find(&prescriptionVM).Error
|
|
402
|
+ return prescriptionVM, err
|
|
403
|
+}
|
|
404
|
+
|
|
405
|
+func GetBatchReceiveTreatmentAsses(orgid int64, patient_id int64, record_date int64) (ReceiveAssessmentVM, error) {
|
|
406
|
+
|
|
407
|
+ receiveAssessmentVM := ReceiveAssessmentVM{}
|
|
408
|
+ err := p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and record_date = ? and status = 1", orgid, patient_id, record_date).Find(&receiveAssessmentVM).Error
|
|
409
|
+ return receiveAssessmentVM, err
|
|
410
|
+}
|
|
411
|
+
|
|
412
|
+func GetBatchAssessmentBeforeDislysisVM(orgid int64, patient_id int64, assessment_date int64) (AssessmentBeforeDislysisVM, error) {
|
|
413
|
+
|
|
414
|
+ AssessmentBeforeDislysisVM := AssessmentBeforeDislysisVM{}
|
|
415
|
+ err := p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and assessment_date = ? and status = 1", orgid, patient_id, assessment_date).Find(&AssessmentBeforeDislysisVM).Error
|
|
416
|
+ return AssessmentBeforeDislysisVM, err
|
|
417
|
+}
|
|
418
|
+
|
|
419
|
+func GetBatchAssessmentAfterDislysisVM(orgid int64, patient_id int64, assessment_date int64) (AssessmentAfterDislysisVM, error) {
|
|
420
|
+
|
|
421
|
+ assessmentAfterDislysisVM := AssessmentAfterDislysisVM{}
|
|
422
|
+ err := p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and assessment_date = ? and status = 1", orgid, patient_id, assessment_date).Find(&assessmentAfterDislysisVM).Error
|
|
423
|
+ return assessmentAfterDislysisVM, err
|
|
424
|
+}
|
|
425
|
+
|
|
426
|
+func GetBatchLastAfterWeight(orgid int64, patient_id int64, assessment_date int64) (XtAssessmentAfterDislysisVM, error) {
|
|
427
|
+
|
|
428
|
+ xtAssessmentAfterDislysisVM := XtAssessmentAfterDislysisVM{}
|
|
429
|
+ err := p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and assessment_date < ? and status = 1", orgid, patient_id, assessment_date).Order("id desc").First(&xtAssessmentAfterDislysisVM).Error
|
|
430
|
+ return xtAssessmentAfterDislysisVM, err
|
|
431
|
+}
|
|
432
|
+
|
|
433
|
+func GetBatchMonitor(orgid int64, patient_id int64, monitoring_date int64) (MonitoringRecordVM []*MonitoringRecordVM, err error) {
|
|
434
|
+
|
|
435
|
+ err = p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and monitoring_date = ? and status = 1", orgid, patient_id, monitoring_date).Order("operate_time asc").Find(&MonitoringRecordVM).Error
|
|
436
|
+ return MonitoringRecordVM, err
|
|
437
|
+}
|
|
438
|
+
|
|
439
|
+func GetBatchDoctorAdvice(orgid int64, patient_id int64, advice_date int64) (DoctorAdviceVM []*DoctorAdviceVM, err error) {
|
|
440
|
+
|
|
441
|
+ err = p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and advice_date = ? and status = 1 and advice_type = 2", orgid, patient_id, advice_date).Order("start_time asc, groupno desc, id asc").Find(&DoctorAdviceVM).Error
|
|
442
|
+ return DoctorAdviceVM, err
|
|
443
|
+}
|
|
444
|
+
|
|
445
|
+func GetBatchDobuleCheck(orgid int64, patient_id int64, check_date int64) (*DoubleCheckVM, error) {
|
|
446
|
+
|
|
447
|
+ doubleCheckVM := DoubleCheckVM{}
|
|
448
|
+ err := p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and check_date =? and status = 1", orgid, patient_id, check_date).Find(&doubleCheckVM).Error
|
|
449
|
+ return &doubleCheckVM, err
|
|
450
|
+}
|
|
451
|
+
|
|
452
|
+func GetBatchSummerVM(orgid int64, patient_id int64, assessment_date int64) (*SummerVM, error) {
|
|
453
|
+
|
|
454
|
+ SummerVM := SummerVM{}
|
|
455
|
+ err := p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and assessment_date =? and status = 1", orgid, patient_id, assessment_date).Find(&SummerVM).Error
|
|
456
|
+ return &SummerVM, err
|
|
457
|
+}
|