Browse Source

2024/6/17

28169 1 month ago
parent
commit
63c6d114de

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

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

+ 14 - 1
controllers/dialysis_api_controller.go View File

4481
 	//接诊评估
4481
 	//接诊评估
4482
 	receiverTreatmentAccess, _ := service.FindReceiverTreatmentAccessRecordById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4482
 	receiverTreatmentAccess, _ := service.FindReceiverTreatmentAccessRecordById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4483
 
4483
 
4484
+	if receiverTreatmentAccess.Condition == 1 {
4485
+		if len(receiverTreatmentAccess.AdmissionNumber) == 0 || receiverTreatmentAccess.AdmissionNumber == "" {
4486
+			lastAcceptTreatment, _ := service.GetLastAcceptTreatment(adminUserInfo.CurrentOrgId, patientInfo.ID)
4487
+			receiverTreatmentAccess.AdmissionNumber = lastAcceptTreatment.AdmissionNumber
4488
+			receiverTreatmentAccess.HisDepartment = lastAcceptTreatment.HisDepartment
4489
+			receiverTreatmentAccess.HisBed = lastAcceptTreatment.HisBed
4490
+		}
4491
+	}
4492
+
4484
 	check, _ := service.FindDoubleCheckById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4493
 	check, _ := service.FindDoubleCheckById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4485
 
4494
 
4486
 	if adminUserInfo.CurrentOrgId != 10101 && adminUserInfo.CurrentOrgId != 10445 && adminUserInfo.CurrentOrgId != 10345 {
4495
 	if adminUserInfo.CurrentOrgId != 10101 && adminUserInfo.CurrentOrgId != 10445 && adminUserInfo.CurrentOrgId != 10345 {
4859
 		for _, advice := range advices_two {
4868
 		for _, advice := range advices_two {
4860
 			p, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02"))
4869
 			p, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02"))
4861
 			now := p.Unix()
4870
 			now := p.Unix()
4871
+
4862
 			dayStr := strconv.FormatInt(advice.DayCount, 10)
4872
 			dayStr := strconv.FormatInt(advice.DayCount, 10)
4863
 			dayStr2 := "-" + dayStr
4873
 			dayStr2 := "-" + dayStr
4864
 			count, _ := strconv.ParseInt(dayStr2, 10, 64)
4874
 			count, _ := strconv.ParseInt(dayStr2, 10, 64)
4865
 			oldTime := time.Now().AddDate(0, 0, int(count)).Unix()
4875
 			oldTime := time.Now().AddDate(0, 0, int(count)).Unix()
4876
+			fmt.Println("oldTime--------------------------", oldTime)
4866
 			advices, _ := service.FindAllDoctorAdviceByTime(now, oldTime, patient_id, adminUserInfo.CurrentOrgId, advice.TemplateId)
4877
 			advices, _ := service.FindAllDoctorAdviceByTime(now, oldTime, patient_id, adminUserInfo.CurrentOrgId, advice.TemplateId)
4867
-
4878
+			fmt.Println("advices-------------------------", advices)
4868
 			for _, ad := range advices {
4879
 			for _, ad := range advices {
4869
 				advice_three = append(advice_three, ad)
4880
 				advice_three = append(advice_three, ad)
4870
 			}
4881
 			}
4952
 		for _, advice := range advices_two {
4963
 		for _, advice := range advices_two {
4953
 			p, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02"))
4964
 			p, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02"))
4954
 			now := p.Unix()
4965
 			now := p.Unix()
4966
+			fmt.Println("now-------------------------", now)
4955
 			dayStr := strconv.FormatInt(advice.DayCount, 10)
4967
 			dayStr := strconv.FormatInt(advice.DayCount, 10)
4956
 			dayStr2 := "-" + dayStr
4968
 			dayStr2 := "-" + dayStr
4957
 			count, _ := strconv.ParseInt(dayStr2, 10, 64)
4969
 			count, _ := strconv.ParseInt(dayStr2, 10, 64)
4958
 			oldTime := time.Now().AddDate(0, 0, int(count)).Unix()
4970
 			oldTime := time.Now().AddDate(0, 0, int(count)).Unix()
4971
+			fmt.Println("oldTime--------------------------", oldTime)
4959
 			advices, _ := service.FindAllDoctorAdviceByTime(now, oldTime, patient_id, adminUserInfo.CurrentOrgId, advice.TemplateId)
4972
 			advices, _ := service.FindAllDoctorAdviceByTime(now, oldTime, patient_id, adminUserInfo.CurrentOrgId, advice.TemplateId)
4960
 
4973
 
4961
 			for _, ad := range advices {
4974
 			for _, ad := range advices {

+ 2 - 1
controllers/drug_stock_api_contorller.go View File

3515
 	start_time := c.GetString("start_time")
3515
 	start_time := c.GetString("start_time")
3516
 	end_time := c.GetString("end_time")
3516
 	end_time := c.GetString("end_time")
3517
 	order_type, _ := c.GetInt64("order_type")
3517
 	order_type, _ := c.GetInt64("order_type")
3518
+	storehouse_id, _ := c.GetInt64("storehouse_id")
3518
 	timeLayout := "2006-01-02"
3519
 	timeLayout := "2006-01-02"
3519
 	loc, _ := time.LoadLocation("Local")
3520
 	loc, _ := time.LoadLocation("Local")
3520
 
3521
 
3543
 	dealerList, _ := service.GetAllDealerList(orgId)
3544
 	dealerList, _ := service.GetAllDealerList(orgId)
3544
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3545
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3545
 	if order_type == 2 {
3546
 	if order_type == 2 {
3546
-		list, err := service.GetDrugOutOrderInfoPrintList(startTime, endTime, orgId)
3547
+		list, err := service.GetDrugOutOrderInfoPrintList(startTime, endTime, orgId, storehouse_id)
3547
 		if err == nil {
3548
 		if err == nil {
3548
 			c.ServeSuccessJSON(map[string]interface{}{
3549
 			c.ServeSuccessJSON(map[string]interface{}{
3549
 				"list":             list,
3550
 				"list":             list,

+ 81 - 8
controllers/mobile_api_controllers/dialysis_api_controller.go View File

1327
 		//}
1327
 		//}
1328
 		// 查询信息规挡的设置天数
1328
 		// 查询信息规挡的设置天数
1329
 
1329
 
1330
-		if adminUserInfo.Org.Id == 10340 {
1331
-			if condition == 1 {
1332
-				lastAcceptTreatment, _ := service.GetLastAcceptTreatment(adminUserInfo.Org.Id, id)
1333
-				if receiveTreatmentAsses.AdmissionNumber == "" {
1334
-					receiveTreatmentAsses.AdmissionNumber = lastAcceptTreatment.AdmissionNumber
1335
-				}
1336
-			}
1337
-		}
1338
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1330
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1339
 		if infor.ID > 0 && infor.WeekDay > 0 {
1331
 		if infor.ID > 0 && infor.WeekDay > 0 {
1340
 
1332
 
1363
 
1355
 
1364
 		receiveTreatmentAsses.Modifier = adminUserInfo.AdminUser.Id
1356
 		receiveTreatmentAsses.Modifier = adminUserInfo.AdminUser.Id
1365
 		receiveTreatmentAsses.ID = receiveTreatment.ID
1357
 		receiveTreatmentAsses.ID = receiveTreatment.ID
1358
+
1359
+		if adminUserInfo.Org.Id == 10340 {
1360
+			if condition == 1 {
1361
+				lastAcceptTreatment, _ := service.GetLastAcceptTreatment(adminUserInfo.Org.Id, id)
1362
+				if receiveTreatmentAsses.AdmissionNumber == "" {
1363
+					receiveTreatmentAsses.AdmissionNumber = lastAcceptTreatment.AdmissionNumber
1364
+				}
1365
+			}
1366
+		}
1366
 		err := service.UpadateReceiveTreatmentAsses(&receiveTreatmentAsses)
1367
 		err := service.UpadateReceiveTreatmentAsses(&receiveTreatmentAsses)
1367
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":receive_treatment_asses"
1368
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":receive_treatment_asses"
1368
 		redis := service.RedisClient()
1369
 		redis := service.RedisClient()
5115
 		defer redis.Close()
5116
 		defer redis.Close()
5116
 
5117
 
5117
 	}
5118
 	}
5119
+
5118
 	// 查询信息规挡的设置天数
5120
 	// 查询信息规挡的设置天数
5119
 
5121
 
5120
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
5122
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
5140
 		}
5142
 		}
5141
 	}
5143
 	}
5142
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)
5144
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)
5145
+	//修改床位后重新生成消毒计划
5146
+	if adminUserInfo.Org.Id == 10340 {
5147
+		//根据床位号获取设备型号
5148
+		unitType, _ := service.GetUnitType(dialysisRecord.BedID, dialysisRecord.UserOrgId)
5149
+		//查询使用消毒最后一条消毒记录
5150
+		_, err := service.GetLaseDeviceInfomation(dialysisRecord.UserOrgId, dialysisRecord.BedID, dialysisRecord.DialysisDate, dialysisRecord.SchedualType)
5151
+		fmt.Println("err", err)
5152
+		if err == gorm.ErrRecordNotFound {
5153
+			//查找排班
5154
+			scheduleByPatient, _ := service.GetScheduleByPatient(dialysisRecord.PatientId, dialysisRecord.DialysisDate, dialysisRecord.UserOrgId)
5155
+			//查询改设备是否有消毒计划
5156
+			plan, errcode := service.GetDisInfectionTime(dialysisRecord.UserOrgId, unitType.UnitType, dialysisRecord.SchedualType, scheduleByPatient.ScheduleWeek)
5157
+
5158
+			//根据床位号获取设备id
5159
+			addmacher, _ := service.GetEquimentIDTwo(dialysisRecord.BedID, dialysisRecord.UserOrgId)
5160
+
5161
+			//查询病人信息
5162
+			patients, _ := service.GetPatientInfoMation(dialysisRecord.PatientId)
5163
+			var con = ""
5164
+			if patients.IsInfectious == 0 {
5165
+				con = ""
5166
+			}
5167
+			if patients.IsInfectious == 1 {
5168
+				con = "无"
5169
+			}
5170
+			if patients.IsInfectious == 2 {
5171
+				con = "有"
5172
+			}
5173
+
5174
+			if errcode == nil {
5175
+				var end_time int64
5176
+				end_time = dialysisRecord.EndTime + plan.DisinfecTime*60
5177
+				//新增消毒
5178
+				information := models.DeviceInformation{
5179
+					Date:                  dialysisRecord.DialysisDate,
5180
+					Zone:                  dialysisRecord.ZoneId,
5181
+					Class:                 dialysisRecord.SchedualType,
5182
+					BedNumber:             dialysisRecord.BedID,
5183
+					PatientId:             dialysisRecord.PatientId,
5184
+					DialysisMode:          scheduleByPatient.ModeId,
5185
+					LongTime:              strconv.FormatInt(plan.DisinfecTime, 10),
5186
+					Disinfection:          1,
5187
+					DialysisConcentration: 1,
5188
+					DisinfectionStatus:    1,
5189
+					Move:                  1,
5190
+					UserOrgId:             dialysisRecord.UserOrgId,
5191
+					DisinfectType:         plan.Way,
5192
+					DisinfectantType:      plan.MachineDisinfectant,
5193
+					FluidPath:             plan.DisinfectanWay, //液路消毒方式
5194
+					Disinfectant:          plan.Disinfectant,
5195
+					Ctime:                 time.Now().Unix(),
5196
+					Status:                1,
5197
+					SignName:              nurseID,
5198
+					EquimentId:            addmacher.ID,
5199
+					DisinfectionResidue:   2,
5200
+					Bed:                   addmacher.BedNumber,
5201
+					StartTime:             dialysisRecord.StartTime,
5202
+					EndTime:               dialysisRecord.EndTime,
5203
+					Contagion:             con,
5204
+					WeightLoss:            0,
5205
+					Hyperfiltratio:        0,
5206
+					DialysisHour:          "",
5207
+					MachineRun:            1,
5208
+					DisinfecStartime:      dialysisRecord.EndTime,
5209
+					DisinfecEndtime:       end_time,
5210
+				}
5211
+				err := service.CreateInformationTwo(&information)
5212
+				fmt.Println("报错", err)
5213
+			}
5214
+		}
5215
+	}
5143
 	order, _ := service.GetLastPatientOrder(record_id)
5216
 	order, _ := service.GetLastPatientOrder(record_id)
5144
 	service.UpdateMobilePatient(adminUserInfo.Org.Id, order.PatientId, schedule_remark)
5217
 	service.UpdateMobilePatient(adminUserInfo.Org.Id, order.PatientId, schedule_remark)
5145
 	redis := service.RedisClient()
5218
 	redis := service.RedisClient()

+ 13 - 4
controllers/mobile_api_controllers/patient_api_controller.go View File

1375
 
1375
 
1376
 							if medical.IsUse != 1 {
1376
 							if medical.IsUse != 1 {
1377
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1377
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1378
-									if advice.UserOrgId != 10278 {
1378
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 {
1379
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1379
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1380
 										advice.ExecutionTime = 0
1380
 										advice.ExecutionTime = 0
1381
 										advice.ExecutionState = 2
1381
 										advice.ExecutionState = 2
1391
 
1391
 
1392
 								}
1392
 								}
1393
 								if prescribing_number_total > total {
1393
 								if prescribing_number_total > total {
1394
-									if advice.UserOrgId != 10278 {
1394
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 {
1395
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1395
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1396
 										advice.ExecutionTime = 0
1396
 										advice.ExecutionTime = 0
1397
 										advice.ExecutionState = 2
1397
 										advice.ExecutionState = 2
1547
 							}
1547
 							}
1548
 							if medical.IsUse != 1 {
1548
 							if medical.IsUse != 1 {
1549
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1549
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1550
-									if advice.UserOrgId != 10278 {
1550
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 {
1551
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1551
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1552
 										advice.ExecutionTime = 0
1552
 										advice.ExecutionTime = 0
1553
 										advice.ExecutionState = 2
1553
 										advice.ExecutionState = 2
1561
 									return
1561
 									return
1562
 								}
1562
 								}
1563
 								if prescribing_number_total > total {
1563
 								if prescribing_number_total > total {
1564
-									if advice.UserOrgId != 10278 {
1564
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 {
1565
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1565
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1566
 										advice.ExecutionTime = 0
1566
 										advice.ExecutionTime = 0
1567
 										advice.ExecutionState = 2
1567
 										advice.ExecutionState = 2
5680
 	//接诊评估
5680
 	//接诊评估
5681
 	receiverTreatmentAccess, _ := service.FindReceiverTreatmentAccessRecordById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
5681
 	receiverTreatmentAccess, _ := service.FindReceiverTreatmentAccessRecordById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
5682
 
5682
 
5683
+	if receiverTreatmentAccess.Condition == 1 {
5684
+		if len(receiverTreatmentAccess.AdmissionNumber) == 0 || receiverTreatmentAccess.AdmissionNumber == "" {
5685
+			lastAcceptTreatment, _ := service.GetLastAcceptTreatment(adminUserInfo.Org.Id, patientInfo.ID)
5686
+			receiverTreatmentAccess.AdmissionNumber = lastAcceptTreatment.AdmissionNumber
5687
+			receiverTreatmentAccess.HisDepartment = lastAcceptTreatment.HisDepartment
5688
+			receiverTreatmentAccess.HisBed = lastAcceptTreatment.HisBed
5689
+		}
5690
+	}
5691
+
5683
 	//相关操作对应的操作人
5692
 	//相关操作对应的操作人
5684
 	//operators, _ := service.GetAdminUserES(adminUserInfo.Org.Id, adminUserInfo.App.Id, operatorIDs)
5693
 	//operators, _ := service.GetAdminUserES(adminUserInfo.Org.Id, adminUserInfo.App.Id, operatorIDs)
5685
 	operators, err := service.GetAllStarfEs(adminUserInfo.Org.Id)
5694
 	operators, err := service.GetAllStarfEs(adminUserInfo.Org.Id)

+ 6 - 4
controllers/patient_api_controller.go View File

1054
 	infections, _ := service.GetAllInfectionRecord(infectiousRecord.InspectDate, adminUserInfo.CurrentOrgId, patient.ID, infectiousRecord.ProjectId)
1054
 	infections, _ := service.GetAllInfectionRecord(infectiousRecord.InspectDate, adminUserInfo.CurrentOrgId, patient.ID, infectiousRecord.ProjectId)
1055
 	diseases := service.GetPatientDiseases(patient.ID)
1055
 	diseases := service.GetPatientDiseases(patient.ID)
1056
 	contagions := service.GetPatientContagions(patient.ID)
1056
 	contagions := service.GetPatientContagions(patient.ID)
1057
+	patientVascularAccessOne, _ := service.GetPatientVascularAccessOne(patient.ID)
1057
 	c.ServeSuccessJSON(map[string]interface{}{
1058
 	c.ServeSuccessJSON(map[string]interface{}{
1058
-		"patient":    patient,
1059
-		"diseases":   diseases,
1060
-		"contagions": contagions,
1061
-		"infections": infections,
1059
+		"patient":                  patient,
1060
+		"diseases":                 diseases,
1061
+		"contagions":               contagions,
1062
+		"infections":               infections,
1063
+		"patientVascularAccessOne": patientVascularAccessOne,
1062
 	})
1064
 	})
1063
 	return
1065
 	return
1064
 }
1066
 }

+ 8 - 0
controllers/print_data_api_controller.go View File

51
 			item.Prescription = prescription
51
 			item.Prescription = prescription
52
 			//接诊评估
52
 			//接诊评估
53
 			receiveTreatmentAsses, _ := service.GetBatchReceiveTreatmentAsses(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
53
 			receiveTreatmentAsses, _ := service.GetBatchReceiveTreatmentAsses(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
54
+			if receiveTreatmentAsses.Condition == 1 {
55
+				if len(receiveTreatmentAsses.AdmissionNumber) == 0 || receiveTreatmentAsses.AdmissionNumber == "" {
56
+					lastAcceptTreatment, _ := service.GetLastAcceptTreatment(adminUserInfo.CurrentOrgId, item.PatientID)
57
+					receiveTreatmentAsses.AdmissionNumber = lastAcceptTreatment.AdmissionNumber
58
+					receiveTreatmentAsses.HisDepartment = lastAcceptTreatment.HisDepartment
59
+					receiveTreatmentAsses.HisBed = lastAcceptTreatment.HisBed
60
+				}
61
+			}
54
 			item.ReceiveAssessment = receiveTreatmentAsses
62
 			item.ReceiveAssessment = receiveTreatmentAsses
55
 
63
 
56
 			//透前评估
64
 			//透前评估

+ 8 - 0
controllers/stock_in_api_controller.go View File

408
 				license_number, _ := items["license_number"].(string)
408
 				license_number, _ := items["license_number"].(string)
409
 
409
 
410
 				register_number, _ := items["register_number"].(string)
410
 				register_number, _ := items["register_number"].(string)
411
+
412
+				good_code, _ := items["good_code"].(string)
411
 				//入库单表格
413
 				//入库单表格
412
 				warehouseInfo := &models.WarehousingInfo{
414
 				warehouseInfo := &models.WarehousingInfo{
413
 					ID:               id,
415
 					ID:               id,
434
 					StorehouseId:     storehouse_id,
436
 					StorehouseId:     storehouse_id,
435
 					IsCheck:          2,
437
 					IsCheck:          2,
436
 					RegisterNumber:   register_number,
438
 					RegisterNumber:   register_number,
439
+					GoodCode:         good_code,
437
 				}
440
 				}
438
 				warehousingInfo = append(warehousingInfo, warehouseInfo)
441
 				warehousingInfo = append(warehousingInfo, warehouseInfo)
439
 
442
 
684
 				dealer := int64(items["dealer"].(float64))
687
 				dealer := int64(items["dealer"].(float64))
685
 				license_number, _ := items["license_number"].(string)
688
 				license_number, _ := items["license_number"].(string)
686
 				register_number, _ := items["register_number"].(string)
689
 				register_number, _ := items["register_number"].(string)
690
+				good_code, _ := items["good_code"].(string)
687
 				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
691
 				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
688
 					utils.ErrorLog("id")
692
 					utils.ErrorLog("id")
689
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
693
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
716
 						StorehouseId:     storehouse_id,
720
 						StorehouseId:     storehouse_id,
717
 						IsCheck:          2,
721
 						IsCheck:          2,
718
 						RegisterNumber:   register_number,
722
 						RegisterNumber:   register_number,
723
+						GoodCode:         good_code,
719
 					}
724
 					}
720
 					warehousingInfo = append(warehousingInfo, warehouseInfo)
725
 					warehousingInfo = append(warehousingInfo, warehouseInfo)
721
 
726
 
744
 						PackingPrice:     packing_price,
749
 						PackingPrice:     packing_price,
745
 						StorehouseId:     storehouse_id,
750
 						StorehouseId:     storehouse_id,
746
 						RegisterNumber:   register_number,
751
 						RegisterNumber:   register_number,
752
+						GoodCode:         good_code,
747
 					}
753
 					}
748
 					upDateWarehousingInfo = append(upDateWarehousingInfo, warehouseInfo)
754
 					upDateWarehousingInfo = append(upDateWarehousingInfo, warehouseInfo)
749
 
755
 
769
 						WarehousingDetailId: warehouseInfo.ID,
775
 						WarehousingDetailId: warehouseInfo.ID,
770
 						StorehouseId:        storehouse_id,
776
 						StorehouseId:        storehouse_id,
771
 						RegisterNumber:      register_number,
777
 						RegisterNumber:      register_number,
778
+						GoodCode:            good_code,
772
 					}
779
 					}
773
 
780
 
774
 					stockFlow = append(stockFlow, flow)
781
 					stockFlow = append(stockFlow, flow)
7645
 				IsCheck:                 1,
7652
 				IsCheck:                 1,
7646
 				OverCount:               flush_count,
7653
 				OverCount:               flush_count,
7647
 				OperateTime:             time.Now().Unix(),
7654
 				OperateTime:             time.Now().Unix(),
7655
+				GoodCode:                item.GoodCode,
7648
 			}
7656
 			}
7649
 			//创建出库流水
7657
 			//创建出库流水
7650
 			service.CreateStockFlowOne(stockFlow)
7658
 			service.CreateStockFlowOne(stockFlow)

+ 2 - 0
models/new_stock_models.go View File

174
 	MedicalInsuranceNumber string                 `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
174
 	MedicalInsuranceNumber string                 `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
175
 	DrugType               int64                  `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
175
 	DrugType               int64                  `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
176
 	MedicalInsuranceLevel  int64                  `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
176
 	MedicalInsuranceLevel  int64                  `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
177
+	IsSelfDrug             int64                  `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
177
 }
178
 }
178
 
179
 
179
 func (NewBaseDrugOne) TableName() string {
180
 func (NewBaseDrugOne) TableName() string {
424
 	Ctime                            int64             `gorm:"column:ctime" json:"ctime" form:"ctime"`
425
 	Ctime                            int64             `gorm:"column:ctime" json:"ctime" form:"ctime"`
425
 	Mtime                            int64             `gorm:"column:mtime" json:"mtime" form:"mtime"`
426
 	Mtime                            int64             `gorm:"column:mtime" json:"mtime" form:"mtime"`
426
 	OrgId                            int64             `gorm:"column:org_id" json:"org_id" form:"org_id"`
427
 	OrgId                            int64             `gorm:"column:org_id" json:"org_id" form:"org_id"`
428
+	IsSelfDrug                       int64             `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
427
 	MedicalInsuranceNumber           string            `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
429
 	MedicalInsuranceNumber           string            `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
428
 	DrugFlowWarehouseInfo            []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_flow_info"`
430
 	DrugFlowWarehouseInfo            []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_flow_info"`
429
 	DrugActFlowWarehouseInfo         []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_act_flow_info"`
431
 	DrugActFlowWarehouseInfo         []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_act_flow_info"`

+ 4 - 0
models/stock_models.go View File

107
 	StorehouseId          int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
107
 	StorehouseId          int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
108
 	SecondWarehouseInfoId int64   `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
108
 	SecondWarehouseInfoId int64   `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
109
 	WarehousingTime       string  `json:"warehousing_time"`
109
 	WarehousingTime       string  `json:"warehousing_time"`
110
+	PackingPrice          float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
110
 }
111
 }
111
 
112
 
112
 func (StWarehousingInfo) TableName() string {
113
 func (StWarehousingInfo) TableName() string {
176
 	RegisterNumber            string      `gorm:"column:register_number" json:"register_number" form:"register_number"`
177
 	RegisterNumber            string      `gorm:"column:register_number" json:"register_number" form:"register_number"`
177
 	ManafacturerName          string      `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
178
 	ManafacturerName          string      `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
178
 	DealerName                string      `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
179
 	DealerName                string      `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
180
+	GoodCode                  string      `gorm:"column:good_code" json:"good_code" form:"good_code"`
179
 }
181
 }
180
 
182
 
181
 func (WarehousingInfo) TableName() string {
183
 func (WarehousingInfo) TableName() string {
700
 	Remark                    string          `gorm:"column:remark" json:"remark" form:"remark"`
702
 	Remark                    string          `gorm:"column:remark" json:"remark" form:"remark"`
701
 	FlushOverCount            int64           `gorm:"column:flush_over_count" json:"flush_over_count" form:"flush_over_count"`
703
 	FlushOverCount            int64           `gorm:"column:flush_over_count" json:"flush_over_count" form:"flush_over_count"`
702
 	OperateTime               int64           `gorm:"column:operate_time" json:"operate_time" form:"operate_time"`
704
 	OperateTime               int64           `gorm:"column:operate_time" json:"operate_time" form:"operate_time"`
705
+	GoodCode                  string          `gorm:"column:good_code" json:"good_code" form:"good_code"`
703
 }
706
 }
704
 
707
 
705
 func (VmStockFlow) TableName() string {
708
 func (VmStockFlow) TableName() string {
1541
 	StorehouseId              int64    `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
1544
 	StorehouseId              int64    `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
1542
 	SecondWarehouseInfoId     int64    `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
1545
 	SecondWarehouseInfoId     int64    `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
1543
 	RegisterNumber            string   `gorm:"column:register_number" json:"register_number" form:"register_number"`
1546
 	RegisterNumber            string   `gorm:"column:register_number" json:"register_number" form:"register_number"`
1547
+	GoodCode                  string   `gorm:"column:good_code" json:"good_code" form:"good_code"`
1544
 }
1548
 }
1545
 
1549
 
1546
 func (VmWarehousingInfoSix) TableName() string {
1550
 func (VmWarehousingInfoSix) TableName() string {

+ 4 - 1
service/drug_stock_service.go View File

261
 	return list, err
261
 	return list, err
262
 }
262
 }
263
 
263
 
264
-func GetDrugOutOrderInfoPrintList(startime int64, endtime int64, orgid int64) (list []*models.SgjDrugWarehouseOutInfo, err error) {
264
+func GetDrugOutOrderInfoPrintList(startime int64, endtime int64, orgid int64, storehouse_id int64) (list []*models.SgjDrugWarehouseOutInfo, err error) {
265
 
265
 
266
 	db := XTReadDB().Table("xt_drug_warehouse_out_info").Where("status = 1 and is_check=1")
266
 	db := XTReadDB().Table("xt_drug_warehouse_out_info").Where("status = 1 and is_check=1")
267
 	if startime > 0 {
267
 	if startime > 0 {
273
 	if orgid > 0 {
273
 	if orgid > 0 {
274
 		db = db.Where("org_id = ?", orgid)
274
 		db = db.Where("org_id = ?", orgid)
275
 	}
275
 	}
276
+	if storehouse_id > 0 {
277
+		db = db.Where("storehouse_id=?", storehouse_id)
278
+	}
276
 	err = db.Preload("XtDrugWarehouseInfo", "status=1 and org_id =?", orgid).Preload("XtBaseDrug", "status = 1 and org_id = ?", orgid).Find(&list).Error
279
 	err = db.Preload("XtDrugWarehouseInfo", "status=1 and org_id =?", orgid).Preload("XtBaseDrug", "status = 1 and org_id = ?", orgid).Find(&list).Error
277
 	return list, err
280
 	return list, err
278
 }
281
 }

+ 6 - 0
service/his_project_service.go View File

788
 	return access, err
788
 	return access, err
789
 }
789
 }
790
 
790
 
791
+func GetPatientVascularAccessOne(patient_id int64) (models.XtPatientVascularAccess, error) {
792
+	access := models.XtPatientVascularAccess{}
793
+	err = XTReadDB().Where("patient_id = ? and status = 1 and user_status =1", patient_id).Last(&access).Error
794
+	return access, err
795
+}
796
+
791
 func CreateHisProjectTh11o(project models.HisProject) error {
797
 func CreateHisProjectTh11o(project models.HisProject) error {
792
 
798
 
793
 	err := XTWriteDB().Model(&project).Create(&project).Error
799
 	err := XTWriteDB().Model(&project).Create(&project).Error

+ 2 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go View File

491
 	IsPrecaution                 int64  `gorm:"column:is_precaution" json:"is_precaution"`
491
 	IsPrecaution                 int64  `gorm:"column:is_precaution" json:"is_precaution"`
492
 	AdmissionNumber              string `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
492
 	AdmissionNumber              string `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
493
 	UserOrgId                    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
493
 	UserOrgId                    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
494
+	HisDepartment                string `gorm:"column:his_department" json:"his_department" form:"his_department"`
495
+	HisBed                       string `gorm:"column:his_bed" json:"his_bed" form:"his_bed"`
494
 }
496
 }
495
 
497
 
496
 func (ReceiveAssessmentVM) TableName() string {
498
 func (ReceiveAssessmentVM) TableName() string {

+ 7 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go View File

431
 	return receiveAssessmentVM, err
431
 	return receiveAssessmentVM, err
432
 }
432
 }
433
 
433
 
434
+func GetLastAcceptTreatment(user_org_id int64, patient_id int64) (models.ReceiveTreatmentAsses, error) {
435
+
436
+	treatmentAsses := models.ReceiveTreatmentAsses{}
437
+	err := p_service.XTReadDB().Where("user_org_id = ? and patient_id = ? and status=1 and admission_number<>''", user_org_id, patient_id).Last(&treatmentAsses).Error
438
+	return treatmentAsses, err
439
+}
440
+
434
 func GetBatchAssessmentBeforeDislysisVM(orgid int64, patient_id int64, assessment_date int64) (AssessmentBeforeDislysisVM, error) {
441
 func GetBatchAssessmentBeforeDislysisVM(orgid int64, patient_id int64, assessment_date int64) (AssessmentBeforeDislysisVM, error) {
435
 
442
 
436
 	AssessmentBeforeDislysisVM := AssessmentBeforeDislysisVM{}
443
 	AssessmentBeforeDislysisVM := AssessmentBeforeDislysisVM{}

+ 3 - 3
service/self_drug_service.go View File

1880
 
1880
 
1881
 	offset := (page - 1) * limit
1881
 	offset := (page - 1) * limit
1882
 	likeKey := "%" + keyword + "%"
1882
 	likeKey := "%" + keyword + "%"
1883
-	db := XTReadDB().Table("xt_base_drug as x").Where("x.status = 1 AND find_in_set('停用',x.drug_status) = 0")
1883
+	db := XTReadDB().Table("xt_base_drug as x").Where("x.status = 1 AND find_in_set('停用',x.drug_status) = 0 and x.is_self_drug!=1")
1884
 	if good_type == 2 {
1884
 	if good_type == 2 {
1885
 		db = db.Where("x.sum_count<=x.drug_stock_limit")
1885
 		db = db.Where("x.sum_count<=x.drug_stock_limit")
1886
 	}
1886
 	}
1899
 	}
1899
 	}
1900
 
1900
 
1901
 	if len(keyword) > 0 {
1901
 	if len(keyword) > 0 {
1902
-		db = db.Where("drug_name like ? or manufacturer in(?)", likeKey, ids)
1902
+		db = db.Where("x.drug_name like ? or x.manufacturer in(?)", likeKey, ids)
1903
 	}
1903
 	}
1904
 
1904
 
1905
 	if orgId > 0 {
1905
 	if orgId > 0 {
2903
 
2903
 
2904
 func GetDrugNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, startime int64, endtime int64, ids []int64, infos []int64) (druginfo []*models.VmBaseDrugTwenty, total int64, err error) {
2904
 func GetDrugNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, startime int64, endtime int64, ids []int64, infos []int64) (druginfo []*models.VmBaseDrugTwenty, total int64, err error) {
2905
 
2905
 
2906
-	db := XTReadDB().Model(&druginfo).Where("status = 1")
2906
+	db := XTReadDB().Model(&druginfo).Where("status = 1 and is_self_drug!=1")
2907
 	offset := (page - 1) * limit
2907
 	offset := (page - 1) * limit
2908
 	likeKey := "%" + keyword + "%"
2908
 	likeKey := "%" + keyword + "%"
2909
 	if good_type > 0 {
2909
 	if good_type > 0 {

+ 6 - 6
service/stock_service.go View File

467
 			insertParams := make([]string, 0)
467
 			insertParams := make([]string, 0)
468
 			insertData := make([]interface{}, 0)
468
 			insertData := make([]interface{}, 0)
469
 			for _, info := range warehousingInfo {
469
 			for _, info := range warehousingInfo {
470
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
470
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
471
 				insertData = append(insertData, info.WarehousingId)
471
 				insertData = append(insertData, info.WarehousingId)
472
 				insertData = append(insertData, info.GoodId)
472
 				insertData = append(insertData, info.GoodId)
473
 				insertData = append(insertData, info.GoodTypeId)
473
 				insertData = append(insertData, info.GoodTypeId)
490
 				insertData = append(insertData, info.LicenseNumber)
490
 				insertData = append(insertData, info.LicenseNumber)
491
 				insertData = append(insertData, info.PackingPrice)
491
 				insertData = append(insertData, info.PackingPrice)
492
 				insertData = append(insertData, info.StorehouseId)
492
 				insertData = append(insertData, info.StorehouseId)
493
+				insertData = append(insertData, info.GoodCode)
493
 			}
494
 			}
494
 			thisSQL += strings.Join(insertParams, ", ")
495
 			thisSQL += strings.Join(insertParams, ", ")
495
 			err = utx.Exec(thisSQL, insertData...).Error
496
 			err = utx.Exec(thisSQL, insertData...).Error
6214
 	return info, err
6215
 	return info, err
6215
 }
6216
 }
6216
 
6217
 
6217
-func GetLastWarehouseInfoTwo(goodid int64, storehouse_id int64, user_org_id int64) (models.WarehousingInfo, error) {
6218
+func GetLastWarehouseInfoTwo(goodid int64, storehouse_id int64, user_org_id int64) (info []*models.WarehousingInfo, err error) {
6218
 
6219
 
6219
-	info := models.WarehousingInfo{}
6220
-	err := XTReadDB().Model(&info).Where("good_id = ? and status = 1 and storehouse_id=? and org_id = ?  and stock_count > 0", goodid, storehouse_id, user_org_id).Order("ctime").First(&info).Error
6220
+	err = XTReadDB().Model(&info).Where("good_id = ? and status = 1 and storehouse_id=? and org_id = ?  and stock_count > 0", goodid, storehouse_id, user_org_id).Order("ctime").First(&info).Error
6221
 	return info, err
6221
 	return info, err
6222
 }
6222
 }
6223
 
6223
 
6917
 
6917
 
6918
 func UpdateWarehouseInfoByGoodIdOne(info *models.WarehousingInfo, id int64) error {
6918
 func UpdateWarehouseInfoByGoodIdOne(info *models.WarehousingInfo, id int64) error {
6919
 
6919
 
6920
-	err := XTWriteDB().Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark, "packing_price": info.PackingPrice, "storehouse_id": info.StorehouseId, "register_number": info.RegisterNumber, "good_id": info.GoodId}).Error
6920
+	err := XTWriteDB().Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark, "packing_price": info.PackingPrice, "storehouse_id": info.StorehouseId, "register_number": info.RegisterNumber, "good_id": info.GoodId, "good_code": info.GoodCode}).Error
6921
 	return err
6921
 	return err
6922
 }
6922
 }
6923
 
6923
 
8032
 
8032
 
8033
 func UpdateWarehouseDetail(info *models.WarehousingInfo, id int64) error {
8033
 func UpdateWarehouseDetail(info *models.WarehousingInfo, id int64) error {
8034
 
8034
 
8035
-	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"good_id": info.GoodId, "good_type_id": info.GoodTypeId, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "warehousing_count": info.WarehousingCount, "warehousing_unit": info.WarehousingUnit, "price": info.Price, "total_price": info.TotalPrice, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "remark": info.Remark, "license_number": info.LicenseNumber, "packing_price": info.PackingPrice, "register_number": info.RegisterNumber, "storehouse_id": info.StorehouseId}).Error
8035
+	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"good_id": info.GoodId, "good_type_id": info.GoodTypeId, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "warehousing_count": info.WarehousingCount, "warehousing_unit": info.WarehousingUnit, "price": info.Price, "total_price": info.TotalPrice, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "remark": info.Remark, "license_number": info.LicenseNumber, "packing_price": info.PackingPrice, "register_number": info.RegisterNumber, "storehouse_id": info.StorehouseId, "good_code": info.GoodCode}).Error
8036
 	return err
8036
 	return err
8037
 }
8037
 }
8038
 
8038