Kaynağa Gözat

提交代码

陈少旭 5 ay önce
ebeveyn
işleme
5063caecf2

+ 23 - 3
controllers/his_api_controller.go Dosyayı Görüntüle

1423
 	patients_two, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, sch_type, 0)
1423
 	patients_two, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, sch_type, 0)
1424
 
1424
 
1425
 	if patient_type == 2 && c.GetAdminUserInfo().CurrentOrgId == 10721 {
1425
 	if patient_type == 2 && c.GetAdminUserInfo().CurrentOrgId == 10721 {
1426
-		fmt.Println("111111")
1427
-		patients_three, _ := service.GetFuTouHisPatientList(adminInfo.CurrentOrgId, recordDateTime, sch_type)
1426
+		patients_three, _ := service.GetFuTouHisPatientList(adminInfo.CurrentOrgId, recordDateTime)
1427
+		patients_four, _ := service.GetScheduleHisPatientListTwo(adminInfo.CurrentOrgId, recordDateTime)
1428
+
1428
 		fmt.Println(patients_three)
1429
 		fmt.Println(patients_three)
1429
 		//获取当前用户的信息
1430
 		//获取当前用户的信息
1430
 		adminUserInfo, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, adminInfo.AdminUser.Id)
1431
 		adminUserInfo, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, adminInfo.AdminUser.Id)
1435
 		noElementsSlice := make([]service.PatientThree, 0)
1436
 		noElementsSlice := make([]service.PatientThree, 0)
1436
 		c.ServeSuccessJSON(map[string]interface{}{
1437
 		c.ServeSuccessJSON(map[string]interface{}{
1437
 			"list":       patients_three,
1438
 			"list":       patients_three,
1438
-			"list_two":   patients_three,
1439
+			"list_two":   patients_four,
1439
 			"list_three": noElementsSlice,
1440
 			"list_three": noElementsSlice,
1440
 			"info":       adminUserInfo,
1441
 			"info":       adminUserInfo,
1441
 			"doctors":    doctors,
1442
 			"doctors":    doctors,
3431
 						med_type = "14"
3432
 						med_type = "14"
3432
 					}
3433
 					}
3433
 
3434
 
3435
+					if items["diagnoses"] == nil || reflect.TypeOf(items["diagnoses"]).String() != "string" {
3436
+						utils.ErrorLog("diagnoses")
3437
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3438
+						return
3439
+					}
3440
+					//med_type := strconv.Itoa(int(items["med_type"].(float64)))
3441
+					diagnoses, _ := items["diagnoses"].(string)
3442
+
3434
 					//if order_status == 0 {
3443
 					//if order_status == 0 {
3435
 					//	order_status = 1
3444
 					//	order_status = 1
3436
 					//}
3445
 					//}
3473
 							PreTime:            pTime,
3482
 							PreTime:            pTime,
3474
 							PType:              p_type,
3483
 							PType:              p_type,
3475
 							MedType:            med_type,
3484
 							MedType:            med_type,
3485
+							Diagnose:           diagnoses,
3476
 						}
3486
 						}
3477
 						tempPrescription = prescription
3487
 						tempPrescription = prescription
3478
 						service.SaveHisPrescriptionOne(tx, tempPrescription)
3488
 						service.SaveHisPrescriptionOne(tx, tempPrescription)
3494
 						//tempPrescription.OrderStatus = order_status
3504
 						//tempPrescription.OrderStatus = order_status
3495
 						tempPrescription.PreTime = pTime
3505
 						tempPrescription.PreTime = pTime
3496
 						tempPrescription.MedType = med_type
3506
 						tempPrescription.MedType = med_type
3507
+						tempPrescription.Diagnose = diagnoses
3508
+
3497
 						service.SaveHisPrescriptionOne(tx, tempPrescription)
3509
 						service.SaveHisPrescriptionOne(tx, tempPrescription)
3498
 						redis := service.RedisClient()
3510
 						redis := service.RedisClient()
3499
 						key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
3511
 						key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
5081
 					//	order_status = 1
5093
 					//	order_status = 1
5082
 					//}
5094
 					//}
5083
 
5095
 
5096
+					if items["diagnoses"] == nil || reflect.TypeOf(items["diagnoses"]).String() != "string" {
5097
+						utils.ErrorLog("diagnoses")
5098
+					}
5099
+					diagnoses, _ := items["diagnoses"].(string)
5100
+
5084
 					if items["pre_time"] == nil || reflect.TypeOf(items["pre_time"]).String() != "string" {
5101
 					if items["pre_time"] == nil || reflect.TypeOf(items["pre_time"]).String() != "string" {
5085
 						utils.ErrorLog("pre_time")
5102
 						utils.ErrorLog("pre_time")
5086
 					}
5103
 					}
5119
 							PreTime:            pTime,
5136
 							PreTime:            pTime,
5120
 							PType:              p_type,
5137
 							PType:              p_type,
5121
 							MedType:            med_type,
5138
 							MedType:            med_type,
5139
+							Diagnose:           diagnoses,
5122
 						}
5140
 						}
5123
 						tempPrescription = prescription
5141
 						tempPrescription = prescription
5124
 						service.SaveHisPrescription(tempPrescription)
5142
 						service.SaveHisPrescription(tempPrescription)
5140
 						//tempPrescription.OrderStatus = order_status
5158
 						//tempPrescription.OrderStatus = order_status
5141
 						tempPrescription.PreTime = pTime
5159
 						tempPrescription.PreTime = pTime
5142
 						tempPrescription.MedType = med_type
5160
 						tempPrescription.MedType = med_type
5161
+						tempPrescription.Diagnose = diagnoses
5162
+
5143
 						service.SaveHisPrescription(tempPrescription)
5163
 						service.SaveHisPrescription(tempPrescription)
5144
 						redis := service.RedisClient()
5164
 						redis := service.RedisClient()
5145
 						key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
5165
 						key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"

+ 1 - 1
controllers/his_project_api_controller.go Dosyayı Görüntüle

1614
 	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
1614
 	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
1615
 	recordDateTime := theTime.Unix()
1615
 	recordDateTime := theTime.Unix()
1616
 	adminUserInfo := this.GetAdminUserInfo()
1616
 	adminUserInfo := this.GetAdminUserInfo()
1617
-	patients, err := service.GetScheduleHisPatientList(adminUserInfo.CurrentOrgId, "", recordDateTime, 0)
1617
+	patients, err := service.GetScheduleHisPatientList(adminUserInfo.CurrentOrgId, "", recordDateTime, 0, 0)
1618
 	if err != nil {
1618
 	if err != nil {
1619
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1619
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1620
 		return
1620
 		return

+ 1 - 1
controllers/new_mobile_api_controllers/mobile_his_api_controller.go Dosyayı Görüntüle

1204
 	}
1204
 	}
1205
 	recordDateTime := theTime.Unix()
1205
 	recordDateTime := theTime.Unix()
1206
 	adminInfo := c.GetMobileAdminUserInfo()
1206
 	adminInfo := c.GetMobileAdminUserInfo()
1207
-	patients, _ := service.GetScheduleHisPatientList(adminInfo.Org.Id, "", recordDateTime, sch_type)
1207
+	patients, _ := service.GetScheduleHisPatientList(adminInfo.Org.Id, "", recordDateTime, sch_type, 0)
1208
 	patients_two, _ := service.GetHisPatientList(adminInfo.Org.Id, "", recordDateTime)
1208
 	patients_two, _ := service.GetHisPatientList(adminInfo.Org.Id, "", recordDateTime)
1209
 	patients = append(patients, patients_two...)
1209
 	patients = append(patients, patients_two...)
1210
 	patients = RemoveRepeatedPatient(patients)
1210
 	patients = RemoveRepeatedPatient(patients)

+ 20 - 4
service/his_service.go Dosyayı Görüntüle

144
 	return "his_prescription"
144
 	return "his_prescription"
145
 }
145
 }
146
 
146
 
147
-func GetScheduleHisPatientList(org_id int64, keywords string, record_date int64, sch_type int64) (patients []*Patients, err error) {
148
-	db := readDb.Model(&Patients{}).Select("xt_patients.id,xt_patients.user_org_id,xt_patients.name,xt_patients.status,xt_patients.id_card_no,xt_patients.first_letter,xt_patients.patient_type,sch.schedule_type as sch_type").Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
147
+func GetScheduleHisPatientList(org_id int64, keywords string, record_date int64, sch_type int64, patient_type int64) (patients []*Patients, err error) {
148
+	db := readDb.Model(&Patients{}).Select("xt_patients.id,xt_patients.user_org_id,xt_patients.name,xt_patients.status,xt_patients.id_card_no,xt_patients.first_letter,xt_patients.patient_type,sch.schedule_type as sch_type").Where("xt_patients.user_org_id = ? AND xt_patients.status = 1 and xt_patients.patient_type <> 4", org_id)
149
 
149
 
150
 	if sch_type != 0 {
150
 	if sch_type != 0 {
151
 		db = db.Joins("join xt_schedule as sch ON sch.patient_id = xt_patients.id AND sch.schedule_date = ? AND sch.status = 1 AND sch.user_org_id = ? AND sch.schedule_type = ?", record_date, org_id, sch_type)
151
 		db = db.Joins("join xt_schedule as sch ON sch.patient_id = xt_patients.id AND sch.schedule_date = ? AND sch.status = 1 AND sch.user_org_id = ? AND sch.schedule_type = ?", record_date, org_id, sch_type)
159
 	return
159
 	return
160
 }
160
 }
161
 
161
 
162
+func GetScheduleHisPatientListTwo(org_id int64, record_date int64) (patients []*Patients, err error) {
163
+	db := readDb.Model(&Patients{}).Select("xt_patients.id,xt_patients.user_org_id,xt_patients.name,xt_patients.status,xt_patients.id_card_no,xt_patients.first_letter,xt_patients.patient_type").Where("xt_patients.user_org_id = ? AND xt_patients.status = 1 and xt_patients.patient_type = 4", org_id)
164
+
165
+	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
166
+	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date)
167
+	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date).Group("xt_patients.id").Order("sch_type").Find(&patients).Error
168
+	return
169
+}
170
+
171
+func GetFuTouHisPatientList(org_id int64, record_date int64) (patients []*Patients, err error) {
172
+	db := readDb.Model(&Patients{}).Select("xt_patients.id,xt_patients.user_org_id,xt_patients.name,xt_patients.status,xt_patients.id_card_no,xt_patients.first_letter,xt_patients.patient_type").Where("xt_patients.patient_type = 4 and xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
173
+	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
174
+	err = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date).Find(&patients).Error
175
+	return
176
+}
177
+
162
 func GetChargeHisPatientListOne(org_id int64, keywords string, record_date int64) (patients []*Patients, err error) {
178
 func GetChargeHisPatientListOne(org_id int64, keywords string, record_date int64) (patients []*Patients, err error) {
163
 	db := readDb.Model(&Patients{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
179
 	db := readDb.Model(&Patients{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
164
 	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
180
 	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
270
 	return "his_prescription"
286
 	return "his_prescription"
271
 }
287
 }
272
 
288
 
273
-func GetNewHisPatientList(org_id int64, record_date int64, sch_type int64) (patients []*PatientTwo, err error) {
274
-	db := readDb.Model(&PatientTwo{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id).
289
+func GetNewHisPatientList(org_id int64, record_date int64, sch_type int64, patient_type int64) (patients []*PatientTwo, err error) {
290
+	db := readDb.Model(&PatientTwo{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1 and xt_patients.patient_type <> 4", org_id).
275
 		Joins("join his_patient as hp ON hp.patient_id = xt_patients.id AND hp.record_date = ? AND hp.status = 1 AND hp.user_org_id = ?", record_date, org_id)
291
 		Joins("join his_patient as hp ON hp.patient_id = xt_patients.id AND hp.record_date = ? AND hp.status = 1 AND hp.user_org_id = ?", record_date, org_id)
276
 	if sch_type > 0 {
292
 	if sch_type > 0 {
277
 		db = db.Joins("join xt_schedule as sch ON sch.patient_id = xt_patients.id AND sch.schedule_date = ? AND sch.status = 1 AND sch.user_org_id = ? AND schedule_type = ?", record_date, org_id, sch_type)
293
 		db = db.Joins("join xt_schedule as sch ON sch.patient_id = xt_patients.id AND sch.schedule_date = ? AND sch.status = 1 AND sch.user_org_id = ? AND schedule_type = ?", record_date, org_id, sch_type)