Browse Source

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

28169 2 years ago
parent
commit
a658f05623

+ 1 - 1
controllers/data_api_controller.go View File

@@ -400,7 +400,7 @@ func configFormData(dataconfig *models.Dataconfig, data []byte) (code int) {
400 400
 	}
401 401
 	dataconfig.Module = module
402 402
 
403
-	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" || module == "main_content" || module == "patient_case" || module == "tentative_diagnosis" || module == "diagnostic_basis" || module == "differential_diagnosis" || module == "treatment_plan" {
403
+	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" || module == "special_treatment" || module == "template_summary" || module == "template_plan" || module == "admitting_diagnosis" || module == "discharge_diagnosis" || module == "diagnosis_admission" || module == "treatment" || module == "illness_discharge" || module == "discharge_advice" || module == "dialysis_remark" || module == "catheter_operation" || module == "main_content" || module == "patient_case" || module == "tentative_diagnosis" || module == "diagnostic_basis" || module == "differential_diagnosis" || module == "treatment_plan" || module == "sick_history" {
404 404
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
405 405
 			utils.ErrorLog("title")
406 406
 			code = enums.ErrorCodeParamWrong

+ 1 - 1
controllers/doctors_api_controller.go View File

@@ -164,7 +164,7 @@ func (c *DoctorsApiController) ScheduleAdvices() {
164 164
 func (c *DoctorsApiController) GetAllDoctorAndNurse() {
165 165
 
166 166
 	adminUserInfo := c.GetAdminUserInfo()
167
-	doctors, nursers, _ := service.GetAllDoctorAndNurseSix(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
167
+	doctors, nursers, _ := service.GetAllDoctorAndNurseSeven(adminUserInfo.CurrentOrgId)
168 168
 
169 169
 	c.ServeSuccessJSON(map[string]interface{}{
170 170
 		"doctors": doctors,

+ 2 - 3
controllers/his_api_controller.go View File

@@ -4278,13 +4278,13 @@ func (c *HisApiController) DeleteProject() {
4278 4278
 	label.Status = 0
4279 4279
 	service.CreateHisLabelRecord(&label)
4280 4280
 
4281
+	fmt.Println(goodOutConfig.IsOpen)
4281 4282
 	if goodOutConfig.IsOpen != 1 {
4282 4283
 		if stockConfig.IsOpen == 1 {
4283 4284
 			if project.Type == 2 {
4284 4285
 				err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
4285 4286
 				fmt.Println(err)
4286 4287
 			}
4287
-
4288 4288
 			if project.Type == 3 && project.IsOut == 1 {
4289 4289
 
4290 4290
 				houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
@@ -4545,7 +4545,6 @@ func (c *HisApiController) DeleteProject() {
4545 4545
 
4546 4546
 	//保存处方出库
4547 4547
 	if goodOutConfig.IsOpen == 1 {
4548
-
4549 4548
 		if project.Type == 3 {
4550 4549
 			houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
4551 4550
 			good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
@@ -9785,7 +9784,7 @@ func (c *HisApiController) GetPrivateExpensesInfo() {
9785 9784
 	}
9786 9785
 
9787 9786
 	orderInfos = append(orderInfos, orderInfos_two...)
9788
-	if c.GetAdminUserInfo().CurrentOrgId != 10138 {
9787
+	if c.GetAdminUserInfo().CurrentOrgId != 10138 || c.GetAdminUserInfo().CurrentOrgId != 10278 {
9789 9788
 		orderInfos = append(orderInfos, orderInfos_three...)
9790 9789
 
9791 9790
 	}

+ 9 - 8
controllers/his_config_api_controller.go View File

@@ -515,6 +515,7 @@ func (this *HisConfigApiController) GetModeTemplateName() {
515 515
 func (this *HisConfigApiController) GetPrescriptionTemplateDetail() {
516 516
 
517 517
 	mode_id, _ := this.GetInt64("mode_id")
518
+
518 519
 	orgId := this.GetAdminUserInfo().CurrentOrgId
519 520
 	template, _ := service.GetModeTemplateNameDetail(mode_id, orgId)
520 521
 
@@ -1014,7 +1015,7 @@ func (c *HisConfigApiController) GetDrugsName() {
1014 1015
 
1015 1016
 }
1016 1017
 
1017
-//配置项
1018
+// 配置项
1018 1019
 func (c *HisConfigApiController) GetModeConfigs() {
1019 1020
 	var err error
1020 1021
 	defer func() {
@@ -1177,7 +1178,7 @@ func (c *HisConfigApiController) ReplaceConfig() {
1177 1178
 
1178 1179
 }
1179 1180
 
1180
-//批量替换——药品
1181
+// 批量替换——药品
1181 1182
 func (c *HisConfigApiController) ReplaceSaveDrug() {
1182 1183
 	var g errgroup.Group
1183 1184
 	var err error
@@ -1323,7 +1324,7 @@ func (c *HisConfigApiController) ReplaceSaveDrug() {
1323 1324
 	return
1324 1325
 }
1325 1326
 
1326
-//批量替换项目
1327
+// 批量替换项目
1327 1328
 func (c *HisConfigApiController) ReplaceSaveProject() {
1328 1329
 	var g errgroup.Group
1329 1330
 	var err error
@@ -1489,7 +1490,7 @@ func (c *HisConfigApiController) ReplaceSaveProject() {
1489 1490
 	return
1490 1491
 }
1491 1492
 
1492
-//批量删除项目
1493
+// 批量删除项目
1493 1494
 func (c *HisConfigApiController) BatchDeleteItems() {
1494 1495
 	var g errgroup.Group
1495 1496
 	var err error
@@ -1539,7 +1540,7 @@ func (c *HisConfigApiController) BatchDeleteItems() {
1539 1540
 	return
1540 1541
 }
1541 1542
 
1542
-//批量删除药品
1543
+// 批量删除药品
1543 1544
 func (c *HisConfigApiController) DeleteDrugsBatch() {
1544 1545
 	var g errgroup.Group
1545 1546
 	var err error
@@ -1589,7 +1590,7 @@ func (c *HisConfigApiController) DeleteDrugsBatch() {
1589 1590
 	return
1590 1591
 }
1591 1592
 
1592
-//批量添加
1593
+// 批量添加
1593 1594
 func (c *HisConfigApiController) AddsTemplate() {
1594 1595
 	var g errgroup.Group
1595 1596
 	var err error
@@ -1787,7 +1788,7 @@ func (c *HisConfigApiController) AddsTemplate() {
1787 1788
 
1788 1789
 }
1789 1790
 
1790
-//根据透析模式和患者id获取该患者的处方内容
1791
+// 根据透析模式和患者id获取该患者的处方内容
1791 1792
 func (c *HisConfigApiController) PTemplateInformation() {
1792 1793
 	var err error
1793 1794
 	defer func() {
@@ -1812,7 +1813,7 @@ func (c *HisConfigApiController) PTemplateInformation() {
1812 1813
 	return
1813 1814
 }
1814 1815
 
1815
-//删除单条记录
1816
+// 删除单条记录
1816 1817
 func (c *HisConfigApiController) DeleteOne() {
1817 1818
 	var err error
1818 1819
 	defer func() {

+ 181 - 3
controllers/inspection_api_controller.go View File

@@ -27,12 +27,17 @@ func InspectionApiRegistRouters() {
27 27
 	beego.Router("/api/patient/inspection/get", &InspectionApiController{}, "Get:GetAllPatientInspection")
28 28
 	beego.Router("/api/patient/inspectioninit/get", &InspectionApiController{}, "Get:GetInitInsepction")
29 29
 
30
+	beego.Router("/api/patient/pic_inspection/create", &InspectionApiController{}, "Post:CreatePatientPicInspection")
31
+	beego.Router("/api/patient/pic_inspection/edit", &InspectionApiController{}, "Post:EditPatientPicInspection")
32
+
30 33
 }
31 34
 
32
-//PatientInspectionReference 请求检验检查大小项目
33
-//[get]: /api/patient/inspection/reference
35
+// PatientInspectionReference 请求检验检查大小项目
36
+// [get]: /api/patient/inspection/reference
34 37
 func (c *InspectionApiController) PatientInspectionReference() {
35 38
 	patient, _ := c.GetInt64("patient")
39
+	inspect_type, _ := c.GetInt64("type")
40
+
36 41
 	if patient <= 0 {
37 42
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
38 43
 		return
@@ -40,7 +45,7 @@ func (c *InspectionApiController) PatientInspectionReference() {
40 45
 
41 46
 	adminUserInfo := c.GetAdminUserInfo()
42 47
 
43
-	references, err := service.GetInspectionReference(adminUserInfo.CurrentOrgId)
48
+	references, err := service.GetInspectionReference(adminUserInfo.CurrentOrgId, inspect_type)
44 49
 	if err != nil {
45 50
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
46 51
 		return
@@ -226,6 +231,179 @@ func (c *InspectionApiController) CreatePatientInspection() {
226 231
 	})
227 232
 	return
228 233
 }
234
+func (c *InspectionApiController) CreatePatientPicInspection() {
235
+	patient, _ := c.GetInt64("patient", 0)
236
+	if patient <= 0 {
237
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
238
+		return
239
+	}
240
+
241
+	adminUserInfo := c.GetAdminUserInfo()
242
+	patientInfo, _ := service.FindPatientById(adminUserInfo.CurrentOrgId, patient)
243
+	if patientInfo.ID == 0 {
244
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
245
+		return
246
+	}
247
+
248
+	var from models.InepectionPICForm
249
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &from)
250
+	if err != nil {
251
+		utils.ErrorLog("%v", err)
252
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
253
+		return
254
+	}
255
+
256
+	timeLayout := "2006-01-02 15:04"
257
+	loc, _ := time.LoadLocation("Local")
258
+
259
+	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
260
+	if err != nil {
261
+		utils.ErrorLog(err.Error())
262
+		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
263
+		return
264
+	}
265
+	if len(from.Imags) == 0 {
266
+		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未上传图片")
267
+		return
268
+	}
269
+
270
+	date := theTime.Unix()
271
+	insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, date, from.ProjectId)
272
+	if err != nil {
273
+		utils.ErrorLog("%v", err)
274
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
275
+		return
276
+	}
277
+	if len(insp) > 0 {
278
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionDateExit)
279
+		return
280
+	}
281
+
282
+	inspection_re, _ := service.GetInspectionReferenceTwo(from.ProjectId)
283
+
284
+	inspections := make([]models.Inspection, 0)
285
+	for index, item := range from.Imags {
286
+		var inspection models.Inspection
287
+		inspection.OrgId = adminUserInfo.CurrentOrgId
288
+		inspection.PatientId = patient
289
+		inspection.ProjectId = from.ProjectId
290
+		inspection.ItemId = inspection_re[index].ID
291
+		inspection.ItemName = item.Desc
292
+		inspection.ProjectName = ""
293
+		inspection.InspectType = 3
294
+		inspection.InspectValue = item.ImgUrl
295
+		inspection.InspectDesc = item.Desc
296
+		inspection.InspectDate = date
297
+		inspection.Status = 1
298
+		inspection.CreatedTime = time.Now().Unix()
299
+		inspection.UpdatedTime = time.Now().Unix()
300
+		inspections = append(inspections, inspection)
301
+	}
302
+	err = service.CreatePatientInspection(inspections)
303
+	if err != nil {
304
+		utils.ErrorLog("%v", err)
305
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionAddFail)
306
+		return
307
+	}
308
+	c.ServeSuccessJSON(map[string]interface{}{
309
+		"inspections": inspections,
310
+	})
311
+	return
312
+}
313
+func (c *InspectionApiController) EditPatientPicInspection() {
314
+	patient, _ := c.GetInt64("patient", 0)
315
+	if patient <= 0 {
316
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
317
+		return
318
+	}
319
+
320
+	adminUserInfo := c.GetAdminUserInfo()
321
+	patientInfo, _ := service.FindPatientById(adminUserInfo.CurrentOrgId, patient)
322
+	if patientInfo.ID == 0 {
323
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
324
+		return
325
+	}
326
+
327
+	var from models.InepectionPICForm
328
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &from)
329
+	if err != nil {
330
+		utils.ErrorLog("%v", err)
331
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
332
+		return
333
+	}
334
+
335
+	timeLayout := "2006-01-02 15:04"
336
+	loc, _ := time.LoadLocation("Local")
337
+
338
+	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
339
+	if err != nil {
340
+		utils.ErrorLog(err.Error())
341
+		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
342
+		return
343
+	}
344
+	if len(from.Imags) == 0 {
345
+		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未上传图片")
346
+		return
347
+	}
348
+
349
+	date := theTime.Unix()
350
+	inspection_re, _ := service.GetInspectionReferenceTwo(from.ProjectId)
351
+	inspections := make([]models.Inspection, 0)
352
+	for index, item := range from.Imags {
353
+		if item.ID == 0 {
354
+			var inspection models.Inspection
355
+			inspection.OrgId = adminUserInfo.CurrentOrgId
356
+			inspection.PatientId = patient
357
+			inspection.ProjectId = from.ProjectId
358
+			inspection.ItemId = inspection_re[index].ID
359
+			inspection.ItemName = item.Desc
360
+			inspection.ProjectName = ""
361
+			inspection.InspectType = 3
362
+			inspection.InspectValue = item.ImgUrl
363
+			inspection.InspectDesc = item.Desc
364
+			inspection.InspectDate = date
365
+			inspection.Status = 1
366
+			inspection.CreatedTime = time.Now().Unix()
367
+			inspection.UpdatedTime = time.Now().Unix()
368
+			inspections = append(inspections, inspection)
369
+
370
+		} else {
371
+			var inspection models.Inspection
372
+			inspection.ID = item.ID
373
+			inspection.OrgId = adminUserInfo.CurrentOrgId
374
+			inspection.PatientId = patient
375
+			inspection.ProjectId = from.ProjectId
376
+			inspection.ItemId = inspection_re[index].ID
377
+			inspection.ItemName = item.Desc
378
+			inspection.ProjectName = ""
379
+			inspection.InspectType = 3
380
+			inspection.InspectValue = item.ImgUrl
381
+			inspection.InspectDesc = item.Desc
382
+			inspection.InspectDate = date
383
+			inspection.Status = 1
384
+			inspection.CreatedTime = time.Now().Unix()
385
+			inspection.UpdatedTime = time.Now().Unix()
386
+			err = service.SavePatientInspection(inspection)
387
+		}
388
+
389
+	}
390
+
391
+	for _, item := range from.DeleteImg {
392
+		service.DeleteInspectionTwo(item.ID)
393
+	}
394
+	if len(inspections) > 0 {
395
+		err = service.CreatePatientInspection(inspections)
396
+	}
397
+	if err != nil {
398
+		utils.ErrorLog("%v", err)
399
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionAddFail)
400
+		return
401
+	}
402
+	c.ServeSuccessJSON(map[string]interface{}{
403
+		"inspections": inspections,
404
+	})
405
+	return
406
+}
229 407
 
230 408
 func (c *InspectionApiController) EditPatientInspection() {
231 409
 	patient, _ := c.GetInt64("patient", 0)

+ 1 - 1
controllers/mobile_api_controllers/check_api_controller.go View File

@@ -20,7 +20,7 @@ func (c *CheckApiController) GetInspectionReference() {
20 20
 
21 21
 	adminUserInfo := c.GetMobileAdminUserInfo()
22 22
 
23
-	references, err := service.GetInspectionReference(adminUserInfo.Org.Id)
23
+	references, err := service.GetInspectionReference(adminUserInfo.Org.Id, 0)
24 24
 	if err != nil {
25 25
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
26 26
 		return

+ 3 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go View File

@@ -1039,6 +1039,9 @@ func (c *StaffScheduleApiController) ChangeScheduleBed() {
1039 1039
 	id, _ := c.GetInt64("id")
1040 1040
 	org_id := c.GetMobileAdminUserInfo().Org.Id
1041 1041
 
1042
+	temp_schedule, _ := service.GetScheduleByClassTypeTwo(schedule_type, schedule_date, patient_id, org_id)
1043
+	id = temp_schedule.ID
1044
+
1042 1045
 	//查询该班次该床位是否已经存在患者
1043 1046
 	schedule, _ := service.GetScheduleByClassType(schedule_type, schedule_date, bed_id, org_id)
1044 1047
 	//查询该床位所属分区

+ 666 - 0
controllers/patient_dataconfig_api_controller.go View File

@@ -22,12 +22,678 @@ func PatientDataConfigAPIControllerRegistRouters() {
22 22
 	beego.Router("/api/patient/rescues", &PatientDataConfigAPIController{}, "get:Rescues")
23 23
 	beego.Router("/api/patient/rescue/create", &PatientDataConfigAPIController{}, "post:CreateRescue")
24 24
 	beego.Router("/api/patient/rescue/delete", &PatientDataConfigAPIController{}, "post:DeleteRescue")
25
+
26
+	beego.Router("/api/patient/sickhistory", &PatientDataConfigAPIController{}, "get:GetSickHistorys")
27
+	beego.Router("/api/patient/sickhistory/create", &PatientDataConfigAPIController{}, "get:CreateSickHistory")
28
+	beego.Router("/api/patient/sickhistory/delete", &PatientDataConfigAPIController{}, "post:DeleteSickHistory")
29
+	beego.Router("/api/patient/sickhistory/modify", &PatientDataConfigAPIController{}, "get:ModifySickHistory")
30
+
31
+	beego.Router("/api/patient/physiquecheck", &PatientDataConfigAPIController{}, "get:GetPhysiqueChecks")
32
+	beego.Router("/api/patient/physiquecheck/create", &PatientDataConfigAPIController{}, "get:CreatePhysiqueCheck")
33
+	beego.Router("/api/patient/physiquecheck/delete", &PatientDataConfigAPIController{}, "post:DeletePhysiqueCheck")
34
+	beego.Router("/api/patient/physiquecheck/modify", &PatientDataConfigAPIController{}, "get:ModifyPhysiqueCheck")
35
+
36
+	beego.Router("/api/patient/sickhistory/print", &PatientDataConfigAPIController{}, "get:GetSickhistoryPrints")
37
+	beego.Router("/api/patient/physiquecheck/print", &PatientDataConfigAPIController{}, "get:GetPhysiquecheckPrints")
38
+
25 39
 }
26 40
 
27 41
 type PatientDataConfigAPIController struct {
28 42
 	BaseAuthAPIController
29 43
 }
30 44
 
45
+func (this *PatientDataConfigAPIController) GetPhysiquecheckPrints() {
46
+
47
+	patientID, _ := this.GetInt64("patient_id")
48
+	idsStr := this.GetString("ids")
49
+	if patientID <= 0 || len(idsStr) == 0 {
50
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
51
+		return
52
+	}
53
+	recordIDStrs := strings.Split(idsStr, ",")
54
+	patient, _ := service.GetPatientByID(this.GetAdminUserInfo().CurrentOrgId, patientID)
55
+	sickHostory, _ := service.GetPatienttPhysiqueByIds(this.GetAdminUserInfo().CurrentOrgId, patientID, recordIDStrs)
56
+	this.ServeSuccessJSON(map[string]interface{}{
57
+		"patient":      patient,
58
+		"sickhistorys": sickHostory,
59
+	})
60
+
61
+}
62
+func (this *PatientDataConfigAPIController) GetSickhistoryPrints() {
63
+	patientID, _ := this.GetInt64("patient_id")
64
+	idsStr := this.GetString("ids")
65
+	if patientID <= 0 || len(idsStr) == 0 {
66
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
67
+		return
68
+	}
69
+	recordIDStrs := strings.Split(idsStr, ",")
70
+	patient, _ := service.GetPatientByID(this.GetAdminUserInfo().CurrentOrgId, patientID)
71
+	sickHostory, _ := service.GetPatientSickHistoryByIds(this.GetAdminUserInfo().CurrentOrgId, patientID, recordIDStrs)
72
+	for _, item := range sickHostory {
73
+		pc, _ := service.GetLastPatientPhysiqueCheck(this.GetAdminUserInfo().CurrentOrgId, item.PatientId, item.RecordDate)
74
+		item.XtPatientPhysiqueCheck = pc
75
+	}
76
+	this.ServeSuccessJSON(map[string]interface{}{
77
+		"patient":      patient,
78
+		"sickhistorys": sickHostory,
79
+	})
80
+}
81
+
82
+func (this *PatientDataConfigAPIController) GetSickHistorys() {
83
+	patientID, _ := this.GetInt64("patient_id")
84
+	startTimeYMDStr := this.GetString("start_time")
85
+	endTimeYMDStr := this.GetString("end_time")
86
+	if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
87
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
88
+		return
89
+	}
90
+	endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
91
+	startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
92
+	endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
93
+	if parseStartTimeErr != nil || parseEndTimeErr != nil {
94
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
95
+		return
96
+	}
97
+
98
+	adminUserInfo := this.GetAdminUserInfo()
99
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
100
+	if getPatientErr != nil {
101
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
102
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
103
+		return
104
+	} else if patient == nil {
105
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
106
+		return
107
+	}
108
+
109
+	records, getRecordsErr := service.GetPatientSickHistory(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
110
+	if getRecordsErr != nil {
111
+		this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
112
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
113
+		return
114
+	}
115
+
116
+	admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
117
+	if getAllAdminsErr != nil {
118
+		this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
119
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
120
+		return
121
+	}
122
+
123
+	this.ServeSuccessJSON(map[string]interface{}{
124
+		"records": records,
125
+		"doctors": admins,
126
+	})
127
+}
128
+func (this *PatientDataConfigAPIController) CreateSickHistory() {
129
+	patientID, _ := this.GetInt64("patient_id")
130
+	content := this.GetString("content")
131
+	record_time_str := this.GetString("record_time")
132
+	title := this.GetString("title")
133
+	is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
134
+	is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
135
+	is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
136
+	guominyaowu_desc := this.GetString("guominyaowu_desc")
137
+	doctor_id, _ := this.GetInt64("doctor_id")
138
+
139
+	if patientID <= 0 || len(content) == 0 {
140
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
141
+		return
142
+	}
143
+
144
+	if len(record_time_str) == 0 {
145
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
146
+		return
147
+	}
148
+	record_date := strings.Split(record_time_str, " ")
149
+
150
+	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
151
+	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
152
+
153
+	adminUserInfo := this.GetAdminUserInfo()
154
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
155
+	if getPatientErr != nil {
156
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
157
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
158
+		return
159
+	} else if patient == nil {
160
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
161
+		return
162
+	}
163
+
164
+	now := time.Now().Unix()
165
+	record := models.XtPatientSickHistory{
166
+		OrgId:                   adminUserInfo.CurrentOrgId,
167
+		PatientId:               patientID,
168
+		Recorder:                adminUserInfo.AdminUser.Id,
169
+		RecordTime:              checkDate.Unix(),
170
+		Content:                 content,
171
+		Status:                  1,
172
+		Title:                   title,
173
+		IsShenyizhiHistory:      is_shenyizhishi,
174
+		IsFumoDialysisHistory:   is_fumotouxishi,
175
+		HypersusceptibilityDesc: guominyaowu_desc,
176
+		IsHypersusceptibility:   is_guominyaowu,
177
+		Ctime:                   now,
178
+		Mtime:                   now,
179
+		DoctorId:                doctor_id,
180
+		RecordDate:              checkDate_two.Unix(),
181
+	}
182
+
183
+	createErr := service.CreatePatientSickHistory(&record)
184
+	if createErr != nil {
185
+		this.ErrorLog("创建患者病史记录失败:%v", createErr)
186
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
187
+		return
188
+	}
189
+
190
+	this.ServeSuccessJSON(map[string]interface{}{
191
+		"record": record,
192
+	})
193
+}
194
+func (this *PatientDataConfigAPIController) DeleteSickHistory() {
195
+	patientID, _ := this.GetInt64("patient_id")
196
+	idsStr := this.GetString("ids")
197
+	if patientID <= 0 || len(idsStr) == 0 {
198
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
199
+		return
200
+	}
201
+
202
+	adminUserInfo := this.GetAdminUserInfo()
203
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
204
+	if getPatientErr != nil {
205
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
206
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
207
+		return
208
+	} else if patient == nil {
209
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
210
+		return
211
+	}
212
+
213
+	recordIDStrs := strings.Split(idsStr, ",")
214
+	recordIDs := make([]int64, 0, len(recordIDStrs))
215
+	for _, idStr := range recordIDStrs {
216
+		id, parseErr := strconv.Atoi(idStr)
217
+		if parseErr != nil {
218
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
219
+			return
220
+		}
221
+		recordIDs = append(recordIDs, int64(id))
222
+	}
223
+
224
+	deleteErr := service.DeletePatientSickHistoryInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
225
+	if deleteErr != nil {
226
+		this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
227
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
228
+		return
229
+	}
230
+	this.ServeSuccessJSON(nil)
231
+}
232
+func (this *PatientDataConfigAPIController) ModifySickHistory() {
233
+	patientID, _ := this.GetInt64("patient_id")
234
+	content := this.GetString("content")
235
+	id, _ := this.GetInt64("id", 0)
236
+	record_time_str := this.GetString("record_time")
237
+	title := this.GetString("title")
238
+
239
+	is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
240
+	is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
241
+	is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
242
+	guominyaowu_desc := this.GetString("guominyaowu_desc")
243
+	doctor_id, _ := this.GetInt64("doctor_id")
244
+
245
+	if patientID <= 0 || len(content) == 0 || id == 0 || len(record_time_str) == 0 {
246
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
247
+		return
248
+	}
249
+	//timeLayout := "2006-01-02"
250
+	//loc, _ := time.LoadLocation("Local")
251
+	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
252
+
253
+	fmt.Println("checkDate--------------", checkDate)
254
+	adminUserInfo := this.GetAdminUserInfo()
255
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
256
+	if getPatientErr != nil {
257
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
258
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
259
+		return
260
+	} else if patient == nil {
261
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
262
+		return
263
+	}
264
+
265
+	now := time.Now().Unix()
266
+
267
+	record := models.XtPatientSickHistory{
268
+		ID:                      id,
269
+		OrgId:                   adminUserInfo.CurrentOrgId,
270
+		PatientId:               patientID,
271
+		Recorder:                adminUserInfo.AdminUser.Id,
272
+		Content:                 content,
273
+		Status:                  1,
274
+		Ctime:                   now,
275
+		Mtime:                   now,
276
+		Title:                   title,
277
+		RecordTime:              checkDate.Unix(),
278
+		IsShenyizhiHistory:      is_shenyizhishi,
279
+		IsFumoDialysisHistory:   is_fumotouxishi,
280
+		HypersusceptibilityDesc: guominyaowu_desc,
281
+		IsHypersusceptibility:   is_guominyaowu,
282
+		DoctorId:                doctor_id,
283
+	}
284
+	createErr := service.ModifyPatientSickHistory(&record)
285
+	if createErr != nil {
286
+		this.ErrorLog("创建患者抢救记录失败:%v", createErr)
287
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
288
+		return
289
+	}
290
+	this.ServeSuccessJSON(map[string]interface{}{
291
+		"record": record,
292
+	})
293
+}
294
+
295
+func (this *PatientDataConfigAPIController) GetPhysiqueChecks() {
296
+	patientID, _ := this.GetInt64("patient_id")
297
+	startTimeYMDStr := this.GetString("start_time")
298
+	endTimeYMDStr := this.GetString("end_time")
299
+	if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
300
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
301
+		return
302
+	}
303
+	endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
304
+	startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
305
+	endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
306
+	if parseStartTimeErr != nil || parseEndTimeErr != nil {
307
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
308
+		return
309
+	}
310
+
311
+	adminUserInfo := this.GetAdminUserInfo()
312
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
313
+	if getPatientErr != nil {
314
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
315
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
316
+		return
317
+	} else if patient == nil {
318
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
319
+		return
320
+	}
321
+
322
+	records, getRecordsErr := service.GetPatientPhysiqueCheck(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
323
+	if getRecordsErr != nil {
324
+		this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
325
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
326
+		return
327
+	}
328
+
329
+	admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
330
+	if getAllAdminsErr != nil {
331
+		this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
332
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
333
+		return
334
+	}
335
+
336
+	this.ServeSuccessJSON(map[string]interface{}{
337
+		"records": records,
338
+		"doctors": admins,
339
+	})
340
+}
341
+func (this *PatientDataConfigAPIController) CreatePhysiqueCheck() {
342
+	patientID, _ := this.GetInt64("patient_id")
343
+	doctor_id, _ := this.GetInt64("doctor_id")
344
+	record_time_str := this.GetString("record_time")
345
+	t := this.GetString("t")
346
+	p := this.GetString("p")
347
+	r := this.GetString("r")
348
+	bp_left := this.GetString("bp_left")
349
+	bp_right := this.GetString("bp_right")
350
+	pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
351
+	tiwei, _ := this.GetInt64("tiwei")
352
+	fuzhong, _ := this.GetInt64("fuzhong")
353
+	chuxuedian, _ := this.GetInt64("chuxuedian")
354
+
355
+	fayu, _ := this.GetInt64("fayu")
356
+	yinyang, _ := this.GetInt64("yinyang")
357
+	shenzhi, _ := this.GetInt64("shenzhi")
358
+	pifunianmo, _ := this.GetInt64("pifunianmo")
359
+	buwei := this.GetString("buwei")
360
+	chengdu := this.GetString("chengdu")
361
+	pixiachuxue, _ := this.GetInt64("pixiachuxue")
362
+	zidian, _ := this.GetInt64("zidian")
363
+	pifuwendu, _ := this.GetInt64("pifuwendu")
364
+	qita := this.GetString("qita")
365
+
366
+	linbazhongda, _ := this.GetInt64("linbazhongda")
367
+	linbabuwei := this.GetString("linbabuwei")
368
+
369
+	yanlian, _ := this.GetInt64("yanlian")
370
+	tongkong, _ := this.GetInt64("tongkong")
371
+	zuo := this.GetString("zuo")
372
+	you := this.GetString("you")
373
+
374
+	duiguangfanshe := this.GetString("duiguangfanshe")
375
+	biantaoti := this.GetString("biantaoti")
376
+	yanbu := this.GetString("yanbu")
377
+	toubuqita := this.GetString("toubuqita")
378
+	huxiyin := this.GetString("huxiyin")
379
+
380
+	xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
381
+	feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
382
+	luoyin, _ := this.GetInt64("luoyin")
383
+	desc := this.GetString("desc")
384
+
385
+	xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
386
+	xinlv, _ := this.GetInt64("xinlv")
387
+	xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
388
+	zayin, _ := this.GetInt64("zayin")
389
+	fujiayin, _ := this.GetInt64("fujiayin")
390
+	xinzangdesc := this.GetString("xinzangdesc")
391
+
392
+	fushuizheng, _ := this.GetInt64("fushuizheng")
393
+	ganjingjingmai := this.GetString("ganjingjingmai")
394
+
395
+	gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
396
+	gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
397
+	pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
398
+	pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
399
+
400
+	shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
401
+	shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
402
+	fubu_desc := this.GetString("fubu_desc")
403
+	oth_desc := this.GetString("oth_desc")
404
+
405
+	if patientID <= 0 {
406
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
407
+		return
408
+	}
409
+
410
+	if len(record_time_str) == 0 {
411
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
412
+		return
413
+	}
414
+
415
+	record_date := strings.Split(record_time_str, " ")
416
+	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
417
+	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
418
+
419
+	adminUserInfo := this.GetAdminUserInfo()
420
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
421
+	if getPatientErr != nil {
422
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
423
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
424
+		return
425
+	} else if patient == nil {
426
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
427
+		return
428
+	}
429
+
430
+	now := time.Now().Unix()
431
+	record := models.XtPatientPhysiqueCheck{
432
+		DoctorId:         doctor_id,
433
+		OrgId:            adminUserInfo.CurrentOrgId,
434
+		PatientId:        patientID,
435
+		Recorder:         adminUserInfo.AdminUser.Id,
436
+		RecordTime:       checkDate.Unix(),
437
+		Status:           1,
438
+		Ctime:            now,
439
+		Mtime:            now,
440
+		T:                t,
441
+		P:                p,
442
+		R:                r,
443
+		BpRight:          bp_right,
444
+		BpLeft:           bp_left,
445
+		Pinxuerongmao:    pinxuerongmao,
446
+		Tiwei:            tiwei,
447
+		Fuzhong:          fuzhong,
448
+		Chuxuedian:       chuxuedian,
449
+		Fayu:             fayu,
450
+		Yinyang:          yinyang,
451
+		Shenzhi:          shenzhi,
452
+		Pifunianmo:       pifunianmo,
453
+		Buwei:            buwei,
454
+		Chengdu:          chengdu,
455
+		Pixiachuxue:      pixiachuxue,
456
+		Zidian:           zidian,
457
+		Pifuwendu:        pifuwendu,
458
+		Qita:             qita,
459
+		Linbazhongda:     linbazhongda,
460
+		Linbabuwei:       linbabuwei,
461
+		Yanlian:          yanlian,
462
+		Tongkong:         tongkong,
463
+		Zuo:              zuo,
464
+		You:              you,
465
+		Duiguangfanshe:   duiguangfanshe,
466
+		Biantaoti:        biantaoti,
467
+		Yanbu:            yanbu,
468
+		Toubuqita:        toubuqita,
469
+		Huxiyin:          huxiyin,
470
+		Xiongmomocayin:   xiongmomocayin,
471
+		Feizhangbuwei:    feizhangbuwei,
472
+		Luoyin:           luoyin,
473
+		Desc:             desc,
474
+		Xinzangdaxiao:    xinzangdaxiao,
475
+		Xinlv:            xinlv,
476
+		Xinbaomocasheng:  xinbaomocasheng,
477
+		Zayin:            zayin,
478
+		Fujiayin:         fujiayin,
479
+		Xinzangdesc:      xinzangdesc,
480
+		Fushuizheng:      fushuizheng,
481
+		Ganjingjingmai:   ganjingjingmai,
482
+		GangzhangYatong:  gangzhang_yatong,
483
+		GangzhangKoutong: gangzhang_koutong,
484
+		PizhangKoutong:   pizhang_koutong,
485
+		PizhangYatong:    pizhang_yatong,
486
+		ShenzhangKoutong: shenzhang_koutong,
487
+		ShenzhangYatong:  shenzhang_yatong,
488
+		FubuDesc:         fubu_desc,
489
+		OthDesc:          oth_desc,
490
+		RecordDate:       checkDate_two.Unix(),
491
+	}
492
+	createErr := service.CreatePatientPhysiqueCheck(&record)
493
+	if createErr != nil {
494
+		this.ErrorLog("创建患者病史记录失败:%v", createErr)
495
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
496
+		return
497
+	}
498
+
499
+	this.ServeSuccessJSON(map[string]interface{}{
500
+		"record": record,
501
+	})
502
+}
503
+func (this *PatientDataConfigAPIController) DeletePhysiqueCheck() {
504
+	patientID, _ := this.GetInt64("patient_id")
505
+	idsStr := this.GetString("ids")
506
+	if patientID <= 0 || len(idsStr) == 0 {
507
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
508
+		return
509
+	}
510
+
511
+	adminUserInfo := this.GetAdminUserInfo()
512
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
513
+	if getPatientErr != nil {
514
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
515
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
516
+		return
517
+	} else if patient == nil {
518
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
519
+		return
520
+	}
521
+
522
+	recordIDStrs := strings.Split(idsStr, ",")
523
+	recordIDs := make([]int64, 0, len(recordIDStrs))
524
+	for _, idStr := range recordIDStrs {
525
+		id, parseErr := strconv.Atoi(idStr)
526
+		if parseErr != nil {
527
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
528
+			return
529
+		}
530
+		recordIDs = append(recordIDs, int64(id))
531
+	}
532
+
533
+	deleteErr := service.DeletePatientPhysiqueCheckInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
534
+	if deleteErr != nil {
535
+		this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
536
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
537
+		return
538
+	}
539
+	this.ServeSuccessJSON(nil)
540
+}
541
+func (this *PatientDataConfigAPIController) ModifyPhysiqueCheck() {
542
+	patientID, _ := this.GetInt64("patient_id")
543
+	id, _ := this.GetInt64("id", 0)
544
+	doctor_id, _ := this.GetInt64("doctor_id", 0)
545
+
546
+	record_time_str := this.GetString("record_time")
547
+
548
+	if patientID <= 0 || id == 0 || len(record_time_str) == 0 {
549
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
550
+		return
551
+	}
552
+	t := this.GetString("t")
553
+	p := this.GetString("p")
554
+	r := this.GetString("r")
555
+	bp_left := this.GetString("bp_left")
556
+	bp_right := this.GetString("bp_right")
557
+	pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
558
+	tiwei, _ := this.GetInt64("tiwei")
559
+	fuzhong, _ := this.GetInt64("fuzhong")
560
+	chuxuedian, _ := this.GetInt64("chuxuedian")
561
+
562
+	fayu, _ := this.GetInt64("fayu")
563
+	yinyang, _ := this.GetInt64("yinyang")
564
+	shenzhi, _ := this.GetInt64("shenzhi")
565
+	pifunianmo, _ := this.GetInt64("pifunianmo")
566
+	buwei := this.GetString("buwei")
567
+	chengdu := this.GetString("chengdu")
568
+	pixiachuxue, _ := this.GetInt64("pixiachuxue")
569
+	zidian, _ := this.GetInt64("zidian")
570
+	pifuwendu, _ := this.GetInt64("pifuwendu")
571
+	qita := this.GetString("qita")
572
+
573
+	linbazhongda, _ := this.GetInt64("linbazhongda")
574
+	linbabuwei := this.GetString("linbabuwei")
575
+
576
+	yanlian, _ := this.GetInt64("yanlian")
577
+	tongkong, _ := this.GetInt64("tongkong")
578
+	zuo := this.GetString("zuo")
579
+	you := this.GetString("you")
580
+
581
+	duiguangfanshe := this.GetString("duiguangfanshe")
582
+	biantaoti := this.GetString("biantaoti")
583
+	yanbu := this.GetString("yanbu")
584
+	toubuqita := this.GetString("toubuqita")
585
+	huxiyin := this.GetString("huxiyin")
586
+
587
+	xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
588
+	feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
589
+	luoyin, _ := this.GetInt64("luoyin")
590
+	desc := this.GetString("desc")
591
+
592
+	xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
593
+	xinlv, _ := this.GetInt64("xinlv")
594
+	xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
595
+	zayin, _ := this.GetInt64("zayin")
596
+	fujiayin, _ := this.GetInt64("fujiayin")
597
+	xinzangdesc := this.GetString("xinzangdesc")
598
+
599
+	fushuizheng, _ := this.GetInt64("fushuizheng")
600
+	ganjingjingmai := this.GetString("ganjingjingmai")
601
+
602
+	gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
603
+	gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
604
+	pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
605
+	pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
606
+
607
+	shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
608
+	shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
609
+	fubu_desc := this.GetString("fubu_desc")
610
+	oth_desc := this.GetString("oth_desc")
611
+
612
+	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
613
+	adminUserInfo := this.GetAdminUserInfo()
614
+	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
615
+	if getPatientErr != nil {
616
+		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
617
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
618
+		return
619
+	} else if patient == nil {
620
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
621
+		return
622
+	}
623
+	now := time.Now().Unix()
624
+
625
+	record := models.XtPatientPhysiqueCheck{
626
+		ID:               id,
627
+		OrgId:            adminUserInfo.CurrentOrgId,
628
+		PatientId:        patientID,
629
+		Recorder:         adminUserInfo.AdminUser.Id,
630
+		RecordTime:       checkDate.Unix(),
631
+		DoctorId:         doctor_id,
632
+		Status:           1,
633
+		Ctime:            now,
634
+		Mtime:            now,
635
+		T:                t,
636
+		P:                p,
637
+		R:                r,
638
+		BpRight:          bp_right,
639
+		BpLeft:           bp_left,
640
+		Pinxuerongmao:    pinxuerongmao,
641
+		Tiwei:            tiwei,
642
+		Fuzhong:          fuzhong,
643
+		Chuxuedian:       chuxuedian,
644
+		Fayu:             fayu,
645
+		Yinyang:          yinyang,
646
+		Shenzhi:          shenzhi,
647
+		Pifunianmo:       pifunianmo,
648
+		Buwei:            buwei,
649
+		Chengdu:          chengdu,
650
+		Pixiachuxue:      pixiachuxue,
651
+		Zidian:           zidian,
652
+		Pifuwendu:        pifuwendu,
653
+		Qita:             qita,
654
+		Linbazhongda:     linbazhongda,
655
+		Linbabuwei:       linbabuwei,
656
+		Yanlian:          yanlian,
657
+		Tongkong:         tongkong,
658
+		Zuo:              zuo,
659
+		You:              you,
660
+		Duiguangfanshe:   duiguangfanshe,
661
+		Biantaoti:        biantaoti,
662
+		Yanbu:            yanbu,
663
+		Toubuqita:        toubuqita,
664
+		Huxiyin:          huxiyin,
665
+		Xiongmomocayin:   xiongmomocayin,
666
+		Feizhangbuwei:    feizhangbuwei,
667
+		Luoyin:           luoyin,
668
+		Desc:             desc,
669
+		Xinzangdaxiao:    xinzangdaxiao,
670
+		Xinlv:            xinlv,
671
+		Xinbaomocasheng:  xinbaomocasheng,
672
+		Zayin:            zayin,
673
+		Fujiayin:         fujiayin,
674
+		Xinzangdesc:      xinzangdesc,
675
+		Fushuizheng:      fushuizheng,
676
+		Ganjingjingmai:   ganjingjingmai,
677
+		GangzhangYatong:  gangzhang_yatong,
678
+		GangzhangKoutong: gangzhang_koutong,
679
+		PizhangKoutong:   pizhang_koutong,
680
+		PizhangYatong:    pizhang_yatong,
681
+		ShenzhangKoutong: shenzhang_koutong,
682
+		ShenzhangYatong:  shenzhang_yatong,
683
+		FubuDesc:         fubu_desc,
684
+		OthDesc:          oth_desc,
685
+	}
686
+	createErr := service.ModifyPatientPhysiqueCheck(&record)
687
+	if createErr != nil {
688
+		this.ErrorLog("修改患者体格检查失败:%v", createErr)
689
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
690
+		return
691
+	}
692
+	this.ServeSuccessJSON(map[string]interface{}{
693
+		"record": record,
694
+	})
695
+}
696
+
31 697
 // /api/patient/courses [get]
32 698
 // @param patient_id:int
33 699
 // @param start_time:string (yyyy-MM-dd)

+ 17 - 17
controllers/public_api_controller.go View File

@@ -115,23 +115,23 @@ func (c *PublicApiController) HandleSchedule() {
115 115
 
116 116
 func (c *PublicApiController) HandleOne() {
117 117
 	//fmt.Println("~~~~~~")
118
-	start_time := c.GetString("start_time")
119
-	end_time := c.GetString("end_time")
120
-
121
-	timeLayout := "2006-01-02"
122
-	loc, _ := time.LoadLocation("Local")
123
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
124
-	if err != nil {
125
-	}
126
-	startRecordDateTime := startTime.Unix()
127
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
128
-	if err != nil {
129
-	}
130
-	endRecordDateTime := endTime.Unix()
131
-	orders, _ := service.GetHisOrderDetailOne(startRecordDateTime, endRecordDateTime)
132
-	c.ServeSuccessJSON(map[string]interface{}{
133
-		"order": orders,
134
-	})
118
+	//start_time := c.GetString("start_time")
119
+	//end_time := c.GetString("end_time")
120
+	//
121
+	//timeLayout := "2006-01-02"
122
+	//loc, _ := time.LoadLocation("Local")
123
+	//startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
124
+	//if err != nil {
125
+	//}
126
+	//startRecordDateTime := startTime.Unix()
127
+	//endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
128
+	//if err != nil {
129
+	//}
130
+	//endRecordDateTime := endTime.Unix()
131
+	//orders, _ := service.GetHisOrderDetailOne(startRecordDateTime, endRecordDateTime)
132
+	//c.ServeSuccessJSON(map[string]interface{}{
133
+	//	"order": orders,
134
+	//})
135 135
 }
136 136
 
137 137
 //func (c *PublicApiController) HandleScheduleTwo() {

+ 4 - 0
models/his_charge_models.go View File

@@ -179,6 +179,10 @@ type HisChargeSettleOrder struct {
179 179
 	AliPay      string `gorm:"ali_pay" json:"ali_pay" form:"ali_pay"`
180 180
 	JifenPay    string `gorm:"jifen_pay" json:"jifen_pay" form:"jifen_pay"`
181 181
 	OthDesc     string `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
182
+
183
+	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
184
+	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
185
+	IsUploadSuccess   int64 `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
182 186
 }
183 187
 
184 188
 func (HisChargeSettleOrder) TableName() string {

+ 4 - 0
models/his_hospital_models.go View File

@@ -33,6 +33,10 @@ type HisHospitalOrder struct {
33 33
 
34 34
 	IsPre     int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
35 35
 	Diagnosis string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
36
+
37
+	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
38
+	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
39
+	IsUploadSuccess   int64 `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
36 40
 }
37 41
 
38 42
 func (HisHospitalOrder) TableName() string {

+ 5 - 4
models/his_models.go View File

@@ -507,16 +507,17 @@ type TempHisOrder struct {
507 507
 	FaPiaoCode            string  `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
508 508
 	FaPiaoNumber          string  `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
509 509
 
510
-	AdminUser         AdminUser `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
511
-	IsUploadDiagnose  int64     `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
512
-	IsUploadOrderInfo int64     `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
513
-	IsUploadSuccess   int64     `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
510
+	AdminUser AdminUser `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
514 511
 
515 512
 	SettleType      int64  `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
516 513
 	SettleStartTime int64  `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
517 514
 	SettleEndTime   int64  `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
518 515
 	IsPre           int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
519 516
 	Diagnosis       string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
517
+
518
+	IsUploadDiagnose  int64 `gorm:"column:is_upload_diagnose" json:"is_upload_diagnose" form:"is_upload_diagnose"`
519
+	IsUploadOrderInfo int64 `gorm:"column:is_upload_order_info" json:"is_upload_order_info" form:"is_upload_order_info"`
520
+	IsUploadSuccess   int64 `gorm:"column:is_upload_success" json:"is_upload_success" form:"is_upload_success"`
520 521
 }
521 522
 
522 523
 func (TempHisOrder) TableName() string {

+ 21 - 0
models/inspection_models.go View File

@@ -15,6 +15,7 @@ type Inspection struct {
15 15
 	Status       int64  `gorm:"column:status" json:"status" form:"status"`
16 16
 	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
17 17
 	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
18
+	InspectDesc  string `gorm:"column:inspect_desc" json:"inspect_desc" form:"inspect_desc"`
18 19
 }
19 20
 
20 21
 func (Inspection) TableName() string {
@@ -112,6 +113,26 @@ type InepectionForm struct {
112 113
 		RangeType   int64  `json:"range_type"`
113 114
 		Value       string `json:"value"`
114 115
 	} `json:"formItem"`
116
+	Imags []struct {
117
+		ID     int64  `json:"id"`
118
+		ImgUrl string `json:"img_url"`
119
+		Desc   string `json:"desc"`
120
+	} `json:"imgs"`
121
+}
122
+
123
+type InepectionPICForm struct {
124
+	Method         string `json:"method"`
125
+	ProjectId      int64  `json:"project_id"`
126
+	InspectDate    string `json:"inspect_date"`
127
+	OldInspectDate string `json:"old_inspect_date"`
128
+	Imags          []struct {
129
+		ID     int64  `json:"id"`
130
+		ImgUrl string `json:"img_url"`
131
+		Desc   string `json:"desc"`
132
+	} `json:"imgs"`
133
+	DeleteImg []struct {
134
+		ID int64 `json:"id"`
135
+	} `json:"delete_imgs"`
115 136
 }
116 137
 
117 138
 type InspectionDate struct {

+ 92 - 0
models/patient_models.go View File

@@ -1826,3 +1826,95 @@ type XtPatientFirstDisease struct {
1826 1826
 func (XtPatientFirstDisease) TableName() string {
1827 1827
 	return "xt_patient_first_disease"
1828 1828
 }
1829
+
1830
+type XtPatientSickHistory struct {
1831
+	ID                      int64                  `gorm:"column:id" json:"id" form:"id"`
1832
+	OrgId                   int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`
1833
+	PatientId               int64                  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1834
+	Recorder                int64                  `gorm:"column:recorder" json:"recorder" form:"recorder"`
1835
+	RecordTime              int64                  `gorm:"column:record_time" json:"record_time" form:"record_time"`
1836
+	RecordDate              int64                  `gorm:"column:record_date" json:"record_date" form:"record_date"`
1837
+	Content                 string                 `gorm:"column:content" json:"content" form:"content"`
1838
+	Status                  int64                  `gorm:"column:status" json:"status" form:"status"`
1839
+	Ctime                   int64                  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1840
+	Mtime                   int64                  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1841
+	Title                   string                 `gorm:"column:title" json:"title" form:"title"`
1842
+	IsShenyizhiHistory      int64                  `gorm:"column:is_shenyizhi_history" json:"is_shenyizhi_history" form:"is_shenyizhi_history"`
1843
+	IsFumoDialysisHistory   int64                  `gorm:"column:is_fumo_dialysis_history" json:"is_fumo_dialysis_history" form:"is_fumo_dialysis_history"`
1844
+	HypersusceptibilityDesc string                 `gorm:"column:hypersusceptibility_desc" json:"hypersusceptibility_desc" form:"hypersusceptibility_desc"`
1845
+	DoctorId                int64                  `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
1846
+	IsHypersusceptibility   int64                  `gorm:"column:is_hypersusceptibility" json:"is_hypersusceptibility" form:"is_hypersusceptibility"`
1847
+	XtPatientPhysiqueCheck  XtPatientPhysiqueCheck `gorm:"json:"ppc"`
1848
+}
1849
+
1850
+func (XtPatientSickHistory) TableName() string {
1851
+	return "xt_patient_sick_history"
1852
+}
1853
+
1854
+type XtPatientPhysiqueCheck struct {
1855
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
1856
+	OrgId      int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
1857
+	PatientId  int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1858
+	Recorder   int64 `gorm:"column:recorder" json:"recorder" form:"recorder"`
1859
+	RecordTime int64 `gorm:"column:record_time" json:"record_time" form:"record_time"`
1860
+	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
1861
+
1862
+	Status           int64  `gorm:"column:status" json:"status" form:"status"`
1863
+	Ctime            int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1864
+	Mtime            int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1865
+	T                string `gorm:"column:t" json:"t" form:"t"`
1866
+	P                string `gorm:"column:p" json:"p" form:"p"`
1867
+	R                string `gorm:"column:r" json:"r" form:"r"`
1868
+	BpRight          string `gorm:"column:bp_right" json:"bp_right" form:"bp_right"`
1869
+	BpLeft           string `gorm:"column:bp_left" json:"bp_left" form:"bp_left"`
1870
+	Pinxuerongmao    int64  `gorm:"column:pinxuerongmao" json:"pinxuerongmao" form:"pinxuerongmao"`
1871
+	Tiwei            int64  `gorm:"column:tiwei" json:"tiwei" form:"tiwei"`
1872
+	Fuzhong          int64  `gorm:"column:fuzhong" json:"fuzhong" form:"fuzhong"`
1873
+	Chuxuedian       int64  `gorm:"column:chuxuedian" json:"chuxuedian" form:"chuxuedian"`
1874
+	Fayu             int64  `gorm:"column:fayu" json:"fayu" form:"fayu"`
1875
+	Yinyang          int64  `gorm:"column:yinyang" json:"yinyang" form:"yinyang"`
1876
+	Shenzhi          int64  `gorm:"column:shenzhi" json:"shenzhi" form:"shenzhi"`
1877
+	Pifunianmo       int64  `gorm:"column:pifunianmo" json:"pifunianmo" form:"pifunianmo"`
1878
+	Buwei            string `gorm:"column:buwei" json:"buwei" form:"buwei"`
1879
+	Chengdu          string `gorm:"column:chengdu" json:"chengdu" form:"chengdu"`
1880
+	Pixiachuxue      int64  `gorm:"column:pixiachuxue" json:"pixiachuxue" form:"pixiachuxue"`
1881
+	Zidian           int64  `gorm:"column:zidian" json:"zidian" form:"zidian"`
1882
+	Pifuwendu        int64  `gorm:"column:pifuwendu" json:"pifuwendu" form:"pifuwendu"`
1883
+	Qita             string `gorm:"column:qita" json:"qita" form:"qita"`
1884
+	Linbazhongda     int64  `gorm:"column:linbazhongda" json:"linbazhongda" form:"linbazhongda"`
1885
+	Linbabuwei       string `gorm:"column:linbabuwei" json:"linbabuwei" form:"linbabuwei"`
1886
+	Yanlian          int64  `gorm:"column:yanlian" json:"yanlian" form:"yanlian"`
1887
+	Tongkong         int64  `gorm:"column:tongkong" json:"tongkong" form:"tongkong"`
1888
+	Zuo              string `gorm:"column:zuo" json:"zuo" form:"zuo"`
1889
+	You              string `gorm:"column:you" json:"you" form:"you"`
1890
+	Duiguangfanshe   string `gorm:"column:duiguangfanshe" json:"duiguangfanshe" form:"duiguangfanshe"`
1891
+	Biantaoti        string `gorm:"column:biantaoti" json:"biantaoti" form:"biantaoti"`
1892
+	Yanbu            string `gorm:"column:yanbu" json:"yanbu" form:"yanbu"`
1893
+	Toubuqita        string `gorm:"column:toubuqita" json:"toubuqita" form:"toubuqita"`
1894
+	Huxiyin          string `gorm:"column:huxiyin" json:"huxiyin" form:"huxiyin"`
1895
+	Xiongmomocayin   int64  `gorm:"column:xiongmomocayin" json:"xiongmomocayin" form:"xiongmomocayin"`
1896
+	Feizhangbuwei    int64  `gorm:"column:feizhangbuwei" json:"feizhangbuwei" form:"feizhangbuwei"`
1897
+	Luoyin           int64  `gorm:"column:luoyin" json:"luoyin" form:"luoyin"`
1898
+	Desc             string `gorm:"column:desc" json:"desc" form:"desc"`
1899
+	Xinzangdaxiao    int64  `gorm:"column:xinzangdaxiao" json:"xinzangdaxiao" form:"xinzangdaxiao"`
1900
+	Xinlv            int64  `gorm:"column:xinlv" json:"xinlv" form:"xinlv"`
1901
+	Xinbaomocasheng  int64  `gorm:"column:xinbaomocasheng" json:"xinbaomocasheng" form:"xinbaomocasheng"`
1902
+	Zayin            int64  `gorm:"column:zayin" json:"zayin" form:"zayin"`
1903
+	Fujiayin         int64  `gorm:"column:fujiayin" json:"fujiayin" form:"fujiayin"`
1904
+	Xinzangdesc      string `gorm:"column:xinzangdesc" json:"xinzangdesc" form:"xinzangdesc"`
1905
+	Fushuizheng      int64  `gorm:"column:fushuizheng" json:"fushuizheng" form:"fushuizheng"`
1906
+	Ganjingjingmai   string `gorm:"column:ganjingjingmai" json:"ganjingjingmai" form:"ganjingjingmai"`
1907
+	GangzhangYatong  int64  `gorm:"column:gangzhang_yatong" json:"gangzhang_yatong" form:"gangzhang_yatong"`
1908
+	GangzhangKoutong int64  `gorm:"column:gangzhang_koutong" json:"gangzhang_koutong" form:"gangzhang_koutong"`
1909
+	PizhangYatong    int64  `gorm:"column:pizhang_yatong" json:"pizhang_yatong" form:"pizhang_yatong"`
1910
+	PizhangKoutong   int64  `gorm:"column:pizhang_koutong" json:"pizhang_koutong" form:"pizhang_koutong"`
1911
+	ShenzhangYatong  int64  `gorm:"column:shenzhang_yatong" json:"shenzhang_yatong" form:"shenzhang_yatong"`
1912
+	ShenzhangKoutong int64  `gorm:"column:shenzhang_koutong" json:"shenzhang_koutong" form:"shenzhang_koutong"`
1913
+	FubuDesc         string `gorm:"column:fubu_desc" json:"fubu_desc" form:"fubu_desc"`
1914
+	OthDesc          string `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
1915
+	DoctorId         int64  `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
1916
+}
1917
+
1918
+func (XtPatientPhysiqueCheck) TableName() string {
1919
+	return "xt_patient_physique_check"
1920
+}

+ 81 - 322
service/app_version.go View File

@@ -353,6 +353,7 @@ type HisPrescriptionInfoTemplateTwo struct {
353 353
 func (HisPrescriptionInfoTemplateTwo) TableName() string {
354 354
 	return "his_prescription_info_template"
355 355
 }
356
+
356 357
 func GetHisPrescriptionTemplateTwo() (prescription []*HisPrescriptionInfoTemplateTwo, err error) {
357 358
 	err = readDb.Model(&HisPrescriptionInfoTemplateTwo{}).
358 359
 		Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
@@ -362,9 +363,11 @@ func GetHisPrescriptionTemplateTwo() (prescription []*HisPrescriptionInfoTemplat
362 363
 		Find(&prescription).Error
363 364
 	return
364 365
 }
366
+
365 367
 func SaveAdviceTemplate(advice HisPrescriptionAdviceTemplate) {
366 368
 	writeDb.Save(&advice)
367 369
 }
370
+
368 371
 func GetAllPT(org_id int64) (his []*models.HisPrescriptionTemplate, err error) {
369 372
 	err = readDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND status = 1", org_id).Find(&his).Error
370 373
 	return
@@ -422,6 +425,7 @@ type HisPrescriptionInfoTemplateTHree struct {
422 425
 func (HisPrescriptionInfoTemplateTHree) TableName() string {
423 426
 	return "his_prescription_info_template"
424 427
 }
428
+
425 429
 func GetAllPTInfo(org_id int64, p_template_id int64) (his []*HisPrescriptionInfoTemplateTHree, err error) {
426 430
 	err = readDb.Model(&HisPrescriptionInfoTemplateTHree{}).Preload("HisPrescriptionAdviceTemplate", func(db *gorm.DB) *gorm.DB {
427 431
 		return db.Where("status = 1")
@@ -430,6 +434,7 @@ func GetAllPTInfo(org_id int64, p_template_id int64) (his []*HisPrescriptionInfo
430 434
 	}).Where("user_org_id = ? AND status = 1 AND p_template_id = ?", org_id, p_template_id).Find(&his).Error
431 435
 	return
432 436
 }
437
+
433 438
 func GetAllInfo(org_id int64, project_id int64) (his []*HisPrescriptionProjectTemplate, err error) {
434 439
 	err = readDb.Model(&HisPrescriptionProjectTemplate{}).Where("user_org_id = ? AND status = 1 AND project_id = ? ", org_id, project_id).Find(&his).Error
435 440
 	return
@@ -438,21 +443,26 @@ func UpdateStatus(project_id int64, p_id int64) {
438 443
 	writeDb.Model(&HisPrescriptionProjectTemplate{}).Where("id = ?", project_id).Updates(map[string]interface{}{"status": 0})
439 444
 	writeDb.Model(&HisPrescriptionInfoTemplateTwo{}).Where("id = ?", p_id).Updates(map[string]interface{}{"status": 0})
440 445
 }
446
+
441 447
 func SaveOrder(order *models.HisOrder) {
442 448
 	writeDb.Save(&order)
443 449
 }
450
+
444 451
 func GetAllPrivateHis(org_id int64) (his []*models.HisPatient) {
445 452
 	readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND balance_accounts_type = 2 AND status = 1", org_id).Find(&his)
446 453
 	return
447 454
 }
455
+
448 456
 func SaveHis(his *models.HisPatient) {
449 457
 	writeDb.Save(his)
450 458
 	return
451 459
 }
460
+
452 461
 func GetAllProjectPrescription() (pre []*models.HisPrescription) {
453 462
 	readDb.Model(&models.HisPrescription{}).Where("user_org_id = 10215 AND status = 1 AND type = 2 AND order_status = 1 AND record_date >= 1659283200").Find(&pre)
454 463
 	return
455 464
 }
465
+
456 466
 func GetAllProject(id int64) (pre []*models.HisPrescriptionProject) {
457 467
 	readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = 10215 AND status = 1 AND project_id = 1735  AND prescription_id = ?", id).Find(&pre)
458 468
 	return
@@ -468,6 +478,7 @@ func GetAllProject(id int64) (pre []*models.HisPrescriptionProject) {
468 478
 //	}).Find(&order).Error
469 479
 //	return
470 480
 //}
481
+
471 482
 type HisOrderTen struct {
472 483
 	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
473 484
 	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -542,47 +553,14 @@ type HisOrderTen struct {
542 553
 	Creator               int64                 `gorm:"column:creator" json:"creator" form:"creator"`
543 554
 	PType                 int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
544 555
 	Decimal               float64               `gorm:"column:decimal" json:"decimal" form:"decimal"`
545
-	HisPrescriptionTen    []*HisPrescriptionTen `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"info"`
546
-	//VmHisOrderInfo9504    []*VmHisOrderInfo9504 `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"order_info"`
547
-	VmHisOrderInfo9504 []*VmHisOrderInfo9504 `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"order_info"`
548
-	OthDesc            string                `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
549
-	PayWays            string                `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
550
-
551
-	Patients Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
556
+	VmHisOrderInfo9504    []*VmHisOrderInfo9504 `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"info"`
557
+	Patients              Patients              `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
552 558
 }
553 559
 
554 560
 func (HisOrderTen) TableName() string {
555 561
 	return "his_order"
556 562
 }
557 563
 
558
-type HisPrescriptionInfoOne struct {
559
-	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
560
-	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
561
-	RecordDate         int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
562
-	PatientId          int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
563
-	HisPatientId       int64  `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
564
-	Status             int64  `gorm:"column:status" json:"status" form:"status"`
565
-	Ctime              int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
566
-	Mtime              int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
567
-	Creator            int64  `gorm:"column:creator" json:"creator" form:"creator"`
568
-	Modifier           int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
569
-	Diagnosis          string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
570
-	RegisterType       int64  `gorm:"column:register_type" json:"register_type" form:"register_type"`
571
-	Doctor             string `gorm:"column:doctor" json:"doctor" form:"doctor"`
572
-	Departments        int64  `gorm:"column:departments" json:"departments" form:"departments"`
573
-	SickHistory        string `gorm:"column:sick_history" json:"sick_history" form:"sick_history"`
574
-	PrescriptionNumber string `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
575
-	PrescriptionStatus int64  `gorm:"column:prescription_status" json:"prescription_status" form:"prescription_status"`
576
-	BatchNumber        string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
577
-	DoctorId           int64  `gorm:"column:doctor_id" json:"doctor_id" form:"doctor_id"`
578
-	SickType           int64  `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
579
-	PType              int64  `gorm:"column:p_type" json:"p_type" form:"p_type"`
580
-}
581
-
582
-func (HisPrescriptionInfoOne) TableName() string {
583
-	return "his_prescription_info"
584
-}
585
-
586 564
 type HisPrescriptionTen struct {
587 565
 	ID                        int64                        `gorm:"column:id" json:"id" form:"id"`
588 566
 	UserOrgId                 int64                        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -604,7 +582,6 @@ type HisPrescriptionTen struct {
604 582
 	Patients                  Patients                     `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
605 583
 	HisDoctorAdviceInfoTen    []*HisDoctorAdviceInfoTen    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
606 584
 	HisPrescriptionProjectTen []*HisPrescriptionProjectTen `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
607
-	HisPrescriptionInfoOne    HisPrescriptionInfoOne       `gorm:"ForeignKey:PrescriptionNumber;AssociationForeignKey:PrescriptionNumber" json:"p_info"`
608 585
 	Total                     string                       `gorm:"-" json:"total" form:"total"`
609 586
 	PType                     int64                        `gorm:"column:p_type" json:"p_type" form:"p_type"`
610 587
 	MedType                   string                       `gorm:"column:med_type" json:"med_type" form:"med_type"`
@@ -614,83 +591,43 @@ type HisPrescriptionTen struct {
614 591
 func (HisPrescriptionTen) TableName() string {
615 592
 	return "his_prescription"
616 593
 }
594
+
617 595
 func GetHisOrderDetailThree() (order []*HisOrderTen, err error) {
618
-	err = readDb.Model(&HisOrderTen{}).Preload("VmHisOrderInfo9504", "status = 1").Preload("Patients", "status = 1").Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
596
+	err = readDb.Model(&HisOrderTen{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
619 597
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
620 598
 			return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
621 599
 		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
622 600
 			return db.Where("status = 1").Preload("Drug", "status = 1")
623 601
 		})
624
-	}).Where("settle_accounts_date >= 1675180800 AND settle_accounts_date <= 1677513600 AND status = 1 AND order_status =2 and p_type = 1 AND user_org_id = 10215").Find(&order).Order("patient_id").Error
602
+	}).Where("setl_time >= '2023-03-01 00:00:00' AND setl_time <= '2023-03-31 23:59:59' AND status = 1 AND order_status =2 and p_type = 1 AND user_org_id = 10215").Find(&order).Order("patient_id").Error
625 603
 	return
626 604
 }
627 605
 
628
-type VmHisOrderInfo9504Two struct {
629
-	ID               int64   `gorm:"column:id" json:"id" form:"id"`
630
-	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`
631
-	UploadDate       int64   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
632
-	AdviceId         int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
633
-	DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
634
-	Cnt              float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
635
-	Pric             float64 `gorm:"column:pric" json:"pric" form:"pric"`
636
-	PatientId        int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
637
-	PricUplmtAmt     float64 `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
638
-	SelfpayProp      float64 `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
639
-	FulamtOwnpayAmt  float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
640
-	OverlmtAmt       float64 `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
641
-	PreselfpayAmt    float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
642
-	BasMednFlag      string  `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
643
-	MedChrgitmType   string  `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
644
-	HiNegoDrugFlag   string  `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
645
-	Status           int64   `gorm:"column:status" json:"status" form:"status"`
646
-	Memo             string  `gorm:"column:memo" json:"memo" form:"memo"`
647
-	FeedetlSn        string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
648
-	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
649
-	InscpScpAmt      float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
650
-	DrtReimFlag      string  `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
651
-	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
652
-	ListSpItemFlag   string  `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
653
-	ChldMedcFlag     string  `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
654
-	LmtUsedFlag      string  `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
655
-	ChrgitmLv        string  `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
656
-	UserOrgId        int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
657
-	HisPatientId     int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
658
-	OrderId          int64   `gorm:"column:order_id" json:"order_id" form:"order_id"`
659
-	ProjectId        int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
660
-	Type             int64   `gorm:"column:type" json:"type" form:"type"`
661
-	ItemId           int64   `gorm:"column:item_id" json:"item_id" form:"item_id"`
662
-	SettleType       int64   `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
663
-}
664
-
665
-func (VmHisOrderInfo9504Two) TableName() string {
666
-	return "his_order_info"
667
-}
668
-
669 606
 type HisDoctorAdviceInfoTen struct {
670
-	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
671
-	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
672
-	PatientId             int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
673
-	AdviceDate            int64                 `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
674
-	AdviceName            string                `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
675
-	AdviceDesc            string                `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
676
-	SingleDose            float64               `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
677
-	SingleDoseUnit        string                `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
678
-	PrescribingNumber     float64               `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
679
-	PrescribingNumberUnit string                `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
680
-	DeliveryWay           string                `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
681
-	ExecutionFrequency    string                `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
682
-	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
683
-	CreatedTime           int64                 `gorm:"column:created_time" json:"created_time" form:"created_time"`
684
-	RecordDate            int64                 `gorm:"column:record_date" json:"record_date" form:"record_date"`
685
-	DrugSpec              float64               `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
686
-	DrugSpecUnit          string                `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
687
-	PrescriptionId        int64                 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
688
-	VmHisOrderInfo9504Two VmHisOrderInfo9504Two `gorm:"ForeignKey:AdviceId;AssociationForeignKey:ID" json:"order_info"`
689
-	Price                 float64               `gorm:"column:price" json:"price" form:"price"`
690
-	DrugId                int64                 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
691
-	Drug                  Drug                  `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
692
-	IsMedicine            int64                 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
693
-	ExecutionFrequencyId  int64                 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
607
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
608
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
609
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
610
+	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
611
+	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
612
+	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
613
+	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
614
+	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
615
+	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
616
+	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
617
+	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
618
+	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
619
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
620
+	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
621
+	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
622
+	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
623
+	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
624
+	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
625
+
626
+	Price                float64 `gorm:"column:price" json:"price" form:"price"`
627
+	DrugId               int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
628
+	Drug                 Drug    `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
629
+	IsMedicine           int64   `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
630
+	ExecutionFrequencyId int64   `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
694 631
 }
695 632
 
696 633
 func (HisDoctorAdviceInfoTen) TableName() string {
@@ -698,39 +635,38 @@ func (HisDoctorAdviceInfoTen) TableName() string {
698 635
 }
699 636
 
700 637
 type HisPrescriptionProjectTen struct {
701
-	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
702
-	ProjectId             int64                 `gorm:"column:project_id" json:"project_id" form:"project_id"`
703
-	Price                 float64               `gorm:"column:price" json:"price" form:"price"`
704
-	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
705
-	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
706
-	Ctime                 int64                 `gorm:"column:ctime" json:"ctime" form:"ctime"`
707
-	Mtime                 int64                 `gorm:"column:mtime" json:"mtime" form:"mtime"`
708
-	PatientId             int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
709
-	HisPatientId          int64                 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
710
-	RecordDate            int64                 `gorm:"column:record_date" json:"record_date" form:"record_date"`
711
-	PrescriptionId        int64                 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
712
-	Count                 string                `gorm:"column:count" json:"count" form:"count"`
713
-	FeedetlSn             string                `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
714
-	MedListCodg           string                `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
715
-	SingleDose            string                `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
716
-	DeliveryWay           string                `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
717
-	ExecutionFrequency    string                `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
718
-	Day                   string                `gorm:"column:day" json:"day" form:"day"`
719
-	VMHisProject          VMHisProject          `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
720
-	VMGoodInfo            VMGoodInfo            `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
721
-	Remark                string                `gorm:"column:remark" json:"remark" form:"remark"`
722
-	Unit                  string                `gorm:"column:unit" json:"unit" form:"unit"`
723
-	Type                  int64                 `gorm:"column:type" json:"type" form:"type"`
724
-	Doctor                int64                 `gorm:"column:doctor" json:"doctor" form:"doctor"`
725
-	ExecutionTime         int64                 `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
726
-	ExecutionStaff        int64                 `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
727
-	ExecutionState        int64                 `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
728
-	CheckTime             int64                 `gorm:"column:check_time" json:"check_time" form:"check_time"`
729
-	CheckState            int64                 `gorm:"column:check_state" json:"check_state" form:"check_state"`
730
-	Checker               int64                 `gorm:"column:checker" json:"checker" form:"checker"`
731
-	StartTime             int64                 `gorm:"column:start_time" json:"start_time" form:"start_time"`
732
-	TeamId                int64                 `gorm:"column:team_id" json:"team_id" form:"team_id"`
733
-	VmHisOrderInfo9504Two VmHisOrderInfo9504Two `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"order_info"`
638
+	ID                 int64        `gorm:"column:id" json:"id" form:"id"`
639
+	ProjectId          int64        `gorm:"column:project_id" json:"project_id" form:"project_id"`
640
+	Price              float64      `gorm:"column:price" json:"price" form:"price"`
641
+	UserOrgId          int64        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
642
+	Status             int64        `gorm:"column:status" json:"status" form:"status"`
643
+	Ctime              int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
644
+	Mtime              int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
645
+	PatientId          int64        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
646
+	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
647
+	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
648
+	PrescriptionId     int64        `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
649
+	Count              string       `gorm:"column:count" json:"count" form:"count"`
650
+	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
651
+	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
652
+	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
653
+	DeliveryWay        string       `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
654
+	ExecutionFrequency string       `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
655
+	Day                string       `gorm:"column:day" json:"day" form:"day"`
656
+	VMHisProject       VMHisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
657
+	VMGoodInfo         VMGoodInfo   `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
658
+	Remark             string       `gorm:"column:remark" json:"remark" form:"remark"`
659
+	Unit               string       `gorm:"column:unit" json:"unit" form:"unit"`
660
+	Type               int64        `gorm:"column:type" json:"type" form:"type"`
661
+	Doctor             int64        `gorm:"column:doctor" json:"doctor" form:"doctor"`
662
+	ExecutionTime      int64        `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
663
+	ExecutionStaff     int64        `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
664
+	ExecutionState     int64        `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
665
+	CheckTime          int64        `gorm:"column:check_time" json:"check_time" form:"check_time"`
666
+	CheckState         int64        `gorm:"column:check_state" json:"check_state" form:"check_state"`
667
+	Checker            int64        `gorm:"column:checker" json:"checker" form:"checker"`
668
+	StartTime          int64        `gorm:"column:start_time" json:"start_time" form:"start_time"`
669
+	TeamId             int64        `gorm:"column:team_id" json:"team_id" form:"team_id"`
734 670
 
735 671
 	FrequencyType        int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
736 672
 	DayCount             int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
@@ -741,19 +677,14 @@ type HisPrescriptionProjectTen struct {
741 677
 func (HisPrescriptionProjectTen) TableName() string {
742 678
 	return "his_prescription_project"
743 679
 }
680
+
744 681
 func GetHisPatient11111(orgid int64) (paitent []*models.HisHospitalCheckRecord, err error) {
745
-	err = XTReadDB().Model(&paitent).Where("user_org_id = ?  and status = 1 AND in_hosptial_time >= '2023-02-01 00:00:00' AND in_hosptial_time <= '2023-02-28 23:59:59'", orgid).Find(&paitent).Error
746
-	return paitent, err
747
-}
748
-func GetHisPatient2222(orgid int64) (paitent []*models.HisPatient, err error) {
749
-	err = XTReadDB().Model(&models.HisPatient{}).Where("user_org_id = ?  and status = 1 AND record_date >= 1654012800 AND record_date <= 1659196800 ", orgid).Find(&paitent).Error
682
+	err = XTReadDB().Model(&paitent).Where("user_org_id = ?  and status = 1 AND in_hosptial_time >= '2022-12-01 00:00:00' AND in_hosptial_time <= '2022-12-31 23:59:59'", orgid).Find(&paitent).Error
750 683
 	return paitent, err
751 684
 }
685
+
752 686
 func SaveHP(paitent *models.HisHospitalCheckRecord) {
753 687
 	writeDb.Save(&paitent)
754
-}
755
-func SaveHPtWO(paitent *models.HisPatient) {
756
-	writeDb.Save(&paitent)
757 688
 
758 689
 }
759 690
 
@@ -829,8 +760,6 @@ type HisOrder9504 struct {
829 760
 	DepartmentName        string    `gorm:"-" json:"department_name" form:"department_name"`
830 761
 	DoctorName            string    `gorm:"-" json:"doctor_name" form:"doctor_name"`
831 762
 	SettleStartTime       int64     `gorm:"settle_start_time" json:"settle_start_time" form:"settle_start_time"`
832
-	OthDesc               string    `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
833
-	PayWays               string    `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
834 763
 
835 764
 	Creator            int64                 `gorm:"column:creator" json:"creator" form:"creator"`
836 765
 	PType              int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
@@ -926,6 +855,7 @@ type VmHisOrderInfo95042 struct {
926 855
 func (VmHisOrderInfo95042) TableName() string {
927 856
 	return "his_order_info"
928 857
 }
858
+
929 859
 func GetHisOrderDetail9504() (order []*HisOrder9504, err error) {
930 860
 	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
931 861
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
@@ -936,6 +866,7 @@ func GetHisOrderDetail9504() (order []*HisOrder9504, err error) {
936 866
 	}).Where("settle_accounts_date >= 1640966400 AND settle_accounts_date <= 1661875200 AND status = 1 AND order_status =2  AND user_org_id = 9504").Find(&order).Order("setl_time").Error
937 867
 	return
938 868
 }
869
+
939 870
 func GetHisOrderDetail10188() (order []*HisOrder9504, err error) {
940 871
 	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
941 872
 		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
@@ -959,7 +890,7 @@ func GetHisOrderDetail10138() (order []*HisOrderTen, err error) {
959 890
 		return db.Where("status = 1 AND order_status = 2").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
960 891
 			return db.Where("status = 1").Preload("VMHisProject")
961 892
 		})
962
-	}).Where("settle_accounts_date >= 1672502400 AND settle_accounts_date <= 1676822400 AND status = 1 AND order_status =2  AND user_org_id = 10278").Find(&order).Error
893
+	}).Where("settle_accounts_date >= 1664553600 AND settle_accounts_date <= 1672416000 AND status = 1 AND order_status =2  AND user_org_id = 10278").Find(&order).Error
963 894
 	return
964 895
 }
965 896
 
@@ -1104,181 +1035,9 @@ func SaveSch(sch models.Schedule) (err error) {
1104 1035
 }
1105 1036
 
1106 1037
 func SaveSchTwo(sch models.Schedule, sch_two models.Schedule) (err error) {
1107
-	utx := writeDb.Begin()
1108
-	if err = utx.Model(&Schedule{}).Where("status=1 AND id = ?", sch.ID).Updates(map[string]interface{}{"status": 0}).Error; err != nil {
1109
-		utx.Rollback()
1110
-		return err
1111
-	}
1112
-	if err = utx.Model(&Schedule{}).Where("status=1 AND id = ?", sch_two.ID).Updates(map[string]interface{}{"status": 0}).Error; err != nil {
1113
-		utx.Rollback()
1114
-		return err
1115
-	}
1116
-	utx.Commit()
1117
-	return err
1118
-}
1038
+	//err = writeDb.Save(&sch).Error
1039
+	err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch.ID).Updates(map[string]interface{}{"status": 0}).Error
1040
+	err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch_two.ID).Updates(map[string]interface{}{"status": 0}).Error
1119 1041
 
1120
-func GetHisOrderInfoDetail() (order []*VmHisOrderInfo9504, err error) {
1121
-	err = readDb.Model(&VmHisOrderInfo9504{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1122
-		return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1123
-	}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1124
-		return db.Where("status = 1").Preload("Drug")
1125
-	}).Where("status = 1 AND order_number = '202302201702258124538'").Find(&order).Error
1126
-	return
1127
-}
1128
-
1129
-func GetHisPrescriptionInfoDetail() (order []*HisPrescriptionProjectTen, err error) {
1130
-	err = readDb.Model(&HisPrescriptionProjectTen{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1131
-		return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1132
-	}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1133
-		return db.Where("status = 1").Preload("Drug")
1134
-	}).Where("status = 1 AND order_number = '202302201702258124538'").Find(&order).Error
1135
-	return
1136
-}
1137
-
1138
-type HisOrder10138 struct {
1139
-	ID                 int64                 `gorm:"column:id" json:"id" form:"id"`
1140
-	UserOrgId          int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1141
-	Status             int64                 `gorm:"column:status" json:"status" form:"status"`
1142
-	Number             string                `gorm:"column:number" json:"number" form:"number"`
1143
-	PatientId          int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1144
-	OrderStatus        int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
1145
-	MdtrtId            string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
1146
-	Ctime              int64                 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1147
-	SettleAccountsDate int64                 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
1148
-	VmHisOrderInfo9504 []*VmHisOrderInfo9504 `json:"infos" form:"infos"`
1149
-}
1150
-
1151
-func (HisOrder10138) TableName() string {
1152
-	return "his_order"
1153
-}
1154
-
1155
-type PatientVM10138 struct {
1156
-	ID            int64            `gorm:"column:id" json:"id" form:"id"`
1157
-	UserOrgId     int64            `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1158
-	Name          string           `gorm:"column:name" json:"name" form:"name"`
1159
-	HisOrder10138 []*HisOrder10138 `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"order"`
1160
-}
1161
-
1162
-func (PatientVM10138) TableName() string {
1163
-	return "xt_patients"
1164
-}
1165
-
1166
-func GetHisAllPatientOrder(start_time int64, end_time int64) (order []*PatientVM10138, err error) {
1167
-	err = readDb.Model(&PatientVM10138{}).Preload("HisOrder10138", " ctime >= ? AND ctime <= ? AND status = 1 AND order_status = 2", start_time, end_time).Where("user_org_id = 10138 AND status = 1").Find(&order).Error
1168
-	return
1169
-}
1170
-
1171
-func GetHisOrderInfoDetail10138(order_number string) (order []*VmHisOrderInfo9504, err error) {
1172
-	err = readDb.Model(&VmHisOrderInfo9504{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1173
-		return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1174
-	}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1175
-		return db.Where("status = 1").Preload("Drug")
1176
-	}).Where("status = 1 AND order_number = ?", order_number).Find(&order).Error
1177
-	return
1178
-}
1179
-
1180
-//func GetHisOrderDetailOne(start_time int64, end_time int64) (order []*HisOrder9504, err error) {
1181
-//	err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
1182
-//		return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1183
-//			return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
1184
-//		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1185
-//			return db.Where("status = 1").Preload("Drug")
1186
-//		})
1187
-//	}).Where("settle_accounts_date >= ? AND settle_accounts_date <= ? AND status = 1 AND order_status =2  AND user_org_id = 9919", start_time, end_time).Find(&order).Order("setl_time").Error
1188
-//	return
1189
-//}
1190
-//
1191
-
1192
-type HisOrderTenOne struct {
1193
-	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
1194
-	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1195
-	HisPatientId          int64                 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1196
-	SettleAccountsDate    int64                 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
1197
-	Ctime                 int64                 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1198
-	Mtime                 int64                 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1199
-	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
1200
-	Number                string                `gorm:"column:number" json:"number" form:"number"`
1201
-	PatientId             int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1202
-	Infcode               int64                 `gorm:"column:infcode" json:"infcode" form:"infcode"`
1203
-	WarnMsg               string                `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
1204
-	Cainfo                string                `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
1205
-	ErrMsg                string                `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
1206
-	RespondTime           string                `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
1207
-	InfRefmsgid           string                `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
1208
-	OrderStatus           int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
1209
-	MdtrtId               string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
1210
-	SetlId                string                `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
1211
-	PsnNo                 string                `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
1212
-	PsnName               string                `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
1213
-	PsnCertType           string                `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
1214
-	Certno                string                `gorm:"column:certno" json:"certno" form:"certno"`
1215
-	Gend                  string                `gorm:"column:gend" json:"gend" form:"gend"`
1216
-	Naty                  string                `gorm:"column:naty" json:"naty" form:"naty"`
1217
-	Brdy                  time.Time             `gorm:"column:brdy" json:"brdy" form:"brdy"`
1218
-	Age                   float64               `gorm:"column:age" json:"age" form:"age"`
1219
-	Insutype              string                `gorm:"column:insutype" json:"insutype" form:"insutype"`
1220
-	PsnType               string                `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
1221
-	CvlservFlag           string                `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
1222
-	SetlTime              string                `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
1223
-	MdtrtCertType         string                `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
1224
-	MedType               string                `gorm:"column:med_type" json:"med_type" form:"med_type"`
1225
-	MedfeeSumamt          float64               `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
1226
-	FulamtOwnpayAmt       float64               `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
1227
-	OverlmtSelfPay        float64               `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
1228
-	PreselfpayAmt         float64               `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
1229
-	InscpScpAmt           float64               `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
1230
-	ActPayDedc            float64               `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
1231
-	HifpPay               float64               `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
1232
-	CvlservPay            float64               `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
1233
-	PoolPropSelfpay       float64               `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
1234
-	HifesPay              float64               `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
1235
-	HifmiPay              float64               `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
1236
-	HifobPay              float64               `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
1237
-	MafPay                float64               `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
1238
-	OthPay                float64               `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
1239
-	FundPaySumamt         float64               `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
1240
-	PsnPartAmt            float64               `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
1241
-	AcctPay               float64               `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
1242
-	PsnCashPay            float64               `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
1243
-	HospPartAmt           float64               `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
1244
-	Balc                  float64               `gorm:"column:balc" json:"balc" form:"balc"`
1245
-	AcctMulaidPay         float64               `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
1246
-	MedinsSetlId          string                `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
1247
-	ClrOptins             string                `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
1248
-	ClrWay                string                `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
1249
-	ClrType               string                `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
1250
-	SetlDetail            string                `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
1251
-	IsMedicineInsurance   int64                 `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
1252
-	PayWay                int64                 `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
1253
-	PayPrice              float64               `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
1254
-	PayCardNo             string                `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
1255
-	DiscountPrice         float64               `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
1256
-	PreferentialPrice     float64               `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
1257
-	RealityPrice          float64               `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
1258
-	FoundPrice            float64               `gorm:"column:found_price" json:"found_price" form:"found_price"`
1259
-	MedicalInsurancePrice float64               `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
1260
-	PrivatePrice          float64               `gorm:"column:private_price" json:"private_price" form:"private_price"`
1261
-	DepartmentName        string                `gorm:"-" json:"department_name" form:"department_name"`
1262
-	DoctorName            string                `gorm:"-" json:"doctor_name" form:"doctor_name"`
1263
-	Creator               int64                 `gorm:"column:creator" json:"creator" form:"creator"`
1264
-	PType                 int64                 `gorm:"column:p_type" json:"p_type" form:"p_type"`
1265
-	Decimal               float64               `gorm:"column:decimal" json:"decimal" form:"decimal"`
1266
-	HisPrescriptionTen    []*HisPrescriptionTen `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"info"`
1267
-	OthDesc               string                `gorm:"oth_desc" json:"oth_desc" form:"oth_desc"`
1268
-	PayWays               string                `gorm:"pay_ways" json:"pay_ways" form:"pay_ways"`
1269
-}
1270
-
1271
-func (HisOrderTenOne) TableName() string {
1272
-	return "his_order"
1273
-}
1274
-
1275
-func GetHisOrderDetailOne(start_time int64, end_time int64) (order []*HisOrderTen, err error) {
1276
-	err = readDb.Model(&HisOrderTen{}).Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
1277
-		return db.Where("status = 1").Preload("HisPrescriptionInfoOne", "status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
1278
-			return db.Where("status = 1").Preload("VmHisOrderInfo9504Two", "status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
1279
-		}).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
1280
-			return db.Where("status = 1").Preload("VmHisOrderInfo9504Two", "status = 1").Preload("Drug", "status = 1")
1281
-		})
1282
-	}).Where("settle_accounts_date >= ? AND settle_accounts_date <= ? AND status = 1 AND order_status =2 AND user_org_id = 9919 AND setl_id <> ''", start_time, end_time).Find(&order).Error
1283 1042
 	return
1284 1043
 }

+ 6 - 0
service/device_service.go View File

@@ -824,6 +824,12 @@ func GetScheduleByClassType(schedule_type int64, schedule_date int64, bed_id int
824 824
 	return schedule, err
825 825
 }
826 826
 
827
+func GetScheduleByClassTypeTwo(schedule_type int64, schedule_date int64, patient_id int64, user_org_id int64) (models.XtSchedule, error) {
828
+	schedule := models.XtSchedule{}
829
+	err := XTReadDB().Where(" schedule_date = ? and patient_id = ? and user_org_id = ? and status = 1", schedule_date, patient_id, user_org_id).Find(&schedule).Error
830
+	return schedule, err
831
+}
832
+
827 833
 func GetPartionId(bed_id int64, org_id int64) (models.XtDeviceNumber, error) {
828 834
 
829 835
 	number := models.XtDeviceNumber{}

+ 19 - 19
service/his_config_service.go View File

@@ -54,7 +54,7 @@ func DelelteHisPrescriptionInfoTemplate(id int64, user_org_id int64) (err error)
54 54
 
55 55
 func DelelteHisPrescriptionTemplate(id int64, user_org_id int64) (err error) {
56 56
 	err = writeDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0}).Error
57
-	err = writeDb.Model(&models.HisPrescriptionInfoTemplate{}).Where("user_org_id = ? AND id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
57
+	err = writeDb.Model(&models.HisPrescriptionInfoTemplate{}).Where("user_org_id = ? AND p_template_id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
58 58
 	return
59 59
 }
60 60
 
@@ -69,7 +69,7 @@ func DelelteHisPrescriptionProjectTemplate(id int64, user_org_id int64) (err err
69 69
 	return
70 70
 }
71 71
 
72
-//封装保存接口
72
+// 封装保存接口
73 73
 func FenCreatePrescriptionTemplate(id, mode_id, types, patient_id int64, name string, adminInfo *AdminUserInfo, dataBody map[string]interface{}) (err error) {
74 74
 	tmp_bool_id := IsDialysisMode(adminInfo.CurrentOrgId, patient_id, mode_id)
75 75
 
@@ -203,7 +203,7 @@ func FenCreatePrescriptionTemplate(id, mode_id, types, patient_id int64, name st
203 203
 	return
204 204
 }
205 205
 
206
-//复制一个setProjectTemplateWithJSON接口
206
+// 复制一个setProjectTemplateWithJSON接口
207 207
 func FensetProjectTemplateWithJSON(project *models.HisPrescriptionProjectTemplate, json map[string]interface{}) int {
208 208
 	if json["id"] != nil {
209 209
 		id := json["id"].(string)
@@ -321,7 +321,7 @@ func FensetProjectTemplateWithJSON(project *models.HisPrescriptionProjectTemplat
321 321
 	return 0
322 322
 }
323 323
 
324
-//复制一个setAdviceTemplateWithJSON接口
324
+// 复制一个setAdviceTemplateWithJSON接口
325 325
 func FensetAdviceTemplateWithJSON(advice *models.HisPrescriptionAdviceTemplate, json map[string]interface{}) int {
326 326
 	//if json["advice_id"] != nil || reflect.TypeOf(json["advice_id"]).String() == "float64" {
327 327
 	//	advice_id := int64(json["advice_id"].(float64))
@@ -448,7 +448,7 @@ func FensetAdviceTemplateWithJSON(advice *models.HisPrescriptionAdviceTemplate,
448 448
 	return 0
449 449
 }
450 450
 
451
-//判断该患者是否有该透析模式
451
+// 判断该患者是否有该透析模式
452 452
 func IsDialysisMode(orgid, patient_id, mode int64) bool {
453 453
 	var total int
454 454
 	XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and patient_id = ? and status = 1 and mode = ?", orgid, patient_id, mode).Count(&total)
@@ -459,7 +459,7 @@ func IsDialysisMode(orgid, patient_id, mode int64) bool {
459 459
 	}
460 460
 }
461 461
 
462
-//获取该透析模式的患者列表
462
+// 获取该透析模式的患者列表
463 463
 func GetDialysisModePatient(orgid, model int64) (list []*models.DialysisPatient, err error) {
464 464
 	var tmp []*models.DialysisPatient
465 465
 	err = XTReadDB().Raw("select id,name from xt_patients,(SELECT patient_id FROM his_prescription_template WHERE user_org_id = ? and "+
@@ -470,7 +470,7 @@ func GetDialysisModePatient(orgid, model int64) (list []*models.DialysisPatient,
470 470
 	return tmp, err
471 471
 }
472 472
 
473
-//如果没有名字默认透析模式
473
+// 如果没有名字默认透析模式
474 474
 func DialysisModeName(mode int64) string {
475 475
 	tmp := make(map[int64]string)
476 476
 	tmp[1] = "HD"
@@ -511,14 +511,14 @@ func DialysisModeName(mode int64) string {
511 511
 	return ""
512 512
 }
513 513
 
514
-//查询出该模板的id
514
+// 查询出该模板的id
515 515
 func IdOfTheTemplate(orgid, patient_id, mode_id int64) (src_template models.HisPrescriptionTemplate, err error) {
516 516
 	err = XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and "+
517 517
 		"patient_id = ? and status = 1 and mode = ?", orgid, patient_id, mode_id).Find(&src_template).Error
518 518
 	return src_template, err
519 519
 }
520 520
 
521
-//根据透析模式、患者姓名、药品项目获取处方内容
521
+// 根据透析模式、患者姓名、药品项目获取处方内容
522 522
 func GetPrescriptionContent(mode, orgid, patient_id int64) (list []*models.HisPrescriptionInfoTemplate, err error) {
523 523
 	var tmp models.HisPrescriptionTemplate
524 524
 	err = XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and patient_id = ? and mode = ? and status = 1", orgid, patient_id, mode).Find(&tmp).Error
@@ -531,7 +531,7 @@ func GetPrescriptionContent(mode, orgid, patient_id int64) (list []*models.HisPr
531 531
 
532 532
 }
533 533
 
534
-//获取该透析模式患者列表(批量删除时用)药品
534
+// 获取该透析模式患者列表(批量删除时用)药品
535 535
 func GetDialysisDrugDelect(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
536 536
 	var tmp []*models.DialysisPatient
537 537
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
@@ -546,7 +546,7 @@ func GetDialysisDrugDelect(orgid, model, drug_id int64) (list []*models.Dialysis
546 546
 	return tmp, err
547 547
 }
548 548
 
549
-//获取该透析模式患者列表(批量删除时用)项目
549
+// 获取该透析模式患者列表(批量删除时用)项目
550 550
 func GetDialysisProjectDelect2(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
551 551
 	var tmp []*models.DialysisPatient
552 552
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
@@ -561,7 +561,7 @@ func GetDialysisProjectDelect2(orgid, model, drug_id int64) (list []*models.Dial
561 561
 	return tmp, err
562 562
 }
563 563
 
564
-//获取该透析模式患者列表(批量删除时用)耗材
564
+// 获取该透析模式患者列表(批量删除时用)耗材
565 565
 func GetDialysisProjectDelect3(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
566 566
 	var tmp []*models.DialysisPatient
567 567
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
@@ -576,7 +576,7 @@ func GetDialysisProjectDelect3(orgid, model, drug_id int64) (list []*models.Dial
576 576
 	return tmp, err
577 577
 }
578 578
 
579
-//根据透析模式删除药品
579
+// 根据透析模式删除药品
580 580
 func ModeDeleteDrug(orgid, model, drug_id int64, patient_id []int64) (err error) {
581 581
 	//开事务
582 582
 	tx := XTWriteDB().Begin()
@@ -613,7 +613,7 @@ func ModeDeleteDrug(orgid, model, drug_id int64, patient_id []int64) (err error)
613 613
 	return
614 614
 }
615 615
 
616
-//根据透析模式删除项目和耗材
616
+// 根据透析模式删除项目和耗材
617 617
 func ModeDelectItemsAndConsumables(orgid, model int64, drug_id string, patient_id []int64) (err error) {
618 618
 	//开事务
619 619
 	tx := XTWriteDB().Begin()
@@ -668,7 +668,7 @@ func ModeDelectItemsAndConsumables(orgid, model int64, drug_id string, patient_i
668 668
 	return
669 669
 }
670 670
 
671
-//替换该透析模式药品
671
+// 替换该透析模式药品
672 672
 func ReplaceDrug(orgid, model, drug_id int64, patient_id []int64, advice models.HisPrescriptionAdviceTemplate) (err error) {
673 673
 	//开事务
674 674
 	tx := XTWriteDB().Begin()
@@ -714,7 +714,7 @@ func ReplaceDrug(orgid, model, drug_id int64, patient_id []int64, advice models.
714 714
 	return
715 715
 }
716 716
 
717
-//替换该透析模式耗材
717
+// 替换该透析模式耗材
718 718
 func ReplaceItemsAndConsumables(orgid, model int64, drug_id string, patient_id []int64, project models.HisPrescriptionProjectTemplate) (err error) {
719 719
 	//开事务
720 720
 	tx := XTWriteDB().Begin()
@@ -778,7 +778,7 @@ func ReplaceItemsAndConsumables(orgid, model int64, drug_id string, patient_id [
778 778
 	return
779 779
 }
780 780
 
781
-//跟据id查询药品、项目、耗材、套餐
781
+// 跟据id查询药品、项目、耗材、套餐
782 782
 func QueryFourTables(id string, orgid int64) (tmp interface{}, err error) {
783 783
 	if id[0] == 112 {
784 784
 		after := id[1:]
@@ -857,7 +857,7 @@ func QueryFourTables(id string, orgid int64) (tmp interface{}, err error) {
857 857
 	}
858 858
 }
859 859
 
860
-//获取机构项目中所用的组
860
+// 获取机构项目中所用的组
861 861
 func GetDataConfig(orgid int64) (dataconfig []*models.DictDataconfig, err error) {
862 862
 	err = XTReadDB().Raw("select * from xt_drug_data_config where parent_id in "+
863 863
 		"(select id from xt_drug_data_config where name = \"统计分类\" and parent_id = 0) "+
@@ -865,7 +865,7 @@ func GetDataConfig(orgid int64) (dataconfig []*models.DictDataconfig, err error)
865 865
 	return
866 866
 }
867 867
 
868
-//翻译项目中的组
868
+// 翻译项目中的组
869 869
 func TranslateZu(sc, orgid int64, types string) (s string, err error) {
870 870
 	var dataconfig []*models.DictDataconfig
871 871
 	tmp := "select * from xt_drug_data_config where parent_id in (select id from xt_d·rug_data_config where name = \"" + types + "\" and parent_id = 0) and value = " + config.ToString(sc) + " and status = 1 and (org_id = " + config.ToString(orgid) + " or org_id = 0)"

+ 34 - 6
service/inspection_service.go View File

@@ -7,14 +7,28 @@ import (
7 7
 	"time"
8 8
 )
9 9
 
10
-func GetInspectionReference(orgId int64) (reference []*models.InspectionReference, err error) {
11
-	var count int
12
-	err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Count(&count).Error
13
-	if count > 0 {
14
-		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Order("project_id").Find(&reference).Error
10
+func GetInspectionReference(orgId int64, inspect_type int64) (reference []*models.InspectionReference, err error) {
11
+	if inspect_type == 0 {
12
+		var count int
13
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = 0", orgId).Count(&count).Error
14
+		if count > 0 {
15
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = 0", orgId).Order("project_id").Find(&reference).Error
16
+		} else {
17
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1 and inspection_type = 0").Order("project_id").Find(&reference).Error
18
+		}
19
+
15 20
 	} else {
16
-		err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1").Order("project_id").Find(&reference).Error
21
+
22
+		var count int
23
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = ?", orgId, inspect_type).Count(&count).Error
24
+		if count > 0 {
25
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1 and inspection_type = ?", orgId, inspect_type).Order("project_id").Find(&reference).Error
26
+		} else {
27
+			err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1 and inspection_type = ?", inspect_type).Order("project_id").Find(&reference).Error
28
+		}
29
+
17 30
 	}
31
+
18 32
 	return
19 33
 }
20 34
 
@@ -82,6 +96,15 @@ func CreatePatientInspection(inspectins []models.Inspection) (err error) {
82 96
 	return
83 97
 }
84 98
 
99
+func SavePatientInspection(inspectin models.Inspection) (err error) {
100
+	err = writeDb.Save(&inspectin).Error
101
+	return
102
+}
103
+func DeleteInspectionTwo(id int64) {
104
+	err = writeDb.Model(&models.Inspection{}).Where("id = ?", id).Updates(map[string]interface{}{"status": 0}).Error
105
+	return
106
+}
107
+
85 108
 func EditPatientInspection(add []models.Inspection, edit []models.Inspection, noDeleteIDs []int64, patientId, orgId, projectId, date int64) (err error) {
86 109
 	if len(add) == 0 && len(edit) == 0 && len(noDeleteIDs) == 0 {
87 110
 		err = errors.New(" Cant be nil.")
@@ -236,3 +259,8 @@ func GetInspectionReferenceByOrgId(orgid int64) (insepciton []*models.XtInspecti
236 259
 	err = readDb.Model(&insepciton).Where("org_id = ? and status = 1 and project_name = '传染病检查'", orgid).Find(&insepciton).Error
237 260
 	return insepciton, err
238 261
 }
262
+
263
+func GetInspectionReferenceTwo(project_id int64) (reference []*models.InspectionReference, err error) {
264
+	err = readDb.Model(&models.InspectionReference{}).Where("project_id = ? and status = 1", project_id).Order("project_id").Find(&reference).Error
265
+	return
266
+}

+ 71 - 0
service/patient_dataconfig_service.go View File

@@ -29,11 +29,61 @@ func GetPatientCourseOfDisease(orgID int64, patientID int64, startTime int64, en
29 29
 	return records, nil
30 30
 }
31 31
 
32
+func GetPatientSickHistory(orgID int64, patientID int64, startTime int64, endTime int64) ([]*models.XtPatientSickHistory, error) {
33
+	var records []*models.XtPatientSickHistory
34
+	err := readDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and record_time >= ? and record_time <= ? and status = 1", orgID, patientID, startTime, endTime).Order("record_time desc").Find(&records).Error
35
+	if err != nil {
36
+		return nil, err
37
+	}
38
+	return records, nil
39
+}
40
+
41
+func GetPatientSickHistoryByIds(orgID int64, patientID int64, ids []string) ([]*models.XtPatientSickHistory, error) {
42
+	var records []*models.XtPatientSickHistory
43
+	err := readDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, ids).Order("record_time desc").Find(&records).Error
44
+	if err != nil {
45
+		return nil, err
46
+	}
47
+	return records, nil
48
+}
49
+
50
+func GetPatienttPhysiqueByIds(orgID int64, patientID int64, ids []string) ([]*models.XtPatientPhysiqueCheck, error) {
51
+	var records []*models.XtPatientPhysiqueCheck
52
+	err := readDb.Model(&models.XtPatientPhysiqueCheck{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, ids).Order("record_time desc").Find(&records).Error
53
+	if err != nil {
54
+		return nil, err
55
+	}
56
+	return records, nil
57
+}
58
+
59
+func GetPatientPhysiqueCheck(orgID int64, patientID int64, startTime int64, endTime int64) ([]*models.XtPatientPhysiqueCheck, error) {
60
+	var records []*models.XtPatientPhysiqueCheck
61
+	err := readDb.Model(&models.XtPatientPhysiqueCheck{}).Where("org_id = ? and patient_id = ? and record_time >= ? and record_time <= ? and status = 1", orgID, patientID, startTime, endTime).Order("record_time desc").Find(&records).Error
62
+	if err != nil {
63
+		return nil, err
64
+	}
65
+	return records, nil
66
+}
67
+
68
+func GetLastPatientPhysiqueCheck(orgID int64, patientID int64, record_date int64) (records models.XtPatientPhysiqueCheck, err error) {
69
+	err = readDb.Model(&models.XtPatientPhysiqueCheck{}).Where("org_id = ? and patient_id = ? and record_date = ? and status = 1", orgID, patientID, record_date).Order("record_time desc").Last(&records).Error
70
+	return records, err
71
+}
72
+
32 73
 func CreatePatientCourseOfDisease(record *models.PatientDiseaseCourse) error {
33 74
 	err := writeDb.Model(&models.PatientDiseaseCourse{}).Create(record).Error
34 75
 	return err
35 76
 }
36 77
 
78
+func CreatePatientSickHistory(record *models.XtPatientSickHistory) error {
79
+	err := writeDb.Model(&models.XtPatientSickHistory{}).Create(record).Error
80
+	return err
81
+}
82
+
83
+func CreatePatientPhysiqueCheck(record *models.XtPatientPhysiqueCheck) error {
84
+	err := writeDb.Model(&models.XtPatientPhysiqueCheck{}).Create(record).Error
85
+	return err
86
+}
37 87
 func GetPatientRescueRecords(orgID int64, patientID int64, startTime int64, endTime int64) ([]*models.PatientRescueRecord, error) {
38 88
 	var records []*models.PatientRescueRecord
39 89
 	err := readDb.Model(&models.PatientRescueRecord{}).Where("org_id = ? and patient_id = ? and record_time >= ? and record_time <= ? and status = 1", orgID, patientID, startTime, endTime).Order("record_time desc").Find(&records).Error
@@ -53,12 +103,33 @@ func ModifyPatientCourses(record *models.PatientDiseaseCourse) error {
53 103
 	return err
54 104
 }
55 105
 
106
+func ModifyPatientSickHistory(record *models.XtPatientSickHistory) error {
107
+	err := writeDb.Save(record).Error
108
+	//err := writeDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and status = 1 and id = ?", record.OrgId, record.PatientId, record.ID).Updates(map[string]interface{}{"content": record.Content, "record_time": record.RecordTime, "mtime": time.Now().Unix(), "title": record.Title}).Error
109
+	return err
110
+}
111
+
112
+func ModifyPatientPhysiqueCheck(record *models.XtPatientPhysiqueCheck) error {
113
+	err := writeDb.Save(record).Error
114
+	//err := writeDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and status = 1 and id = ?", record.OrgId, record.PatientId, record.ID).Updates(map[string]interface{}{"content": record.Content, "record_time": record.RecordTime, "mtime": time.Now().Unix(), "title": record.Title}).Error
115
+	return err
116
+}
56 117
 func DeletePatientCoursesInBatch(orgID int64, patientID int64, recordIDs []int64) error {
57 118
 	err := writeDb.Model(&models.PatientDiseaseCourse{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
58 119
 	return err
59 120
 }
60 121
 
122
+func DeletePatientSickHistoryInBatch(orgID int64, patientID int64, recordIDs []int64) error {
123
+	err := writeDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
124
+	return err
125
+}
126
+
61 127
 func DeletePatientResuceRecordsInBatch(orgID int64, patientID int64, recordIDs []int64) error {
62 128
 	err := writeDb.Model(&models.PatientRescueRecord{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
63 129
 	return err
64 130
 }
131
+
132
+func DeletePatientPhysiqueCheckInBatch(orgID int64, patientID int64, recordIDs []int64) error {
133
+	err := writeDb.Model(&models.XtPatientPhysiqueCheck{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
134
+	return err
135
+}

+ 20 - 0
service/user_service.go View File

@@ -68,6 +68,26 @@ func GetAllDoctorAndNurseSix(orgId int64, appid int64) (doctors []AdminUserList,
68 68
 	return
69 69
 }
70 70
 
71
+func GetAllDoctorAndNurseSeven(orgId int64) (doctors []AdminUserList, nurses []AdminUserList, err error) {
72
+
73
+	var users []AdminUserList
74
+	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("org_id=?  and uar.user_type IN (2,3)", orgId).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&users).Error
75
+	if err != nil {
76
+		return
77
+	}
78
+	if len(users) == 0 {
79
+		return
80
+	}
81
+	for _, item := range users {
82
+		if item.UserType == 2 {
83
+			doctors = append(doctors, item)
84
+		} else {
85
+			nurses = append(nurses, item)
86
+		}
87
+	}
88
+	return
89
+}
90
+
71 91
 func GetAllAdminUsers(orgId, appid int64) (list []*AdminUserList, err error) {
72 92
 
73 93
 	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.org_id=? and uar.app_id =? and ua.status=1", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type,uar.status").Scan(&list).Error