Browse Source

提交代码

陈少旭 1 week ago
parent
commit
5063caecf2

+ 23 - 3
controllers/his_api_controller.go View File

@@ -1423,8 +1423,9 @@ func (c *HisApiController) GetHisPatientList() {
1423 1423
 	patients_two, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, sch_type, 0)
1424 1424
 
1425 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 1429
 		fmt.Println(patients_three)
1429 1430
 		//获取当前用户的信息
1430 1431
 		adminUserInfo, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, adminInfo.AdminUser.Id)
@@ -1435,7 +1436,7 @@ func (c *HisApiController) GetHisPatientList() {
1435 1436
 		noElementsSlice := make([]service.PatientThree, 0)
1436 1437
 		c.ServeSuccessJSON(map[string]interface{}{
1437 1438
 			"list":       patients_three,
1438
-			"list_two":   patients_three,
1439
+			"list_two":   patients_four,
1439 1440
 			"list_three": noElementsSlice,
1440 1441
 			"info":       adminUserInfo,
1441 1442
 			"doctors":    doctors,
@@ -3431,6 +3432,14 @@ func (c *HisApiController) CreateHisPrescription() {
3431 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 3443
 					//if order_status == 0 {
3435 3444
 					//	order_status = 1
3436 3445
 					//}
@@ -3473,6 +3482,7 @@ func (c *HisApiController) CreateHisPrescription() {
3473 3482
 							PreTime:            pTime,
3474 3483
 							PType:              p_type,
3475 3484
 							MedType:            med_type,
3485
+							Diagnose:           diagnoses,
3476 3486
 						}
3477 3487
 						tempPrescription = prescription
3478 3488
 						service.SaveHisPrescriptionOne(tx, tempPrescription)
@@ -3494,6 +3504,8 @@ func (c *HisApiController) CreateHisPrescription() {
3494 3504
 						//tempPrescription.OrderStatus = order_status
3495 3505
 						tempPrescription.PreTime = pTime
3496 3506
 						tempPrescription.MedType = med_type
3507
+						tempPrescription.Diagnose = diagnoses
3508
+
3497 3509
 						service.SaveHisPrescriptionOne(tx, tempPrescription)
3498 3510
 						redis := service.RedisClient()
3499 3511
 						key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
@@ -5081,6 +5093,11 @@ func (c *HisApiController) CreateHisPrescription() {
5081 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 5101
 					if items["pre_time"] == nil || reflect.TypeOf(items["pre_time"]).String() != "string" {
5085 5102
 						utils.ErrorLog("pre_time")
5086 5103
 					}
@@ -5119,6 +5136,7 @@ func (c *HisApiController) CreateHisPrescription() {
5119 5136
 							PreTime:            pTime,
5120 5137
 							PType:              p_type,
5121 5138
 							MedType:            med_type,
5139
+							Diagnose:           diagnoses,
5122 5140
 						}
5123 5141
 						tempPrescription = prescription
5124 5142
 						service.SaveHisPrescription(tempPrescription)
@@ -5140,6 +5158,8 @@ func (c *HisApiController) CreateHisPrescription() {
5140 5158
 						//tempPrescription.OrderStatus = order_status
5141 5159
 						tempPrescription.PreTime = pTime
5142 5160
 						tempPrescription.MedType = med_type
5161
+						tempPrescription.Diagnose = diagnoses
5162
+
5143 5163
 						service.SaveHisPrescription(tempPrescription)
5144 5164
 						redis := service.RedisClient()
5145 5165
 						key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"

+ 1 - 1
controllers/his_project_api_controller.go View File

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

+ 1 - 1
controllers/new_mobile_api_controllers/mobile_his_api_controller.go View File

@@ -1204,7 +1204,7 @@ func (c *MobileHisApiController) GetHisPatientList() {
1204 1204
 	}
1205 1205
 	recordDateTime := theTime.Unix()
1206 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 1208
 	patients_two, _ := service.GetHisPatientList(adminInfo.Org.Id, "", recordDateTime)
1209 1209
 	patients = append(patients, patients_two...)
1210 1210
 	patients = RemoveRepeatedPatient(patients)

+ 20 - 4
service/his_service.go View File

@@ -144,8 +144,8 @@ func (HisPrescription) TableName() string {
144 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 150
 	if sch_type != 0 {
151 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,6 +159,22 @@ func GetScheduleHisPatientList(org_id int64, keywords string, record_date int64,
159 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 178
 func GetChargeHisPatientListOne(org_id int64, keywords string, record_date int64) (patients []*Patients, err error) {
163 179
 	db := readDb.Model(&Patients{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
164 180
 	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
@@ -270,8 +286,8 @@ func (HisPrescriptionTwo) TableName() string {
270 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 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 292
 	if sch_type > 0 {
277 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)