瀏覽代碼

删除项目逻辑优化

陈少旭 2 年之前
父節點
當前提交
981c4f07ef

+ 1 - 1
controllers/data_api_controller.go 查看文件

@@ -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 查看文件

@@ -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,

+ 1 - 1
controllers/his_api_controller.go 查看文件

@@ -9593,7 +9593,7 @@ func (c *HisApiController) GetPrivateExpensesInfo() {
9593 9593
 	}
9594 9594
 
9595 9595
 	orderInfos = append(orderInfos, orderInfos_two...)
9596
-	if c.GetAdminUserInfo().CurrentOrgId != 10138 {
9596
+	if c.GetAdminUserInfo().CurrentOrgId != 10138 || c.GetAdminUserInfo().CurrentOrgId != 10278 {
9597 9597
 		orderInfos = append(orderInfos, orderInfos_three...)
9598 9598
 
9599 9599
 	}

+ 9 - 8
controllers/his_config_api_controller.go 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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
 	//查询该床位所属分区

+ 620 - 0
controllers/patient_dataconfig_api_controller.go 查看文件

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

+ 4 - 0
models/his_charge_models.go 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

+ 21 - 0
models/inspection_models.go 查看文件

@@ -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 {

+ 88 - 0
models/patient_models.go 查看文件

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

+ 6 - 0
service/device_service.go 查看文件

@@ -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 查看文件

@@ -50,7 +50,7 @@ func DelelteHisPrescriptionInfoTemplate(id int64, user_org_id int64) (err error)
50 50
 
51 51
 func DelelteHisPrescriptionTemplate(id int64, user_org_id int64) (err error) {
52 52
 	err = writeDb.Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? AND id = ?", user_org_id, id).Updates(map[string]interface{}{"status": 0}).Error
53
-	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
53
+	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
54 54
 	return
55 55
 }
56 56
 
@@ -65,7 +65,7 @@ func DelelteHisPrescriptionProjectTemplate(id int64, user_org_id int64) (err err
65 65
 	return
66 66
 }
67 67
 
68
-//封装保存接口
68
+// 封装保存接口
69 69
 func FenCreatePrescriptionTemplate(id, mode_id, types, patient_id int64, name string, adminInfo *AdminUserInfo, dataBody map[string]interface{}) (err error) {
70 70
 	tmp_bool_id := IsDialysisMode(adminInfo.CurrentOrgId, patient_id, mode_id)
71 71
 
@@ -199,7 +199,7 @@ func FenCreatePrescriptionTemplate(id, mode_id, types, patient_id int64, name st
199 199
 	return
200 200
 }
201 201
 
202
-//复制一个setProjectTemplateWithJSON接口
202
+// 复制一个setProjectTemplateWithJSON接口
203 203
 func FensetProjectTemplateWithJSON(project *models.HisPrescriptionProjectTemplate, json map[string]interface{}) int {
204 204
 	if json["id"] != nil {
205 205
 		id := json["id"].(string)
@@ -317,7 +317,7 @@ func FensetProjectTemplateWithJSON(project *models.HisPrescriptionProjectTemplat
317 317
 	return 0
318 318
 }
319 319
 
320
-//复制一个setAdviceTemplateWithJSON接口
320
+// 复制一个setAdviceTemplateWithJSON接口
321 321
 func FensetAdviceTemplateWithJSON(advice *models.HisPrescriptionAdviceTemplate, json map[string]interface{}) int {
322 322
 	//if json["advice_id"] != nil || reflect.TypeOf(json["advice_id"]).String() == "float64" {
323 323
 	//	advice_id := int64(json["advice_id"].(float64))
@@ -444,7 +444,7 @@ func FensetAdviceTemplateWithJSON(advice *models.HisPrescriptionAdviceTemplate,
444 444
 	return 0
445 445
 }
446 446
 
447
-//判断该患者是否有该透析模式
447
+// 判断该患者是否有该透析模式
448 448
 func IsDialysisMode(orgid, patient_id, mode int64) bool {
449 449
 	var total int
450 450
 	XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and patient_id = ? and status = 1 and mode = ?", orgid, patient_id, mode).Count(&total)
@@ -455,7 +455,7 @@ func IsDialysisMode(orgid, patient_id, mode int64) bool {
455 455
 	}
456 456
 }
457 457
 
458
-//获取该透析模式的患者列表
458
+// 获取该透析模式的患者列表
459 459
 func GetDialysisModePatient(orgid, model int64) (list []*models.DialysisPatient, err error) {
460 460
 	var tmp []*models.DialysisPatient
461 461
 	err = XTReadDB().Raw("select id,name from xt_patients,(SELECT patient_id FROM his_prescription_template WHERE user_org_id = ? and "+
@@ -466,7 +466,7 @@ func GetDialysisModePatient(orgid, model int64) (list []*models.DialysisPatient,
466 466
 	return tmp, err
467 467
 }
468 468
 
469
-//如果没有名字默认透析模式
469
+// 如果没有名字默认透析模式
470 470
 func DialysisModeName(mode int64) string {
471 471
 	tmp := make(map[int64]string)
472 472
 	tmp[1] = "HD"
@@ -507,14 +507,14 @@ func DialysisModeName(mode int64) string {
507 507
 	return ""
508 508
 }
509 509
 
510
-//查询出该模板的id
510
+// 查询出该模板的id
511 511
 func IdOfTheTemplate(orgid, patient_id, mode_id int64) (src_template models.HisPrescriptionTemplate, err error) {
512 512
 	err = XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and "+
513 513
 		"patient_id = ? and status = 1 and mode = ?", orgid, patient_id, mode_id).Find(&src_template).Error
514 514
 	return src_template, err
515 515
 }
516 516
 
517
-//根据透析模式、患者姓名、药品项目获取处方内容
517
+// 根据透析模式、患者姓名、药品项目获取处方内容
518 518
 func GetPrescriptionContent(mode, orgid, patient_id int64) (list []*models.HisPrescriptionInfoTemplate, err error) {
519 519
 	var tmp models.HisPrescriptionTemplate
520 520
 	err = XTReadDB().Model(&models.HisPrescriptionTemplate{}).Where("user_org_id = ? and patient_id = ? and mode = ? and status = 1", orgid, patient_id, mode).Find(&tmp).Error
@@ -527,7 +527,7 @@ func GetPrescriptionContent(mode, orgid, patient_id int64) (list []*models.HisPr
527 527
 
528 528
 }
529 529
 
530
-//获取该透析模式患者列表(批量删除时用)药品
530
+// 获取该透析模式患者列表(批量删除时用)药品
531 531
 func GetDialysisDrugDelect(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
532 532
 	var tmp []*models.DialysisPatient
533 533
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
@@ -542,7 +542,7 @@ func GetDialysisDrugDelect(orgid, model, drug_id int64) (list []*models.Dialysis
542 542
 	return tmp, err
543 543
 }
544 544
 
545
-//获取该透析模式患者列表(批量删除时用)项目
545
+// 获取该透析模式患者列表(批量删除时用)项目
546 546
 func GetDialysisProjectDelect2(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
547 547
 	var tmp []*models.DialysisPatient
548 548
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
@@ -557,7 +557,7 @@ func GetDialysisProjectDelect2(orgid, model, drug_id int64) (list []*models.Dial
557 557
 	return tmp, err
558 558
 }
559 559
 
560
-//获取该透析模式患者列表(批量删除时用)耗材
560
+// 获取该透析模式患者列表(批量删除时用)耗材
561 561
 func GetDialysisProjectDelect3(orgid, model, drug_id int64) (list []*models.DialysisPatient, err error) {
562 562
 	var tmp []*models.DialysisPatient
563 563
 	err = XTReadDB().Raw("select id,name from xt_patients,("+
@@ -572,7 +572,7 @@ func GetDialysisProjectDelect3(orgid, model, drug_id int64) (list []*models.Dial
572 572
 	return tmp, err
573 573
 }
574 574
 
575
-//根据透析模式删除药品
575
+// 根据透析模式删除药品
576 576
 func ModeDeleteDrug(orgid, model, drug_id int64, patient_id []int64) (err error) {
577 577
 	//开事务
578 578
 	tx := XTWriteDB().Begin()
@@ -609,7 +609,7 @@ func ModeDeleteDrug(orgid, model, drug_id int64, patient_id []int64) (err error)
609 609
 	return
610 610
 }
611 611
 
612
-//根据透析模式删除项目和耗材
612
+// 根据透析模式删除项目和耗材
613 613
 func ModeDelectItemsAndConsumables(orgid, model int64, drug_id string, patient_id []int64) (err error) {
614 614
 	//开事务
615 615
 	tx := XTWriteDB().Begin()
@@ -664,7 +664,7 @@ func ModeDelectItemsAndConsumables(orgid, model int64, drug_id string, patient_i
664 664
 	return
665 665
 }
666 666
 
667
-//替换该透析模式药品
667
+// 替换该透析模式药品
668 668
 func ReplaceDrug(orgid, model, drug_id int64, patient_id []int64, advice models.HisPrescriptionAdviceTemplate) (err error) {
669 669
 	//开事务
670 670
 	tx := XTWriteDB().Begin()
@@ -710,7 +710,7 @@ func ReplaceDrug(orgid, model, drug_id int64, patient_id []int64, advice models.
710 710
 	return
711 711
 }
712 712
 
713
-//替换该透析模式耗材
713
+// 替换该透析模式耗材
714 714
 func ReplaceItemsAndConsumables(orgid, model int64, drug_id string, patient_id []int64, project models.HisPrescriptionProjectTemplate) (err error) {
715 715
 	//开事务
716 716
 	tx := XTWriteDB().Begin()
@@ -774,7 +774,7 @@ func ReplaceItemsAndConsumables(orgid, model int64, drug_id string, patient_id [
774 774
 	return
775 775
 }
776 776
 
777
-//跟据id查询药品、项目、耗材、套餐
777
+// 跟据id查询药品、项目、耗材、套餐
778 778
 func QueryFourTables(id string, orgid int64) (tmp interface{}, err error) {
779 779
 	if id[0] == 112 {
780 780
 		after := id[1:]
@@ -853,7 +853,7 @@ func QueryFourTables(id string, orgid int64) (tmp interface{}, err error) {
853 853
 	}
854 854
 }
855 855
 
856
-//获取机构项目中所用的组
856
+// 获取机构项目中所用的组
857 857
 func GetDataConfig(orgid int64) (dataconfig []*models.DictDataconfig, err error) {
858 858
 	err = XTReadDB().Raw("select * from xt_drug_data_config where parent_id in "+
859 859
 		"(select id from xt_drug_data_config where name = \"统计分类\" and parent_id = 0) "+
@@ -861,7 +861,7 @@ func GetDataConfig(orgid int64) (dataconfig []*models.DictDataconfig, err error)
861 861
 	return
862 862
 }
863 863
 
864
-//翻译项目中的组
864
+// 翻译项目中的组
865 865
 func TranslateZu(sc, orgid int64, types string) (s string, err error) {
866 866
 	var dataconfig []*models.DictDataconfig
867 867
 	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 查看文件

@@ -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
+}

+ 48 - 0
service/patient_dataconfig_service.go 查看文件

@@ -29,11 +29,38 @@ 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 GetPatientPhysiqueCheck(orgID int64, patientID int64, startTime int64, endTime int64) ([]*models.XtPatientPhysiqueCheck, error) {
42
+	var records []*models.XtPatientPhysiqueCheck
43
+	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
44
+	if err != nil {
45
+		return nil, err
46
+	}
47
+	return records, nil
48
+}
49
+
32 50
 func CreatePatientCourseOfDisease(record *models.PatientDiseaseCourse) error {
33 51
 	err := writeDb.Model(&models.PatientDiseaseCourse{}).Create(record).Error
34 52
 	return err
35 53
 }
36 54
 
55
+func CreatePatientSickHistory(record *models.XtPatientSickHistory) error {
56
+	err := writeDb.Model(&models.XtPatientSickHistory{}).Create(record).Error
57
+	return err
58
+}
59
+
60
+func CreatePatientPhysiqueCheck(record *models.XtPatientPhysiqueCheck) error {
61
+	err := writeDb.Model(&models.XtPatientPhysiqueCheck{}).Create(record).Error
62
+	return err
63
+}
37 64
 func GetPatientRescueRecords(orgID int64, patientID int64, startTime int64, endTime int64) ([]*models.PatientRescueRecord, error) {
38 65
 	var records []*models.PatientRescueRecord
39 66
 	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 +80,33 @@ func ModifyPatientCourses(record *models.PatientDiseaseCourse) error {
53 80
 	return err
54 81
 }
55 82
 
83
+func ModifyPatientSickHistory(record *models.XtPatientSickHistory) error {
84
+	err := writeDb.Save(record).Error
85
+	//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
86
+	return err
87
+}
88
+
89
+func ModifyPatientPhysiqueCheck(record *models.XtPatientPhysiqueCheck) error {
90
+	err := writeDb.Save(record).Error
91
+	//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
92
+	return err
93
+}
56 94
 func DeletePatientCoursesInBatch(orgID int64, patientID int64, recordIDs []int64) error {
57 95
 	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 96
 	return err
59 97
 }
60 98
 
99
+func DeletePatientSickHistoryInBatch(orgID int64, patientID int64, recordIDs []int64) error {
100
+	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
101
+	return err
102
+}
103
+
61 104
 func DeletePatientResuceRecordsInBatch(orgID int64, patientID int64, recordIDs []int64) error {
62 105
 	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 106
 	return err
64 107
 }
108
+
109
+func DeletePatientPhysiqueCheckInBatch(orgID int64, patientID int64, recordIDs []int64) error {
110
+	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
111
+	return err
112
+}

+ 20 - 0
service/user_service.go 查看文件

@@ -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