28169 пре 1 година
родитељ
комит
e602323b0a

+ 1 - 1
conf/app.conf Прегледај датотеку

1
 appname = 血透
1
 appname = 血透
2
 httpport = 9531
2
 httpport = 9531
3
-runmode = dev
3
+runmode = prod
4
 #dev/prod
4
 #dev/prod
5
 
5
 
6
 #
6
 #

+ 52 - 0
controllers/dialysis_api_controller.go Прегледај датотеку

764
 
764
 
765
 		updateErr := service.UpDateDialysisPrescription(&prescription)
765
 		updateErr := service.UpDateDialysisPrescription(&prescription)
766
 
766
 
767
+		//创建步骤表
768
+		finish := models.XtDialysisFinish{
769
+			IsFinish:   1,
770
+			UserOrgId:  adminUserInfo.CurrentOrgId,
771
+			Status:     1,
772
+			Ctime:      time.Now().Unix(),
773
+			Mtime:      0,
774
+			Module:     1,
775
+			RecordDate: recordDate.Unix(),
776
+			Sourse:     1,
777
+			PatientId:  patient,
778
+		}
779
+
780
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 1, patient)
781
+		if dialysisFinish.ID == 0 {
782
+			service.CreateDialysisFinish(finish)
783
+		}
767
 		//修改处方
784
 		//修改处方
768
 		if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
785
 		if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
769
 			// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
786
 			// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
1329
 
1346
 
1330
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
1347
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
1331
 
1348
 
1349
+	//创建步骤表
1350
+	finishOne := models.XtDialysisFinish{
1351
+		IsFinish:   1,
1352
+		UserOrgId:  adminUserInfo.CurrentOrgId,
1353
+		Status:     1,
1354
+		Ctime:      time.Now().Unix(),
1355
+		Mtime:      0,
1356
+		Module:     1,
1357
+		RecordDate: recordDate.Unix(),
1358
+		Sourse:     1,
1359
+		PatientId:  patient,
1360
+	}
1361
+
1362
+	dialysisFinishOne, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 1, patient)
1363
+	if dialysisFinishOne.ID == 0 {
1364
+		service.CreateDialysisFinish(finishOne)
1365
+	}
1332
 	//获取最新1条
1366
 	//获取最新1条
1333
 	dialysisSolution, _ := service.GetLastPatientDialysisSolution(patient, adminUserInfo.CurrentOrgId)
1367
 	dialysisSolution, _ := service.GetLastPatientDialysisSolution(patient, adminUserInfo.CurrentOrgId)
1334
 
1368
 
2843
 		}
2877
 		}
2844
 
2878
 
2845
 		err := service.UpadatePredialysisEvaluation(&assessmentBeforeDislysis)
2879
 		err := service.UpadatePredialysisEvaluation(&assessmentBeforeDislysis)
2880
+
2881
+		//创建步骤表
2882
+		finish := models.XtDialysisFinish{
2883
+			IsFinish:   1,
2884
+			UserOrgId:  adminUserInfo.CurrentOrgId,
2885
+			Status:     1,
2886
+			Ctime:      time.Now().Unix(),
2887
+			Mtime:      0,
2888
+			Module:     3,
2889
+			RecordDate: recordDate.Unix(),
2890
+			Sourse:     1,
2891
+			PatientId:  patient,
2892
+		}
2893
+
2894
+		dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.CurrentOrgId, recordDate.Unix(), 3, patient)
2895
+		if dialysisFinish.ID == 0 {
2896
+			service.CreateDialysisFinish(finish)
2897
+		}
2846
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
2898
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
2847
 		redis := service.RedisClient()
2899
 		redis := service.RedisClient()
2848
 		//清空key 值
2900
 		//清空key 值

+ 34 - 0
controllers/his_api_controller.go Прегледај датотеку

2636
 			PatientDiagnosis:   patient_diagnose,
2636
 			PatientDiagnosis:   patient_diagnose,
2637
 		}
2637
 		}
2638
 		service.SavePatientPrescriptionInfo(hpInfo)
2638
 		service.SavePatientPrescriptionInfo(hpInfo)
2639
+		//创建步骤表
2640
+		finish := models.XtDialysisFinish{
2641
+			IsFinish:   1,
2642
+			UserOrgId:  adminInfo.CurrentOrgId,
2643
+			Status:     1,
2644
+			Ctime:      time.Now().Unix(),
2645
+			Mtime:      0,
2646
+			Module:     4,
2647
+			RecordDate: theTime.Unix(),
2648
+			Sourse:     1,
2649
+			PatientId:  patient_id,
2650
+		}
2651
+
2652
+		dialysisFinish, _ := service.GetDialysisFinish(adminInfo.CurrentOrgId, theTime.Unix(), 4, patient_id)
2653
+		if dialysisFinish.ID == 0 {
2654
+			service.CreateDialysisFinish(finish)
2655
+		}
2639
 		redis := service.RedisClient()
2656
 		redis := service.RedisClient()
2640
 		key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
2657
 		key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
2641
 		redis.Set(key, "", time.Second)
2658
 		redis.Set(key, "", time.Second)
2669
 			PatientDiagnosis:   patient_diagnose,
2686
 			PatientDiagnosis:   patient_diagnose,
2670
 		}
2687
 		}
2671
 		service.SavePatientPrescriptionInfo(hpInfo)
2688
 		service.SavePatientPrescriptionInfo(hpInfo)
2689
+		//创建步骤表
2690
+		finish := models.XtDialysisFinish{
2691
+			IsFinish:   1,
2692
+			UserOrgId:  adminInfo.CurrentOrgId,
2693
+			Status:     1,
2694
+			Ctime:      time.Now().Unix(),
2695
+			Mtime:      0,
2696
+			Module:     4,
2697
+			RecordDate: info.RecordDate,
2698
+			Sourse:     1,
2699
+			PatientId:  info.PatientId,
2700
+		}
2701
+
2702
+		dialysisFinish, _ := service.GetDialysisFinish(adminInfo.CurrentOrgId, info.RecordDate, 4, info.PatientId)
2703
+		if dialysisFinish.ID == 0 {
2704
+			service.CreateDialysisFinish(finish)
2705
+		}
2672
 		redis := service.RedisClient()
2706
 		redis := service.RedisClient()
2673
 		key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
2707
 		key := strconv.FormatInt(adminInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(theTime.Unix(), 10) + ":his_advices_list_all"
2674
 		redis.Set(key, "", time.Second)
2708
 		redis.Set(key, "", time.Second)

+ 32 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Прегледај датотеку

1277
 	weightAfter, _ := c.GetFloat("weight_after", 0)
1277
 	weightAfter, _ := c.GetFloat("weight_after", 0)
1278
 	additionalWeight, _ := c.GetFloat("additional_weight", 0)
1278
 	additionalWeight, _ := c.GetFloat("additional_weight", 0)
1279
 	weightReduce, _ := c.GetFloat("weight_loss", 0)
1279
 	weightReduce, _ := c.GetFloat("weight_loss", 0)
1280
+	fmt.Println("weight_loss", weightReduce)
1280
 	temperature, _ := c.GetFloat("temperature", 0)
1281
 	temperature, _ := c.GetFloat("temperature", 0)
1281
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
1282
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
1282
 	breathing_rate := c.GetString("breathing_rate")
1283
 	breathing_rate := c.GetString("breathing_rate")
1284
 
1285
 
1285
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
1286
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
1286
 	actual_ultrafiltration, _ := c.GetFloat("actual_ultrafiltration", 0)
1287
 	actual_ultrafiltration, _ := c.GetFloat("actual_ultrafiltration", 0)
1288
+
1289
+	fmt.Println("actual_ultrafiltration233232322323", actual_ultrafiltration)
1287
 	actual_displacement, _ := c.GetFloat("actual_displacement", 0)
1290
 	actual_displacement, _ := c.GetFloat("actual_displacement", 0)
1291
+
1288
 	actualtreatHour, _ := c.GetInt64("actual_treatment_hour", 0)
1292
 	actualtreatHour, _ := c.GetInt64("actual_treatment_hour", 0)
1289
 	actualtreatmin, _ := c.GetInt64("actual_treatment_minute", 0)
1293
 	actualtreatmin, _ := c.GetInt64("actual_treatment_minute", 0)
1290
 	cruor := c.GetString("cruor")
1294
 	cruor := c.GetString("cruor")
1354
 	after_urea := c.GetString("after_urea")
1358
 	after_urea := c.GetString("after_urea")
1355
 	pip_coagulation := c.GetString("pip_coagulation")
1359
 	pip_coagulation := c.GetString("pip_coagulation")
1356
 	accumulated_blood_volume := c.GetString("accumulated_blood_volume")
1360
 	accumulated_blood_volume := c.GetString("accumulated_blood_volume")
1361
+	fmt.Println("accumulated_blood_volume", accumulated_blood_volume)
1357
 	if id <= 0 {
1362
 	if id <= 0 {
1358
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1363
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1359
 		return
1364
 		return
1361
 
1366
 
1362
 	adminUserInfo := c.GetMobileAdminUserInfo()
1367
 	adminUserInfo := c.GetMobileAdminUserInfo()
1363
 	patient, _ := service.FindPatientById(adminUserInfo.Org.Id, id)
1368
 	patient, _ := service.FindPatientById(adminUserInfo.Org.Id, id)
1369
+
1364
 	if patient.ID == 0 {
1370
 	if patient.ID == 0 {
1365
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
1371
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
1366
 		return
1372
 		return
1370
 		recordDateStr = time.Now().Format("2006-01-02")
1376
 		recordDateStr = time.Now().Format("2006-01-02")
1371
 	}
1377
 	}
1372
 	recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
1378
 	recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
1379
+	fmt.Println("parseDateErr", parseDateErr)
1373
 	if parseDateErr != nil {
1380
 	if parseDateErr != nil {
1374
 		c.ErrorLog("日期(%v)解析错误:%v", recordDateStr, parseDateErr)
1381
 		c.ErrorLog("日期(%v)解析错误:%v", recordDateStr, parseDateErr)
1375
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1382
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1531
 				"assessmentAfterDislysis": assessmentAfterDislysis,
1538
 				"assessmentAfterDislysis": assessmentAfterDislysis,
1532
 			})
1539
 			})
1533
 		}
1540
 		}
1541
+		return
1534
 	} else { //修改
1542
 	} else { //修改
1535
 
1543
 
1536
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1544
 		infor, _ := service.GetDialysisInformationSetting(adminUserInfo.Org.Id)
1543
 
1551
 
1544
 			//今日的日期减去设置的日期
1552
 			//今日的日期减去设置的日期
1545
 			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1553
 			cha_time = timeNewDate.Unix() - infor.WeekDay*86400
1546
-			fmt.Println("recordDate.Unix()", recordDate.Unix())
1547
 			if cha_time >= recordDate.Unix() {
1554
 			if cha_time >= recordDate.Unix() {
1548
 				//查询审核是否允许
1555
 				//查询审核是否允许
1549
 				infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1556
 				infor, _ := service.GetDialysisInformationByRecordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1569
 		assessmentAfterDislysis.ID = assessmentAfter.ID
1576
 		assessmentAfterDislysis.ID = assessmentAfter.ID
1570
 
1577
 
1571
 		err := service.UpdateAssessmentAfterDislysisRecord(&assessmentAfterDislysis)
1578
 		err := service.UpdateAssessmentAfterDislysisRecord(&assessmentAfterDislysis)
1579
+		fmt.Println("werwewweoweoweoweoewoewoew", err)
1572
 		redis := service.RedisClient()
1580
 		redis := service.RedisClient()
1573
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1581
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
1574
 
1582
 
1580
 
1588
 
1581
 		keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis_list_all"
1589
 		keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_after_dislysis_list_all"
1582
 		redis.Set(keyOne, "", time.Second)
1590
 		redis.Set(keyOne, "", time.Second)
1583
-
1584
 		if err == nil {
1591
 		if err == nil {
1585
 			c.ServeSuccessJSON(map[string]interface{}{
1592
 			c.ServeSuccessJSON(map[string]interface{}{
1586
 				"assessmentAfterDislysis": assessmentAfterDislysis,
1593
 				"assessmentAfterDislysis": assessmentAfterDislysis,
1587
 			})
1594
 			})
1595
+			return
1588
 		}
1596
 		}
1597
+
1589
 	}
1598
 	}
1599
+
1600
+	return
1590
 }
1601
 }
1591
 
1602
 
1592
 func (c *DialysisAPIController) PostDialysisPrescription() {
1603
 func (c *DialysisAPIController) PostDialysisPrescription() {
3657
 
3668
 
3658
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3669
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3659
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
3670
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
3671
+	fmt.Println("appRole0000000000000", appRole.UserType)
3660
 	//
3672
 	//
3661
 	if appRole.UserType == 2 || appRole.UserType == 1 {
3673
 	if appRole.UserType == 2 || appRole.UserType == 1 {
3662
 		prescription_doctor = adminUserInfo.AdminUser.Id
3674
 		prescription_doctor = adminUserInfo.AdminUser.Id
5846
 
5858
 
5847
 		}
5859
 		}
5848
 	}
5860
 	}
5861
+
5862
+	//创建步骤表
5863
+	finish := models.XtDialysisFinish{
5864
+		IsFinish:   1,
5865
+		UserOrgId:  adminInfo.Org.Id,
5866
+		Status:     1,
5867
+		Ctime:      time.Now().Unix(),
5868
+		Mtime:      0,
5869
+		Module:     11,
5870
+		RecordDate: record_time,
5871
+		Sourse:     1,
5872
+		PatientId:  patient_id,
5873
+	}
5874
+
5875
+	dialysisFinish, _ := service.GetDialysisFinish(adminInfo.Org.Id, record_time, 11, patient_id)
5876
+	if dialysisFinish.ID == 0 {
5877
+		service.CreateDialysisFinish(finish)
5878
+	}
5849
 	consumables, _ := service.FindConsumablesByDate(adminInfo.Org.Id, patient_id, record_time)
5879
 	consumables, _ := service.FindConsumablesByDate(adminInfo.Org.Id, patient_id, record_time)
5850
 
5880
 
5851
 	_, record := service.FindAutomaticReduceRecordByOrgId(adminInfo.Org.Id)
5881
 	_, record := service.FindAutomaticReduceRecordByOrgId(adminInfo.Org.Id)

+ 0 - 2
controllers/mobile_api_controllers/mobile_api_base_controller.go Прегледај датотеку

7
 	"XT_New/service"
7
 	"XT_New/service"
8
 	"bytes"
8
 	"bytes"
9
 	"encoding/json"
9
 	"encoding/json"
10
-	"fmt"
11
 	"log"
10
 	"log"
12
 	"os"
11
 	"os"
13
 	"path"
12
 	"path"
143
 
142
 
144
 			//redis key值
143
 			//redis key值
145
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
144
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
146
-			fmt.Println("ket--------------------", key)
147
 
145
 
148
 			redis.Set(key, "", time.Second)
146
 			redis.Set(key, "", time.Second)
149
 			purviews_json_str, _ := redis.Get(key).Result()
147
 			purviews_json_str, _ := redis.Get(key).Result()

+ 12 - 3
controllers/patient_api_controller.go Прегледај датотеку

108
 	reimbursement_way, _ := c.GetInt64("reimbursement_way", 0)
108
 	reimbursement_way, _ := c.GetInt64("reimbursement_way", 0)
109
 	isscheduling, _ := c.GetInt64("isscheduling", 0)
109
 	isscheduling, _ := c.GetInt64("isscheduling", 0)
110
 	isprescription, _ := c.GetInt64("isprescription", 0)
110
 	isprescription, _ := c.GetInt64("isprescription", 0)
111
-
111
+	patientSoureType, _ := c.GetInt64("patientSoureType")
112
 	if page <= 0 {
112
 	if page <= 0 {
113
 		page = 1
113
 		page = 1
114
 	}
114
 	}
147
 
147
 
148
 	var patients []*models.Patients
148
 	var patients []*models.Patients
149
 	var total int64
149
 	var total int64
150
-	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime)
150
+	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType)
151
 
151
 
152
 	c.ServeSuccessJSON(map[string]interface{}{
152
 	c.ServeSuccessJSON(map[string]interface{}{
153
 		"patients": patients,
153
 		"patients": patients,
229
 	fmt.Println(code)
229
 	fmt.Println(code)
230
 	fmt.Println(patient)
230
 	fmt.Println(patient)
231
 
231
 
232
-	fmt.Println("contagions是什么", contagions)
233
 	if code > 0 {
232
 	if code > 0 {
234
 		c.ServeFailJSONWithSGJErrorCode(code)
233
 		c.ServeFailJSONWithSGJErrorCode(code)
235
 		return
234
 		return
367
 		TreatmentPlan:                patient.TreatmentPlan,
366
 		TreatmentPlan:                patient.TreatmentPlan,
368
 		Doctor:                       patient.Doctor,
367
 		Doctor:                       patient.Doctor,
369
 		RecordNumber:                 patient.RecordNumber,
368
 		RecordNumber:                 patient.RecordNumber,
369
+		PatientSource:                patient.PatientSource,
370
 	}
370
 	}
371
 
371
 
372
 	err = service.CreatePatientsNew(&patientsNew)
372
 	err = service.CreatePatientsNew(&patientsNew)
584
 		SchRemark:                 patient.SchRemark,
584
 		SchRemark:                 patient.SchRemark,
585
 		TreatmentPlan:             patient.TreatmentPlan,
585
 		TreatmentPlan:             patient.TreatmentPlan,
586
 		RecordNumber:              patient.RecordNumber,
586
 		RecordNumber:              patient.RecordNumber,
587
+		PatientSource:             patient.PatientSource,
587
 	}
588
 	}
588
 	//	//更新病人ID获取新表病人ID
589
 	//	//更新病人ID获取新表病人ID
589
 	err = service.UpdatepatientTwo(&patientsNew, id)
590
 	err = service.UpdatepatientTwo(&patientsNew, id)
4910
 		record_number := patientBody["record_number"].(string)
4911
 		record_number := patientBody["record_number"].(string)
4911
 		patient.RecordNumber = record_number
4912
 		patient.RecordNumber = record_number
4912
 	}
4913
 	}
4914
+
4915
+	patient_source := int64(patientBody["patient_source"].(float64))
4916
+	if patient_source <= 0 {
4917
+		utils.ErrorLog("patient_source <= 0")
4918
+		code = enums.ErrorCodeParamWrong
4919
+		return
4920
+	}
4921
+	patient.PatientSource = patient_source
4913
 	return
4922
 	return
4914
 }
4923
 }
4915
 
4924
 

+ 2 - 0
models/patient_models.go Прегледај датотеку

222
 	TreatmentPlan            string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
222
 	TreatmentPlan            string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
223
 	Doctor                   int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
223
 	Doctor                   int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
224
 	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
224
 	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
225
+	PatientSource            int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
225
 }
226
 }
226
 
227
 
227
 func (Patients) TableName() string {
228
 func (Patients) TableName() string {
814
 	Doctor                       int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
815
 	Doctor                       int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
815
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
816
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
816
 	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
817
 	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
818
+	PatientSource                int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
817
 }
819
 }
818
 
820
 
819
 func (XtPatientsNew) TableName() string {
821
 func (XtPatientsNew) TableName() string {

+ 1 - 1
service/manage_center_service.go Прегледај датотеку

853
 				BatchNumber:             info.BatchNumber,
853
 				BatchNumber:             info.BatchNumber,
854
 				Count:                   prescribingNumber,
854
 				Count:                   prescribingNumber,
855
 				UserOrgId:               advice.UserOrgId,
855
 				UserOrgId:               advice.UserOrgId,
856
-				PatientId:               0,
856
+				PatientId:               advice.PatientId,
857
 				SystemTime:              info.SysRecordTime,
857
 				SystemTime:              info.SysRecordTime,
858
 				ConsumableType:          7,
858
 				ConsumableType:          7,
859
 				IsSys:                   0,
859
 				IsSys:                   0,

+ 5 - 1
service/patient_service.go Прегледај датотеку

12
 )
12
 )
13
 
13
 
14
 // GetPatientList 返回患者的列表
14
 // GetPatientList 返回患者的列表
15
-func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool) (patients []*models.Patients, total int64, err error) {
15
+func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64) (patients []*models.Patients, total int64, err error) {
16
 
16
 
17
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
17
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
18
 	if orgID > 0 {
18
 	if orgID > 0 {
65
 		db = db.Where("p.created_time<=?", endTime)
65
 		db = db.Where("p.created_time<=?", endTime)
66
 	}
66
 	}
67
 
67
 
68
+	if patientSoureType > 0 {
69
+		db = db.Where("p.patient_source =?", patientSoureType)
70
+	}
71
+
68
 	offset := (page - 1) * limit
72
 	offset := (page - 1) * limit
69
 	if lapseto == 2 || lapseto == 3 {
73
 	if lapseto == 2 || lapseto == 3 {
70
 		err = db.Order("p.death_time desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
74
 		err = db.Order("p.death_time desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error

+ 1 - 1
service/self_drug_service.go Прегледај датотеку

2715
 
2715
 
2716
 func GetDrugInventoryWarehouseInfoList(org_id int64, storehouse_id int64) (info []*models.XtDrugWarehouseInfo, err error) {
2716
 func GetDrugInventoryWarehouseInfoList(org_id int64, storehouse_id int64) (info []*models.XtDrugWarehouseInfo, err error) {
2717
 
2717
 
2718
-	err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id = ? and is_check = 1 and org_id = ?", storehouse_id, org_id).Preload("XtBaseDrug", "status= 1").Find(&info).Error
2718
+	err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id = ? and is_check = 1 and org_id = ?", storehouse_id, org_id).Preload("XtBaseDrug", "status= 1").Order("drug_id").Find(&info).Error
2719
 	return info, err
2719
 	return info, err
2720
 }
2720
 }

+ 1 - 1
service/stock_service.go Прегледај датотеку

8212
 
8212
 
8213
 func GetInvetoryWarehouseInfoList(orgid int64, storehouse_id int64) (info []*models.WarehousingInfo, err error) {
8213
 func GetInvetoryWarehouseInfoList(orgid int64, storehouse_id int64) (info []*models.WarehousingInfo, err error) {
8214
 
8214
 
8215
-	err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id=? and is_check= 1 and org_id = ?", storehouse_id, orgid).Preload("GoodInfo", "status = 1").Find(&info).Error
8215
+	err = XTReadDB().Model(&info).Where("status = 1 and storehouse_id=? and is_check= 1 and org_id = ?", storehouse_id, orgid).Preload("GoodInfo", "status = 1").Order("good_id").Find(&info).Error
8216
 	return info, err
8216
 	return info, err
8217
 }
8217
 }
8218
 
8218