Browse Source

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

陈少旭 1 month ago
parent
commit
2bec370bed

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 = 10402 //机构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 = 10402 //机构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 = 10402 //机构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 = 10402 //机构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 {

+ 1 - 10
controllers/his_api_controller.go View File

@@ -3390,7 +3390,7 @@ func (c *HisApiController) CreateHisPrescription() {
3390 3390
 	var adviceList []models.HisDoctorAdviceInfo
3391 3391
 	var projectList []models.HisPrescriptionProject
3392 3392
 
3393
-	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10726 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10571 || adminInfo.CurrentOrgId == 10724 || adminInfo.CurrentOrgId == 9671 {
3393
+	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10726 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10571 || adminInfo.CurrentOrgId == 10724 || adminInfo.CurrentOrgId == 9671 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10653 {
3394 3394
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3395 3395
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3396 3396
 
@@ -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
 	//针对河间咸的

+ 22 - 7
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -641,6 +641,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
641 641
 
642 642
 	record_date, _ := c.GetInt64("record_date")
643 643
 
644
+	patient_id, _ := c.GetInt64("patient_id")
645
+
644 646
 	if origin != 2 {
645 647
 		adminUserInfo := c.GetMobileAdminUserInfo()
646 648
 		execution_staff := adminUserInfo.AdminUser.Id
@@ -672,8 +674,9 @@ func (c *PatientApiController) ExecDoctorAdvice() {
672 674
 		var advice models.DoctorAdvice
673 675
 
674 676
 		if groupno > 0 {
675
-			advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
677
+			advices, _ := service.FindAllDoctorAdviceByGoroupNoThree(adminUserInfo.Org.Id, groupno, patient_id, record_date)
676 678
 
679
+			fmt.Println("advices---------------------------------------------", advices)
677 680
 			for _, item := range advices {
678 681
 
679 682
 				//自备药
@@ -1184,6 +1187,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1184 1187
 
1185 1188
 		//针对普宁
1186 1189
 		if adminUserInfo.Org.Id != 10599 {
1190
+			fmt.Println("开始时间--------------------", advice.StartTime)
1191
+			fmt.Println("theTime---------------------", theTime.Unix())
1187 1192
 			if advice.StartTime > theTime.Unix() {
1188 1193
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
1189 1194
 				return
@@ -1223,7 +1228,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1223 1228
 
1224 1229
 				}
1225 1230
 			}
1226
-			err = service.ExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
1231
+			err = service.ExceDoctorAdviceByGroupNoOne(&advices, groupno, adminUserInfo.Org.Id, patient_id, record_date)
1227 1232
 
1228 1233
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
1229 1234
 			redis := service.RedisClient()
@@ -2345,6 +2350,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2345 2350
 							}
2346 2351
 
2347 2352
 							if prescribing_number_total > total_count {
2353
+								tx.Rollback()
2348 2354
 								c.ServeSuccessJSON(map[string]interface{}{
2349 2355
 									"msg":    "3",
2350 2356
 									"advice": advice,
@@ -2445,6 +2451,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2445 2451
 							}
2446 2452
 
2447 2453
 						} else {
2454
+							tx.Rollback()
2448 2455
 							c.ServeSuccessJSON(map[string]interface{}{
2449 2456
 								"msg":    "3",
2450 2457
 								"advice": advice,
@@ -2584,8 +2591,9 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
2584 2591
 	execution_time := c.GetString("execution_time")
2585 2592
 	fmt.Println("execution_time", execution_time)
2586 2593
 	groupno, _ := c.GetInt64("groupno", -1)
2587
-	//patient_id, _ := c.GetInt64("patient_id")
2594
+	patient_id, _ := c.GetInt64("patient_id")
2588 2595
 	advice_date, _ := c.GetInt64("advice_date")
2596
+	record_date, _ := c.GetInt64("record_date")
2589 2597
 	var ids []string
2590 2598
 	if groupno == 0 {
2591 2599
 		advice_ids := c.GetString("advice_id")
@@ -2617,7 +2625,7 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
2617 2625
 	var advice models.DoctorAdvice
2618 2626
 
2619 2627
 	if groupno > 0 {
2620
-		advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
2628
+		advices, _ := service.FindAllDoctorAdviceByGoroupNoThree(adminUserInfo.Org.Id, groupno, patient_id, record_date)
2621 2629
 		for _, item := range advices {
2622 2630
 			if item.ExecutionState == 1 {
2623 2631
 				advice = item
@@ -2680,7 +2688,7 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
2680 2688
 
2681 2689
 			}
2682 2690
 		}
2683
-		err = service.ModifyExceDoctorAdviceByGroupNo(&advices, groupno, adminUserInfo.Org.Id)
2691
+		err = service.ModifyExceDoctorAdviceByGroupNoTwo(&advices, groupno, adminUserInfo.Org.Id, patient_id, record_date)
2684 2692
 		//记录日志
2685 2693
 		byterequest, _ := json.Marshal(advices)
2686 2694
 		adviceLog := models.XtDoctorAdviceLog{
@@ -6743,6 +6751,9 @@ func (c *PatientApiController) ExecProject() {
6743 6751
 	team_id, _ := c.GetInt64("team_id")
6744 6752
 	is_check_team, _ := c.GetInt64("is_check_team")
6745 6753
 
6754
+	record_date, _ := c.GetInt64("record_date")
6755
+	patient_id, _ := c.GetInt64("patient_id")
6756
+
6746 6757
 	if len(execution_time) <= 0 {
6747 6758
 		utils.ErrorLog("execution_time")
6748 6759
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -6920,7 +6931,8 @@ func (c *PatientApiController) ExecProject() {
6920 6931
 
6921 6932
 				}
6922 6933
 			}
6923
-			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
+
6924 6936
 			var ids []int64
6925 6937
 			for _, items := range ps {
6926 6938
 				ids = append(ids, items.ID)
@@ -6947,6 +6959,9 @@ func (c *PatientApiController) CheckProject() {
6947 6959
 	team_id, _ := c.GetInt64("team_id")
6948 6960
 	is_check_team, _ := c.GetInt64("is_check_team")
6949 6961
 
6962
+	record_date, _ := c.GetInt64("record_date")
6963
+	patient_id, _ := c.GetInt64("patient_id")
6964
+
6950 6965
 	project, _ := service.FindHisProjectById(adminInfo.Org.Id, project_id)
6951 6966
 	if project.CheckState == 1 {
6952 6967
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceChecked)
@@ -7062,7 +7077,7 @@ func (c *PatientApiController) CheckProject() {
7062 7077
 
7063 7078
 				}
7064 7079
 			}
7065
-			ps, _ := service.GetCheckTeamProject(team_id, project.PatientId, project.RecordDate, project.UserOrgId)
7080
+			ps, _ := service.GetCheckTeamProjectOne(team_id, patient_id, record_date, adminInfo.Org.Id)
7066 7081
 			var ids []int64
7067 7082
 			for _, items := range ps {
7068 7083
 				ids = append(ids, items.ID)

+ 425 - 58
controllers/patient_api_controller.go View File

@@ -168,6 +168,40 @@ func PatientApiRegistRouters() {
168 168
 
169 169
 	beego.Router("/api/patient/deletepatientdeathsummary", &DialysisApiController{}, "Get:DeletePatientDeathSummary")
170 170
 
171
+	beego.Router("/api/patient/createnewsickhistoryrecord", &PatientApiController{}, "Post:CreateNewSickHistoryRecord")
172
+
173
+	beego.Router("/api/patient/getnewsickhistory", &PatientApiController{}, "Get:GetNewSickHistory")
174
+
175
+	beego.Router("/api/patient/deletenewsickhistory", &PatientApiController{}, "Get:DeleteNewSickHistory")
176
+
177
+	beego.Router("/api/patient/savesickhistorytemplate", &PatientApiController{}, "Post:SaveSickHistoryTemplate")
178
+
179
+	beego.Router("/api/patient/getsickhistorytemplate", &PatientApiController{}, "Get:GetSickHistoryTemplate")
180
+
181
+	beego.Router("/api/patient/modifysickhistorytemplate", &PatientApiController{}, "Post:ModifySickHistoryTemplate")
182
+
183
+	beego.Router("/api/patient/deletesickhistorytemplate", &PatientApiController{}, "Get:DeleteSickHistoryTemplate")
184
+
185
+	beego.Router("/api/patient/createnewcourseofdiseaserecord", &PatientApiController{}, "Post:CreateNewCourseOfDiaseaseRecord")
186
+
187
+	beego.Router("/api/patient/getpatientcourseofdiseaseslist", &PatientApiController{}, "Get:GetPatientCoureseOfDiseasesList")
188
+
189
+	beego.Router("/api/patient/deletenewcourseofdisease", &PatientApiController{}, "Get:DeleteNewCourseOfDisease")
190
+
191
+	beego.Router("/api/patient/createnewcouresetemplate", &PatientApiController{}, "Post:CreateNewCourseTemplate")
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
+
171 205
 }
172 206
 func (c *PatientApiController) GetExportList() {
173 207
 	startTime := c.GetString("start_time")
@@ -6331,68 +6365,31 @@ func (c *PatientApiController) ExportPatients() {
6331 6365
 			if patientNameM["id_card_no"] != nil || reflect.TypeOf(patientNameM["id_card_no"]).String() == "string" {
6332 6366
 				id_card_no, _ := patientNameM["id_card_no"].(string)
6333 6367
 
6334
-				if IsIdCard(id_card_no) == false { //身份证号码不符合要求则生成一条导入错误日志
6335
-
6336
-					if len(id_card_no) == 0 {
6337
-						err_log := models.ExportErrLog{
6338
-							LogType:    1,
6339
-							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
6340
-							ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的身份证号码不能为空",
6341
-							Status:     1,
6342
-							CreateTime: time.Now().Unix(),
6343
-							UpdateTime: time.Now().Unix(),
6344
-							ExportTime: export_time,
6345
-						}
6346
-						service.CreateExportErrLog(&err_log)
6347
-						continue
6348
-
6349
-					} else {
6350
-						err_log := models.ExportErrLog{
6351
-							LogType:    1,
6352
-							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
6353
-							ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的身份证号码格式不符合要求",
6354
-							Status:     1,
6355
-							CreateTime: time.Now().Unix(),
6356
-							UpdateTime: time.Now().Unix(),
6357
-							ExportTime: export_time,
6358
-						}
6359
-						service.CreateExportErrLog(&err_log)
6360
-						continue
6361
-
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,
6362 6379
 					}
6363
-
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
6364 6388
 				} else {
6365
-					//var tempPatient *models.Patients
6366
-					//for _, item := range all_patient {
6367
-					//	if item.IdCardNo == id_card_no {
6368
-					//		tempPatient = item
6369
-					//	}
6370
-					//}
6371
-					count := service.FindPatientIdCardNoIsExist(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
6372
-					if count >= 1 {
6373
-						//if tempPatient != nil && tempPatient.ID > 0 {
6374
-						err_log := models.ExportErrLog{
6375
-							LogType:    1,
6376
-							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
6377
-							ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的身份证号码在系统中已经存在",
6378
-							Status:     1,
6379
-							CreateTime: time.Now().Unix(),
6380
-							UpdateTime: time.Now().Unix(),
6381
-							ExportTime: export_time,
6382
-						}
6383
-						service.CreateExportErrLog(&err_log)
6384
-						continue
6385
-					}
6386
-					//}
6387
-					patient.IdCardNo = id_card_no
6388
-					//patient.Birthday = GetBirthDay(id_card_no).Unix()
6389
-					if GetBirthDay(id_card_no) == nil {
6390
-						patient.Birthday = 0
6391
-					} else {
6392
-						patient.Birthday = GetBirthDay(id_card_no).Unix()
6389
+					patient.Birthday = GetBirthDay(id_card_no).Unix()
6393 6390
 
6394
-					}
6395 6391
 				}
6392
+
6396 6393
 			}
6397 6394
 
6398 6395
 			fmt.Println("111112222")
@@ -8159,3 +8156,373 @@ func (c *DialysisApiController) DeletePatientDeathSummary() {
8159 8156
 		"msg": "删除成功",
8160 8157
 	})
8161 8158
 }
8159
+
8160
+func (this *PatientApiController) CreateNewSickHistoryRecord() {
8161
+
8162
+	dataBody := make(map[string]interface{}, 0)
8163
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
8164
+	if err != nil {
8165
+		utils.ErrorLog(err.Error())
8166
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8167
+		return
8168
+	}
8169
+
8170
+	record_date := dataBody["record_time"].(string)
8171
+	timeLayout := "2006-01-02"
8172
+	loc, _ := time.LoadLocation("Local")
8173
+	var recordDate int64
8174
+	if len(record_date) > 0 {
8175
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
8176
+		if err != nil {
8177
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8178
+			return
8179
+		}
8180
+		recordDate = theTime.Unix()
8181
+	}
8182
+
8183
+	id := int64(dataBody["id"].(float64))
8184
+
8185
+	patient_id := int64(dataBody["patient_id"].(float64))
8186
+
8187
+	doctor_id := int64(dataBody["doctor_id"].(float64))
8188
+
8189
+	guominyaowu_desc := dataBody["guominyaowu_desc"].(string)
8190
+
8191
+	is_fumotouxishi := int64(dataBody["is_fumotouxishi"].(float64))
8192
+
8193
+	is_guominyaowu := int64(dataBody["is_guominyaowu"].(float64))
8194
+
8195
+	is_shenyizhishi := int64(dataBody["is_shenyizhishi"].(float64))
8196
+
8197
+	content := dataBody["content"].(string)
8198
+
8199
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8200
+
8201
+	patientSickHistory := models.XtPatientSickHistory{
8202
+		ID:                      id,
8203
+		OrgId:                   orgId,
8204
+		PatientId:               patient_id,
8205
+		Recorder:                0,
8206
+		RecordTime:              recordDate,
8207
+		RecordDate:              recordDate,
8208
+		Content:                 content,
8209
+		Status:                  1,
8210
+		Ctime:                   time.Now().Unix(),
8211
+		Mtime:                   time.Now().Unix(),
8212
+		Title:                   "",
8213
+		IsShenyizhiHistory:      is_shenyizhishi,
8214
+		IsFumoDialysisHistory:   is_fumotouxishi,
8215
+		HypersusceptibilityDesc: guominyaowu_desc,
8216
+		DoctorId:                doctor_id,
8217
+		IsHypersusceptibility:   is_guominyaowu,
8218
+	}
8219
+
8220
+	service.CreateNewSickHistoryRecord(patientSickHistory)
8221
+
8222
+	this.ServeSuccessJSON(map[string]interface{}{
8223
+		"patientSickHistory": patientSickHistory,
8224
+	})
8225
+}
8226
+
8227
+func (this *PatientApiController) GetNewSickHistory() {
8228
+
8229
+	patient_id, _ := this.GetInt64("patient_id")
8230
+
8231
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8232
+
8233
+	list, _ := service.GetNewSickHistory(patient_id, orgId)
8234
+
8235
+	this.ServeSuccessJSON(map[string]interface{}{
8236
+		"list": list,
8237
+	})
8238
+}
8239
+
8240
+func (this *PatientApiController) DeleteNewSickHistory() {
8241
+
8242
+	id, _ := this.GetInt64("id")
8243
+
8244
+	service.DeleteNewSickHistory(id)
8245
+
8246
+	this.ServeSuccessJSON(map[string]interface{}{
8247
+		"msg": "ok",
8248
+	})
8249
+}
8250
+
8251
+func (this *PatientApiController) SaveSickHistoryTemplate() {
8252
+
8253
+	dataBody := make(map[string]interface{}, 0)
8254
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
8255
+	if err != nil {
8256
+		utils.ErrorLog(err.Error())
8257
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8258
+		return
8259
+	}
8260
+
8261
+	title := dataBody["title"].(string)
8262
+
8263
+	content := dataBody["content"].(string)
8264
+
8265
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8266
+
8267
+	sickHistoryTemplate := models.XtSickHistoryTemplate{
8268
+		Content:   content,
8269
+		UserOrgId: orgId,
8270
+		Title:     title,
8271
+		Ctime:     time.Now().Unix(),
8272
+		Mtime:     time.Now().Unix(),
8273
+		Status:    1,
8274
+	}
8275
+
8276
+	service.CreateSickHistoryTemplate(sickHistoryTemplate)
8277
+
8278
+	this.ServeSuccessJSON(map[string]interface{}{
8279
+		"sickHistoryTemplate": "sickHistoryTemplate",
8280
+	})
8281
+}
8282
+
8283
+func (this *PatientApiController) GetSickHistoryTemplate() {
8284
+
8285
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8286
+
8287
+	templateList, _ := service.GetSickHistoryTemplate(orgId)
8288
+
8289
+	this.ServeSuccessJSON(map[string]interface{}{
8290
+		"templateList": templateList,
8291
+	})
8292
+}
8293
+
8294
+func (this *PatientApiController) ModifySickHistoryTemplate() {
8295
+
8296
+	dataBody := make(map[string]interface{}, 0)
8297
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
8298
+	if err != nil {
8299
+		utils.ErrorLog(err.Error())
8300
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8301
+		return
8302
+	}
8303
+
8304
+	template_id := int64(dataBody["template_id"].(float64))
8305
+	content := dataBody["content"].(string)
8306
+
8307
+	service.ModifySickHistoryTemplate(template_id, content)
8308
+
8309
+	this.ServeSuccessJSON(map[string]interface{}{
8310
+		"msg": "ok",
8311
+	})
8312
+}
8313
+
8314
+func (this *PatientApiController) DeleteSickHistoryTemplate() {
8315
+
8316
+	template_id, _ := this.GetInt64("template_id")
8317
+
8318
+	service.DeleteSickHistoryTemplate(template_id)
8319
+
8320
+	this.ServeSuccessJSON(map[string]interface{}{
8321
+		"msg": "ok",
8322
+	})
8323
+}
8324
+
8325
+func (this *PatientApiController) CreateNewCourseOfDiaseaseRecord() {
8326
+
8327
+	dataBody := make(map[string]interface{}, 0)
8328
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
8329
+	if err != nil {
8330
+		utils.ErrorLog(err.Error())
8331
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8332
+		return
8333
+	}
8334
+
8335
+	patient_id := int64(dataBody["patient_id"].(float64))
8336
+
8337
+	record_date := dataBody["record_date"].(string)
8338
+
8339
+	id := int64(dataBody["id"].(float64))
8340
+
8341
+	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_date)
8342
+
8343
+	content := dataBody["content"].(string)
8344
+	admin_user_id := int64(dataBody["admin_user_id"].(float64))
8345
+
8346
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8347
+
8348
+	patientCourse := models.PatientDiseaseCourse{
8349
+		ID:         id,
8350
+		OrgID:      orgId,
8351
+		PatientID:  patient_id,
8352
+		Recorder:   admin_user_id,
8353
+		RecordTime: recordDate.Unix(),
8354
+		Content:    content,
8355
+		Status:     1,
8356
+		CreateTime: time.Now().Unix(),
8357
+		ModifyTime: time.Now().Unix(),
8358
+		Title:      "",
8359
+	}
8360
+
8361
+	service.CreateNewCourseOfDiaseaseRecord(patientCourse)
8362
+
8363
+	this.ServeSuccessJSON(map[string]interface{}{
8364
+		"msg": "ok",
8365
+	})
8366
+
8367
+}
8368
+
8369
+func (this *PatientApiController) GetPatientCoureseOfDiseasesList() {
8370
+
8371
+	patient_id, _ := this.GetInt64("patient_id")
8372
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8373
+	list, _ := service.GetPatientCoureseOfDiseasesList(patient_id, orgId)
8374
+	this.ServeSuccessJSON(map[string]interface{}{
8375
+		"list": list,
8376
+	})
8377
+}
8378
+
8379
+func (this *PatientApiController) DeleteNewCourseOfDisease() {
8380
+
8381
+	id, _ := this.GetInt64("id")
8382
+
8383
+	service.DeleteNewCourseOfDisease(id)
8384
+
8385
+	this.ServeSuccessJSON(map[string]interface{}{
8386
+		"msg": "ok",
8387
+	})
8388
+}
8389
+
8390
+func (this *PatientApiController) CreateNewCourseTemplate() {
8391
+
8392
+	dataBody := make(map[string]interface{}, 0)
8393
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
8394
+	if err != nil {
8395
+		utils.ErrorLog(err.Error())
8396
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8397
+		return
8398
+	}
8399
+
8400
+	title := dataBody["title"].(string)
8401
+
8402
+	content := dataBody["content"].(string)
8403
+
8404
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8405
+
8406
+	courseTemplate := models.XtPatientCourseTemplate{
8407
+		Content:   content,
8408
+		UserOrgId: orgId,
8409
+		Title:     title,
8410
+		Status:    1,
8411
+		Ctime:     time.Now().Unix(),
8412
+		Mtime:     time.Now().Unix(),
8413
+	}
8414
+
8415
+	service.CreateCourseTemplate(courseTemplate)
8416
+
8417
+	this.ServeSuccessJSON(map[string]interface{}{
8418
+		"msg": "ok",
8419
+	})
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
 

+ 19 - 16
models/data_models.go View File

@@ -19,6 +19,7 @@ type Dataconfig struct {
19 19
 	Order          int64  `gorm:"column:orders" json:"orders" form:"orders"`
20 20
 	Code           string `gorm:"column:code" json:"code" form:"code"`
21 21
 	FieldType      int64  `gorm:"column:field_type" json:"field_type" form:"field_type"`
22
+	Sort           int64  `gorm:"column:sort" json:"sort" form:"sort"`
22 23
 }
23 24
 
24 25
 func (Dataconfig) TableName() string {
@@ -97,22 +98,24 @@ func (DictionaryConfigViewModel) TableName() string {
97 98
 }
98 99
 
99 100
 type ConfigViewModel struct {
100
-	ID           int64         `gorm:"column:id" json:"id" form:"id"`
101
-	ParentId     int64         `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
102
-	Module       string        `gorm:"column:module" json:"module" form:"module"`
103
-	OrgId        int64         `gorm:"column:org_id" json:"org_id" form:"org_id"`
104
-	Name         string        `gorm:"column:name" json:"name" form:"name"`
105
-	FieldName    string        `gorm:"column:field_name" json:"field_name" form:"field_name"`
106
-	Value        int           `gorm:"column:value" json:"value" form:"value"`
107
-	CreatedTime  string        `gorm:"column:create_time" json:"create_time" form:"create_time"`
108
-	UpdatedTime  string        `gorm:"column:update_time" json:"update_time" form:"update_time"`
109
-	CreateUserId int64         `gorm:"column:create_user_id" json:"create_user_id" form:"create_user_id"`
110
-	Status       int64         `gorm:"column:status" json:"status" form:"status"`
111
-	Remark       string        `gorm:"column:remark" json:"remark" form:"remark"`
112
-	Title        string        `gorm:"column:title" json:"title" form:"title"`
113
-	Content      string        `gorm:"column:content" json:"content" form:"content"`
114
-	Order        int64         `gorm:"column:orders" json:"orders" form:"orders"`
115
-	Childs       []*Dataconfig `json:"childs" `
101
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
102
+	ParentId     int64  `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
103
+	Module       string `gorm:"column:module" json:"module" form:"module"`
104
+	OrgId        int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
105
+	Name         string `gorm:"column:name" json:"name" form:"name"`
106
+	FieldName    string `gorm:"column:field_name" json:"field_name" form:"field_name"`
107
+	Value        int    `gorm:"column:value" json:"value" form:"value"`
108
+	CreatedTime  string `gorm:"column:create_time" json:"create_time" form:"create_time"`
109
+	UpdatedTime  string `gorm:"column:update_time" json:"update_time" form:"update_time"`
110
+	CreateUserId int64  `gorm:"column:create_user_id" json:"create_user_id" form:"create_user_id"`
111
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
112
+	Remark       string `gorm:"column:remark" json:"remark" form:"remark"`
113
+	Title        string `gorm:"column:title" json:"title" form:"title"`
114
+	Content      string `gorm:"column:content" json:"content" form:"content"`
115
+	Order        int64  `gorm:"column:orders" json:"orders" form:"orders"`
116
+	Sort         int64  `gorm:"column:sort" json:"sort" form:"sort"`
117
+
118
+	Childs []*Dataconfig `json:"childs" `
116 119
 }
117 120
 
118 121
 func (ConfigViewModel) TableName() string {

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

+ 1 - 0
models/inspection_models.go View File

@@ -70,6 +70,7 @@ type InspectionReference struct {
70 70
 	UpdatedTime      int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
71 71
 	SystemProjectId  int64  `gorm:"column:system_project_id" json:"system_project_id" form:"system_project_id"`
72 72
 	SystemItemId     int64  `gorm:"column:system_item_id" json:"system_item_id" form:"system_item_id"`
73
+	Sort             int64  `gorm:"column:sort" json:"sort" form:"sort"`
73 74
 	//remind 	 XtCheckRemind   `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ProjectId" json:"good_info"`
74 75
 }
75 76
 

+ 50 - 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 {
@@ -2830,3 +2836,47 @@ func (XtDeathSummary) TableName() string {
2830 2836
 
2831 2837
 	return "xt_death_summary"
2832 2838
 }
2839
+
2840
+type XtSickHistoryTemplate struct {
2841
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2842
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2843
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2844
+	Title     string `gorm:"column:title" json:"title" form:"title"`
2845
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2846
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2847
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2848
+}
2849
+
2850
+func (XtSickHistoryTemplate) TableName() string {
2851
+
2852
+	return "xt_sick_history_template"
2853
+}
2854
+
2855
+type XtPatientCourseTemplate struct {
2856
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
2857
+	Content   string `gorm:"column:content" json:"content" form:"content"`
2858
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2859
+	Title     string `gorm:"column:title" json:"title" form:"title"`
2860
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
2861
+	Ctime     int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2862
+	Mtime     int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2863
+}
2864
+
2865
+func (XtPatientCourseTemplate) TableName() string {
2866
+
2867
+	return "xt_patient_course_template"
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
+}

+ 4 - 2
service/data.go View File

@@ -1,11 +1,12 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5
-	_ "github.com/astaxie/beego"
6 4
 	_ "strconv"
7 5
 	_ "strings"
8 6
 	"time"
7
+
8
+	"XT_New/models"
9
+	_ "github.com/astaxie/beego"
9 10
 )
10 11
 
11 12
 // GetPatientList 返回患者的列表
@@ -48,6 +49,7 @@ func GetConfigList(orgID int64) (dataconfig interface{}, err error) {
48 49
 				Remark:       config.Remark,
49 50
 				Title:        config.Title,
50 51
 				Content:      config.Content,
52
+				Sort:         config.Sort,
51 53
 			}
52 54
 			// configResult = append(configResult,newConfig)
53 55
 			result := resultConfig[config.Module]

+ 23 - 0
service/dialysis_service.go View File

@@ -980,6 +980,12 @@ func ExceDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_id int
980 980
 	return err
981 981
 }
982 982
 
983
+func ExceDoctorAdviceByGroupNoOne(m *models.DoctorAdvice, groupNo int64, org_id int64, patient_id int64, record_date int64) (err error) {
984
+
985
+	err = writeDb.Model(&models.DoctorAdvice{}).Where("groupno = ?  AND user_org_id = ? AND status = 1 AND execution_state = 2 and patient_id = ? and advice_date = ?", groupNo, org_id, patient_id, record_date).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
986
+	return err
987
+}
988
+
983 989
 func GetExceDoctorAdviceGroupNo(groupNo int64, org_id int64) (advice []*models.DoctorAdvice, err error) {
984 990
 
985 991
 	err = XTReadDB().Where("groupno = ?  AND user_org_id = ? AND status = 1", groupNo, org_id).Find(&advice).Error
@@ -1195,6 +1201,18 @@ func ModifyExceDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_
1195 1201
 	return err
1196 1202
 }
1197 1203
 
1204
+func ModifyExceDoctorAdviceByGroupNoTwo(m *models.DoctorAdvice, groupNo int64, org_id int64, patient_id int64, advice_date int64) (err error) {
1205
+	ut := writeDb.Begin()
1206
+	err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ?  AND user_org_id = ? AND status = 1 AND execution_state = 1 and patient_id = ? and advice_date = ?", groupNo, org_id, patient_id, advice_date).Updates(map[string]interface{}{"execution_time": m.ExecutionTime}).Error
1207
+	if err != nil {
1208
+		ut.Rollback()
1209
+		return
1210
+	}
1211
+	ut.Commit()
1212
+
1213
+	return err
1214
+}
1215
+
1198 1216
 func ModifyExceDoctorAdviceByGroupNoOne(m *models.DoctorAdvice, ids []string) (err error) {
1199 1217
 	ut := writeDb.Begin()
1200 1218
 	err = ut.Model(&models.DoctorAdvice{}).Where("id in(?) and status =1", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime}).Error
@@ -1854,6 +1872,11 @@ func GetCheckTeamProject(team_id int64, patient_id int64, record_date int64, use
1854 1872
 	return
1855 1873
 }
1856 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
+
1857 1880
 func GetAdminUserRoleInformation(orgid int64) (models.SgjOrgFollow, error) {
1858 1881
 
1859 1882
 	follow := models.SgjOrgFollow{}

+ 1 - 1
service/inspection_service.go View File

@@ -398,7 +398,7 @@ func GetInspectionByProjectId(patient_id int64, org_id int64, project_id int64)
398 398
 
399 399
 func GetInSpctionRerefce(project_id int64, user_org_id int64) (inspct []*models.InspectionReference, err error) {
400 400
 
401
-	err = XTReadDB().Where("project_id = ? and (org_id = ? or org_id=0) and status =1", project_id, user_org_id).Find(&inspct).Error
401
+	err = XTReadDB().Where("project_id = ? and (org_id = ? or org_id=0) and status =1", project_id, user_org_id).Order("sort desc").Find(&inspct).Error
402 402
 	return inspct, err
403 403
 }
404 404
 

+ 145 - 0
service/patient_service.go View File

@@ -1786,6 +1786,11 @@ func FindAllDoctorAdviceByGoroupNoOne(orgID int64, groupno int64) (advice []mode
1786 1786
 	return
1787 1787
 }
1788 1788
 
1789
+func FindAllDoctorAdviceByGoroupNoThree(orgID int64, groupno int64, patient_id int64, advice_date int64) (advice []models.DoctorAdvice, err error) {
1790
+	err = readDb.Model(&models.DoctorAdvice{}).Where("user_org_id=?  AND groupno = ? AND status = 1 and patient_id =? and advice_date =?", orgID, groupno, patient_id, advice_date).Find(&advice).Error
1791
+	return
1792
+}
1793
+
1789 1794
 func UpdateDoctorAdviceByGoroupNo(id int64, drug_id int64) error {
1790 1795
 
1791 1796
 	err := XTWriteDB().Model(&models.DoctorAdvice{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"drug_id": drug_id, "drug_name_id": drug_id, "way": 1}).Error
@@ -4392,3 +4397,143 @@ func DeletePatientDeathSummary(id int64) error {
4392 4397
 
4393 4398
 	return err
4394 4399
 }
4400
+
4401
+func CreateNewSickHistoryRecord(history models.XtPatientSickHistory) error {
4402
+
4403
+	err := XTWriteDB().Save(&history).Error
4404
+
4405
+	return err
4406
+}
4407
+
4408
+func GetNewSickHistory(patient_id int64, org_id int64) (sick []*models.XtPatientSickHistory, err error) {
4409
+
4410
+	err = XTReadDB().Where("patient_id = ? and org_id = ? and status =1", patient_id, org_id).Order("record_time desc").Find(&sick).Error
4411
+
4412
+	return sick, err
4413
+}
4414
+
4415
+func DeleteNewSickHistory(id int64) error {
4416
+
4417
+	err := XTWriteDB().Model(&models.XtPatientSickHistory{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
4418
+
4419
+	return err
4420
+}
4421
+
4422
+func CreateSickHistoryTemplate(template models.XtSickHistoryTemplate) error {
4423
+
4424
+	err := XTWriteDB().Create(&template).Error
4425
+
4426
+	return err
4427
+}
4428
+
4429
+func GetSickHistoryTemplate(user_org_id int64) (template []*models.XtSickHistoryTemplate, err error) {
4430
+
4431
+	err = XTReadDB().Where("user_org_id = ? and status=1", user_org_id).Find(&template).Error
4432
+
4433
+	return template, err
4434
+}
4435
+
4436
+func ModifySickHistoryTemplate(id int64, content string) error {
4437
+
4438
+	err := XTReadDB().Model(&models.XtSickHistoryTemplate{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"content": content}).Error
4439
+	return err
4440
+}
4441
+
4442
+func DeleteSickHistoryTemplate(id int64) error {
4443
+
4444
+	err := XTWriteDB().Model(&models.XtSickHistoryTemplate{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
4445
+
4446
+	return err
4447
+}
4448
+
4449
+func CreateNewCourseOfDiaseaseRecord(course models.PatientDiseaseCourse) error {
4450
+
4451
+	err := XTWriteDB().Save(&course).Error
4452
+
4453
+	return err
4454
+}
4455
+
4456
+func GetPatientCoureseOfDiseasesList(patient_id int64, org_id int64) (list []*models.PatientDiseaseCourse, err error) {
4457
+
4458
+	err = XTReadDB().Where("patient_id = ? and org_id = ? and status=1", patient_id, org_id).Find(&list).Error
4459
+
4460
+	return list, err
4461
+
4462
+}
4463
+
4464
+func DeleteNewCourseOfDisease(id int64) error {
4465
+
4466
+	patientCourse := models.PatientDiseaseCourse{}
4467
+	err := XTWriteDB().Model(&patientCourse).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
4468
+	return err
4469
+}
4470
+
4471
+func CreateCourseTemplate(course models.XtPatientCourseTemplate) error {
4472
+
4473
+	err := XTWriteDB().Create(&course).Error
4474
+
4475
+	return err
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

@@ -3424,6 +3424,12 @@ func FindStockOutByIsSys(org_id int64, is_sys int, record_time int64) (out model
3424 3424
 
3425 3425
 }
3426 3426
 
3427
+func FindStockOutByIsSysOne(org_id int64, is_sys int, record_time int64, warehousing_out_order string) (out models.WarehouseOut, err error) {
3428
+	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
3429
+	return
3430
+
3431
+}
3432
+
3427 3433
 func FindStockOutByIsSysSix(org_id int64, is_sys int, record_time int64, second_warehouse_id int64) (out models.WarehouseOut, err error) {
3428 3434
 	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
3429 3435
 	return
@@ -3513,6 +3519,13 @@ func UpdateAutoMaticReduceDetailOne(goodid int64, goodtypeid int64, recordtime i
3513 3519
 	return err
3514 3520
 }
3515 3521
 
3522
+func GetGoodsIsExsit(good_id int64, sys_record_time int64, org_id int64, warehouse_out_id int64) (models.WarehouseOutInfo, error) {
3523
+
3524
+	outInfo := models.WarehouseOutInfo{}
3525
+	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
3526
+	return outInfo, err
3527
+}
3528
+
3516 3529
 func AddSigleWarehouseOutInfo(info *models.WarehouseOutInfo) error {
3517 3530
 
3518 3531
 	err := writeDb.Create(&info).Error