28169 2 anni fa
parent
commit
36b73bb0c3

+ 1 - 1
controllers/dialysis_api_controller.go Vedi File

@@ -4916,7 +4916,7 @@ func (this *DialysisApiController) GetPatientDialysisSolutionGroupList() {
4916 4916
 	goodType, _ := service.GetAllGoodType(orgId)
4917 4917
 	if config.IsOpen != 1 {
4918 4918
 		list, total, err := service.GetPatientDialysisSolutionGroupList(keyword, limit, page, partition_id, schedule_type, startTime.Unix(), orgId, ids)
4919
-		fmt.Println("list2232323223332323232", list)
4919
+
4920 4920
 		if err == nil {
4921 4921
 			this.ServeSuccessJSON(map[string]interface{}{
4922 4922
 				"list":     list,

+ 59 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Vedi File

@@ -7943,9 +7943,68 @@ func (this *DialysisAPIController) ExectionMobileAdvice() {
7943 7943
 							if config.IsOpen != 1 {
7944 7944
 								if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
7945 7945
 									service.HisDrugsDelivery(orgId, creater, &advice)
7946
+									if orgId == 3877 || orgId == 10265 {
7947
+										//查询该药品是否有出库记录
7948
+										flowMap, _ := service.GetDrugFLowByAdviceById(advice.DrugId, advice.PatientId, advice.UserOrgId, advice.AdviceDate)
7949
+										if len(flowMap) == 0 {
7950
+											errs := service.UpdateHisAdviceById(advice.ID)
7951
+											if errs != nil {
7952
+												drugError := models.XtDrugError{
7953
+													UserOrgId:             orgId,
7954
+													DrugId:                item.DrugId,
7955
+													RecordDate:            item.AdviceDate,
7956
+													PatientId:             item.PatientId,
7957
+													Remark:                "透析医嘱页面出库记录为空,更新执行人失败",
7958
+													Status:                1,
7959
+													Ctime:                 time.Now().Unix(),
7960
+													Mtime:                 0,
7961
+													SumCount:              0,
7962
+													Prescribingnumber:     advice.PrescribingNumber,
7963
+													PrescribingNumberUnit: advice.PrescribingNumberUnit,
7964
+												}
7965
+												service.CreateDrugError(drugError)
7966
+											}
7967
+											this.ServeSuccessJSON(map[string]interface{}{
7968
+												"msg":  "2",
7969
+												"drug": medical,
7970
+												"ids":  ids,
7971
+											})
7972
+											return
7973
+
7974
+										}
7975
+									}
7946 7976
 								}
7947 7977
 								if pharmacyConfig.IsOpen != 1 {
7948 7978
 									service.HisDrugsDelivery(orgId, creater, &advice)
7979
+									if orgId == 3877 || orgId == 10265 {
7980
+										//查询该药品是否有出库记录
7981
+										flowMap, _ := service.GetDrugFLowByAdviceById(advice.DrugId, advice.PatientId, advice.UserOrgId, advice.AdviceDate)
7982
+										if len(flowMap) == 0 {
7983
+											errs := service.UpdateHisAdviceById(advice.ID)
7984
+											if errs != nil {
7985
+												drugError := models.XtDrugError{
7986
+													UserOrgId:             orgId,
7987
+													DrugId:                item.DrugId,
7988
+													RecordDate:            item.AdviceDate,
7989
+													PatientId:             item.PatientId,
7990
+													Remark:                "透析医嘱页面出库记录为空,更新执行人失败",
7991
+													Status:                1,
7992
+													Ctime:                 time.Now().Unix(),
7993
+													Mtime:                 0,
7994
+													SumCount:              0,
7995
+													Prescribingnumber:     advice.PrescribingNumber,
7996
+													PrescribingNumberUnit: advice.PrescribingNumberUnit,
7997
+												}
7998
+												service.CreateDrugError(drugError)
7999
+											}
8000
+											this.ServeSuccessJSON(map[string]interface{}{
8001
+												"msg":  "2",
8002
+												"drug": medical,
8003
+												"ids":  ids,
8004
+											})
8005
+											return
8006
+										}
8007
+									}
7949 8008
 								}
7950 8009
 
7951 8010
 								//更新字典里面的库存

+ 1 - 0
models/dialysis.go Vedi File

@@ -1241,6 +1241,7 @@ type HisDoctorAdvice struct {
1241 1241
 	DrugId                int64              `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
1242 1242
 	DrugNameId            int64              `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
1243 1243
 	ExecutionFrequencyId  int64              `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1244
+	IsMobile              int64              `gorm:"column:is_mobile" json:"is_mobile" form:"is_mobile"`
1244 1245
 }
1245 1246
 
1246 1247
 func (HisDoctorAdvice) TableName() string {

+ 1 - 1
service/dialysis_service.go Vedi File

@@ -1988,7 +1988,7 @@ func GetHisMobileAdviceList(orgid int64, ids []string) (advice []*models.HisDoct
1988 1988
 func ExectionMobileAdvice(orgid int64, ids []string, execution_time int64, execution_staff int64) error {
1989 1989
 
1990 1990
 	advice := models.HisDoctorAdvice{}
1991
-	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and id in(?) and status = 1", orgid, ids).Updates(map[string]interface{}{"execution_time": execution_time, "execution_staff": execution_staff, "execution_state": 1}).Error
1991
+	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and id in(?) and status = 1", orgid, ids).Updates(map[string]interface{}{"execution_time": execution_time, "execution_staff": execution_staff, "execution_state": 1, "is_mobile": 3}).Error
1992 1992
 	return err
1993 1993
 }
1994 1994