Browse Source

医保对接

csx 2 years ago
parent
commit
fcd10408bc

+ 484 - 13
controllers/coordinate_controller.go View File

@@ -68,6 +68,36 @@ type RefundDetail struct {
68 68
 	Code string `json:"code"`
69 69
 }
70 70
 
71
+type ResultQuery struct {
72
+	Msg    string `json:"msg"`
73
+	Result []struct {
74
+		Type      string `json:"type"`
75
+		Name      string `json:"name"`
76
+		Vaa01     int    `json:"vaa01"`
77
+		Vaa07     int    `json:"vaa07"`
78
+		Visittime string `json:"visittime"`
79
+	} `json:"result"`
80
+	Code string `json:"code"`
81
+}
82
+
83
+type ResultUpload struct {
84
+	Code   string `json:"code"`
85
+	Msg    string `json:"msg"`
86
+	Result []struct {
87
+		List            []interface{} `json:"list"`
88
+		Page            int64         `json:"page"`
89
+		Pagenumber      int64         `json:"pagenumber"`
90
+		Records         int64         `json:"records"`
91
+		RecordsFiltered int64         `json:"recordsFiltered"`
92
+		RecordsTotal    int64         `json:"recordsTotal"`
93
+		Result          string        `json:"result"`
94
+		ResultMsg       string        `json:"resultMsg"`
95
+		Total           int64         `json:"total"`
96
+		TotalPage       int64         `json:"totalPage"`
97
+		Userdata        string        `json:"userdata"`
98
+	} `json:"result"`
99
+}
100
+
71 101
 func CoordinateRcegistRouters() {
72 102
 	beego.Router("/coordinate/check", &CoordinateController{}, "get:SavePatientMessageInfo")
73 103
 	//坐标挂号
@@ -80,6 +110,439 @@ func CoordinateRcegistRouters() {
80 110
 	beego.Router("/coordinate/settle", &CoordinateController{}, "post:Settle")
81 111
 	//坐标退费回调
82 112
 	beego.Router("/coordinate/refund", &CoordinateController{}, "post:Refund")
113
+	//坐标患者查询~上传医嘱~结算功能
114
+	beego.Router("/coordinate/settleAccount", &CoordinateController{}, "get:SettleAccount")
115
+
116
+}
117
+
118
+func (c *CoordinateController) SettleAccount() {
119
+	patient_id, _ := c.GetInt64("patient_id")
120
+	record_date := c.GetString("record_date")
121
+	admin_user_id, _ := c.GetInt64("admin_user_id")
122
+	diagnosis_id := c.GetString("diagnosis")
123
+	sick_type, _ := c.GetInt64("sick_type")
124
+	reg_type, _ := c.GetInt64("p_type")
125
+	org_id, _ := c.GetInt64("org_id")
126
+	org_id = 3877
127
+	org, _ := service.GetOrgById(org_id)
128
+	patient, _ := service.GetPatientByID(org.Id, patient_id)
129
+	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
130
+
131
+	result, request := service.GetHisPatientForCoordinate(patient.IdCardNo)
132
+	saveLog(result, request, "查询", "查询", org.OrgName)
133
+	var res ResultQuery
134
+	if err := json.Unmarshal([]byte(result), &res); err != nil {
135
+		utils.ErrorLog("解析失败:%v", err)
136
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
137
+		return
138
+	}
139
+	if res.Code == "10000" {
140
+		if len(res.Result) == 0 {
141
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisPatientNoRegException)
142
+			return
143
+		}
144
+		timeLayout := "2006-01-02"
145
+		loc, _ := time.LoadLocation("Local")
146
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
147
+		if err != nil {
148
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
149
+			return
150
+		}
151
+		org_id := org.Id
152
+		recordDateTime := theTime.Unix()
153
+		patientPrescription, _ := service.FindPatientPrescriptionInfoTwo(org_id, patient.ID, recordDateTime, 2)
154
+		if patientPrescription.ID == 0 {
155
+			patientPrescription, _ = service.FindLastPatientPrescriptionInfo(org_id, patient.ID, recordDateTime)
156
+		}
157
+		departmwnt, _ := service.GetDepartMentDetail(patientPrescription.Departments)
158
+		doctor_info, _ := service.GetAdminUserInfoByID(org_id, patientPrescription.DoctorId)
159
+		//admin_user_info, _ := service.GetAdminUserInfoByID(org_id, admin_user_id)
160
+
161
+		var prescriptions []*models.HisPrescription
162
+
163
+		if settle_accounts_type == 1 { //日结
164
+			prescriptions, _ = service.GetUnSettleHisPrescriptionFive(org_id, patient_id, recordDateTime, 2)
165
+		} else { //月结
166
+
167
+			start_time_str := c.GetString("start_time")
168
+			end_time_str := c.GetString("end_time")
169
+			timeLayout := "2006-01-02"
170
+			loc, _ := time.LoadLocation("Local")
171
+			theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
172
+			if err != nil {
173
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
174
+				return
175
+			}
176
+			recordStartTime := theStartTime.Unix()
177
+			theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
178
+			if err != nil {
179
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
180
+				return
181
+			}
182
+			recordEndTime := theEndTime.Unix()
183
+			prescriptions, _ = service.GetUnSettleMonthHisPrescription(org_id, patient_id, recordStartTime, recordEndTime)
184
+		}
185
+		var total float64
186
+
187
+		for _, item := range prescriptions {
188
+			fmt.Println(item)
189
+			if item.Type == 1 { //药品
190
+				for _, subItem := range item.HisDoctorAdviceInfo {
191
+					total = total + (subItem.Price * subItem.PrescribingNumber)
192
+				}
193
+			}
194
+			if item.Type == 2 { //项目
195
+				for _, subItem := range item.HisPrescriptionProject {
196
+					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
197
+					total = total + (subItem.Price * cnt)
198
+				}
199
+			}
200
+
201
+		}
202
+
203
+		var ids []int64
204
+
205
+		for _, item := range prescriptions {
206
+			ids = append(ids, item.ID)
207
+		}
208
+
209
+		var customs []*models.NewCustomTwo
210
+		for _, item := range prescriptions {
211
+			if item.Type == 1 { //药品
212
+				for _, subItem := range item.HisDoctorAdviceInfo {
213
+					cus := &models.NewCustomTwo{
214
+						AdviceId:         subItem.ID,
215
+						ProjectId:        0,
216
+						DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
217
+						Cut:              fmt.Sprintf("%.4f", subItem.PrescribingNumber),
218
+						FeedetlSn:        subItem.FeedetlSn,
219
+						Price:            fmt.Sprintf("%.2f", subItem.Price),
220
+						MedListCodg:      subItem.Drug.MedicalInsuranceNumber,
221
+						Type:             1,
222
+					}
223
+					customs = append(customs, cus)
224
+				}
225
+			}
226
+			if item.Type == 2 { //项目
227
+				for _, subItem := range item.HisPrescriptionProject {
228
+					if subItem.Type == 2 {
229
+						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
230
+						cus := &models.NewCustomTwo{
231
+							AdviceId:         0,
232
+							ProjectId:        subItem.ID,
233
+							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
234
+							Cut:              fmt.Sprintf("%.4f", cnt),
235
+							FeedetlSn:        subItem.FeedetlSn,
236
+							Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
237
+							MedListCodg:      subItem.HisProject.MedicalCode,
238
+							Type:             2,
239
+						}
240
+						customs = append(customs, cus)
241
+
242
+					} else {
243
+						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
244
+						cus := &models.NewCustomTwo{
245
+							AdviceId:         0,
246
+							ProjectId:        subItem.ID,
247
+							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
248
+							Cut:              fmt.Sprintf("%.4f", cnt),
249
+							FeedetlSn:        subItem.FeedetlSn,
250
+							Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
251
+							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
252
+							Type:             3,
253
+						}
254
+						customs = append(customs, cus)
255
+					}
256
+
257
+				}
258
+			}
259
+		}
260
+
261
+		var info models.UploadInfo
262
+		info.Vaa01 = res.Result[0].Vaa01
263
+		info.Fasong = "1"
264
+		info.Vaa07 = res.Result[0].Vaa07
265
+		info.Bck01c = departmwnt.Number
266
+		info.Bce02a = doctor_info.DoctorNumber
267
+
268
+		diagnosis_ids := strings.Split(patientPrescription.Diagnosis, ",")
269
+		var config []*models.HisXtDiagnoseConfig
270
+		for _, item := range diagnosis_ids {
271
+			id, _ := strconv.ParseInt(item, 10, 64)
272
+			diagnosisConfig, _ := service.FindDiagnoseById(id)
273
+			config = append(config, diagnosisConfig)
274
+		}
275
+		for index, item := range config {
276
+			var diag models.Diag
277
+			diag.Vao06 = strconv.FormatInt(int64(index+1), 10)
278
+			diag.Bak02 = item.CountryCode
279
+			info.Diag = append(info.Diag, &diag)
280
+		}
281
+		var presInfos []*models.PresInfo
282
+		var presDetails []*models.PresDetail
283
+		for index, item := range prescriptions {
284
+			var presDetail models.PresDetail
285
+			var presInfo models.PresInfo
286
+			presInfo.Cbmid = strconv.FormatInt(item.ID, 10)
287
+			if item.Type == 1 {
288
+				presInfo.Cbm06 = "0"
289
+			} else {
290
+				presInfo.Cbm06 = "5"
291
+			}
292
+
293
+			if item.Type == 1 {
294
+				presInfo.Cbm07 = item.MedType
295
+			} else {
296
+				presInfo.Cbm07 = item.MedType
297
+			}
298
+
299
+			presDetail.Vaf59 = strconv.FormatInt(int64(index+1), 10)
300
+			var infoItems []*models.Item
301
+			for _, subItem := range item.HisDoctorAdviceInfo {
302
+				ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
303
+
304
+				var infoItem models.Item
305
+				infoItem.Rownr = "0"
306
+				infoItem.Vaf11 = "1"
307
+				infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
308
+				infoItem.Bbx01 = subItem.Drug.MedicalInsuranceNumber
309
+				infoItem.Bda01 = "1"
310
+				infoItem.Bby01 = ""
311
+				if subItem.Drug.MinUnit != subItem.Drug.DoseUnit {
312
+					infoItem.Vaf22 = subItem.Drug.DrugName + " " + subItem.Drug.Dose + subItem.Drug.DoseUnit + "*" + strconv.FormatInt(subItem.Drug.MinNumber, 10) + subItem.Drug.MinUnit + "/" + subItem.Drug.MaxUnit
313
+				}
314
+				infoItem.Vaf14 = subItem.Drug.DrugName
315
+				infoItem.Bdi01 = ef.Code
316
+				infoItem.Vaf17 = strconv.FormatInt(subItem.Day, 10)
317
+				infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
318
+				infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
319
+				infoItem.Vaf35 = "0"
320
+				infoItem.Vaf32 = "0"
321
+				infoItem.Bck01b = departmwnt.Number
322
+				infoItem.Bck01d = departmwnt.Number
323
+				infoItem.Vaf58 = "0"
324
+				infoItem.Vaf61 = "1"
325
+				infoItems = append(infoItems, &infoItem)
326
+			}
327
+			for _, subItem := range item.HisPrescriptionProject {
328
+				ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
329
+
330
+				if subItem.Type == 2 {
331
+					var infoItem models.Item
332
+					infoItem.Rownr = "0"
333
+					infoItem.Vaf11 = "1"
334
+					infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
335
+					infoItem.Bbx01 = subItem.HisProject.MedicalCode
336
+
337
+					if subItem.HisProject.CostClassify == 2 {
338
+						infoItem.Bda01 = "T"
339
+					} else if subItem.HisProject.CostClassify == 3 {
340
+						infoItem.Bda01 = "L"
341
+					} else {
342
+						infoItem.Bda01 = "T"
343
+					}
344
+					infoItem.Bby01 = ""
345
+					infoItem.Vaf22 = subItem.HisProject.ProjectName
346
+					infoItem.Bdi01 = ef.Code
347
+					infoItem.Vaf17 = subItem.Day
348
+					infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
349
+					infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.Count)
350
+					infoItem.Vaf35 = "0"
351
+					infoItem.Vaf18 = 0
352
+					infoItem.Vaf32 = "0"
353
+					infoItem.Bck01b = departmwnt.Number
354
+					infoItem.Bck01d = departmwnt.Number
355
+					infoItem.Vaf58 = "0"
356
+					infoItem.Vaf61 = "1"
357
+					infoItems = append(infoItems, &infoItem)
358
+
359
+				} else {
360
+					var infoItem models.Item
361
+					infoItem.Rownr = "0"
362
+					infoItem.Vaf11 = "1"
363
+					infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
364
+					infoItem.Bbx01 = subItem.GoodInfo.MedicalInsuranceNumber
365
+					infoItem.Bda01 = "M"
366
+					infoItem.Bby01 = ""
367
+					infoItem.Vaf22 = subItem.GoodInfo.GoodName + " " + subItem.GoodInfo.SpecificationName
368
+					infoItem.Bdi01 = ef.Code
369
+					infoItem.Vaf17 = subItem.Day
370
+					infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
371
+					infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.Count)
372
+					infoItem.Vaf35 = "0"
373
+					infoItem.Vaf32 = "0"
374
+					infoItem.Bck01b = departmwnt.Number
375
+					infoItem.Bck01d = departmwnt.Number
376
+					infoItem.Vaf58 = "0"
377
+					infoItem.Vaf61 = "1"
378
+					infoItems = append(infoItems, &infoItem)
379
+
380
+				}
381
+
382
+			}
383
+			presDetail.Item = infoItems
384
+			presDetails = append(presDetails, &presDetail)
385
+			presInfo.PresDetail = presDetails
386
+			presInfos = append(presInfos, &presInfo)
387
+		}
388
+		info.PresInfo = presInfos
389
+
390
+		result2, request2 := service.UploadPrescriptionForCoordinate(info)
391
+		saveLog(result2, request2, "上传明细", "上传明细", org.OrgName)
392
+
393
+		var res2 ResultUpload
394
+		if err := json.Unmarshal([]byte(result2), &res2); err != nil {
395
+			utils.ErrorLog("解析失败:%v", err)
396
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
397
+			return
398
+		}
399
+		if res2.Code == "10000" {
400
+
401
+			timestamp := time.Now().Unix()
402
+			tempTime := time.Unix(timestamp, 0)
403
+			timeFormat := tempTime.Format("20060102150405")
404
+			chrgBchno := rand.Intn(100000) + 10000
405
+			ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(patient.ID, 10)
406
+			his := models.VMHisPatient{
407
+				Name:                   patient.Name,
408
+				Gender:                 patient.Gender,
409
+				Birthday:               patient.Birthday,
410
+				MedicalTreatmentType:   0,
411
+				IdType:                 1,
412
+				IdCardNo:               patient.IdCardNo,
413
+				BalanceAccountsType:    1,
414
+				MedicalInsuranceNumber: "",
415
+				RegisterType:           0,
416
+				RegisterCost:           0,
417
+				TreatmentCost:          0,
418
+				Status:                 1,
419
+				Ctime:                  time.Now().Unix(),
420
+				Mtime:                  time.Now().Unix(),
421
+				PsnNo:                  strconv.FormatInt(int64(res.Result[0].Vaa01), 10),
422
+				PsnCertType:            "",
423
+				Certno:                 patient.IdCardNo,
424
+				PsnName:                patient.Name,
425
+				Gend:                   "",
426
+				Naty:                   "",
427
+				Brdy:                   "",
428
+				Age:                    0,
429
+				Iinfo:                  "",
430
+				Idetinfo:               "",
431
+				PatientId:              patient.ID,
432
+				RecordDate:             theTime.Unix(),
433
+				UserOrgId:              org_id,
434
+				AdminUserId:            admin_user_id,
435
+				IsReturn:               1,
436
+				Doctor:                 patientPrescription.DoctorId,
437
+				Departments:            patientPrescription.Departments,
438
+				IptOtpNo:               ipt_otp_no,
439
+				Number:                 strconv.FormatInt(int64(res.Result[0].Vaa07), 10),
440
+				PhoneNumber:            patient.Phone,
441
+			}
442
+			service.UpdateHisPatientStatus(&his)
443
+			service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, org_id)
444
+			tm := time.Unix(time.Now().Unix(), 0)
445
+
446
+			order := &models.HisOrder{
447
+				PsnNo:              his.PsnNo,
448
+				UserOrgId:          org_id,
449
+				HisPatientId:       his.ID,
450
+				PatientId:          patient_id,
451
+				SettleAccountsDate: recordDateTime,
452
+				Ctime:              time.Now().Unix(),
453
+				Mtime:              time.Now().Unix(),
454
+				Status:             1,
455
+				OrderStatus:        1,
456
+				MdtrtId:            his.Number,
457
+				Number:             ipt_otp_no,
458
+				SetlId:             "",
459
+				MedfeeSumamt:       total,
460
+				MedType:            strconv.Itoa(int(reg_type)),
461
+				SettleEndTime:      0,
462
+				SettleStartTime:    0,
463
+				SettleType:         settle_accounts_type,
464
+				Diagnosis:          diagnosis_id,
465
+				PType:              2,
466
+				SetlTime:           tm.Format("2006-01-02 15:04:05"),
467
+			}
468
+			err = service.CreateOrder(order)
469
+			if err != nil {
470
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateOrderException)
471
+				return
472
+			}
473
+
474
+			for _, item := range customs {
475
+				var advice_id int64 = 0
476
+				var project_id int64 = 0
477
+				var item_id int64 = 0
478
+
479
+				var types int64 = 0
480
+
481
+				if item.Type == 1 {
482
+					advice_id = item.AdviceId
483
+					project_id = 0
484
+					item_id = 0
485
+				} else if item.Type == 2 {
486
+					advice_id = 0
487
+					item_id = 0
488
+
489
+					project_id = item.ProjectId
490
+				} else if item.Type == 3 {
491
+					advice_id = 0
492
+					item_id = item.ItemId
493
+					project_id = 0
494
+				}
495
+				detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
496
+				cut, _ := strconv.ParseFloat(item.Cut, 32)
497
+				pric, _ := strconv.ParseFloat(item.Price, 32)
498
+				info := &models.HisOrderInfo{
499
+					OrderNumber:      order.Number,
500
+					UploadDate:       time.Now().Unix(),
501
+					AdviceId:         advice_id,
502
+					DetItemFeeSumamt: detItemFeeSumamt,
503
+					Cnt:              cut,
504
+					Pric:             pric,
505
+					PatientId:        patient_id,
506
+					Status:           1,
507
+					Mtime:            time.Now().Unix(),
508
+					Ctime:            time.Now().Unix(),
509
+					UserOrgId:        org_id,
510
+					HisPatientId:     his.ID,
511
+					OrderId:          order.ID,
512
+					ProjectId:        project_id,
513
+					Type:             types,
514
+					ItemId:           item_id,
515
+				}
516
+				service.CreateOrderInfo(info)
517
+			}
518
+			his.Diagnosis = diagnosis_id
519
+			his.SickType = sick_type
520
+			his.RegisterType = reg_type
521
+			his.MedicalTreatmentType = reg_type
522
+			service.UpdataHisPateintTwo(&his)
523
+			err = service.UpDatePrescriptionNumber(org_id, ids, strconv.FormatInt(int64(chrgBchno), 10))
524
+			err = service.UpDateHisPrescriptionInfoNumber(org_id, patient_id, strconv.FormatInt(int64(chrgBchno), 10), recordDateTime, his.ID)
525
+			err = service.UpdataOrderStatusThree(strconv.FormatInt(int64(chrgBchno), 10), org_id)
526
+
527
+			c.ServeSuccessJSON(map[string]interface{}{
528
+				"msg": "医嘱保存成功",
529
+			})
530
+
531
+		} else {
532
+			c.ServeSuccessJSON(map[string]interface{}{
533
+				"failed_code": -10,
534
+				"msg":         res.Msg,
535
+			})
536
+
537
+		}
538
+
539
+	} else {
540
+		c.ServeSuccessJSON(map[string]interface{}{
541
+			"failed_code": -10,
542
+			"msg":         res.Msg,
543
+		})
544
+
545
+	}
83 546
 
84 547
 }
85 548
 
@@ -97,15 +560,17 @@ func (c *CoordinateController) Settle() {
97 560
 		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
98 561
 		return
99 562
 	}
100
-	patien_id := respJSON["patientid"].(string)
101
-	infoSeq := respJSON["infoseq"].(string)
102
-	docId := respJSON["docid"].(string)
103
-	fmt.Println(patien_id)
104
-	fmt.Println(infoSeq)
105
-	fmt.Println(docId)
106
-
107
-	order, _ := service.GetHisOrderFour(patien_id, infoSeq, "")
108
-	order.SetlId = docId
563
+	patien_id := respJSON["vaa01"].(float64)
564
+	infoSeq := respJSON["vaa07"].(float64)
565
+
566
+	//strconv.For(patien_id, 10)
567
+
568
+	vaa001 := fmt.Sprintf("%f", patien_id)
569
+	vaa007 := fmt.Sprintf("%f", infoSeq)
570
+
571
+	setl_id := respJSON["setl_id"].(string)
572
+	order, _ := service.GetHisOrderFour(vaa001, vaa007, "")
573
+	order.SetlId = setl_id
109 574
 	if order.ID == 0 {
110 575
 		json := make(map[string]interface{})
111 576
 		json["msg"] = "结算记录不存在,请检查参数是否正确"
@@ -134,10 +599,16 @@ func (c *CoordinateController) Refund() {
134 599
 		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
135 600
 		return
136 601
 	}
137
-	patien_id := respJSON["patientid"].(string)
138
-	infoSeq := respJSON["infoseq"].(string)
139
-	docId := respJSON["docid"].(string)
140
-	order, _ := service.GetHisOrderFour(patien_id, infoSeq, docId)
602
+	patien_id := respJSON["vaa01"].(float64)
603
+	infoSeq := respJSON["vaa07"].(float64)
604
+
605
+	//strconv.For(patien_id, 10)
606
+
607
+	vaa001 := fmt.Sprintf("%f", patien_id)
608
+	vaa007 := fmt.Sprintf("%f", infoSeq)
609
+
610
+	docId := respJSON["setl_id"].(string)
611
+	order, _ := service.GetHisOrderFour(vaa001, vaa007, docId)
141 612
 	if order.ID == 0 {
142 613
 		json := make(map[string]interface{})
143 614
 		json["msg"] = "结算记录不存在,请检查参数是否正确"

+ 1 - 1
controllers/data_api_controller.go View File

@@ -825,7 +825,6 @@ func (c *DataApiController) CreateExecutionFrequency() {
825 825
 		return
826 826
 	}
827 827
 	timeNow := time.Now().Unix()
828
-	ef.Code = ""
829 828
 	ef.Status = 1
830 829
 	ef.CreatedTime = timeNow
831 830
 	ef.UpdatedTime = timeNow
@@ -881,6 +880,7 @@ func (c *DataApiController) UpdateExecutionFrequency() {
881 880
 	timeNow := time.Now().Unix()
882 881
 	ef.UpdatedTime = timeNow
883 882
 	ef.Name = efdata.Name
883
+	ef.Code = efdata.Code
884 884
 
885 885
 	err = service.UpdateExecutionFrequency(ef)
886 886
 	if err != nil {

+ 4 - 0
enums/error_code.go View File

@@ -260,6 +260,8 @@ const ( // ErrorCode
260 260
 
261 261
 	ErrorCodeDeleteMedicineWrong   = 3900003
262 262
 	ErrorCodeDeletePChargeWrongTwo = 3900004
263
+
264
+	ErrorCodeHisPatientNoRegException = 4000000
263 265
 )
264 266
 
265 267
 var ErrCodeMsgs = map[int]string{
@@ -508,6 +510,8 @@ var ErrCodeMsgs = map[int]string{
508 510
 	ErrorCodeDeletePChargeWrong:    "处方中包含收费处方或已经上传的处方,无法删除",
509 511
 	ErrorCodeDeleteMedicineWrong:   "该药品已经发药,无法删除",
510 512
 	ErrorCodeDeletePChargeWrongTwo: "该医嘱所属处方已经收费或已经上传的处方,无法删除",
513
+
514
+	ErrorCodeHisPatientNoRegException: "该患者尚未挂号,请先挂号",
511 515
 }
512 516
 
513 517
 type SGJError struct {

+ 1 - 0
models/dialysis.go View File

@@ -1179,6 +1179,7 @@ type HisDoctorAdvice struct {
1179 1179
 	Way                   int64              `gorm:"column:way" json:"way" form:"way"`
1180 1180
 	DrugId                int64              `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
1181 1181
 	DrugNameId            int64              `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
1182
+	ExecutionFrequencyId  int64              `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1182 1183
 }
1183 1184
 
1184 1185
 func (HisDoctorAdvice) TableName() string {

+ 1 - 0
models/drug_pharmacy_management_models.go View File

@@ -195,6 +195,7 @@ type PharmacyHisDoctorAdviceInfo struct {
195 195
 	IsMedicine            int64   `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
196 196
 	Mtime                 int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
197 197
 	AdviceId              int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
198
+	ExecutionFrequencyId  int64   `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
198 199
 }
199 200
 
200 201
 func (PharmacyHisDoctorAdviceInfo) TableName() string {

+ 14 - 12
models/his_charge_models.go View File

@@ -1,18 +1,19 @@
1 1
 package models
2 2
 
3 3
 type HisChargePrescriptionProject struct {
4
-	ID                int64             `gorm:"column:id" json:"id" form:"id"`
5
-	ProjectId         int64             `gorm:"column:project_id" json:"project_id" form:"project_id"`
6
-	UserOrgId         int64             `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
7
-	Status            int64             `gorm:"column:status" json:"status" form:"status"`
8
-	PatientId         int64             `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
9
-	RecordDate        int64             `gorm:"column:record_date" json:"record_date" form:"record_date"`
10
-	Count             string            `gorm:"column:count" json:"count" form:"count"`
11
-	Type              int64             `gorm:"column:type" json:"type" form:"type"`
12
-	Unit              string            `gorm:"column:unit" json:"unit" form:"unit"`
13
-	Remark            string            `gorm:"column:remark" json:"remark" form:"remark"`
14
-	HisChargeProject  HisChargeProject  `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
15
-	HisChargeGoodInfo HisChargeGoodInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
4
+	ID                   int64             `gorm:"column:id" json:"id" form:"id"`
5
+	ProjectId            int64             `gorm:"column:project_id" json:"project_id" form:"project_id"`
6
+	UserOrgId            int64             `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
7
+	Status               int64             `gorm:"column:status" json:"status" form:"status"`
8
+	PatientId            int64             `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
9
+	RecordDate           int64             `gorm:"column:record_date" json:"record_date" form:"record_date"`
10
+	Count                string            `gorm:"column:count" json:"count" form:"count"`
11
+	Type                 int64             `gorm:"column:type" json:"type" form:"type"`
12
+	Unit                 string            `gorm:"column:unit" json:"unit" form:"unit"`
13
+	Remark               string            `gorm:"column:remark" json:"remark" form:"remark"`
14
+	HisChargeProject     HisChargeProject  `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
15
+	HisChargeGoodInfo    HisChargeGoodInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
16
+	ExecutionFrequencyId int64             `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
16 17
 }
17 18
 
18 19
 func (HisChargePrescriptionProject) TableName() string {
@@ -31,6 +32,7 @@ type HisChargeDoctorAdviceInfo struct {
31 32
 	AdviceDate            int64  `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
32 33
 	Drug                  Drug   `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
33 34
 	IsMedicine            int64  `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
35
+	ExecutionFrequencyId  int64  `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
34 36
 }
35 37
 
36 38
 func (HisChargeDoctorAdviceInfo) TableName() string {

+ 37 - 32
models/his_models.go View File

@@ -256,6 +256,7 @@ type HisDoctorAdviceInfo struct {
256 256
 	LmtUsedFlag           int64                  `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
257 257
 	HisOrderInfo          HisOrderInfo           `gorm:"ForeignKey:AdviceId;AssociationForeignKey:ID" json:"order_info"`
258 258
 	IsMedicine            int64                  `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
259
+	ExecutionFrequencyId  int64                  `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
259 260
 }
260 261
 
261 262
 func (HisDoctorAdviceInfo) TableName() string {
@@ -803,10 +804,11 @@ type HisPrintPrescriptionProject struct {
803 804
 
804 805
 	XtHisProjectTeam XtHisProjectTeam `gorm:"ForeignKey:TeamId;AssociationForeignKey:ID" json:"team"`
805 806
 
806
-	FrequencyType int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
807
-	DayCount      int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
808
-	WeekDay       string `gorm:"column:week_day" json:"week_day" form:"week_day"`
809
-	IsCheckTeam   int64  `gorm:"-" json:"is_check_team" form:"is_check_team"`
807
+	FrequencyType        int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
808
+	DayCount             int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
809
+	WeekDay              string `gorm:"column:week_day" json:"week_day" form:"week_day"`
810
+	IsCheckTeam          int64  `gorm:"-" json:"is_check_team" form:"is_check_team"`
811
+	ExecutionFrequencyId int64  `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
810 812
 }
811 813
 
812 814
 func (HisPrintPrescriptionProject) TableName() string {
@@ -851,11 +853,12 @@ type HisPrescriptionProject struct {
851 853
 
852 854
 	XtHisProjectTeam XtHisProjectTeam `gorm:"ForeignKey:TeamId;AssociationForeignKey:ID" json:"team"`
853 855
 
854
-	FrequencyType int64        `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
855
-	DayCount      int64        `gorm:"column:day_count" json:"day_count" form:"day_count"`
856
-	WeekDay       string       `gorm:"column:week_day" json:"week_day" form:"week_day"`
857
-	IsCheckTeam   int64        `gorm:"-" json:"is_check_team" form:"is_check_team"`
858
-	HisOrderInfo  HisOrderInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"order_info"`
856
+	FrequencyType        int64        `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
857
+	DayCount             int64        `gorm:"column:day_count" json:"day_count" form:"day_count"`
858
+	WeekDay              string       `gorm:"column:week_day" json:"week_day" form:"week_day"`
859
+	IsCheckTeam          int64        `gorm:"-" json:"is_check_team" form:"is_check_team"`
860
+	HisOrderInfo         HisOrderInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"order_info"`
861
+	ExecutionFrequencyId int64        `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
859 862
 }
860 863
 
861 864
 func (HisPrescriptionProject) TableName() string {
@@ -1932,11 +1935,12 @@ type NewCustomHisPrescriptionProject struct {
1932 1935
 
1933 1936
 	XtHisProjectTeam XtHisProjectTeam `gorm:"ForeignKey:TeamId;AssociationForeignKey:ID" json:"team"`
1934 1937
 
1935
-	FrequencyType int64        `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
1936
-	DayCount      int64        `gorm:"column:day_count" json:"day_count" form:"day_count"`
1937
-	WeekDay       string       `gorm:"column:week_day" json:"week_day" form:"week_day"`
1938
-	IsCheckTeam   int64        `gorm:"-" json:"is_check_team" form:"is_check_team"`
1939
-	HisOrderInfo  HisOrderInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"order_info"`
1938
+	FrequencyType        int64        `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
1939
+	DayCount             int64        `gorm:"column:day_count" json:"day_count" form:"day_count"`
1940
+	WeekDay              string       `gorm:"column:week_day" json:"week_day" form:"week_day"`
1941
+	IsCheckTeam          int64        `gorm:"-" json:"is_check_team" form:"is_check_team"`
1942
+	HisOrderInfo         HisOrderInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"order_info"`
1943
+	ExecutionFrequencyId int64        `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1940 1944
 }
1941 1945
 
1942 1946
 func (NewCustomHisPrescriptionProject) TableName() string {
@@ -1964,24 +1968,25 @@ func (HisYidiClearRecord) TableName() string {
1964 1968
 }
1965 1969
 
1966 1970
 type HisPrescriptionProjectTwo struct {
1967
-	ID             int64   `gorm:"column:id" json:"id" form:"id"`
1968
-	ProjectId      int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
1969
-	Price          float64 `gorm:"column:price" json:"price" form:"price"`
1970
-	UserOrgId      int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1971
-	Status         int64   `gorm:"column:status" json:"status" form:"status"`
1972
-	PatientId      int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1973
-	RecordDate     int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1974
-	PrescriptionId int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1975
-	Count          string  `gorm:"column:count" json:"count" form:"count"`
1976
-	FeedetlSn      string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1977
-	Type           int64   `gorm:"column:type" json:"type" form:"type"`
1978
-	Doctor         int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
1979
-	ExecutionTime  int64   `gborm:"column:execution_time" json:"execution_time" form:"execution_time"`
1980
-	ExecutionStaff int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
1981
-	ExecutionState int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
1982
-	CheckTime      int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
1983
-	CheckState     int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
1984
-	Checker        int64   `gorm:"column:checker" json:"checker" form:"checker"`
1971
+	ID                   int64   `gorm:"column:id" json:"id" form:"id"`
1972
+	ProjectId            int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
1973
+	Price                float64 `gorm:"column:price" json:"price" form:"price"`
1974
+	UserOrgId            int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1975
+	Status               int64   `gorm:"column:status" json:"status" form:"status"`
1976
+	PatientId            int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1977
+	RecordDate           int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
1978
+	PrescriptionId       int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1979
+	Count                string  `gorm:"column:count" json:"count" form:"count"`
1980
+	FeedetlSn            string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1981
+	Type                 int64   `gorm:"column:type" json:"type" form:"type"`
1982
+	Doctor               int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
1983
+	ExecutionTime        int64   `gborm:"column:execution_time" json:"execution_time" form:"execution_time"`
1984
+	ExecutionStaff       int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
1985
+	ExecutionState       int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
1986
+	CheckTime            int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
1987
+	CheckState           int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
1988
+	Checker              int64   `gorm:"column:checker" json:"checker" form:"checker"`
1989
+	ExecutionFrequencyId int64   `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1985 1990
 }
1986 1991
 
1987 1992
 func (HisPrescriptionProjectTwo) TableName() string {

+ 35 - 33
models/his_summary_models.go View File

@@ -179,39 +179,40 @@ func (VmHisOrderInfo) TableName() string {
179 179
 }
180 180
 
181 181
 type VmHisPrescriptionProject struct {
182
-	ID                 int64   `gorm:"column:id" json:"id" form:"id"`
183
-	ProjectId          int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
184
-	Price              float64 `gorm:"column:price" json:"price" form:"price"`
185
-	UserOrgId          int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
186
-	Status             int64   `gorm:"column:status" json:"status" form:"status"`
187
-	Ctime              int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
188
-	Mtime              int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
189
-	PatientId          int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
190
-	HisPatientId       int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
191
-	RecordDate         int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
192
-	PrescriptionId     int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
193
-	Count              string  `gorm:"column:count" json:"count" form:"count"`
194
-	FeedetlSn          string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
195
-	MedListCodg        string  `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
196
-	SingleDose         string  `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
197
-	DeliveryWay        string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
198
-	ExecutionFrequency string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
199
-	Day                string  `gorm:"column:day" json:"day" form:"day"`
200
-	Remark             string  `gorm:"column:remark" json:"remark" form:"remark"`
201
-	Unit               string  `gorm:"column:unit" json:"unit" form:"unit"`
202
-	Type               int64   `gorm:"column:type" json:"type" form:"type"`
203
-	Doctor             int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
204
-	ExecutionTime      int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
205
-	ExecutionStaff     int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
206
-	ExecutionState     int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
207
-	CheckTime          int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
208
-	CheckState         int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
209
-	Checker            int64   `gorm:"column:checker" json:"checker" form:"checker"`
210
-	StartTime          int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
211
-	TeamId             int64   `gorm:"column:team_id" json:"team_id" form:"team_id"`
212
-	FrequencyType      int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
213
-	DayCount           int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
214
-	WeekDay            string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
182
+	ID                   int64   `gorm:"column:id" json:"id" form:"id"`
183
+	ProjectId            int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
184
+	Price                float64 `gorm:"column:price" json:"price" form:"price"`
185
+	UserOrgId            int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
186
+	Status               int64   `gorm:"column:status" json:"status" form:"status"`
187
+	Ctime                int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
188
+	Mtime                int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
189
+	PatientId            int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
190
+	HisPatientId         int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
191
+	RecordDate           int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
192
+	PrescriptionId       int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
193
+	Count                string  `gorm:"column:count" json:"count" form:"count"`
194
+	FeedetlSn            string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
195
+	MedListCodg          string  `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
196
+	SingleDose           string  `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
197
+	DeliveryWay          string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
198
+	ExecutionFrequency   string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
199
+	Day                  string  `gorm:"column:day" json:"day" form:"day"`
200
+	Remark               string  `gorm:"column:remark" json:"remark" form:"remark"`
201
+	Unit                 string  `gorm:"column:unit" json:"unit" form:"unit"`
202
+	Type                 int64   `gorm:"column:type" json:"type" form:"type"`
203
+	Doctor               int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
204
+	ExecutionTime        int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
205
+	ExecutionStaff       int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
206
+	ExecutionState       int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
207
+	CheckTime            int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
208
+	CheckState           int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
209
+	Checker              int64   `gorm:"column:checker" json:"checker" form:"checker"`
210
+	StartTime            int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
211
+	TeamId               int64   `gorm:"column:team_id" json:"team_id" form:"team_id"`
212
+	FrequencyType        int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
213
+	DayCount             int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
214
+	WeekDay              string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
215
+	ExecutionFrequencyId int64   `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
215 216
 }
216 217
 
217 218
 func (VmHisPrescriptionProject) TableName() string {
@@ -276,6 +277,7 @@ type VmHisDoctorAdviceInfo struct {
276 277
 	Mtime                 int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
277 278
 	AdviceId              int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
278 279
 	IsMedicine            int64   `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
280
+	ExecutionFrequencyId  int64   `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
279 281
 }
280 282
 
281 283
 func (VmHisDoctorAdviceInfo) TableName() string {

+ 36 - 34
models/stock_models.go View File

@@ -1309,6 +1309,7 @@ type BloodHisDoctorAdviceInfo struct {
1309 1309
 	Way                   int64                       `gorm:"column:way" json:"way" form:"way"`
1310 1310
 	HospApprFlag          int64                       `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
1311 1311
 	LmtUsedFlag           int64                       `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
1312
+	ExecutionFrequencyId  int64                       `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1312 1313
 }
1313 1314
 
1314 1315
 func (BloodHisDoctorAdviceInfo) TableName() string {
@@ -1316,40 +1317,41 @@ func (BloodHisDoctorAdviceInfo) TableName() string {
1316 1317
 }
1317 1318
 
1318 1319
 type BloodHisPrescriptionProject struct {
1319
-	ID                 int64                          `gorm:"column:id" json:"id" form:"id"`
1320
-	ProjectId          int64                          `gorm:"column:project_id" json:"project_id" form:"project_id"`
1321
-	Price              float64                        `gorm:"column:price" json:"price" form:"price"`
1322
-	UserOrgId          int64                          `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1323
-	Status             int64                          `gorm:"column:status" json:"status" form:"status"`
1324
-	Ctime              int64                          `gorm:"column:ctime" json:"ctime" form:"ctime"`
1325
-	Mtime              int64                          `gorm:"column:mtime" json:"mtime" form:"mtime"`
1326
-	PatientId          int64                          `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1327
-	HisPatientId       int64                          `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1328
-	RecordDate         int64                          `gorm:"column:record_date" json:"record_date" form:"record_date"`
1329
-	PrescriptionId     int64                          `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1330
-	Count              string                         `gorm:"column:count" json:"count" form:"count"`
1331
-	FeedetlSn          string                         `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1332
-	MedListCodg        string                         `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
1333
-	SingleDose         string                         `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1334
-	DeliveryWay        string                         `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1335
-	ExecutionFrequency string                         `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
1336
-	Day                string                         `gorm:"column:day" json:"day" form:"day"`
1337
-	Remark             string                         `gorm:"column:remark" json:"remark" form:"remark"`
1338
-	Unit               string                         `gorm:"column:unit" json:"unit" form:"unit"`
1339
-	Type               int64                          `gorm:"column:type" json:"type" form:"type"`
1340
-	Doctor             int64                          `gorm:"column:doctor" json:"doctor" form:"doctor"`
1341
-	ExecutionTime      int64                          `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
1342
-	ExecutionStaff     int64                          `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
1343
-	ExecutionState     int64                          `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
1344
-	CheckTime          int64                          `gorm:"column:check_time" json:"check_time" form:"check_time"`
1345
-	CheckState         int64                          `gorm:"column:check_state" json:"check_state" form:"check_state"`
1346
-	Checker            int64                          `gorm:"column:checker" json:"checker" form:"checker"`
1347
-	StartTime          int64                          `gorm:"column:start_time" json:"start_time" form:"start_time"`
1348
-	TeamId             int64                          `gorm:"column:team_id" json:"team_id" form:"team_id"`
1349
-	FrequencyType      int64                          `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
1350
-	DayCount           int64                          `gorm:"column:day_count" json:"day_count" form:"day_count"`
1351
-	WeekDay            string                         `gorm:"column:week_day" json:"week_day" form:"week_day"`
1352
-	ChildDoctorAdvice  []*BloodHisPrescriptionProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ProjectId" json:"child"`
1320
+	ID                   int64                          `gorm:"column:id" json:"id" form:"id"`
1321
+	ProjectId            int64                          `gorm:"column:project_id" json:"project_id" form:"project_id"`
1322
+	Price                float64                        `gorm:"column:price" json:"price" form:"price"`
1323
+	UserOrgId            int64                          `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1324
+	Status               int64                          `gorm:"column:status" json:"status" form:"status"`
1325
+	Ctime                int64                          `gorm:"column:ctime" json:"ctime" form:"ctime"`
1326
+	Mtime                int64                          `gorm:"column:mtime" json:"mtime" form:"mtime"`
1327
+	PatientId            int64                          `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1328
+	HisPatientId         int64                          `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1329
+	RecordDate           int64                          `gorm:"column:record_date" json:"record_date" form:"record_date"`
1330
+	PrescriptionId       int64                          `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1331
+	Count                string                         `gorm:"column:count" json:"count" form:"count"`
1332
+	FeedetlSn            string                         `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1333
+	MedListCodg          string                         `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
1334
+	SingleDose           string                         `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1335
+	DeliveryWay          string                         `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1336
+	ExecutionFrequency   string                         `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
1337
+	Day                  string                         `gorm:"column:day" json:"day" form:"day"`
1338
+	Remark               string                         `gorm:"column:remark" json:"remark" form:"remark"`
1339
+	Unit                 string                         `gorm:"column:unit" json:"unit" form:"unit"`
1340
+	Type                 int64                          `gorm:"column:type" json:"type" form:"type"`
1341
+	Doctor               int64                          `gorm:"column:doctor" json:"doctor" form:"doctor"`
1342
+	ExecutionTime        int64                          `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
1343
+	ExecutionStaff       int64                          `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
1344
+	ExecutionState       int64                          `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
1345
+	CheckTime            int64                          `gorm:"column:check_time" json:"check_time" form:"check_time"`
1346
+	CheckState           int64                          `gorm:"column:check_state" json:"check_state" form:"check_state"`
1347
+	Checker              int64                          `gorm:"column:checker" json:"checker" form:"checker"`
1348
+	StartTime            int64                          `gorm:"column:start_time" json:"start_time" form:"start_time"`
1349
+	TeamId               int64                          `gorm:"column:team_id" json:"team_id" form:"team_id"`
1350
+	FrequencyType        int64                          `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
1351
+	DayCount             int64                          `gorm:"column:day_count" json:"day_count" form:"day_count"`
1352
+	WeekDay              string                         `gorm:"column:week_day" json:"week_day" form:"week_day"`
1353
+	ChildDoctorAdvice    []*BloodHisPrescriptionProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ProjectId" json:"child"`
1354
+	ExecutionFrequencyId int64                          `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1353 1355
 }
1354 1356
 
1355 1357
 func (BloodHisPrescriptionProject) TableName() string {

+ 161 - 0
service/coordinate_service.go View File

@@ -8,6 +8,7 @@ import (
8 8
 	"github.com/jinzhu/gorm"
9 9
 	"io/ioutil"
10 10
 	"net/http"
11
+	"time"
11 12
 )
12 13
 
13 14
 func SavePatientMessageInfo() (string, string) {
@@ -329,3 +330,163 @@ func GetHisOrderFour(patient_id string, infoSeq string, docId string) (order mod
329 330
 	}
330 331
 	return
331 332
 }
333
+
334
+func GetHisPatientForCoordinate(id_card_no string) (string, string) {
335
+
336
+	//input := make(map[string]interface{})
337
+	inputData := make(map[string]interface{})
338
+	inputData["idcard"] = id_card_no // 就诊凭证编号
339
+
340
+	var inputLog string
341
+	bytesData, err := json.Marshal(inputData)
342
+	inputLog = string(bytesData)
343
+	fmt.Println(string(bytesData))
344
+	if err != nil {
345
+		fmt.Println(err.Error())
346
+		return err.Error(), ""
347
+	}
348
+	reader := bytes.NewReader(bytesData)
349
+	var url string
350
+	gdyb_url := "http://218.104.146.179:9091/esb/listener/getPatientType"
351
+	url = gdyb_url
352
+
353
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
354
+	request, err := http.NewRequest("GET", url, reader)
355
+	if err != nil {
356
+		fmt.Println(err.Error())
357
+		return err.Error(), ""
358
+	}
359
+
360
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
361
+	request.Header.Set("code", "Xmrjyy")
362
+
363
+	client := http.Client{}
364
+	resp, err := client.Do(request)
365
+	if err != nil {
366
+		fmt.Println(err.Error())
367
+		return err.Error(), ""
368
+	}
369
+	respBytes, err := ioutil.ReadAll(resp.Body)
370
+	if err != nil {
371
+		fmt.Println(err.Error())
372
+		return err.Error(), ""
373
+	}
374
+	fmt.Println(string(respBytes))
375
+	str := string(respBytes)
376
+	return str, inputLog
377
+
378
+}
379
+func UploadPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
380
+
381
+	//input := make(map[string]interface{})
382
+	inputData := make(map[string]interface{})
383
+
384
+	diags := make([]map[string]interface{}, 0)
385
+	//diags := make([]map[string]interface{}, 0)
386
+
387
+	presInfos := make([]map[string]interface{}, 0)
388
+
389
+	for _, item := range info.Diag {
390
+		inputDataDiag := make(map[string]interface{})
391
+		inputDataDiag["vao06"] = item.Vao06
392
+		inputDataDiag["bak02"] = item.Bak02
393
+		diags = append(diags, inputDataDiag)
394
+	}
395
+
396
+	for _, item := range info.PresInfo {
397
+		inputDataPresInfo := make(map[string]interface{})
398
+		inputDataPresInfo["cbm06"] = item.Cbm06
399
+		inputDataPresInfo["cbm07"] = item.Cbm06
400
+		inputDataPresInfo["cbmid"] = item.Cbmid
401
+		presDetails := make([]map[string]interface{}, 0)
402
+
403
+		for _, subItem := range item.PresDetail {
404
+			inputDataPresDetail := make(map[string]interface{})
405
+			inputDataPresDetail["vaf59"] = subItem.Vaf59
406
+			Items := make([]map[string]interface{}, 0)
407
+			for _, subSubItem := range subItem.Item {
408
+				inputDataItem := make(map[string]interface{})
409
+				inputDataItem["bbx01"] = subSubItem.Bbx01
410
+				inputDataItem["bda01"] = subSubItem.Bda01
411
+				inputDataItem["bby01"] = subSubItem.Bby01
412
+				inputDataItem["bck01b"] = subSubItem.Bck01b
413
+				inputDataItem["bck01d"] = subSubItem.Bck01d
414
+				inputDataItem["bdi01"] = subSubItem.Bdi01
415
+				inputDataItem["rownr"] = subSubItem.Rownr
416
+				inputDataItem["vaf11"] = subSubItem.Vaf11
417
+				inputDataItem["vaf14"] = subSubItem.Vaf14
418
+				inputDataItem["vaf15"] = subSubItem.Vaf15
419
+				inputDataItem["vaf17"] = subSubItem.Vaf17
420
+				inputDataItem["vaf18"] = subSubItem.Vaf18
421
+				inputDataItem["vaf19"] = subSubItem.Vaf19
422
+				inputDataItem["vaf20"] = subSubItem.Vaf20
423
+				inputDataItem["vaf21"] = subSubItem.Vaf21
424
+				inputDataItem["vaf22"] = subSubItem.Vaf22
425
+				inputDataItem["vaf32"] = subSubItem.Vaf32
426
+				inputDataItem["vaf35"] = subSubItem.Vaf35
427
+				inputDataItem["vaf36"] = subSubItem.Vaf36
428
+				inputDataItem["vaf58"] = subSubItem.Vaf58
429
+				inputDataItem["vaf61"] = subSubItem.Vaf61
430
+				Items = append(Items, inputDataItem)
431
+
432
+			}
433
+			inputDataPresDetail["item"] = Items
434
+			presDetails = append(presDetails, inputDataPresDetail)
435
+		}
436
+		inputDataPresInfo["presDetail"] = presDetails
437
+		presInfos = append(presInfos, inputDataPresInfo)
438
+	}
439
+
440
+	inputData["vaa01"] = info.Vaa01   // 就诊凭证编号
441
+	inputData["Fasong"] = info.Fasong // 就诊凭证编号
442
+	inputData["vaa07"] = info.Vaa07   // 就诊凭证编号
443
+	inputData["bck01c"] = info.Bck01c // 就诊凭证编号
444
+	inputData["bce02a"] = "1001"      // 就诊凭证编号
445
+
446
+	inputData["diag"] = diags         // 就诊凭证编号
447
+	inputData["presInfo"] = presInfos // 就诊凭证编号
448
+
449
+	var inputLog string
450
+	bytesData, err := json.Marshal(inputData)
451
+	inputLog = string(bytesData)
452
+	fmt.Println(string(bytesData))
453
+	if err != nil {
454
+		fmt.Println(err.Error())
455
+		return err.Error(), ""
456
+	}
457
+	reader := bytes.NewReader(bytesData)
458
+	var url string
459
+	gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
460
+	url = gdyb_url
461
+
462
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
463
+	request, err := http.NewRequest("POST", url, reader)
464
+	if err != nil {
465
+		fmt.Println(err.Error())
466
+		return err.Error(), ""
467
+	}
468
+
469
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
470
+	request.Header.Set("code", "Xmrjyy")
471
+
472
+	client := http.Client{}
473
+	resp, err := client.Do(request)
474
+	if err != nil {
475
+		fmt.Println(err.Error())
476
+		return err.Error(), ""
477
+	}
478
+	respBytes, err := ioutil.ReadAll(resp.Body)
479
+	if err != nil {
480
+		fmt.Println(err.Error())
481
+		return err.Error(), ""
482
+	}
483
+	fmt.Println(string(respBytes))
484
+	str := string(respBytes)
485
+	return str, inputLog
486
+
487
+}
488
+
489
+func UpDatePrescriptionNumberForCoordinate(user_org_id int64, ids []int64, number string) (err error) {
490
+	err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND id in (?)", user_org_id, ids).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix(), "order_status": 6}).Error
491
+	return
492
+}

+ 5 - 0
service/data.go View File

@@ -343,3 +343,8 @@ func CreateContinueSchedule(schedule *models.ContinueSchedule) error {
343 343
 	err := writeDb.Model(&schedule).Create(&schedule).Error
344 344
 	return err
345 345
 }
346
+
347
+func GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
348
+	err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
349
+	return
350
+}

+ 5 - 3
service/his_service.go View File

@@ -1699,6 +1699,7 @@ type HisDoctorAdviceInfo struct {
1699 1699
 	Drug                 Drug                 `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
1700 1700
 	VMHisPrescriptionTwo VMHisPrescriptionTwo `gorm:"ForeignKey:ID;AssociationForeignKey:PrescriptionId" json:"prescription"`
1701 1701
 	IsMedicine           int64                `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
1702
+	ExecutionFrequencyId int64                `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1702 1703
 }
1703 1704
 
1704 1705
 func (HisDoctorAdviceInfo) TableName() string {
@@ -1742,9 +1743,10 @@ type HisPrescriptionProject struct {
1742 1743
 	StartTime      int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
1743 1744
 	TeamId         int64 `gorm:"column:team_id" json:"team_id" form:"team_id"`
1744 1745
 
1745
-	FrequencyType int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
1746
-	DayCount      int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
1747
-	WeekDay       string `gorm:"column:week_day" json:"week_day" form:"week_day"`
1746
+	FrequencyType        int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
1747
+	DayCount             int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
1748
+	WeekDay              string `gorm:"column:week_day" json:"week_day" form:"week_day"`
1749
+	ExecutionFrequencyId int64  `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1748 1750
 }
1749 1751
 
1750 1752
 func (HisPrescriptionProject) TableName() string {

+ 57 - 2
service/statistics_service/index_evaluation_service.go View File

@@ -1444,12 +1444,12 @@ func GetNurseWorkloadTableData(user_org_id int64, start_time int64, end_time int
1444 1444
 	userDb := service.UserReadDB()
1445 1445
 	db := service.XTReadDB()
1446 1446
 	//var tempConfig models.Dataconfig
1447
-	offset := (page - 1) * limit
1447
+	//offset := (page - 1) * limit
1448 1448
 
1449 1449
 	//db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
1450 1450
 
1451 1451
 	if admin_user_id == 0 {
1452
-		userDb.Raw("select admin_user_id, user_name,org_id  from sgj_user_admin_role  Where org_id = ?  AND user_type = 3 ", user_org_id).Offset(offset).Limit(limit).Scan(&datas)
1452
+		userDb.Raw("select admin_user_id, user_name,org_id  from sgj_user_admin_role  Where org_id = ?  AND user_type = 3 ", user_org_id).Scan(&datas)
1453 1453
 	} else {
1454 1454
 		userDb.Raw("select admin_user_id, user_name,org_id  from sgj_user_admin_role  Where org_id = ?  AND user_type = 3  AND admin_user_id = ?", user_org_id, admin_user_id).Scan(&datas)
1455 1455
 	}
@@ -1495,6 +1495,61 @@ func GetNurseWorkloadTableData(user_org_id int64, start_time int64, end_time int
1495 1495
 
1496 1496
 }
1497 1497
 
1498
+//func GetMobilNurseWorkloadTableData(user_org_id int64, start_time int64, end_time int64, admin_user_id int64, page int64, limit int64) (datas []*VMUserAdminRole, AdminTotal int64, err error) {
1499
+//	userDb := service.UserReadDB()
1500
+//	db := service.XTReadDB()
1501
+//	//var tempConfig models.Dataconfig
1502
+//	//offset := (page - 1) * limit
1503
+//
1504
+//	//db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
1505
+//
1506
+//	if admin_user_id == 0 {
1507
+//		userDb.Raw("select admin_user_id, user_name,org_id  from sgj_user_admin_role  Where org_id = ?  AND user_type = 3 ", user_org_id).Scan(&datas)
1508
+//	} else {
1509
+//		userDb.Raw("select admin_user_id, user_name,org_id  from sgj_user_admin_role  Where org_id = ?  AND user_type = 3  AND admin_user_id = ?", user_org_id, admin_user_id).Scan(&datas)
1510
+//	}
1511
+//
1512
+//	for _, item := range datas {
1513
+//		var Total int64
1514
+//		var TotalTwo int64
1515
+//		var TotalThree int64
1516
+//		var TotalFour int64
1517
+//		var TotalFive int64
1518
+//		var TotalSix int64
1519
+//		var TotalSeven int64
1520
+//		var TotalEghit int64
1521
+//		var TotalNight int64
1522
+//		//db.Raw("select count(*) as total from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('内瘘',config.name) > 0 Where d.user_org_id = ? AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1523
+//		//db.Raw("select count(*) as total_one from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0 Where  d.user_org_id = ?  AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalOne)
1524
+//		db.Table("xt_monitoring_record as monitor ").Joins("join xt_schedule sch On sch.schedule_date = monitor.monitoring_date AND sch.patient_id = monitor.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("monitor.user_org_id = ? AND monitor.status = 1 AND monitor.monitoring_nurse = ? AND monitor.monitoring_date >= ? AND monitor.monitoring_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalTwo)
1525
+//		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.puncture_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&Total)
1526
+//		db.Table("xt_treatment_summary as summary").Joins("join xt_schedule sch On sch.schedule_date = summary.assessment_date AND sch.patient_id = summary.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("summary.user_org_id = ? AND summary.status = 1 AND summary.creater = ? AND summary.assessment_date >= ? AND summary.assessment_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalThree)
1527
+//
1528
+//		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.change_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalFour)
1529
+//		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.difficult_puncture_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalFive)
1530
+//		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.new_fistula_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalSix)
1531
+//		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.start_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalSeven)
1532
+//		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.finish_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalEghit)
1533
+//		db.Table("xt_dialysis_order as o").Joins("join xt_schedule sch On sch.schedule_date = o.dialysis_date AND sch.patient_id = o.patient_id AND sch.user_org_id = ? AND sch.status = 1", user_org_id).Where("o.user_org_id = ? AND o.status = 1  AND o.dialysis_date >= ? AND o.dialysis_date <= ? AND o.washpipe_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&TotalNight)
1534
+//
1535
+//		item.PunctureCount = Total
1536
+//		item.CureCount = TotalTwo
1537
+//		item.MissionCount = TotalThree
1538
+//		item.ChangeNuserCount = TotalFour
1539
+//		item.DiffiCultPuntureNuserCount = TotalFive
1540
+//		item.NewNuserCount = TotalSix
1541
+//		item.StartNuserCount = TotalSeven
1542
+//		item.FinshNurserCount = TotalEghit
1543
+//		item.WashpipeNurserCount = TotalNight
1544
+//	}
1545
+//
1546
+//	if err != nil {
1547
+//		return nil, AdminTotal, err
1548
+//	}
1549
+//	return datas, AdminTotal, nil
1550
+//
1551
+//}
1552
+
1498 1553
 //工作量统计
1499 1554
 type AdminUser struct {
1500 1555
 	ID          int64  `gorm:"column:id" json:"id" form:"id"`