Browse Source

2024/6/17

28169 2 weeks ago
parent
commit
e852981e32

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

@@ -83,7 +83,7 @@ func (this *BaseAuthAPIController) Prepare() {
83 83
 		userAdmin.ModifyTime = 1530786071
84 84
 		var subscibe models.ServeSubscibe
85 85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10164 //机构id
86
+		subscibe.OrgId = 10702 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,7 +93,7 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10702 //机构id小英9675或4
97 97
 		adminUserInfo.CurrentAppId = 12123 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10164 //机构id小英9675或4
332
+		subscibe.OrgId = 10702 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,7 +339,7 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10702 //机构id小英9675或4
343 343
 		adminUserInfo.CurrentAppId = 12123 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes

+ 28 - 7
controllers/dialysis_api_controller.go View File

@@ -327,13 +327,6 @@ func (c *DialysisApiController) PostPrescription() {
327 327
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
328 328
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
329 329
 
330
-	//heparin_sodium := c.GetString("heparin_sodium")
331
-	//fmt.Println("肝素钠",heparin_sodium)
332
-	//nucleoprotamine := c.GetString("nucleoprotamine")
333
-	//fmt.Println("鱼精蛋白",nucleoprotamine)
334
-	//push_the_protamine := c.GetString("push_the_protamine")
335
-	//fmt.Println("下机前推注鱼精蛋白",push_the_protamine)
336
-	// var prescription_doctor int64
337 330
 	blood := c.GetString("blood")
338 331
 	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
339 332
 
@@ -383,6 +376,12 @@ func (c *DialysisApiController) PostPrescription() {
383 376
 	blood_access_part_id := c.GetString("blood_access_part_id")
384 377
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
385 378
 	dialyzate := c.GetString("dialyzate")
379
+
380
+	first_super, _ := c.GetInt64("first_super")
381
+	is_sequential, _ := c.GetInt64("is_sequential")
382
+
383
+	conduct := c.GetString("conduct")
384
+
386 385
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
387 386
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
388 387
 
@@ -528,6 +527,9 @@ func (c *DialysisApiController) PostPrescription() {
528 527
 		DialysisStrainerId:         dialysis_strainer_id,
529 528
 		DialysisIrrigationId:       dialysis_irrigation_id,
530 529
 		DialysisDialyszersId:       dialysis_dialyszers_id,
530
+		FirstSuper:                 first_super,
531
+		IsSequential:               is_sequential,
532
+		Conduct:                    conduct,
531 533
 	}
532 534
 
533 535
 	if adminUserInfo.CurrentOrgId == 10721 {
@@ -1147,6 +1149,12 @@ func (c *DialysisApiController) PostSoulution() {
1147 1149
 	blood_access_part_id := c.GetString("blood_access_part_id")
1148 1150
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1149 1151
 	dialyzate := c.GetString("dialyzate")
1152
+
1153
+	first_super, _ := c.GetInt64("first_super")
1154
+	is_sequential, _ := c.GetInt64("is_sequential")
1155
+
1156
+	conduct := c.GetString("conduct")
1157
+
1150 1158
 	var prescription_doctor int64
1151 1159
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1152 1160
 
@@ -1342,6 +1350,9 @@ func (c *DialysisApiController) PostSoulution() {
1342 1350
 		DialysisDialyszersId:       dialysis_dialyszers_id,
1343 1351
 		DialysisIrrigationId:       dialysis_irrigation_id,
1344 1352
 		DialysisStrainerId:         dialysis_strainer_id,
1353
+		FirstSuper:                 first_super,
1354
+		IsSequential:               is_sequential,
1355
+		Conduct:                    conduct,
1345 1356
 	}
1346 1357
 
1347 1358
 	if prescription.Anticoagulant == 0 {
@@ -1556,6 +1567,9 @@ func (c *DialysisApiController) PostSoulution() {
1556 1567
 		DialysisDialyszersId:       dialysis_dialyszers_id,
1557 1568
 		DialysisIrrigationId:       dialysis_irrigation_id,
1558 1569
 		DialysisStrainerId:         dialysis_strainer_id,
1570
+		FirstSuper:                 first_super,
1571
+		IsSequential:               is_sequential,
1572
+		Conduct:                    conduct,
1559 1573
 	}
1560 1574
 
1561 1575
 	if solution.Anticoagulant == 0 {
@@ -2316,6 +2330,7 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
2316 2330
 
2317 2331
 	patient, _ := c.GetInt64("patient", 0)
2318 2332
 	recordDateStr := c.GetString("record_date")
2333
+	record_time := c.GetString("record_time")
2319 2334
 	fmt.Println(recordDateStr)
2320 2335
 	if patient <= 0 {
2321 2336
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -2338,6 +2353,10 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
2338 2353
 		return
2339 2354
 	}
2340 2355
 
2356
+	startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", record_time)
2357
+
2358
+	fmt.Println("startDate0000000000000000000000000000", startDate.Unix())
2359
+
2341 2360
 	// data := make(map[string]interface{}, 0)
2342 2361
 	var data models.AssessmentAfterDislysis
2343 2362
 	var err error
@@ -2427,6 +2446,8 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
2427 2446
 	assessment.Condenser = data.Condenser
2428 2447
 	assessment.LastAfterWeight = data.LastAfterWeight
2429 2448
 	assessment.DisplaceLiquiValue = data.DisplaceLiquiValue
2449
+	assessment.RecordTime = startDate.Unix()
2450
+	assessment.SymptomAfterDialysisRemark = data.SymptomAfterDialysisRemark
2430 2451
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
2431 2452
 
2432 2453
 	if assessment.ID > 0 {

+ 0 - 9
controllers/his_api_controller.go View File

@@ -3909,15 +3909,6 @@ func (c *HisApiController) CreateHisPrescription() {
3909 3909
 											return
3910 3910
 
3911 3911
 										}
3912
-
3913
-										drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
3914
-
3915
-										if drugMedical.SumCount == 0 {
3916
-											tx.Rollback()
3917
-											c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
3918
-											return
3919
-
3920
-										}
3921 3912
 									}
3922 3913
 								}
3923 3914
 

+ 67 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -1554,6 +1554,8 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1554 1554
 	transfusion_volume := c.GetString("transfusion_volume")
1555 1555
 	last_after_weight := c.GetString("last_after_weight")
1556 1556
 	displace_liqui_value := c.GetString("displace_liqui_value")
1557
+	start_time := c.GetString("start_time")
1558
+	symptom_after_dialysis_remark := c.GetString("symptom_after_dialysis_remark")
1557 1559
 	if id <= 0 {
1558 1560
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1559 1561
 		return
@@ -1577,6 +1579,9 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1577 1579
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1578 1580
 		return
1579 1581
 	}
1582
+
1583
+	startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", start_time)
1584
+
1580 1585
 	//now := time.Now()
1581 1586
 	//year, month, day := now.Date()
1582 1587
 	//today_time := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
@@ -1664,6 +1669,8 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1664 1669
 		TransfusionVolume:            transfusion_volume,
1665 1670
 		LastAfterWeight:              last_after_weight,
1666 1671
 		DisplaceLiquiValue:           displace_liqui_value,
1672
+		RecordTime:                   startDate.Unix(),
1673
+		SymptomAfterDialysisRemark:   symptom_after_dialysis_remark,
1667 1674
 	}
1668 1675
 
1669 1676
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
@@ -2075,6 +2082,32 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
2075 2082
 	blood_access_part_id := c.GetString("blood_access_part_id")
2076 2083
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
2077 2084
 	dialyzate := c.GetString("dialyzate")
2085
+	first_super := c.GetString("first_super")
2086
+
2087
+	var first_sup int64
2088
+	if first_super == "是" {
2089
+		first_sup = 1
2090
+	}
2091
+	if first_super == "否" {
2092
+		first_sup = 2
2093
+	}
2094
+	if first_super == "请选择" {
2095
+		first_sup = 0
2096
+	}
2097
+	is_sequential := c.GetString("is_sequential")
2098
+
2099
+	var is_sequent int64
2100
+	if is_sequential == "是" {
2101
+		is_sequent = 1
2102
+	}
2103
+	if is_sequential == "否" {
2104
+		is_sequent = 2
2105
+	}
2106
+	if is_sequential == "请选择" {
2107
+		is_sequent = 0
2108
+	}
2109
+
2110
+	conduct := c.GetString("conduct")
2078 2111
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2079 2112
 
2080 2113
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
@@ -2262,6 +2295,9 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
2262 2295
 		DialysisDialyszersId:       dialysis_dialyszers_id,
2263 2296
 		DialysisIrrigationId:       dialysis_irrigation_id,
2264 2297
 		DialysisStrainerId:         dialysis_strainer_id,
2298
+		FirstSuper:                 first_sup,
2299
+		IsSequential:               is_sequent,
2300
+		Conduct:                    conduct,
2265 2301
 	}
2266 2302
 
2267 2303
 	if adminUserInfo.Org.Id == 10721 {
@@ -4365,6 +4401,31 @@ func (c *DialysisAPIController) PostSolution() {
4365 4401
 	blood_access_part_id := c.GetString("blood_access_part_id")
4366 4402
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
4367 4403
 	dialyzate := c.GetString("dialyzate")
4404
+	first_super := c.GetString("first_super")
4405
+	is_sequential := c.GetString("is_sequential")
4406
+
4407
+	var fisrt_sup int64
4408
+	if first_super == "是" {
4409
+		fisrt_sup = 1
4410
+	}
4411
+	if first_super == "否" {
4412
+		fisrt_sup = 2
4413
+	}
4414
+	if first_super == "请选择" {
4415
+		fisrt_sup = 0
4416
+	}
4417
+
4418
+	var is_sequen int64
4419
+	if is_sequential == "是" {
4420
+		is_sequen = 1
4421
+	}
4422
+	if is_sequential == "否" {
4423
+		is_sequen = 2
4424
+	}
4425
+	if is_sequential == "请选择" {
4426
+		is_sequen = 0
4427
+	}
4428
+	conduct := c.GetString("conduct")
4368 4429
 	if mode_id > 0 {
4369 4430
 
4370 4431
 		var str string
@@ -4550,6 +4611,9 @@ func (c *DialysisAPIController) PostSolution() {
4550 4611
 		DialysisDialyszersId:       dialysis_dialyszers_id,
4551 4612
 		DialysisIrrigationId:       dialysis_irrigation_id,
4552 4613
 		DialysisStrainerId:         dialysis_strainer_id,
4614
+		FirstSuper:                 fisrt_sup,
4615
+		IsSequential:               is_sequen,
4616
+		Conduct:                    conduct,
4553 4617
 	}
4554 4618
 
4555 4619
 	if adminUserInfo.Org.Id == 10721 {
@@ -4691,6 +4755,9 @@ func (c *DialysisAPIController) PostSolution() {
4691 4755
 		DialysisDialyszersId:       dialysis_dialyszers_id,
4692 4756
 		DialysisIrrigationId:       dialysis_irrigation_id,
4693 4757
 		DialysisStrainerId:         dialysis_strainer_id,
4758
+		FirstSuper:                 fisrt_sup,
4759
+		IsSequential:               is_sequen,
4760
+		Conduct:                    conduct,
4694 4761
 	}
4695 4762
 
4696 4763
 	//针对河间咸的

+ 9 - 2
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -6751,6 +6751,9 @@ func (c *PatientApiController) ExecProject() {
6751 6751
 	team_id, _ := c.GetInt64("team_id")
6752 6752
 	is_check_team, _ := c.GetInt64("is_check_team")
6753 6753
 
6754
+	record_date, _ := c.GetInt64("record_date")
6755
+	patient_id, _ := c.GetInt64("patient_id")
6756
+
6754 6757
 	if len(execution_time) <= 0 {
6755 6758
 		utils.ErrorLog("execution_time")
6756 6759
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -6928,7 +6931,8 @@ func (c *PatientApiController) ExecProject() {
6928 6931
 
6929 6932
 				}
6930 6933
 			}
6931
-			ps, _ := service.GetCheckTeamProject(team_id, project.PatientId, project.RecordDate, project.UserOrgId)
6934
+			ps, _ := service.GetCheckTeamProjectOne(team_id, patient_id, record_date, adminInfo.Org.Id)
6935
+
6932 6936
 			var ids []int64
6933 6937
 			for _, items := range ps {
6934 6938
 				ids = append(ids, items.ID)
@@ -6955,6 +6959,9 @@ func (c *PatientApiController) CheckProject() {
6955 6959
 	team_id, _ := c.GetInt64("team_id")
6956 6960
 	is_check_team, _ := c.GetInt64("is_check_team")
6957 6961
 
6962
+	record_date, _ := c.GetInt64("record_date")
6963
+	patient_id, _ := c.GetInt64("patient_id")
6964
+
6958 6965
 	project, _ := service.FindHisProjectById(adminInfo.Org.Id, project_id)
6959 6966
 	if project.CheckState == 1 {
6960 6967
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceChecked)
@@ -7070,7 +7077,7 @@ func (c *PatientApiController) CheckProject() {
7070 7077
 
7071 7078
 				}
7072 7079
 			}
7073
-			ps, _ := service.GetCheckTeamProject(team_id, project.PatientId, project.RecordDate, project.UserOrgId)
7080
+			ps, _ := service.GetCheckTeamProjectOne(team_id, patient_id, record_date, adminInfo.Org.Id)
7074 7081
 			var ids []int64
7075 7082
 			for _, items := range ps {
7076 7083
 				ids = append(ids, items.ID)

+ 141 - 58
controllers/patient_api_controller.go View File

@@ -190,6 +190,18 @@ func PatientApiRegistRouters() {
190 190
 
191 191
 	beego.Router("/api/patient/createnewcouresetemplate", &PatientApiController{}, "Post:CreateNewCourseTemplate")
192 192
 
193
+	beego.Router("/api/patient/savepatientdeathrecord", &PatientApiController{}, "Post:SavePatientDeathRecord")
194
+
195
+	beego.Router("/api/patient/getpatientdeathrecord", &PatientApiController{}, "Get:GetPatientDeathRecordOne")
196
+
197
+	beego.Router("/api/patient/savecouresetemplatetitle", &PatientApiController{}, "Post:SaveCoureseTemplateTitle")
198
+
199
+	beego.Router("/api/patient/getpatientcourseoftemplate", &PatientApiController{}, "Get:GetPatientCourseOfTemplate")
200
+
201
+	beego.Router("/api/patient/savecourseofnewtemplate", &PatientApiController{}, "Post:SaveCourseOfNewTemplate")
202
+
203
+	beego.Router("/api/patient/deletecourestempalte", &PatientApiController{}, "Get:DeleteCouseTemplate")
204
+
193 205
 }
194 206
 func (c *PatientApiController) GetExportList() {
195 207
 	startTime := c.GetString("start_time")
@@ -6353,68 +6365,31 @@ func (c *PatientApiController) ExportPatients() {
6353 6365
 			if patientNameM["id_card_no"] != nil || reflect.TypeOf(patientNameM["id_card_no"]).String() == "string" {
6354 6366
 				id_card_no, _ := patientNameM["id_card_no"].(string)
6355 6367
 
6356
-				if IsIdCard(id_card_no) == false { //身份证号码不符合要求则生成一条导入错误日志
6357
-
6358
-					if len(id_card_no) == 0 {
6359
-						err_log := models.ExportErrLog{
6360
-							LogType:    1,
6361
-							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
6362
-							ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的身份证号码不能为空",
6363
-							Status:     1,
6364
-							CreateTime: time.Now().Unix(),
6365
-							UpdateTime: time.Now().Unix(),
6366
-							ExportTime: export_time,
6367
-						}
6368
-						service.CreateExportErrLog(&err_log)
6369
-						continue
6370
-
6371
-					} else {
6372
-						err_log := models.ExportErrLog{
6373
-							LogType:    1,
6374
-							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
6375
-							ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的身份证号码格式不符合要求",
6376
-							Status:     1,
6377
-							CreateTime: time.Now().Unix(),
6378
-							UpdateTime: time.Now().Unix(),
6379
-							ExportTime: export_time,
6380
-						}
6381
-						service.CreateExportErrLog(&err_log)
6382
-						continue
6383
-
6368
+				count := service.FindPatientIdCardNoIsExist(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
6369
+				if count >= 1 {
6370
+					//if tempPatient != nil && tempPatient.ID > 0 {
6371
+					err_log := models.ExportErrLog{
6372
+						LogType:    1,
6373
+						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
6374
+						ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的身份证号码在系统中已经存在",
6375
+						Status:     1,
6376
+						CreateTime: time.Now().Unix(),
6377
+						UpdateTime: time.Now().Unix(),
6378
+						ExportTime: export_time,
6384 6379
 					}
6385
-
6380
+					service.CreateExportErrLog(&err_log)
6381
+					continue
6382
+				}
6383
+				//}
6384
+				patient.IdCardNo = id_card_no
6385
+				//patient.Birthday = GetBirthDay(id_card_no).Unix()
6386
+				if GetBirthDay(id_card_no) == nil {
6387
+					patient.Birthday = 0
6386 6388
 				} else {
6387
-					//var tempPatient *models.Patients
6388
-					//for _, item := range all_patient {
6389
-					//	if item.IdCardNo == id_card_no {
6390
-					//		tempPatient = item
6391
-					//	}
6392
-					//}
6393
-					count := service.FindPatientIdCardNoIsExist(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
6394
-					if count >= 1 {
6395
-						//if tempPatient != nil && tempPatient.ID > 0 {
6396
-						err_log := models.ExportErrLog{
6397
-							LogType:    1,
6398
-							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
6399
-							ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的身份证号码在系统中已经存在",
6400
-							Status:     1,
6401
-							CreateTime: time.Now().Unix(),
6402
-							UpdateTime: time.Now().Unix(),
6403
-							ExportTime: export_time,
6404
-						}
6405
-						service.CreateExportErrLog(&err_log)
6406
-						continue
6407
-					}
6408
-					//}
6409
-					patient.IdCardNo = id_card_no
6410
-					//patient.Birthday = GetBirthDay(id_card_no).Unix()
6411
-					if GetBirthDay(id_card_no) == nil {
6412
-						patient.Birthday = 0
6413
-					} else {
6414
-						patient.Birthday = GetBirthDay(id_card_no).Unix()
6389
+					patient.Birthday = GetBirthDay(id_card_no).Unix()
6415 6390
 
6416
-					}
6417 6391
 				}
6392
+
6418 6393
 			}
6419 6394
 
6420 6395
 			fmt.Println("111112222")
@@ -8443,3 +8418,111 @@ func (this *PatientApiController) CreateNewCourseTemplate() {
8443 8418
 		"msg": "ok",
8444 8419
 	})
8445 8420
 }
8421
+
8422
+func (this *PatientApiController) SavePatientDeathRecord() {
8423
+
8424
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8425
+	dataBody := make(map[string]interface{}, 0)
8426
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
8427
+	fmt.Println("err", err)
8428
+	content := dataBody["content"].(string)
8429
+
8430
+	dialyszerinformedPrint := models.XtDeathRecord{
8431
+		UserOrgId: orgId,
8432
+		Content:   content,
8433
+		Status:    1,
8434
+		Ctime:     time.Now().Unix(),
8435
+		Mtime:     time.Now().Unix(),
8436
+	}
8437
+
8438
+	informed, _ := service.GetPatientDeathRecord(orgId)
8439
+
8440
+	if informed.ID == 0 {
8441
+
8442
+		service.CreatePatientDeathRecord(dialyszerinformedPrint)
8443
+	}
8444
+
8445
+	if informed.ID > 0 {
8446
+		service.UpdatePatientDeathRecord(informed.ID, content)
8447
+	}
8448
+	this.ServeSuccessJSON(map[string]interface{}{
8449
+		"list": dialyszerinformedPrint,
8450
+	})
8451
+}
8452
+
8453
+func (this *PatientApiController) GetPatientDeathRecordOne() {
8454
+
8455
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8456
+
8457
+	record, _ := service.GetPatientDeathRecordList(orgId)
8458
+
8459
+	this.ServeSuccessJSON(map[string]interface{}{
8460
+		"record": record,
8461
+	})
8462
+}
8463
+
8464
+func (this *PatientApiController) SaveCoureseTemplateTitle() {
8465
+
8466
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8467
+	dataBody := make(map[string]interface{}, 0)
8468
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
8469
+	fmt.Println("err", err)
8470
+	title := dataBody["title"].(string)
8471
+	content := dataBody["content"].(string)
8472
+
8473
+	courseTemplate := models.XtPatientCourseTemplate{
8474
+		Content:   content,
8475
+		UserOrgId: orgId,
8476
+		Title:     title,
8477
+		Status:    1,
8478
+		Ctime:     time.Now().Unix(),
8479
+		Mtime:     time.Now().Unix(),
8480
+	}
8481
+
8482
+	service.SaveCoureseTemplateTitle(courseTemplate)
8483
+
8484
+	this.ServeSuccessJSON(map[string]interface{}{
8485
+		"courseTemplate": courseTemplate,
8486
+	})
8487
+
8488
+}
8489
+
8490
+func (this *PatientApiController) GetPatientCourseOfTemplate() {
8491
+
8492
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8493
+
8494
+	list, _ := service.GetPatientCourseOfTemplate(orgId)
8495
+
8496
+	this.ServeSuccessJSON(map[string]interface{}{
8497
+		"templateList": list,
8498
+	})
8499
+}
8500
+
8501
+func (this *PatientApiController) SaveCourseOfNewTemplate() {
8502
+
8503
+	dataBody := make(map[string]interface{}, 0)
8504
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
8505
+	fmt.Println("err", err)
8506
+	id := int64(dataBody["template_id"].(float64))
8507
+	content := dataBody["content"].(string)
8508
+
8509
+	service.SaveCourseOfNewTemplate(id, content)
8510
+
8511
+	this.ServeSuccessJSON(map[string]interface{}{
8512
+		"msg": "ok",
8513
+	})
8514
+
8515
+}
8516
+
8517
+func (this *PatientApiController) DeleteCouseTemplate() {
8518
+
8519
+	id, _ := this.GetInt64("id")
8520
+
8521
+	fmt.Println("id==================", id)
8522
+	service.DeleteCouseTemplate(id)
8523
+
8524
+	this.ServeSuccessJSON(map[string]interface{}{
8525
+		"msg": "ok",
8526
+	})
8527
+
8528
+}

+ 55 - 42
controllers/stock_in_api_controller.go View File

@@ -1260,7 +1260,7 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1260 1260
 
1261 1261
 	if warehouseOut_id == 0 {
1262 1262
 		//查询是否生成出库单
1263
-		warehouseOutObj, _ := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
1263
+		warehouseOutObj, _ := service.FindStockOutByIsSysOne(adminUserInfo.CurrentOrgId, 0, operation_time, warehousing_out_order)
1264 1264
 
1265 1265
 		if warehouseOutObj.ID == 0 {
1266 1266
 			service.AddSigleWarehouseOut(&warehouseOut)
@@ -1316,7 +1316,7 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1316 1316
 
1317 1317
 				count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
1318 1318
 
1319
-				total := float64(count) * price
1319
+				total_one := float64(count) * price
1320 1320
 				remark := items["remark"].(string)
1321 1321
 
1322 1322
 				manufacturer := int64(items["manufacturer"].(float64))
@@ -1378,7 +1378,7 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1378 1378
 					GoodTypeId:              good_type_id,
1379 1379
 					Count:                   count,
1380 1380
 					Price:                   price,
1381
-					TotalPrice:              total,
1381
+					TotalPrice:              total_one,
1382 1382
 					Status:                  1,
1383 1383
 					Ctime:                   ctime,
1384 1384
 					Remark:                  remark,
@@ -1409,46 +1409,54 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1409 1409
 
1410 1410
 	goodWarehouseOut, _ := service.GetLastGoodWarehouseOutTwenty(adminUserInfo.CurrentOrgId)
1411 1411
 
1412
-	for _, it := range warehousingOutInfo {
1413
-		warehouseOutInfo := &models.WarehouseOutInfo{
1414
-			WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1415
-			WarehouseOutId:          goodWarehouseOut.ID,
1416
-			WarehouseInfotId:        0,
1417
-			Status:                  1,
1418
-			Ctime:                   time.Now().Unix(),
1419
-			Remark:                  it.Remark,
1420
-			OrgId:                   adminUserInfo.CurrentOrgId,
1421
-			Type:                    1,
1422
-			Manufacturer:            it.Manufacturer,
1423
-			Dealer:                  it.Dealer,
1424
-			IsSys:                   0,
1425
-			SysRecordTime:           it.SysRecordTime,
1426
-			GoodTypeId:              it.GoodTypeId,
1427
-			GoodId:                  it.GoodId,
1428
-			ExpiryDate:              it.ExpiryDate,
1429
-			ProductDate:             it.ProductDate,
1430
-			Number:                  it.Number,
1431
-			Price:                   it.Price,
1432
-			LicenseNumber:           it.LicenseNumber,
1433
-			SupplyWarehouseId:       0,
1434
-			StorehouseId:            storehouse_id,
1435
-			AdminUserId:             it.AdminUserId,
1436
-			BuyPrice:                it.BuyPrice,
1437
-			StockCount:              it.StockCount,
1438
-			Count:                   it.Count,
1439
-			IsCheck:                 2,
1440
-			RegisterNumber:          it.RegisterNumber,
1441
-			PatientId:               it.PatientId,
1442
-			ClassType:               it.ClassType,
1443
-		}
1444
-		if it.ID == 0 {
1445
-			service.AddSigleWarehouseOutInfo(warehouseOutInfo)
1446
-
1447
-		}
1448
-		if it.ID > 0 {
1449
-			service.ModifyWarehouseOutInfo(it.ID, warehouseOutInfo)
1412
+	if len(warehousingOutInfo) > 0 {
1413
+		for _, it := range warehousingOutInfo {
1414
+			warehouseOutInfo := &models.WarehouseOutInfo{
1415
+				WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1416
+				WarehouseOutId:          goodWarehouseOut.ID,
1417
+				WarehouseInfotId:        0,
1418
+				Status:                  1,
1419
+				Ctime:                   time.Now().Unix(),
1420
+				Remark:                  it.Remark,
1421
+				OrgId:                   adminUserInfo.CurrentOrgId,
1422
+				Type:                    1,
1423
+				Manufacturer:            it.Manufacturer,
1424
+				Dealer:                  it.Dealer,
1425
+				IsSys:                   0,
1426
+				SysRecordTime:           it.SysRecordTime,
1427
+				GoodTypeId:              it.GoodTypeId,
1428
+				GoodId:                  it.GoodId,
1429
+				ExpiryDate:              it.ExpiryDate,
1430
+				ProductDate:             it.ProductDate,
1431
+				Number:                  it.Number,
1432
+				Price:                   it.Price,
1433
+				LicenseNumber:           it.LicenseNumber,
1434
+				SupplyWarehouseId:       0,
1435
+				StorehouseId:            storehouse_id,
1436
+				AdminUserId:             it.AdminUserId,
1437
+				BuyPrice:                it.BuyPrice,
1438
+				StockCount:              it.StockCount,
1439
+				Count:                   it.Count,
1440
+				IsCheck:                 2,
1441
+				RegisterNumber:          it.RegisterNumber,
1442
+				PatientId:               it.PatientId,
1443
+				ClassType:               it.ClassType,
1444
+			}
1445
+			if it.ID == 0 {
1446
+
1447
+				//查询改耗材是否出库
1448
+				outInfo, _ := service.GetGoodsIsExsit(it.GoodId, it.SysRecordTime, it.OrgId, goodWarehouseOut.ID)
1449
+				if outInfo.ID == 0 {
1450
+					service.AddSigleWarehouseOutInfo(warehouseOutInfo)
1451
+				}
1452
+
1453
+			}
1454
+			if it.ID > 0 {
1455
+				service.ModifyWarehouseOutInfo(it.ID, warehouseOutInfo)
1456
+			}
1450 1457
 		}
1451 1458
 	}
1459
+
1452 1460
 	appId := adminUserInfo.CurrentAppId
1453 1461
 
1454 1462
 	warehouseOutInfoList, _ := service.GetLastGoodWarehouseOutInfo(adminUserInfo.CurrentOrgId, goodWarehouseOut.ID)
@@ -1862,7 +1870,12 @@ func (c *StockManagerApiController) EditWarehouseOut() {
1862 1870
 		}
1863 1871
 
1864 1872
 		for _, item := range warehousingOutInfo {
1865
-			service.AddSigleWarehouseOutInfo(item)
1873
+			//查询改耗材是否出库
1874
+			outInfo, _ := service.GetGoodsIsExsit(item.GoodId, item.SysRecordTime, item.OrgId, item.WarehouseOutId)
1875
+			if outInfo.ID == 0 {
1876
+				service.AddSigleWarehouseOutInfo(item)
1877
+			}
1878
+
1866 1879
 		}
1867 1880
 	}
1868 1881
 

+ 2 - 0
models/dialysis.go View File

@@ -660,6 +660,8 @@ type AssessmentAfterDislysis struct {
660 660
 	Condenser                       string  `gorm:"column:condenser" json:"condenser" form:"condenser"`
661 661
 	LastAfterWeight                 string  `gorm:"column:last_after_weight" json:"last_after_weight" form:"last_after_weight"`
662 662
 	DisplaceLiquiValue              string  `gorm:"column:displace_liqui_value" json:"displace_liqui_value" form:"displace_liqui_value"`
663
+	RecordTime                      int64   `gorm:"column:record_time" json:"record_time" form:"record_time"`
664
+	SymptomAfterDialysisRemark      string  `gorm:"column:symptom_after_dialysis_remark" json:"symptom_after_dialysis_remark" form:"symptom_after_dialysis_remark"`
663 665
 }
664 666
 
665 667
 func (AssessmentAfterDislysis) TableName() string {

+ 20 - 0
models/patient_models.go View File

@@ -390,6 +390,9 @@ type DialysisPrescription struct {
390 390
 	DialysisDialyszersId       int64         `gorm:"column:dialysis_dialyszers_id" json:"dialysis_dialyszers_id" form:"dialysis_dialyszers_id"`
391 391
 	DialysisStrainerId         int64         `gorm:"column:dialysis_strainer_id" json:"dialysis_strainer_id" form:"dialysis_strainer_id"`
392 392
 	DialysisIrrigationId       int64         `gorm:"column:dialysis_irrigation_id" json:"dialysis_irrigation_id" form:"dialysis_irrigation_id"`
393
+	FirstSuper                 int64         `gorm:"column:first_super" json:"first_super" form:"first_super"`
394
+	IsSequential               int64         `gorm:"column:is_sequential" json:"is_sequential" form:"is_sequential"`
395
+	Conduct                    string        `gorm:"column:conduct" json:"conduct" form:"conduct"`
393 396
 }
394 397
 
395 398
 func (DialysisPrescription) TableName() string {
@@ -633,6 +636,9 @@ type DialysisSolution struct {
633 636
 	DialysisDialyszersId       int64   `gorm:"column:dialysis_dialyszers_id" json:"dialysis_dialyszers_id" form:"dialysis_dialyszers_id"`
634 637
 	DialysisStrainerId         int64   `gorm:"column:dialysis_strainer_id" json:"dialysis_strainer_id" form:"dialysis_strainer_id"`
635 638
 	DialysisIrrigationId       int64   `gorm:"column:dialysis_irrigation_id" json:"dialysis_irrigation_id" form:"dialysis_irrigation_id"`
639
+	FirstSuper                 int64   `gorm:"column:first_super" json:"first_super" form:"first_super"`
640
+	IsSequential               int64   `gorm:"column:is_sequential" json:"is_sequential" form:"is_sequential"`
641
+	Conduct                    string  `gorm:"column:conduct" json:"conduct" form:"conduct"`
636 642
 }
637 643
 
638 644
 func (DialysisSolution) TableName() string {
@@ -2860,3 +2866,17 @@ func (XtPatientCourseTemplate) TableName() string {
2860 2866
 
2861 2867
 	return "xt_patient_course_template"
2862 2868
 }
2869
+
2870
+type XtDeathRecord struct {
2871
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2872
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2873
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2874
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2875
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2876
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2877
+}
2878
+
2879
+func (XtDeathRecord) TableName() string {
2880
+
2881
+	return "xt_death_record"
2882
+}

+ 5 - 0
service/dialysis_service.go View File

@@ -1872,6 +1872,11 @@ func GetCheckTeamProject(team_id int64, patient_id int64, record_date int64, use
1872 1872
 	return
1873 1873
 }
1874 1874
 
1875
+func GetCheckTeamProjectOne(team_id int64, patient_id int64, record_date int64, user_org_id int64) (ps []*models.HisPrescriptionProject, err error) {
1876
+	err = readDb.Model(&models.HisPrescriptionProject{}).Joins("JOIN xt_his_project as p On p.id = his_prescription_project.project_id").Where("his_prescription_project.team_id IN (?) AND his_prescription_project.patient_id = ? AND his_prescription_project.user_org_id = ? AND his_prescription_project.record_date = ? AND his_prescription_project.status = 1", team_id, patient_id, user_org_id, record_date).Find(&ps).Error
1877
+	return
1878
+}
1879
+
1875 1880
 func GetAdminUserRoleInformation(orgid int64) (models.SgjOrgFollow, error) {
1876 1881
 
1877 1882
 	follow := models.SgjOrgFollow{}

+ 63 - 0
service/patient_service.go View File

@@ -4474,3 +4474,66 @@ func CreateCourseTemplate(course models.XtPatientCourseTemplate) error {
4474 4474
 
4475 4475
 	return err
4476 4476
 }
4477
+
4478
+func GetPatientDeathRecordList(org_id int64) (models.XtDeathRecord, error) {
4479
+
4480
+	deathRecord := models.XtDeathRecord{}
4481
+
4482
+	err := XTReadDB().Where("user_org_id = ? and status=1", org_id).Find(&deathRecord).Error
4483
+
4484
+	return deathRecord, err
4485
+}
4486
+
4487
+func CreatePatientDeathRecord(record models.XtDeathRecord) error {
4488
+
4489
+	err := XTWriteDB().Create(&record).Error
4490
+
4491
+	return err
4492
+}
4493
+
4494
+func UpdatePatientDeathRecord(id int64, content string) error {
4495
+
4496
+	err := XTWriteDB().Model(&models.XtDeathRecord{}).Where("id =? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
4497
+
4498
+	return err
4499
+}
4500
+
4501
+func GetPatientDeathRecord(user_org_id int64) (models.XtDeathRecord, error) {
4502
+
4503
+	record := models.XtDeathRecord{}
4504
+
4505
+	err := XTReadDB().Where("user_org_id = ? and status=1", user_org_id).Find(&record).Error
4506
+
4507
+	return record, err
4508
+}
4509
+
4510
+func SaveCoureseTemplateTitle(courseTemplate models.XtPatientCourseTemplate) error {
4511
+
4512
+	err := XTWriteDB().Create(&courseTemplate).Error
4513
+
4514
+	return err
4515
+
4516
+}
4517
+
4518
+func GetPatientCourseOfTemplate(user_org_id int64) (list []*models.XtPatientCourseTemplate, err error) {
4519
+
4520
+	err = XTReadDB().Where("user_org_id = ? and status=1", user_org_id).Find(&list).Error
4521
+
4522
+	return list, err
4523
+}
4524
+
4525
+func SaveCourseOfNewTemplate(id int64, content string) (models.XtPatientCourseTemplate, error) {
4526
+
4527
+	template := models.XtPatientCourseTemplate{}
4528
+
4529
+	err := XTWriteDB().Model(&template).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
4530
+
4531
+	return template, err
4532
+}
4533
+
4534
+func DeleteCouseTemplate(id int64) error {
4535
+
4536
+	err := XTWriteDB().Model(&models.XtPatientCourseTemplate{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
4537
+
4538
+	return err
4539
+}

+ 13 - 0
service/stock_service.go View File

@@ -3422,6 +3422,12 @@ func FindStockOutByIsSys(org_id int64, is_sys int, record_time int64) (out model
3422 3422
 
3423 3423
 }
3424 3424
 
3425
+func FindStockOutByIsSysOne(org_id int64, is_sys int, record_time int64, warehousing_out_order string) (out models.WarehouseOut, err error) {
3426
+	err = readDb.Model(&models.WarehouseOut{}).Where("is_sys = ? AND status = 1 AND org_id = ? AND warehouse_out_time = ? and warehouse_out_order_number = ?", is_sys, org_id, record_time, warehousing_out_order).First(&out).Error
3427
+	return
3428
+
3429
+}
3430
+
3425 3431
 func FindStockOutByIsSysSix(org_id int64, is_sys int, record_time int64, second_warehouse_id int64) (out models.WarehouseOut, err error) {
3426 3432
 	err = readDb.Model(&models.WarehouseOut{}).Where("is_sys = ? AND status = 1 AND org_id = ? AND warehouse_out_time = ? AND second_warehouse_id=?", is_sys, org_id, record_time, second_warehouse_id).First(&out).Error
3427 3433
 	return
@@ -3511,6 +3517,13 @@ func UpdateAutoMaticReduceDetailOne(goodid int64, goodtypeid int64, recordtime i
3511 3517
 	return err
3512 3518
 }
3513 3519
 
3520
+func GetGoodsIsExsit(good_id int64, sys_record_time int64, org_id int64, warehouse_out_id int64) (models.WarehouseOutInfo, error) {
3521
+
3522
+	outInfo := models.WarehouseOutInfo{}
3523
+	err := XTReadDB().Where("good_id = ? and sys_record_time = ? and org_id = ? and is_sys =0 and status = 1 and warehouse_out_id = ?", good_id, sys_record_time, org_id, warehouse_out_id).Find(&outInfo).Error
3524
+	return outInfo, err
3525
+}
3526
+
3514 3527
 func AddSigleWarehouseOutInfo(info *models.WarehouseOutInfo) error {
3515 3528
 
3516 3529
 	err := writeDb.Create(&info).Error