csx 3 vuotta sitten
vanhempi
commit
5bf8ce83dc

+ 61 - 59
controllers/base_api_controller.go Näytä tiedosto

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
+	"XT_New/models"
6
+
5
 	//"XT_New/models"
7
 	//"XT_New/models"
6
 
8
 
7
 	//"XT_New/models"
9
 	//"XT_New/models"
67
 func (this *BaseAuthAPIController) Prepare() {
69
 func (this *BaseAuthAPIController) Prepare() {
68
 	this.BaseAPIController.Prepare()
70
 	this.BaseAPIController.Prepare()
69
 	if this.GetAdminUserInfo() == nil {
71
 	if this.GetAdminUserInfo() == nil {
70
-		//var userAdmin models.AdminUser
71
-		//userAdmin.Id = 1448
72
-		//userAdmin.Mobile = "13318599895"
73
-		//
74
-		//userAdmin.Id = 597
75
-		//userAdmin.Mobile = "19874122664"
76
-		//userAdmin.IsSuperAdmin = false
77
-		//userAdmin.Status = 1
78
-		//userAdmin.CreateTime = 1530786071
79
-		//userAdmin.ModifyTime = 1530786071
80
-		//var subscibe models.ServeSubscibe
81
-		//subscibe.ID = 1
82
-		//subscibe.OrgId = 3877
83
-		//subscibe.PeriodStart = 1538035409
84
-		//subscibe.PeriodEnd = 1569571409
85
-		//subscibe.State = 1
86
-		//subscibe.Status = 1
87
-		//subscibe.CreatedTime = 1538035409
88
-		//subscibe.UpdatedTime = 1538035409
89
-		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
90
-		//subscibes[4] = &subscibe
91
-		//var adminUserInfo service.AdminUserInfo
92
-		//adminUserInfo.CurrentOrgId = 3877
93
-		//adminUserInfo.CurrentAppId = 4
94
-		//adminUserInfo.AdminUser = &userAdmin
95
-		//adminUserInfo.Subscibes = subscibes
96
-		//this.SetSession("admin_user_info", &adminUserInfo)
97
-
98
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
99
-		this.StopRun()
72
+		var userAdmin models.AdminUser
73
+		userAdmin.Id = 1448
74
+		userAdmin.Mobile = "13318599895"
75
+
76
+		userAdmin.Id = 597
77
+		userAdmin.Mobile = "19874122664"
78
+		userAdmin.IsSuperAdmin = false
79
+		userAdmin.Status = 1
80
+		userAdmin.CreateTime = 1530786071
81
+		userAdmin.ModifyTime = 1530786071
82
+		var subscibe models.ServeSubscibe
83
+		subscibe.ID = 1
84
+		subscibe.OrgId = 3877
85
+		subscibe.PeriodStart = 1538035409
86
+		subscibe.PeriodEnd = 1569571409
87
+		subscibe.State = 1
88
+		subscibe.Status = 1
89
+		subscibe.CreatedTime = 1538035409
90
+		subscibe.UpdatedTime = 1538035409
91
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
+		subscibes[4] = &subscibe
93
+		var adminUserInfo service.AdminUserInfo
94
+		adminUserInfo.CurrentOrgId = 3877
95
+		adminUserInfo.CurrentAppId = 4
96
+		adminUserInfo.AdminUser = &userAdmin
97
+		adminUserInfo.Subscibes = subscibes
98
+		this.SetSession("admin_user_info", &adminUserInfo)
99
+
100
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
101
+		//this.StopRun()ba
100
 
102
 
101
 	}
103
 	}
102
 
104
 
313
 func (this *BaseServeAPIController) Prepare() {
315
 func (this *BaseServeAPIController) Prepare() {
314
 	this.BaseAPIController.Prepare()
316
 	this.BaseAPIController.Prepare()
315
 	if this.GetAdminUserInfo() == nil {
317
 	if this.GetAdminUserInfo() == nil {
316
-		//var userAdmin models.AdminUser
317
-		//userAdmin.Id = 1448
318
-		//userAdmin.Mobile = "13318599895"
319
-		//
320
-		//userAdmin.Id = 597
321
-		//userAdmin.Mobile = "19874122664"
322
-		//userAdmin.IsSuperAdmin = false
323
-		//userAdmin.Status = 1
324
-		//userAdmin.CreateTime = 1530786071
325
-		//userAdmin.ModifyTime = 1530786071
326
-		//var subscibe models.ServeSubscibe
327
-		//subscibe.ID = 1
328
-		//subscibe.OrgId = 3877
329
-		//subscibe.PeriodStart = 1538035409
330
-		//subscibe.PeriodEnd = 1569571409
331
-		//subscibe.State = 1
332
-		//subscibe.Status = 1
333
-		//subscibe.CreatedTime = 1538035409
334
-		//subscibe.UpdatedTime = 1538035409
335
-		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
336
-		//subscibes[4] = &subscibe
337
-		//var adminUserInfo service.AdminUserInfo
338
-		//adminUserInfo.CurrentOrgId = 3877
339
-		//adminUserInfo.CurrentAppId = 4
340
-		//adminUserInfo.AdminUser = &userAdmin
341
-		//adminUserInfo.Subscibes = subscibes
342
-		//this.SetSession("admin_user_info", &adminUserInfo)
343
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
344
-		this.StopRun()
318
+		var userAdmin models.AdminUser
319
+		userAdmin.Id = 1448
320
+		userAdmin.Mobile = "13318599895"
321
+
322
+		userAdmin.Id = 597
323
+		userAdmin.Mobile = "19874122664"
324
+		userAdmin.IsSuperAdmin = false
325
+		userAdmin.Status = 1
326
+		userAdmin.CreateTime = 1530786071
327
+		userAdmin.ModifyTime = 1530786071
328
+		var subscibe models.ServeSubscibe
329
+		subscibe.ID = 1
330
+		subscibe.OrgId = 3877
331
+		subscibe.PeriodStart = 1538035409
332
+		subscibe.PeriodEnd = 1569571409
333
+		subscibe.State = 1
334
+		subscibe.Status = 1
335
+		subscibe.CreatedTime = 1538035409
336
+		subscibe.UpdatedTime = 1538035409
337
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
+		subscibes[4] = &subscibe
339
+		var adminUserInfo service.AdminUserInfo
340
+		adminUserInfo.CurrentOrgId = 3877
341
+		adminUserInfo.CurrentAppId = 4
342
+		adminUserInfo.AdminUser = &userAdmin
343
+		adminUserInfo.Subscibes = subscibes
344
+		this.SetSession("admin_user_info", &adminUserInfo)
345
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
346
+		//this.StopRun()
345
 	}
347
 	}
346
 
348
 
347
 	//if adminUserInfo.AppRole != nil {
349
 	//if adminUserInfo.AppRole != nil {

+ 55 - 17
controllers/dialysis_api_controller.go Näytä tiedosto

259
 	oxygen_uptake, _ := c.GetInt64("oxygen_uptake")
259
 	oxygen_uptake, _ := c.GetInt64("oxygen_uptake")
260
 	oxygen_flow := c.GetString("oxygen_flow")
260
 	oxygen_flow := c.GetString("oxygen_flow")
261
 	oxygen_time := c.GetString("oxygen_time")
261
 	oxygen_time := c.GetString("oxygen_time")
262
+
263
+	hemodialysis_pipelines := c.GetString("hemodialysis_pipelines")
264
+	hemodialysis_pipelines_count, _ := c.GetFloat("hemodialysis_pipelines_count", 0)
265
+
266
+	puncture_needle := c.GetString("puncture_needle")
267
+	puncture_needle_count, _ := c.GetFloat("puncture_needle_count", 0)
268
+
269
+	epo := c.GetString("epo")
270
+	epo_count, _ := c.GetFloat("epo_count", 0)
271
+
262
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
272
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
263
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
273
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
264
 
274
 
352
 		OxygenFlow:                 oxygen_flow,
362
 		OxygenFlow:                 oxygen_flow,
353
 		OxygenUptake:               oxygen_uptake,
363
 		OxygenUptake:               oxygen_uptake,
354
 		OxygenTime:                 oxygen_time,
364
 		OxygenTime:                 oxygen_time,
365
+		HemodialysisPipelines:      hemodialysis_pipelines,
366
+		HemodialysisPipelinesCount: hemodialysis_pipelines_count,
367
+		PunctureNeedle:             puncture_needle,
368
+		PunctureNeedleCount:        puncture_needle_count,
369
+		Epo:                        epo,
370
+		EpoCount:                   epo_count,
355
 	}
371
 	}
356
 
372
 
357
 	//查询最近透析准备表里是否存在 透析器 灌流器
373
 	//查询最近透析准备表里是否存在 透析器 灌流器
597
 	oxygen_uptake, _ := c.GetInt64("oxygen_uptake")
613
 	oxygen_uptake, _ := c.GetInt64("oxygen_uptake")
598
 	oxygen_flow := c.GetString("oxygen_flow")
614
 	oxygen_flow := c.GetString("oxygen_flow")
599
 	oxygen_time := c.GetString("oxygen_time")
615
 	oxygen_time := c.GetString("oxygen_time")
616
+
617
+	hemodialysis_pipelines := c.GetString("hemodialysis_pipelines")
618
+	hemodialysis_pipelines_count, _ := c.GetFloat("hemodialysis_pipelines_count", 0)
619
+
620
+	puncture_needle := c.GetString("puncture_needle")
621
+	puncture_needle_count, _ := c.GetFloat("puncture_needle_count", 0)
622
+
623
+	epo := c.GetString("epo")
624
+	epo_count, _ := c.GetFloat("epo_count", 0)
625
+
600
 	var prescription_doctor int64
626
 	var prescription_doctor int64
601
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
627
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
602
 
628
 
684
 		Package:                    safe_package,
710
 		Package:                    safe_package,
685
 		ALiquid:                    a_liquid,
711
 		ALiquid:                    a_liquid,
686
 
712
 
687
-		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
688
-		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
689
-		Blood:                     blood,
690
-		DialysisIrrigation:        dialysis_irrigation,
691
-		DialysisDialyszers:        dialysis_dialyszers,
692
-		AntioxidantCommodityName:  antioxidant_commodity_name,
693
-		DisplaceSpeed:             displace_speed,
694
-		Illness:                   illness,
695
-		Amylaceum:                 amylaceum,
696
-		SingleTime:                single_time,
697
-		SingleWater:               single_water,
698
-		ReplacementFlow:           replacement_flow,
699
-		PlasmaSeparator:           plasma_separator,
700
-		BilirubinAdsorptionColumn: bilirubin_adsorption_column,
701
-		OxygenTime:                oxygen_time,
702
-		OxygenUptake:              oxygen_uptake,
703
-		OxygenFlow:                oxygen_flow,
713
+		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
714
+		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
715
+		Blood:                      blood,
716
+		DialysisIrrigation:         dialysis_irrigation,
717
+		DialysisDialyszers:         dialysis_dialyszers,
718
+		AntioxidantCommodityName:   antioxidant_commodity_name,
719
+		DisplaceSpeed:              displace_speed,
720
+		Illness:                    illness,
721
+		Amylaceum:                  amylaceum,
722
+		SingleTime:                 single_time,
723
+		SingleWater:                single_water,
724
+		ReplacementFlow:            replacement_flow,
725
+		PlasmaSeparator:            plasma_separator,
726
+		BilirubinAdsorptionColumn:  bilirubin_adsorption_column,
727
+		OxygenTime:                 oxygen_time,
728
+		OxygenUptake:               oxygen_uptake,
729
+		OxygenFlow:                 oxygen_flow,
730
+		HemodialysisPipelines:      hemodialysis_pipelines,
731
+		HemodialysisPipelinesCount: hemodialysis_pipelines_count,
732
+		PunctureNeedle:             puncture_needle,
733
+		PunctureNeedleCount:        puncture_needle_count,
734
+		Epo:                        epo,
735
+		EpoCount:                   epo_count,
704
 	}
736
 	}
705
 
737
 
706
 	//查询最近透析准备表里是否存在 透析器 灌流器
738
 	//查询最近透析准备表里是否存在 透析器 灌流器
859
 		TargetKtv:                  target_ktv,
891
 		TargetKtv:                  target_ktv,
860
 		DialysisIrrigation:         dialysis_irrigation,
892
 		DialysisIrrigation:         dialysis_irrigation,
861
 		DialysisDialyszers:         dialysis_dialyszers,
893
 		DialysisDialyszers:         dialysis_dialyszers,
894
+		HemodialysisPipelines:      hemodialysis_pipelines,
895
+		HemodialysisPipelinesCount: hemodialysis_pipelines_count,
896
+		PunctureNeedle:             puncture_needle,
897
+		PunctureNeedleCount:        puncture_needle_count,
898
+		Epo:                        epo,
899
+		EpoCount:                   epo_count,
862
 	}
900
 	}
863
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
901
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
864
 	if err == nil {
902
 	if err == nil {

+ 334 - 43
controllers/his_api_controller.go Näytä tiedosto

96
 
96
 
97
 	beego.Router("/api/refunddetail/post", &HisApiController{}, "post:RefudDetail")
97
 	beego.Router("/api/refunddetail/post", &HisApiController{}, "post:RefudDetail")
98
 
98
 
99
+	beego.Router("/api/privateexpensesorder/get", &HisApiController{}, "get:GetPrivateExpensesOrder")
100
+
101
+	beego.Router("/api/uncharge/list", &HisApiController{}, "get:GetHisUnChargePatientList")
102
+
103
+}
104
+
105
+func (c *HisApiController) GetHisUnChargePatientList() {
106
+	record_date := c.GetString("record_date")
107
+	timeLayout := "2006-01-02"
108
+	loc, _ := time.LoadLocation("Local")
109
+	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
110
+	if err != nil {
111
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
112
+		return
113
+	}
114
+	recordDateTime := theTime.Unix()
115
+	adminInfo := c.GetAdminUserInfo()
116
+	var tempPatients []*service.NewTempPatients
117
+	//tempPatients, _ := service.GetAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
118
+	tempPatients, _ = service.GetNewAllUnChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
119
+	var patients []*service.NewTempPatients
120
+	var patients_two []*service.NewTempPatients
121
+
122
+	for _, item := range tempPatients {
123
+		//过滤掉没挂号的和没开处方的
124
+		if len(item.HisPatient) > 0 || len(item.HisPrescription) > 0 {
125
+			patients = append(patients, item)
126
+		}
127
+
128
+		//过滤掉没挂号的
129
+		if len(item.HisPatient) > 0 {
130
+			patients_two = append(patients_two, item)
131
+		}
132
+	}
133
+	c.ServeSuccessJSON(map[string]interface{}{
134
+		"list":     patients,
135
+		"list_two": patients_two,
136
+	})
137
+}
138
+
139
+func (c *HisApiController) GetPrivateExpensesOrder() {
140
+	//id, _ := c.GetInt64("id")
141
+	//record_time := c.GetString("record_time")
142
+	order_id, _ := c.GetInt64("order_id")
143
+	admin_user_id, _ := c.GetInt64("admin_user_id")
144
+
145
+	//timeLayout := "2006-01-02"
146
+	//loc, _ := time.LoadLocation("Local")
147
+	//
148
+	//theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
149
+	//if err != nil {
150
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
151
+	//	return
152
+	//}
153
+	//recordDateTime := theTime.Unix()
154
+	adminUser := c.GetAdminUserInfo()
155
+	order, _ := service.GetHisOrderByID(order_id)
156
+	his, _ := service.GetHisPatientInfoThree(adminUser.CurrentOrgId, order.MdtrtId)
157
+
158
+	orderInfos, _ := service.GetHisOrderDetailByNumber(order.Number, adminUser.CurrentOrgId)
159
+
160
+	diagnosis_ids := strings.Split(his.Diagnosis, ",")
161
+
162
+	//var config []*models.HisXtDiagnoseConfig
163
+	var name string
164
+	for _, item := range diagnosis_ids {
165
+		id, _ := strconv.ParseInt(item, 10, 64)
166
+		diagnosisConfig, _ := service.FindDiagnoseById(id)
167
+		if len(name) == 0 {
168
+			name = diagnosisConfig.ClassName
169
+
170
+		} else {
171
+			name = name + "," + diagnosisConfig.ClassName
172
+		}
173
+	}
174
+
175
+	decimal.DivisionPrecision = 2
176
+
177
+	for _, item := range orderInfos {
178
+		item.FulamtOwnpayAmt = item.DetItemFeeSumamt
179
+		if item.HisDoctorAdviceInfo.ID > 0 && item.HisPrescriptionProject.ID == 0 { //药品
180
+			item.MedChrgitmType = "09"
181
+
182
+		}
183
+		if item.HisPrescriptionProject.ID > 0 && item.HisDoctorAdviceInfo.ID == 0 {
184
+			if item.HisPrescriptionProject.Type == 2 {
185
+				switch item.HisPrescriptionProject.VMHisProject.CostClassify {
186
+
187
+				case 1:
188
+					item.MedChrgitmType = "14"
189
+					break
190
+				case 2:
191
+					item.MedChrgitmType = "05"
192
+
193
+					break
194
+				case 3:
195
+					item.MedChrgitmType = "04"
196
+
197
+					break
198
+				case 4:
199
+					item.MedChrgitmType = "14"
200
+
201
+					break
202
+				case 5:
203
+					item.MedChrgitmType = "08"
204
+
205
+					break
206
+				case 6:
207
+					item.MedChrgitmType = "14"
208
+
209
+					break
210
+				case 7:
211
+					item.MedChrgitmType = "14"
212
+
213
+					break
214
+				case 8:
215
+					item.MedChrgitmType = "03"
216
+					break
217
+				case 9:
218
+					item.MedChrgitmType = "14"
219
+					break
220
+
221
+				}
222
+
223
+			} else if item.HisPrescriptionProject.Type == 3 {
224
+				item.MedChrgitmType = "08"
225
+			}
226
+		}
227
+	}
228
+	order.PsnCashPay = order.MedfeeSumamt
229
+
230
+	//var user_name string
231
+	//role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
232
+	//if role.ID == 0 {
233
+	//	user_name = "管理员"
234
+	//} else {
235
+	//	user_name = role.UserName
236
+	//}
237
+
238
+	org, _ := service.GetOrgById(adminUser.CurrentOrgId)
239
+	printor_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
240
+	charge_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, order.Creator)
241
+
242
+	patient, _ := service.GetPatientByID(order.UserOrgId, order.PatientId)
243
+
244
+	c.ServeSuccessJSON(map[string]interface{}{
245
+		"org_name":      org.OrgName,
246
+		"name":          patient.Name,
247
+		"order_infos":   orderInfos,
248
+		"number":        order.MdtrtId,
249
+		"date":          order.SettleAccountsDate,
250
+		"charge_admin":  charge_admin,
251
+		"printor_admin": printor_admin,
252
+		"info":          order,
253
+	})
254
+
99
 }
255
 }
100
 
256
 
101
 func (c *HisApiController) RefudDetail() {
257
 func (c *HisApiController) RefudDetail() {
2696
 			SickType:               sick_type,
2852
 			SickType:               sick_type,
2697
 		}
2853
 		}
2698
 		service.CreateHisPatient(&hisPatient)
2854
 		service.CreateHisPatient(&hisPatient)
2855
+
2699
 		service.UpdateHisPrescriptionHisID(hisPatient.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
2856
 		service.UpdateHisPrescriptionHisID(hisPatient.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
2857
+
2700
 		c.ServeSuccessJSON(map[string]interface{}{
2858
 		c.ServeSuccessJSON(map[string]interface{}{
2701
 			"his_info": hisPatient,
2859
 			"his_info": hisPatient,
2702
 		})
2860
 		})
2736
 		}
2894
 		}
2737
 		service.CreateHisPatient(&hisPatient)
2895
 		service.CreateHisPatient(&hisPatient)
2738
 
2896
 
2897
+		service.UpdateHisPrescriptionHisID(hisPatient.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
2898
+
2739
 		c.ServeSuccessJSON(map[string]interface{}{
2899
 		c.ServeSuccessJSON(map[string]interface{}{
2740
 			"his_info": hisPatient,
2900
 			"his_info": hisPatient,
2741
 		})
2901
 		})
2742
 
2902
 
2743
 	}
2903
 	}
2744
 
2904
 
2745
-	//timeStr := time.Now().Format("2006-01-02")
2746
-	//timeArr := strings.Split(timeStr, "-")
2747
-	//var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(patient.ID, 10)+ ""
2748
-
2749
 }
2905
 }
2750
 
2906
 
2751
 //上传明细----结算
2907
 //上传明细----结算
2823
 			prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
2979
 			prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
2824
 		}
2980
 		}
2825
 
2981
 
2826
-		fmt.Println("~~~~~~~~~")
2827
-		fmt.Println(his.Number)
2828
-		fmt.Println("~~~~~~~~~")
2829
-
2830
 		timestamp := time.Now().Unix()
2982
 		timestamp := time.Now().Unix()
2831
 		tempTime := time.Unix(timestamp, 0)
2983
 		tempTime := time.Unix(timestamp, 0)
2832
 		timeFormat := tempTime.Format("20060102150405")
2984
 		timeFormat := tempTime.Format("20060102150405")
2899
 
3051
 
2900
 		var customs []*Custom
3052
 		var customs []*Custom
2901
 		for _, item := range prescriptions {
3053
 		for _, item := range prescriptions {
2902
-
2903
 			if item.Type == 1 { //药品
3054
 			if item.Type == 1 { //药品
2904
 				for _, subItem := range item.HisDoctorAdviceInfo {
3055
 				for _, subItem := range item.HisDoctorAdviceInfo {
2905
 					cus := &Custom{
3056
 					cus := &Custom{
2915
 					customs = append(customs, cus)
3066
 					customs = append(customs, cus)
2916
 				}
3067
 				}
2917
 			}
3068
 			}
2918
-
2919
 			if item.Type == 2 { //项目
3069
 			if item.Type == 2 { //项目
2920
 				for _, subItem := range item.HisPrescriptionProject {
3070
 				for _, subItem := range item.HisPrescriptionProject {
2921
-
2922
 					cus := &Custom{
3071
 					cus := &Custom{
2923
 						AdviceId:         0,
3072
 						AdviceId:         0,
2924
 						ProjectId:        subItem.ID,
3073
 						ProjectId:        subItem.ID,
2929
 						MedListCodg:      subItem.MedListCodg,
3078
 						MedListCodg:      subItem.MedListCodg,
2930
 						Type:             2,
3079
 						Type:             2,
2931
 					}
3080
 					}
2932
-
2933
 					customs = append(customs, cus)
3081
 					customs = append(customs, cus)
2934
 				}
3082
 				}
2935
 			}
3083
 			}
2936
-
2937
 			for _, item := range item.HisAdditionalCharge {
3084
 			for _, item := range item.HisAdditionalCharge {
2938
 				cus := &Custom{
3085
 				cus := &Custom{
2939
 					ItemId:           item.ID,
3086
 					ItemId:           item.ID,
2946
 					MedListCodg:      item.XtHisAddtionConfig.Code,
3093
 					MedListCodg:      item.XtHisAddtionConfig.Code,
2947
 					Type:             3,
3094
 					Type:             3,
2948
 				}
3095
 				}
2949
-
2950
 				customs = append(customs, cus)
3096
 				customs = append(customs, cus)
2951
 			}
3097
 			}
2952
-
2953
 		}
3098
 		}
2954
-
2955
 		for _, item := range customs {
3099
 		for _, item := range customs {
2956
 			var advice_id int64 = 0
3100
 			var advice_id int64 = 0
2957
 			var project_id int64 = 0
3101
 			var project_id int64 = 0
2973
 				item_id = item.ItemId
3117
 				item_id = item.ItemId
2974
 				project_id = 0
3118
 				project_id = 0
2975
 			}
3119
 			}
2976
-
2977
 			detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
3120
 			detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
2978
 			cut, _ := strconv.ParseFloat(item.Cut, 32)
3121
 			cut, _ := strconv.ParseFloat(item.Cut, 32)
2979
 			pric, _ := strconv.ParseFloat(item.Price, 32)
3122
 			pric, _ := strconv.ParseFloat(item.Price, 32)
2980
-
2981
 			info := &models.HisOrderInfo{
3123
 			info := &models.HisOrderInfo{
2982
 				OrderNumber:      order.Number,
3124
 				OrderNumber:      order.Number,
2983
 				UploadDate:       time.Now().Unix(),
3125
 				UploadDate:       time.Now().Unix(),
3002
 		his.SickType = sick_type
3144
 		his.SickType = sick_type
3003
 		his.RegisterType = reg_type
3145
 		his.RegisterType = reg_type
3004
 		his.MedicalTreatmentType = reg_type
3146
 		his.MedicalTreatmentType = reg_type
3005
-
3006
 		service.UpdataHisPateint(&his)
3147
 		service.UpdataHisPateint(&his)
3007
 		err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
3148
 		err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
3008
 		err = service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime, his_patient_id)
3149
 		err = service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime, his_patient_id)
3012
 				"msg": "结算成功",
3153
 				"msg": "结算成功",
3013
 			})
3154
 			})
3014
 		}
3155
 		}
3015
-
3016
 	} else {
3156
 	} else {
3017
 		if tempOrder.IsPre > 0 {
3157
 		if tempOrder.IsPre > 0 {
3018
-
3019
 			allTotal := fmt.Sprintf("%.2f", tempOrder.MedfeeSumamt)
3158
 			allTotal := fmt.Sprintf("%.2f", tempOrder.MedfeeSumamt)
3020
 			totals, _ := strconv.ParseFloat(allTotal, 64)
3159
 			totals, _ := strconv.ParseFloat(allTotal, 64)
3021
-
3022
 			tempOrder.OrderStatus = 2
3160
 			tempOrder.OrderStatus = 2
3023
 			tempOrder.PayWay = pay_way
3161
 			tempOrder.PayWay = pay_way
3024
 			tempOrder.PayPrice = pay_price
3162
 			tempOrder.PayPrice = pay_price
3034
 			tempOrder.PType = 2
3172
 			tempOrder.PType = 2
3035
 			tempOrder.MedfeeSumamt = totals
3173
 			tempOrder.MedfeeSumamt = totals
3036
 			tempOrder.Diagnosis = diagnosis_id
3174
 			tempOrder.Diagnosis = diagnosis_id
3037
-
3038
 			err = service.SaveHisOrder(&tempOrder)
3175
 			err = service.SaveHisOrder(&tempOrder)
3039
 			err = service.UpdataOrderStatusTwo(tempOrder.Number, adminUser.CurrentOrgId)
3176
 			err = service.UpdataOrderStatusTwo(tempOrder.Number, adminUser.CurrentOrgId)
3040
 			if err != nil {
3177
 			if err != nil {
3046
 					"msg": "结算成功",
3183
 					"msg": "结算成功",
3047
 				})
3184
 				})
3048
 			}
3185
 			}
3049
-
3050
 		}
3186
 		}
3051
 	}
3187
 	}
3052
-
3053
 }
3188
 }
3054
 
3189
 
3055
 //退款
3190
 //退款
3448
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
3583
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
3449
 		return
3584
 		return
3450
 	}
3585
 	}
3586
+
3451
 	org_id := c.GetAdminUserInfo().CurrentOrgId
3587
 	org_id := c.GetAdminUserInfo().CurrentOrgId
3452
 	adminInfo, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
3588
 	adminInfo, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
3453
 	order_info, _ := service.GetHisOrderDetailByNumber(order.Number, org_id)
3589
 	order_info, _ := service.GetHisOrderDetailByNumber(order.Number, org_id)
3454
 	patient, _ := service.GetPatientByID(org_id, order.PatientId)
3590
 	patient, _ := service.GetPatientByID(org_id, order.PatientId)
3455
-	c.ServeSuccessJSON(map[string]interface{}{
3456
-		"order":      order,
3457
-		"order_info": order_info,
3458
-		"patient":    patient,
3459
-		"admin_info": adminInfo,
3460
-	})
3591
+
3592
+	his, _ := service.GetHisPatientInfoThree(order.UserOrgId, order.MdtrtId)
3593
+
3594
+	if his.BalanceAccountsType != 2 {
3595
+		c.ServeSuccessJSON(map[string]interface{}{
3596
+			"order":      order,
3597
+			"order_info": order_info,
3598
+			"patient":    patient,
3599
+			"admin_info": adminInfo,
3600
+		})
3601
+	} else {
3602
+
3603
+		for _, item := range order_info {
3604
+			item.FulamtOwnpayAmt = item.DetItemFeeSumamt
3605
+			if item.HisDoctorAdviceInfo.ID > 0 && item.HisPrescriptionProject.ID == 0 { //药品
3606
+				item.MedChrgitmType = "09"
3607
+
3608
+			}
3609
+			if item.HisPrescriptionProject.ID > 0 && item.HisDoctorAdviceInfo.ID == 0 {
3610
+				if item.HisPrescriptionProject.Type == 2 {
3611
+					switch item.HisPrescriptionProject.VMHisProject.CostClassify {
3612
+
3613
+					case 1:
3614
+						item.MedChrgitmType = "14"
3615
+						break
3616
+					case 2:
3617
+						item.MedChrgitmType = "05"
3618
+
3619
+						break
3620
+					case 3:
3621
+						item.MedChrgitmType = "04"
3622
+
3623
+						break
3624
+					case 4:
3625
+						item.MedChrgitmType = "14"
3626
+
3627
+						break
3628
+					case 5:
3629
+						item.MedChrgitmType = "08"
3630
+
3631
+						break
3632
+					case 6:
3633
+						item.MedChrgitmType = "14"
3634
+
3635
+						break
3636
+					case 7:
3637
+						item.MedChrgitmType = "14"
3638
+
3639
+						break
3640
+					case 8:
3641
+						item.MedChrgitmType = "03"
3642
+						break
3643
+					case 9:
3644
+						item.MedChrgitmType = "14"
3645
+						break
3646
+					}
3647
+				} else if item.HisPrescriptionProject.Type == 3 {
3648
+					item.MedChrgitmType = "08"
3649
+				}
3650
+			}
3651
+		}
3652
+		c.ServeSuccessJSON(map[string]interface{}{
3653
+			"order":      order,
3654
+			"order_info": order_info,
3655
+			"patient":    patient,
3656
+			"admin_info": adminInfo,
3657
+		})
3658
+
3659
+	}
3660
+
3461
 	return
3661
 	return
3462
 }
3662
 }
3463
 
3663
 
3569
 
3769
 
3570
 	his, _ := service.GetHisPatientInfoThree(adminUser.CurrentOrgId, number)
3770
 	his, _ := service.GetHisPatientInfoThree(adminUser.CurrentOrgId, number)
3571
 
3771
 
3572
-	prescriptions, _ := service.GetHisPrescriptionThree(adminUser.CurrentOrgId, patient_id, order.Number)
3772
+	//prescriptions, _ := service.GetHisPrescriptionThree(adminUser.CurrentOrgId, patient_id, order.Number)
3573
 
3773
 
3574
 	var bedCostTotal float64 = 0         //床位总费
3774
 	var bedCostTotal float64 = 0         //床位总费
3575
 	var bedCostSelfTotal float64 = 0     //床位自费
3775
 	var bedCostSelfTotal float64 = 0     //床位自费
3610
 	decimal.DivisionPrecision = 2
3810
 	decimal.DivisionPrecision = 2
3611
 
3811
 
3612
 	if his.BalanceAccountsType == 2 {
3812
 	if his.BalanceAccountsType == 2 {
3613
-		for _, item := range prescriptions {
3614
-			if item.Type == 1 {
3615
-				for _, subItem := range item.HisDoctorAdviceInfo {
3616
-					westernMedicineCostTotal = westernMedicineCostTotal + (subItem.PrescribingNumber * subItem.Price)
3617
-				}
3618
 
3813
 
3619
-			} else {
3620
-				for _, subItem := range item.HisPrescriptionProject {
3621
-					if subItem.Type == 2 {
3622
-						treatCostTotal = treatCostTotal + (float64(subItem.Count) * subItem.Price)
3623
-					} else {
3624
-						materialCostTotal = materialCostTotal + (float64(subItem.Count) * subItem.Price)
3814
+		orderInfos_two, _ := service.GetHisOrderDetailByNumber(order.Number, adminUser.CurrentOrgId)
3815
+
3816
+		for _, item := range orderInfos_two {
3817
+			item.FulamtOwnpayAmt = item.DetItemFeeSumamt
3818
+			if item.HisDoctorAdviceInfo.ID > 0 && item.HisPrescriptionProject.ID == 0 { //药品
3819
+				item.MedChrgitmType = "09"
3820
+
3821
+			}
3822
+			if item.HisPrescriptionProject.ID > 0 && item.HisDoctorAdviceInfo.ID == 0 {
3823
+				if item.HisPrescriptionProject.Type == 2 {
3824
+					switch item.HisPrescriptionProject.VMHisProject.CostClassify {
3825
+
3826
+					case 1:
3827
+						item.MedChrgitmType = "14"
3828
+						break
3829
+					case 2:
3830
+						item.MedChrgitmType = "05"
3831
+
3832
+						break
3833
+					case 3:
3834
+						item.MedChrgitmType = "04"
3835
+
3836
+						break
3837
+					case 4:
3838
+						item.MedChrgitmType = "14"
3839
+
3840
+						break
3841
+					case 5:
3842
+						item.MedChrgitmType = "08"
3843
+
3844
+						break
3845
+					case 6:
3846
+						item.MedChrgitmType = "14"
3847
+
3848
+						break
3849
+					case 7:
3850
+						item.MedChrgitmType = "14"
3851
+
3852
+						break
3853
+					case 8:
3854
+						item.MedChrgitmType = "03"
3855
+						break
3856
+					case 9:
3857
+						item.MedChrgitmType = "14"
3858
+						break
3859
+
3625
 					}
3860
 					}
3861
+
3862
+				} else if item.HisPrescriptionProject.Type == 3 {
3863
+					item.MedChrgitmType = "08"
3626
 				}
3864
 				}
3627
 			}
3865
 			}
3628
 		}
3866
 		}
3867
+
3868
+		for _, item := range orderInfos_two {
3869
+			if item.MedChrgitmType == "01" { //床位费
3870
+				bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
3871
+				bedCostSelfTotal = bedCostTotal
3872
+			}
3873
+
3874
+			if item.MedChrgitmType == "03" { //检查费
3875
+				checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
3876
+				checkCostSelfTotal = checkCostTotal
3877
+			}
3878
+
3879
+			if item.MedChrgitmType == "04" { //化验费
3880
+				laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
3881
+				laboratoryCostSelfTotal = laboratoryCostTotal
3882
+			}
3883
+
3884
+			if item.MedChrgitmType == "05" { //治疗费
3885
+				treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
3886
+				treatCostSelfTotal = treatCostTotal
3887
+			}
3888
+
3889
+			if item.MedChrgitmType == "06" { //手术费
3890
+				treatCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
3891
+				operationCostSelfTotal = treatCostTotal
3892
+			}
3893
+
3894
+			if item.MedChrgitmType == "08" { //材料费
3895
+				materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
3896
+				materialCostSelfTotal = materialCostTotal
3897
+			}
3898
+
3899
+			if item.MedChrgitmType == "09" { //西药费
3900
+				westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
3901
+				westernMedicineCostSelfTotal = westernMedicineCostTotal
3902
+			}
3903
+
3904
+			if item.MedChrgitmType == "11" { //中成费
3905
+				chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
3906
+				chineseTraditionalMedicineCostSelfTotal = chineseTraditionalMedicineCostTotal
3907
+			}
3908
+
3909
+			if item.MedChrgitmType == "14" { //其他费
3910
+				otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
3911
+				otherCostSelfTotal = otherCostTotal
3912
+			}
3913
+
3914
+		}
3915
+
3629
 	} else {
3916
 	} else {
3630
 		for _, item := range orderInfos {
3917
 		for _, item := range orderInfos {
3631
 			if item.MedChrgitmType == "01" { //床位费
3918
 			if item.MedChrgitmType == "01" { //床位费
4516
 		prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
4803
 		prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
4517
 	}
4804
 	}
4518
 
4805
 
4806
+	if reg_type == 1111 || reg_type == 1112 {
4807
+		reg_type = 11
4808
+	}
4809
+
4519
 	timestamp := time.Now().Unix()
4810
 	timestamp := time.Now().Unix()
4520
 	tempTime := time.Unix(timestamp, 0)
4811
 	tempTime := time.Unix(timestamp, 0)
4521
 	timeFormat := tempTime.Format("20060102150405")
4812
 	timeFormat := tempTime.Format("20060102150405")

+ 77 - 39
controllers/mobile_api_controllers/dialysis_api_controller.go Näytä tiedosto

1111
 	oxygen_uptake, _ := c.GetInt64("oxygen_uptake")
1111
 	oxygen_uptake, _ := c.GetInt64("oxygen_uptake")
1112
 	oxygen_flow := c.GetString("oxygen_flow")
1112
 	oxygen_flow := c.GetString("oxygen_flow")
1113
 	oxygen_time := c.GetString("oxygen_time")
1113
 	oxygen_time := c.GetString("oxygen_time")
1114
+
1115
+	hemodialysis_pipelines := c.GetString("hemodialysis_pipelines")
1116
+	hemodialysis_pipelines_count, _ := c.GetFloat("hemodialysis_pipelines_count", 0)
1117
+
1118
+	puncture_needle := c.GetString("puncture_needle")
1119
+	puncture_needle_count, _ := c.GetFloat("puncture_needle_count", 0)
1120
+
1121
+	epo := c.GetString("epo")
1122
+	epo_count, _ := c.GetFloat("epo_count", 0)
1123
+
1114
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1124
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1115
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1125
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1116
 	//
1126
 	//
1208
 		OxygenUptake:               oxygen_uptake,
1218
 		OxygenUptake:               oxygen_uptake,
1209
 		OxygenFlow:                 oxygen_flow,
1219
 		OxygenFlow:                 oxygen_flow,
1210
 		OxygenTime:                 oxygen_time,
1220
 		OxygenTime:                 oxygen_time,
1221
+		HemodialysisPipelines:      hemodialysis_pipelines,
1222
+		HemodialysisPipelinesCount: hemodialysis_pipelines_count,
1223
+		PunctureNeedle:             puncture_needle,
1224
+		PunctureNeedleCount:        puncture_needle_count,
1225
+		Epo:                        epo,
1226
+		EpoCount:                   epo_count,
1211
 	}
1227
 	}
1212
 
1228
 
1213
 	//查询最近透析准备表里是否存在 透析器 灌流器
1229
 	//查询最近透析准备表里是否存在 透析器 灌流器
2020
 	oxygen_uptake, _ := c.GetInt64("oxygen_uptake")
2036
 	oxygen_uptake, _ := c.GetInt64("oxygen_uptake")
2021
 	oxygen_flow := c.GetString("oxygen_flow")
2037
 	oxygen_flow := c.GetString("oxygen_flow")
2022
 	oxygen_time := c.GetString("oxygen_time")
2038
 	oxygen_time := c.GetString("oxygen_time")
2039
+
2040
+	hemodialysis_pipelines := c.GetString("hemodialysis_pipelines")
2041
+	hemodialysis_pipelines_count, _ := c.GetFloat("hemodialysis_pipelines_count", 0)
2042
+
2043
+	puncture_needle := c.GetString("puncture_needle")
2044
+	puncture_needle_count, _ := c.GetFloat("puncture_needle_count", 0)
2045
+
2046
+	epo := c.GetString("epo")
2047
+	epo_count, _ := c.GetFloat("epo_count", 0)
2048
+
2023
 	if mode_id > 0 {
2049
 	if mode_id > 0 {
2024
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
2050
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
2025
 	}
2051
 	}
2079
 		DialyzerPerfusionApparatus: dialyzerPerfusionApparatus,
2105
 		DialyzerPerfusionApparatus: dialyzerPerfusionApparatus,
2080
 		BodyFluid:                  body_fluid,
2106
 		BodyFluid:                  body_fluid,
2081
 
2107
 
2082
-		SpecialMedicine:           special_medicine,
2083
-		SpecialMedicineOther:      special_medicine_other,
2084
-		DisplaceLiquiPart:         displace_liqui_part,
2085
-		DisplaceLiquiValue:        displace_liqui_value,
2086
-		BloodAccess:               blood_access,
2087
-		Ultrafiltration:           ultrafiltration,
2088
-		BodyFluidOther:            body_fluid_other,
2089
-		ReplacementTotal:          replacement_total,
2090
-		Niprocart:                 niprocart,
2091
-		Jms:                       jms,
2092
-		FistulaNeedleSet:          fistula_needle_set,
2093
-		FistulaNeedleSet16:        fistula_needle_set_16,
2094
-		Hemoperfusion:             hemoperfusion,
2095
-		DialyserSterilised:        dialyser_sterilised,
2096
-		Filtryzer:                 filtryzer,
2097
-		TargetKtv:                 target_ktv,
2098
-		Dialyzers:                 dialyzers,
2099
-		Injector:                  injector,
2100
-		Bloodlines:                bloodlines,
2101
-		TubingHemodialysis:        tubing_hemodialysis,
2102
-		Package:                   safe_package,
2103
-		ALiquid:                   a_liquid,
2104
-		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
2105
-		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
2106
-		Blood:                     blood,
2107
-		DialysisDialyszers:        dialysis_dialyszers,
2108
-		DialysisIrrigation:        dialysis_irrigation,
2109
-		AntioxidantCommodityName:  antioxidant_commodity_name,
2110
-		DisplaceSpeed:             displace_speed,
2111
-		Illness:                   illness,
2112
-		Amylaceum:                 amylaceum,
2113
-		SingleWater:               single_water,
2114
-		SingleTime:                single_time,
2115
-		ReplacementFlow:           replacement_flow,
2116
-		PlasmaSeparator:           plasma_separator,
2117
-		BilirubinAdsorptionColumn: bilirubin_adsorption_column,
2118
-		OxygenUptake:              oxygen_uptake,
2119
-		OxygenTime:                oxygen_time,
2120
-		OxygenFlow:                oxygen_flow,
2108
+		SpecialMedicine:            special_medicine,
2109
+		SpecialMedicineOther:       special_medicine_other,
2110
+		DisplaceLiquiPart:          displace_liqui_part,
2111
+		DisplaceLiquiValue:         displace_liqui_value,
2112
+		BloodAccess:                blood_access,
2113
+		Ultrafiltration:            ultrafiltration,
2114
+		BodyFluidOther:             body_fluid_other,
2115
+		ReplacementTotal:           replacement_total,
2116
+		Niprocart:                  niprocart,
2117
+		Jms:                        jms,
2118
+		FistulaNeedleSet:           fistula_needle_set,
2119
+		FistulaNeedleSet16:         fistula_needle_set_16,
2120
+		Hemoperfusion:              hemoperfusion,
2121
+		DialyserSterilised:         dialyser_sterilised,
2122
+		Filtryzer:                  filtryzer,
2123
+		TargetKtv:                  target_ktv,
2124
+		Dialyzers:                  dialyzers,
2125
+		Injector:                   injector,
2126
+		Bloodlines:                 bloodlines,
2127
+		TubingHemodialysis:         tubing_hemodialysis,
2128
+		Package:                    safe_package,
2129
+		ALiquid:                    a_liquid,
2130
+		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
2131
+		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
2132
+		Blood:                      blood,
2133
+		DialysisDialyszers:         dialysis_dialyszers,
2134
+		DialysisIrrigation:         dialysis_irrigation,
2135
+		AntioxidantCommodityName:   antioxidant_commodity_name,
2136
+		DisplaceSpeed:              displace_speed,
2137
+		Illness:                    illness,
2138
+		Amylaceum:                  amylaceum,
2139
+		SingleWater:                single_water,
2140
+		SingleTime:                 single_time,
2141
+		ReplacementFlow:            replacement_flow,
2142
+		PlasmaSeparator:            plasma_separator,
2143
+		BilirubinAdsorptionColumn:  bilirubin_adsorption_column,
2144
+		OxygenUptake:               oxygen_uptake,
2145
+		OxygenTime:                 oxygen_time,
2146
+		OxygenFlow:                 oxygen_flow,
2147
+		HemodialysisPipelines:      hemodialysis_pipelines,
2148
+		HemodialysisPipelinesCount: hemodialysis_pipelines_count,
2149
+		PunctureNeedle:             puncture_needle,
2150
+		PunctureNeedleCount:        puncture_needle_count,
2151
+		Epo:                        epo,
2152
+		EpoCount:                   epo_count,
2121
 	}
2153
 	}
2122
 
2154
 
2123
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
2155
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
2207
 		TargetKtv:                  target_ktv,
2239
 		TargetKtv:                  target_ktv,
2208
 		DialysisDialyszers:         dialysis_dialyszers,
2240
 		DialysisDialyszers:         dialysis_dialyszers,
2209
 		DialysisIrrigation:         dialysis_irrigation,
2241
 		DialysisIrrigation:         dialysis_irrigation,
2242
+		HemodialysisPipelines:      hemodialysis_pipelines,
2243
+		HemodialysisPipelinesCount: hemodialysis_pipelines_count,
2244
+		PunctureNeedle:             puncture_needle,
2245
+		PunctureNeedleCount:        puncture_needle_count,
2246
+		Epo:                        epo,
2247
+		EpoCount:                   epo_count,
2210
 	}
2248
 	}
2211
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
2249
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
2212
 
2250
 

+ 30 - 0
controllers/patient_api_controller.go Näytä tiedosto

3175
 		solution.Remark = remark
3175
 		solution.Remark = remark
3176
 	}
3176
 	}
3177
 
3177
 
3178
+	if dataBody["hemodialysis_pipelines"] != nil && reflect.TypeOf(dataBody["hemodialysis_pipelines"]).String() == "string" {
3179
+		hemodialysis_pipelines := dataBody["hemodialysis_pipelines"].(string)
3180
+		solution.HemodialysisPipelines = hemodialysis_pipelines
3181
+	}
3182
+
3183
+	if dataBody["hemodialysis_pipelines_count"] != nil && reflect.TypeOf(dataBody["hemodialysis_pipelines_count"]).String() == "string" {
3184
+		hemodialysis_pipelines_count, _ := strconv.ParseFloat(dataBody["hemodialysis_pipelines_count"].(string), 64)
3185
+		solution.HemodialysisPipelinesCount = hemodialysis_pipelines_count
3186
+	}
3187
+
3188
+	if dataBody["puncture_needle"] != nil && reflect.TypeOf(dataBody["puncture_needle"]).String() == "string" {
3189
+		puncture_needle := dataBody["puncture_needle"].(string)
3190
+		solution.PunctureNeedle = puncture_needle
3191
+	}
3192
+
3193
+	if dataBody["puncture_needle_count"] != nil && reflect.TypeOf(dataBody["puncture_needle_count"]).String() == "string" {
3194
+		puncture_needle_count, _ := strconv.ParseFloat(dataBody["puncture_needle_count"].(string), 64)
3195
+		solution.PunctureNeedleCount = puncture_needle_count
3196
+	}
3197
+
3198
+	if dataBody["epo"] != nil && reflect.TypeOf(dataBody["epo"]).String() == "string" {
3199
+		epo := dataBody["epo"].(string)
3200
+		solution.Epo = epo
3201
+	}
3202
+
3203
+	if dataBody["epo_count"] != nil && reflect.TypeOf(dataBody["epo_count"]).String() == "string" {
3204
+		epo_count, _ := strconv.ParseFloat(dataBody["epo_count"].(string), 64)
3205
+		solution.EpoCount = epo_count
3206
+	}
3207
+
3178
 	if dataBody["created_time"] != nil && reflect.TypeOf(dataBody["created_time"]).String() == "float64" {
3208
 	if dataBody["created_time"] != nil && reflect.TypeOf(dataBody["created_time"]).String() == "float64" {
3179
 		created_time := int64(dataBody["created_time"].(float64))
3209
 		created_time := int64(dataBody["created_time"].(float64))
3180
 
3210
 

+ 7 - 0
models/common_models.go Näytä tiedosto

287
 	UserSysBeforeCount         int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
287
 	UserSysBeforeCount         int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
288
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
288
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
289
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
289
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
290
+
291
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
292
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
293
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
294
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
295
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
296
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
290
 }
297
 }
291
 
298
 
292
 func (BloodDialysisPrescription) TableName() string {
299
 func (BloodDialysisPrescription) TableName() string {

+ 7 - 0
models/dialysis_parameter_models.go Näytä tiedosto

125
 	TargetUltrafiltration      float64 `gorm:"column:target_ultrafiltration" json:"target_ultrafiltration" form:"target_ultrafiltration"`
125
 	TargetUltrafiltration      float64 `gorm:"column:target_ultrafiltration" json:"target_ultrafiltration" form:"target_ultrafiltration"`
126
 	BloodFlowVolume            float64 `gorm:"column:blood_flow_volume" json:"blood_flow_volume" form:"blood_flow_volume"`
126
 	BloodFlowVolume            float64 `gorm:"column:blood_flow_volume" json:"blood_flow_volume" form:"blood_flow_volume"`
127
 	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus" form:"dialyzer_perfusion_apparatus"`
127
 	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus" form:"dialyzer_perfusion_apparatus"`
128
+
129
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
130
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
131
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
132
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
133
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
134
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
128
 }
135
 }
129
 
136
 
130
 func (DialysisPrescriptionParameter) TableName() string {
137
 func (DialysisPrescriptionParameter) TableName() string {

+ 7 - 0
models/new_monitor.go Näytä tiedosto

61
 	Status                int64   `gorm:"column:status" json:"status"`
61
 	Status                int64   `gorm:"column:status" json:"status"`
62
 	RecordDate            int64   `gorm:"column:record_date" json:"record_date"`
62
 	RecordDate            int64   `gorm:"column:record_date" json:"record_date"`
63
 	TargetUltrafiltration float64 `gorm:"column:target_ultrafiltration" json:"target_ultrafiltration"`
63
 	TargetUltrafiltration float64 `gorm:"column:target_ultrafiltration" json:"target_ultrafiltration"`
64
+
65
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
66
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
67
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
68
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
69
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
70
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
64
 }
71
 }
65
 
72
 
66
 func (VMDialysisPrescription) TableName() string {
73
 func (VMDialysisPrescription) TableName() string {

+ 20 - 0
models/patient_models.go Näytä tiedosto

240
 	OxygenUptake               int64         `gorm:"column:oxygen_uptake" json:"oxygen_uptake" form:"oxygen_uptake"`
240
 	OxygenUptake               int64         `gorm:"column:oxygen_uptake" json:"oxygen_uptake" form:"oxygen_uptake"`
241
 	OxygenFlow                 string        `gorm:"column:oxygen_flow" json:"oxygen_flow" form:"oxygen_flow"`
241
 	OxygenFlow                 string        `gorm:"column:oxygen_flow" json:"oxygen_flow" form:"oxygen_flow"`
242
 	OxygenTime                 string        `gorm:"column:oxygen_time" json:"oxygen_time" form:"oxygen_time"`
242
 	OxygenTime                 string        `gorm:"column:oxygen_time" json:"oxygen_time" form:"oxygen_time"`
243
+
244
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
245
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
246
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
247
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
248
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
249
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
243
 }
250
 }
244
 
251
 
245
 func (DialysisPrescription) TableName() string {
252
 func (DialysisPrescription) TableName() string {
258
 	BloodAccess                int64   `gorm:"column:blood_access" json:"blood_access"`
265
 	BloodAccess                int64   `gorm:"column:blood_access" json:"blood_access"`
259
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
266
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
260
 	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
267
 	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
268
+
269
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
270
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
271
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
272
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
273
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
274
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
261
 }
275
 }
262
 
276
 
263
 func (DialysisPrescriptionList) TableName() string {
277
 func (DialysisPrescriptionList) TableName() string {
348
 	OxygenUptake               int64   `gorm:"column:oxygen_uptake" json:"oxygen_uptake" form:"oxygen_uptake"`
362
 	OxygenUptake               int64   `gorm:"column:oxygen_uptake" json:"oxygen_uptake" form:"oxygen_uptake"`
349
 	OxygenFlow                 string  `gorm:"column:oxygen_flow" json:"oxygen_flow" form:"oxygen_flow"`
363
 	OxygenFlow                 string  `gorm:"column:oxygen_flow" json:"oxygen_flow" form:"oxygen_flow"`
350
 	OxygenTime                 string  `gorm:"column:oxygen_time" json:"oxygen_time" form:"oxygen_time"`
364
 	OxygenTime                 string  `gorm:"column:oxygen_time" json:"oxygen_time" form:"oxygen_time"`
365
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
366
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
367
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
368
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
369
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
370
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
351
 }
371
 }
352
 
372
 
353
 func (DialysisSolution) TableName() string {
373
 func (DialysisSolution) TableName() string {

+ 7 - 0
models/service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Näytä tiedosto

192
 	ALiquid                    int64   `gorm:"column:a_liquid" json:"a_liquid"`
192
 	ALiquid                    int64   `gorm:"column:a_liquid" json:"a_liquid"`
193
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
193
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
194
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
194
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
195
+
196
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
197
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
198
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
199
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
200
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
201
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
195
 }
202
 }
196
 
203
 
197
 func (PrescriptionVM) TableName() string {
204
 func (PrescriptionVM) TableName() string {

+ 7 - 0
models/service/statistics_service/index_models.go Näytä tiedosto

18
 	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
18
 	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
19
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
19
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
20
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
20
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
21
+
22
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
23
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
24
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
25
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
26
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
27
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
21
 }
28
 }
22
 
29
 
23
 func (VMDialysisPrescription) TableName() string {
30
 func (VMDialysisPrescription) TableName() string {

+ 13 - 0
models/user_models.go Näytä tiedosto

191
 	ALiquid                    int64   `gorm:"column:a_liquid" json:"a_liquid" form:"a_liquid"`
191
 	ALiquid                    int64   `gorm:"column:a_liquid" json:"a_liquid" form:"a_liquid"`
192
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
192
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
193
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
193
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
194
+
195
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
196
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
197
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
198
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
199
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
200
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
194
 }
201
 }
195
 
202
 
196
 func (XtDialysisPrescription) TableName() string {
203
 func (XtDialysisPrescription) TableName() string {
337
 	TargetKtv                  float64 `gorm:"column:target_ktv" json:"target_ktv" form:"target_ktv"`
344
 	TargetKtv                  float64 `gorm:"column:target_ktv" json:"target_ktv" form:"target_ktv"`
338
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
345
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
339
 	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
346
 	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
347
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
348
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
349
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
350
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
351
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
352
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
340
 }
353
 }
341
 
354
 
342
 func (XtDialysisSolution) TableName() string {
355
 func (XtDialysisSolution) TableName() string {

+ 6 - 0
service/his_project_service.go Näytä tiedosto

269
 	return
269
 	return
270
 }
270
 }
271
 
271
 
272
+func UpdateHisPrescriptionHisIDTwo(his_patient_id int64, patient_id int64, record_time int64, org_id int64, start_time int64) {
273
+	XTWriteDB().Model(&models.HisPrescription{}).Where("record_date <= ? AND record_date >= ? AND user_org_id = ? AND patient_id = ? AND his_patient_id = 0 AND order_status <> 2", record_time, start_time, org_id, patient_id).Updates(map[string]interface{}{"his_patient_id": his_patient_id})
274
+	XTWriteDB().Model(&models.HisPrescriptionInfo{}).Where("record_date = ? AND user_org_id = ? AND patient_id = ? AND his_patient_id = 0 AND order_status <> 2", record_time, start_time, org_id, patient_id).Updates(map[string]interface{}{"his_patient_id": his_patient_id})
275
+	return
276
+}
277
+
272
 func GetBloodPatientByIdCard(idcard string, orgid int64) (*models.XtPatients, error) {
278
 func GetBloodPatientByIdCard(idcard string, orgid int64) (*models.XtPatients, error) {
273
 	var patients models.XtPatients
279
 	var patients models.XtPatients
274
 	var err error
280
 	var err error

+ 45 - 25
service/his_service.go Näytä tiedosto

475
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
475
 		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
476
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1")
476
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1")
477
 		}).Preload("TempHisOrder", func(db *gorm.DB) *gorm.DB {
477
 		}).Preload("TempHisOrder", func(db *gorm.DB) *gorm.DB {
478
-		return db.Where("status = 1 AND user_org_id = ?", org_id)
478
+		return db.Where("status = 1 AND user_org_id = ? AND order_status <> 3  AND order_status <> 2  ", org_id)
479
 	}).
479
 	}).
480
 		Where("(user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND order_status <> 3 AND p_type = ?) AND  (his_patient_id = ? OR his_patient_id = 0)", org_id, record_date, patient_id, p_type, his_patient_id).
480
 		Where("(user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND order_status <> 3 AND p_type = ?) AND  (his_patient_id = ? OR his_patient_id = 0)", org_id, record_date, patient_id, p_type, his_patient_id).
481
 		Find(&prescription).Error
481
 		Find(&prescription).Error
718
 		Preload("VMDrugSalesReturnInfo", "status = 1 AND org_id = ?", org_id).
718
 		Preload("VMDrugSalesReturnInfo", "status = 1 AND org_id = ?", org_id).
719
 		Preload("VMDrugWarehouseOutInfo", "status = 1 AND org_id = ?", org_id).
719
 		Preload("VMDrugWarehouseOutInfo", "status = 1 AND org_id = ?", org_id).
720
 		Preload("VMDrugCancelStockInfo", "status = 1 AND org_id = ?", org_id).
720
 		Preload("VMDrugCancelStockInfo", "status = 1 AND org_id = ?", org_id).
721
-		Where("org_id = ?  AND status = 1", org_id).Find(&list).Error
721
+		Where("org_id = ?  AND status = 1 AND  find_in_set('停用',drug_status) = 0", org_id).Find(&list).Error
722
 	return
722
 	return
723
 }
723
 }
724
 
724
 
1024
 }
1024
 }
1025
 
1025
 
1026
 func UpdataOrderStatus(id int64, number string, user_org_id int64) (err error) {
1026
 func UpdataOrderStatus(id int64, number string, user_org_id int64) (err error) {
1027
-	err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix()}).Error
1027
+	err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix(), "status": 0}).Error
1028
 	err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 1, "mtime": time.Now().Unix()}).Error
1028
 	err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 1, "mtime": time.Now().Unix()}).Error
1029
 	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 1, "mtime": time.Now().Unix()}).Error
1029
 	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 1, "mtime": time.Now().Unix()}).Error
1030
-
1031
 	return
1030
 	return
1032
-
1033
 }
1031
 }
1034
 
1032
 
1035
 func UpdataOrderInfoStatus(id int64, number string, user_org_id int64) {
1033
 func UpdataOrderInfoStatus(id int64, number string, user_org_id int64) {
1163
 
1161
 
1164
 func GetNewHisPatientPrescriptionList(org_id int64, keywords string, record_date int64, page int64, limit int64) (patients []*VMHisHospitalPrescriptionInfo, err error, total int64) {
1162
 func GetNewHisPatientPrescriptionList(org_id int64, keywords string, record_date int64, page int64, limit int64) (patients []*VMHisHospitalPrescriptionInfo, err error, total int64) {
1165
 	offset := (page - 1) * limit
1163
 	offset := (page - 1) * limit
1166
-	db := readDb.Model(&VMHisHospitalPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 ", org_id, record_date)
1164
+	db := readDb.Model(&VMHisHospitalPrescriptionInfo{}).Where("his_prescription_info.user_org_id = ? AND his_prescription_info.status = 1 AND his_prescription_info.record_date = ? AND his_prescription_info.p_type <> 1 ", org_id, record_date)
1167
 	if len(keywords) > 0 {
1165
 	if len(keywords) > 0 {
1168
 		keywords = "%" + keywords + "%"
1166
 		keywords = "%" + keywords + "%"
1169
-		db = db.Joins("JOIN xt_patients as p On his_prescription_info.patient_id = p.id AND p.user_org_id = ? AND p.name like ?", org_id, keywords)
1167
+		db = db.Joins("JOIN xt_patients  On his_prescription_info.patient_id = xt_patients.id  AND xt_patients.name like ?", keywords)
1170
 	}
1168
 	}
1171
-	db = db.Preload("Patients", "user_org_id = ? AND status = 1", org_id)
1172
-	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND p_type <> 1", org_id)
1169
+	db = db.Preload("Patients", "xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
1170
+	db = db.Preload("HisPrescription", "his_prescription.user_org_id = ? AND his_prescription.status = 1 AND his_prescription.p_type <> 1", org_id)
1173
 	db = db.Count(&total)
1171
 	db = db.Count(&total)
1174
 	err = db.Limit(limit).Offset(offset).Find(&patients).Error
1172
 	err = db.Limit(limit).Offset(offset).Find(&patients).Error
1175
 	return
1173
 	return
1527
 }
1525
 }
1528
 
1526
 
1529
 type HisOrderInfo struct {
1527
 type HisOrderInfo struct {
1530
-	ID                     int64                  `gorm:"column:id" json:"id" form:"id"`
1531
-	OrderNumber            string                 `gorm:"column:order_number" json:"order_number" form:"order_number"`
1532
-	UploadDate             int64                  `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
1533
-	AdviceId               int64                  `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
1534
-	DetItemFeeSumamt       float64                `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
1535
-	Cnt                    float64                `gorm:"column:cnt" json:"cnt" form:"cnt"`
1536
-	Pric                   float64                `gorm:"column:pric" json:"pric" form:"pric"`
1537
-	PatientId              int64                  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1538
-	MedChrgitmType         string                 `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
1539
-	Status                 int64                  `gorm:"column:status" json:"status" form:"status"`
1540
-	FeedetlSn              string                 `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1541
-	ChldMedcFlag           string                 `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
1542
-	ChrgitmLv              string                 `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
1543
-	UserOrgId              int64                  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1544
-	ProjectId              int64                  `gorm:"column:project_id" json:"project_id" form:"project_id"`
1545
-	ItemId                 int64                  `gorm:"column:item_id" json:"item_id" form:"item_id"`
1528
+	ID               int64   `gorm:"column:id" json:"id" form:"id"`
1529
+	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`
1530
+	UploadDate       int64   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
1531
+	AdviceId         int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
1532
+	DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
1533
+	Cnt              float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
1534
+	Pric             float64 `gorm:"column:pric" json:"pric" form:"pric"`
1535
+	PatientId        int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1536
+	MedChrgitmType   string  `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
1537
+	Status           int64   `gorm:"column:status" json:"status" form:"status"`
1538
+	FeedetlSn        string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1539
+	ChldMedcFlag     string  `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
1540
+	ChrgitmLv        string  `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
1541
+	UserOrgId        int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1542
+	ProjectId        int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
1543
+	ItemId           int64   `gorm:"column:item_id" json:"item_id" form:"item_id"`
1544
+	FulamtOwnpayAmt  float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
1545
+
1546
 	HisPrescriptionProject HisPrescriptionProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
1546
 	HisPrescriptionProject HisPrescriptionProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
1547
 	HisDoctorAdviceInfo    HisDoctorAdviceInfo    `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advice"`
1547
 	HisDoctorAdviceInfo    HisDoctorAdviceInfo    `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advice"`
1548
 }
1548
 }
2077
 
2077
 
2078
 	return
2078
 	return
2079
 }
2079
 }
2080
+
2081
+func GetNewAllUnChargeHisPatientListTwo(org_id int64, keywords string, record_date int64) (patients []*NewTempPatients, err error) {
2082
+	db := readDb.Model(&NewTempPatients{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
2083
+	db = db.Preload("HisPatient", func(db *gorm.DB) *gorm.DB {
2084
+		return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", org_id, record_date).Preload("VMHisOrders", "user_org_id = ? AND status = 1 AND settle_accounts_date = ? AND order_status <> 2", org_id, record_date)
2085
+	})
2086
+	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND order_status <> 2 AND order_status <> 3", org_id, record_date)
2087
+	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND prescription_status <> 3", org_id, record_date).Find(&patients).Error
2088
+
2089
+	for _, item := range patients {
2090
+		for _, sumItem := range item.HisPatient {
2091
+			if len(sumItem.VMHisOrders) > 0 {
2092
+				sumItem.VMHisOrder.OrderStatus = sumItem.VMHisOrders[len(sumItem.VMHisOrders)-1].OrderStatus
2093
+			}
2094
+		}
2095
+
2096
+	}
2097
+
2098
+	return
2099
+}

+ 7 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Näytä tiedosto

203
 	ReplacementFlow            string  `gorm:"column:replacement_flow" json:"replacement_flow" form:"replacement_flow"`
203
 	ReplacementFlow            string  `gorm:"column:replacement_flow" json:"replacement_flow" form:"replacement_flow"`
204
 	PlasmaSeparator            string  `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
204
 	PlasmaSeparator            string  `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
205
 	BilirubinAdsorptionColumn  string  `gorm:"column:bilirubin_adsorption_column" json:"bilirubin_adsorption_column" form:"bilirubin_adsorption_column"`
205
 	BilirubinAdsorptionColumn  string  `gorm:"column:bilirubin_adsorption_column" json:"bilirubin_adsorption_column" form:"bilirubin_adsorption_column"`
206
+
207
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
208
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
209
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
210
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
211
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
212
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
206
 }
213
 }
207
 
214
 
208
 func (PrescriptionVM) TableName() string {
215
 func (PrescriptionVM) TableName() string {

+ 7 - 0
service/statistics_service/index_models.go Näytä tiedosto

18
 	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
18
 	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
19
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
19
 	AnticoagulantStopTimeMin   int64   `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
20
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
20
 	AnticoagulantStopTimeHour  int64   `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
21
+
22
+	HemodialysisPipelines      string  `gorm:"column:hemodialysis_pipelines" json:"hemodialysis_pipelines" form:"hemodialysis_pipelines"`
23
+	HemodialysisPipelinesCount float64 `gorm:"column:hemodialysis_pipelines_count" json:"hemodialysis_pipelines_count" form:"hemodialysis_pipelines_count"`
24
+	PunctureNeedle             string  `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
25
+	PunctureNeedleCount        float64 `gorm:"column:puncture_needle_count" json:"puncture_needle_count" form:"puncture_needle_count"`
26
+	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
27
+	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
21
 }
28
 }
22
 
29
 
23
 func (VMDialysisPrescription) TableName() string {
30
 func (VMDialysisPrescription) TableName() string {